Skip to content

File symsync_core.h

FileList > inc > symsync > symsync_core.h

Go to the source code of this file

SymbolSync component API. More...

  • #include "clib_common.h"
  • #include "dp_state.h"
  • #include "farrow/farrow_core.h"
  • #include "jm_perf.h"
  • #include "loop_filter/loop_filter_core.h"
  • #include "nco/nco_core.h"

Classes

Type Name
struct symsync_state_t
SymbolSync state.

Public Functions

Type Name
void symsync_configure (symsync_state_t * state, double bn, double zeta)
symsync_state_t * symsync_create (size_t sps, double bn, double zeta, int order)
Create a symsync instance.
void symsync_destroy (symsync_state_t * state)
Destroy a symsync instance and release all memory.
double symsync_get_bn (const symsync_state_t * state)
double symsync_get_rate (const symsync_state_t * state)
void symsync_get_state (const symsync_state_t * state, void * blob)
double symsync_get_timing_error (const symsync_state_t * state)
void symsync_init (symsync_state_t * s, size_t sps, double bn, double zeta, int order)
Initialise a SymbolSync in place (no allocation).
void symsync_reset (symsync_state_t * state)
Reset SymbolSync to its post-create state.
void symsync_set_bn (symsync_state_t * state, double val)
int symsync_set_state (symsync_state_t * state, const void * blob)
size_t symsync_state_bytes (const symsync_state_t * state)
JM_FORCEINLINE JM_HOT int symsync_step (symsync_state_t * s, float complex x, float complex * y_out)
Per-sample symbol-timing step (the inline composition API).
size_t symsync_steps (symsync_state_t * state, const float complex * x, size_t x_len, float complex * out, size_t max_out)
size_t symsync_steps_max_out (symsync_state_t * state)

Macros

Type Name
define SYMSYNC_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc) ('S','Y','N','C')
define SYMSYNC_STATE_VERSION 1u

Detailed Description

Lifecycle: create -> [step / steps / reset]* -> destroy

Example:

symsync_state_t *obj = symsync_create(4, 0.01, 0.707, 0);
float complex y = symsync_step(obj, 0.0f + 0.0f * I);
symsync_destroy(obj);

Public Functions Documentation

function symsync_configure

void symsync_configure (
    symsync_state_t * state,
    double bn,
    double zeta
) 

function symsync_create

Create a symsync instance.

symsync_state_t * symsync_create (
    size_t sps,
    double bn,
    double zeta,
    int order
) 

Parameters:

  • sps sps (default: 4).
  • bn bn (default: 0.01).
  • zeta zeta (default: 0.707).
  • order Enum index; 0=linear…2=cubic.

Returns:

Heap-allocated state, or NULL on allocation failure.

Note:

Caller must call symsync_destroy() when done.


function symsync_destroy

Destroy a symsync instance and release all memory.

void symsync_destroy (
    symsync_state_t * state
) 

Parameters:

  • state May be NULL.

function symsync_get_bn

double symsync_get_bn (
    const symsync_state_t * state
) 

function symsync_get_rate

double symsync_get_rate (
    const symsync_state_t * state
) 

function symsync_get_state

void symsync_get_state (
    const symsync_state_t * state,
    void * blob
) 

function symsync_get_timing_error

double symsync_get_timing_error (
    const symsync_state_t * state
) 

function symsync_init

Initialise a SymbolSync in place (no allocation).

void symsync_init (
    symsync_state_t * s,
    size_t sps,
    double bn,
    double zeta,
    int order
) 

The by-value counterpart to symsync_create(): lets a composing object embed a symsync_state_t by value and initialise it without a heap allocation (symsync_state_t holds no heap members — the NCO, Farrow and loop filter are all by value). Mirrors loop_filter_init()/costas_init().

Parameters:

  • s State to initialise. Must be non-NULL.
  • sps Nominal samples per symbol.
  • bn Loop noise bandwidth (normalised to the symbol rate).
  • zeta Damping factor (0.707 = critically damped).
  • order Farrow interpolator order (0=linear, 1=parabolic, 2=cubic).

function symsync_reset

Reset SymbolSync to its post-create state.

void symsync_reset (
    symsync_state_t * state
) 

Parameters:

  • state Must be non-NULL.

function symsync_set_bn

void symsync_set_bn (
    symsync_state_t * state,
    double val
) 

function symsync_set_state

int symsync_set_state (
    symsync_state_t * state,
    const void * blob
) 

function symsync_state_bytes

size_t symsync_state_bytes (
    const symsync_state_t * state
) 

function symsync_step

Per-sample symbol-timing step (the inline composition API).

JM_FORCEINLINE  JM_HOT int symsync_step (
    symsync_state_t * s,
    float complex x,
    float complex * y_out
) 

Pushes one input sample into the Farrow history and advances the integer timing NCO. When the NCO crosses its half-scale (mid-symbol) it stores the Gardner mid interpolant; when it wraps (on-time) it forms the on-time interpolant, runs the Gardner TED, steers the NCO frequency, and emits the timing-corrected symbol. Returns 1 and writes y_out on an on-time symbol, else 0. symsync_steps() is exactly this in a loop; a tracking channel inlines it to drive a downstream carrier loop on the recovered symbols.

Parameters:

  • s State. Must be non-NULL.
  • x One input sample.
  • y_out Receives the symbol when the return is 1.

Returns:

1 if a symbol was emitted (into y_out), 0 otherwise.


function symsync_steps

size_t symsync_steps (
    symsync_state_t * state,
    const float complex * x,
    size_t x_len,
    float complex * out,
    size_t max_out
) 

function symsync_steps_max_out

size_t symsync_steps_max_out (
    symsync_state_t * state
) 

Macro Definition Documentation

define SYMSYNC_STATE_MAGIC

#define SYMSYNC_STATE_MAGIC `DP_FOURCC ('S','Y','N','C')`

define SYMSYNC_STATE_VERSION

#define SYMSYNC_STATE_VERSION `1u`


The documentation for this class was generated from the following file native/inc/symsync/symsync_core.h