File channel_core.h¶
FileList > channel > channel_core.h
Go to the source code of this file
GPS-style tracking channel — Costas carrier loop + DLL code loop. More...
#include "clib_common.h"#include "dp_state.h"#include "costas/costas_core.h"#include "dll/dll_core.h"#include "jm_perf.h"#include <complex.h>#include "lo/lo_core.h"#include "loop_filter/loop_filter_core.h"
Classes¶
| Type | Name |
|---|---|
| struct | channel_state_t Tracking-channel state. |
Public Functions¶
| Type | Name |
|---|---|
| size_t | channel_bits (channel_state_t * state, const float complex * x, size_t x_len, uint8_t * out, size_t max_out) |
| size_t | channel_bits_max_out (channel_state_t * state) |
| channel_state_t * | channel_create (const uint8_t * code, size_t code_len, size_t sps, double init_norm_freq, double init_chip, double bn_carrier, double bn_code, double bn_fll, double zeta, double spacing, size_t nav_period) Create a tracking channel (COPIES code ). |
| void | channel_destroy (channel_state_t * state) Destroy a tracking channel and release all memory. |
| size_t | channel_get_bit_phase (const channel_state_t * state) |
| double | channel_get_bn_carrier (const channel_state_t * state) |
| double | channel_get_bn_code (const channel_state_t * state) |
| double | channel_get_code_phase (const channel_state_t * state) |
| double | channel_get_code_rate (const channel_state_t * state) |
| double | channel_get_lock_metric (const channel_state_t * state) |
| double | channel_get_norm_freq (const channel_state_t * state) |
| void | channel_get_state (const channel_state_t * state, void * blob) |
| void | channel_init (channel_state_t * ch, const uint8_t * code, size_t code_len, size_t sps, double init_norm_freq, double init_chip, double bn_carrier, double bn_code, double bn_fll, double zeta, double spacing, size_t nav_period) Initialise a tracking channel in place; BORROWS code . |
| void | channel_reset (channel_state_t * state) Re-seed both loops to the create-time frequency/phase; keep config. |
| void | channel_set_bn_carrier (channel_state_t * state, double val) |
| void | channel_set_bn_code (channel_state_t * state, double val) |
| void | channel_set_norm_freq (channel_state_t * state, double val) |
| int | channel_set_state (channel_state_t * state, const void * blob) |
| size_t | channel_state_bytes (const channel_state_t * state) |
| size_t | channel_steps (channel_state_t * state, const float complex * x, size_t x_len, float complex * out, size_t max_out) |
| size_t | channel_steps_max_out (channel_state_t * state) |
Macros¶
| Type | Name |
|---|---|
| define | CHANNEL_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc) ('C','H','A','N') |
| define | CHANNEL_STATE_VERSION 1u |
Detailed Description¶
A complete tracking channel for a continuous DSSS-BPSK signal: it composes a costas_state_t carrier loop and a dll_state_t code loop on a single shared per-sample integrate-and-dump. Per sample it wipes the carrier (costas_wipeoff, integer NCO) and feeds the de-rotated sample to the DLL's early/prompt/late correlators (dll_accumulate); per code period it dumps the prompt and updates both loops — the code loop on the early/late envelopes, the carrier loop on the same prompt symbol. steps() emits one prompt per period; bits() bit-syncs the prompts into hard data bits (a data bit spans nav_period code periods).
It is seeded by acquisition (the FFT search supplies the coarse carrier frequency + code phase); the loops then track the residual. Set bn_fll > 0 for FLL-assisted carrier pull-in.
Lifecycle: channel_create -> [steps / bits / reset]* -> channel_destroy.
uint8_t code[127] = { ... }; // one code period, 0/1 chips
channel_state_t *ch = channel_create(code, 127, 8, 0.0, 0.0,
0.05, 0.005, 0.0, 0.707, 0.5, 1);
float complex sym[64];
size_t k = channel_steps(ch, rx, rx_len, sym, 64); // prompt per period
channel_destroy(ch);
Public Functions Documentation¶
function channel_bits¶
size_t channel_bits (
channel_state_t * state,
const float complex * x,
size_t x_len,
uint8_t * out,
size_t max_out
)
function channel_bits_max_out¶
function channel_create¶
Create a tracking channel (COPIES code ).
channel_state_t * channel_create (
const uint8_t * code,
size_t code_len,
size_t sps,
double init_norm_freq,
double init_chip,
double bn_carrier,
double bn_code,
double bn_fll,
double zeta,
double spacing,
size_t nav_period
)
Returns:
Heap-allocated state, or NULL on allocation failure.
Note:
Caller must call channel_destroy() when done.
function channel_destroy¶
Destroy a tracking channel and release all memory.
Parameters:
stateMay be NULL.
function channel_get_bit_phase¶
function channel_get_bn_carrier¶
function channel_get_bn_code¶
function channel_get_code_phase¶
function channel_get_code_rate¶
function channel_get_lock_metric¶
function channel_get_norm_freq¶
function channel_get_state¶
function channel_init¶
Initialise a tracking channel in place; BORROWS code .
void channel_init (
channel_state_t * ch,
const uint8_t * code,
size_t code_len,
size_t sps,
double init_norm_freq,
double init_chip,
double bn_carrier,
double bn_code,
double bn_fll,
double zeta,
double spacing,
size_t nav_period
)
The by-value counterpart to channel_create(): the caller retains ownership of code (it is not copied or freed). Seeds the carrier NCO at init_norm_freq and the code phase at init_chip (the acquisition estimate). The carrier loop's update period is one code period (code_len * sps samples).
Parameters:
chState to initialise. Must be non-NULL.codeSpreading code (0/1 chips), one period; borrowed.code_lenCode length (chips per period); >= 1.spsSamples per chip.init_norm_freqSeed carrier frequency, cycles/sample.init_chipSeed code phase, chips.bn_carrierCarrier loop noise bandwidth.bn_codeCode loop noise bandwidth.bn_fllCarrier FLL-assist bandwidth (0 = pure PLL).zetaDamping factor for both loops.spacingDLL early/late tap offset, chips.nav_periodCode periods per data bit (1 = one bit per period).
function channel_reset¶
Re-seed both loops to the create-time frequency/phase; keep config.
Parameters:
stateMust be non-NULL.
function channel_set_bn_carrier¶
function channel_set_bn_code¶
function channel_set_norm_freq¶
function channel_set_state¶
function channel_state_bytes¶
function channel_steps¶
size_t channel_steps (
channel_state_t * state,
const float complex * x,
size_t x_len,
float complex * out,
size_t max_out
)
function channel_steps_max_out¶
Macro Definition Documentation¶
define CHANNEL_STATE_MAGIC¶
define CHANNEL_STATE_VERSION¶
The documentation for this class was generated from the following file native/inc/channel/channel_core.h