Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions include/liquid.h
Original file line number Diff line number Diff line change
Expand Up @@ -6525,9 +6525,9 @@ typedef int (*QDSYNC(_callback))(TO * _buf, \
void * _context); \
\
/* create detector with generic sequence */ \
/* _s : sample sequence */ \
/* _s_len : length of sample sequence */ \
/* _ftype : filter type */ \
/* _s : symbol sequence */ \
/* _s_len : length of symbol sequence */ \
/* _ftype : Nyquist filter type (e.g. LIQUID_FIRFILT_RRC) */ \
/* _k : samples per symbol */ \
/* _m : filter semi-length */ \
/* _beta : filter excess bandwidth factor */ \
Expand All @@ -6542,6 +6542,30 @@ QDSYNC() QDSYNC(_create_linear)(TI * _s, \
QDSYNC(_callback) _callback, \
void * _context); \
\
/* create detector with sequence of CP-FSK symbols */ \
/* _seq : symbol sequence */ \
/* _seq_len : length of symbol sequence */ \
/* _ftype : Nyquist filter type (e.g. LIQUID_FIRFILT_RRC) */ \
/* _bps : bits per symbol, 0 < _bps <= 8 */ \
/* _h : modulation index, _h > 0 */ \
/* _k : samples per symbol */ \
/* _m : filter semi-length */ \
/* _beta : filter excess bandwidth factor */ \
/* _cpfsk_type : cpfsk filter type (e.g. LIQUID_CPFSK_SQUARE) */ \
/* _callback : user-defined callback */ \
/* _context : user-defined context */ \
QDSYNC() QDSYNC(_create_cpfsk)(unsigned char * _seq, \
unsigned int _seq_len, \
int _ftype, \
unsigned int _bps, \
float _h, \
unsigned int _k, \
unsigned int _m, \
float _beta, \
int _cpfsk_type, \
QDSYNC(_callback) _callback, \
void * _context); \
\
/* Copy object recursively including all internal objects and state */ \
QDSYNC() QDSYNC(_copy)(QDSYNC() _q); \
\
Expand All @@ -6555,7 +6579,7 @@ int QDSYNC(_reset)(QDSYNC() _q); \
int QDSYNC(_print)(QDSYNC() _q); \
\
/* Get detection state */ \
int QDSYNC(_is_detected)(QDSYNC() _q); \
int QDSYNC(_is_detected)(QDSYNC() _q); \
\
/* Get detection threshold */ \
float QDSYNC(_get_threshold)(QDSYNC() _q); \
Expand Down
2 changes: 1 addition & 1 deletion src/framing/src/qdetector.proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ QDETECTOR() QDETECTOR(_create_cpfsk)(unsigned char * _sequence,
if (_beta < 0.0f || _beta > 1.0f)
return liquid_error_config("QDETECTOR(_create_cpfsk)(), excess bandwidth factor must be in [0,1]");

// create time-domain template using GMSK modem
// create time-domain template using CPFSK modem
unsigned int s_len = _k * (_sequence_len + 2*_m);
TI * s = (TI*) malloc(s_len * sizeof(TI));
cpfskmod mod = cpfskmod_create(_bps, _h, _k, _m, _beta, _type);
Expand Down
80 changes: 57 additions & 23 deletions src/framing/src/qdsync.proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ int QDSYNC(_buf_append)(QDSYNC() _q, float complex _x);

// main object definition
struct QDSYNC(_s) {
unsigned int seq_len; // preamble sequence length
int ftype; // filter type
unsigned int k; // samples per symbol
unsigned int m; // filter semi-length
Expand Down Expand Up @@ -77,30 +76,22 @@ struct QDSYNC(_s) {
unsigned int buf_out_counter; // output counter
};

// create detector with generic sequence
QDSYNC() QDSYNC(_create_linear)(TI * _seq,
unsigned int _seq_len,
int _ftype,
unsigned int _k,
unsigned int _m,
float _beta,
QDSYNC(_callback) _callback,
void * _context)
// internal use only - create synchronizer with generic detector
QDSYNC() QDSYNC(_create)(QDETECTOR() _detector,
int _ftype,
unsigned int _k,
unsigned int _m,
float _beta,
QDSYNC(_callback) _callback,
void * _context)
{
// validate input
if (_seq_len == 0)
return liquid_error_config("QDSYNC(_create)(), sequence length cannot be zero");

// allocate memory for main object and set internal properties
QDSYNC() q = (QDSYNC()) malloc(sizeof(struct QDSYNC(_s)));
q->seq_len = _seq_len;
q->ftype = _ftype;
q->k = _k;
q->m = _m;
q->beta = _beta;

// create detector
q->detector = QDETECTOR(_create_linear)(_seq, _seq_len, _ftype, _k, _m, _beta);
q->ftype = _ftype;
q->k = _k;
q->m = _m;
q->beta = _beta;
q->detector = _detector;

// create down-coverters for carrier phase tracking
q->mixer = nco_crcf_create(LIQUID_NCO);
Expand All @@ -122,6 +113,48 @@ QDSYNC() QDSYNC(_create_linear)(TI * _seq,
return q;
}

// create detector from sequence of symbols using internal linear interpolator
QDSYNC() QDSYNC(_create_linear)(TI * _seq,
unsigned int _seq_len,
int _ftype,
unsigned int _k,
unsigned int _m,
float _beta,
QDSYNC(_callback) _callback,
void * _context)
{
// validate input
if (_seq_len == 0)
return liquid_error_config("QDSYNC(_create_linear)(), sequence length cannot be zero");

// create detector
QDETECTOR() _detector = QDETECTOR(_create_linear)(_seq, _seq_len, _ftype, _k, _m, _beta);

return QDSYNC(_create)(_detector, _ftype, _k, _m, _beta, _callback, _context);
}

QDSYNC() QDSYNC(_create_cpfsk)(unsigned char * _seq,
unsigned int _seq_len,
int _ftype,
unsigned int _bps,
float _h,
unsigned int _k,
unsigned int _m,
float _beta,
int _cpfsk_type,
QDSYNC(_callback) _callback,
void * _context)
{
// validate input
if (_seq_len == 0)
return liquid_error_config("QDSYNC(_create_cpfsk)(), sequence length cannot be zero");

// create detector
QDETECTOR() _detector = QDETECTOR(_create_cpfsk)(_seq, _seq_len, _bps, _h, _k, _m, _beta, _cpfsk_type);

return QDSYNC(_create)(_detector, _ftype, _k, _m, _beta, _callback, _context);
}

// copy object
QDSYNC() QDSYNC(_copy)(QDSYNC() q_orig)
{
Expand Down Expand Up @@ -176,7 +209,8 @@ int QDSYNC(_reset)(QDSYNC() _q)

int QDSYNC(_print)(QDSYNC() _q)
{
printf("<liquid.qdsync, n=%u>\n", _q->seq_len);
unsigned int _seq_len = QDETECTOR(_get_seq_len)(_q->detector);
printf("<liquid.qdsync, n=%u>\n", _seq_len);
return LIQUID_OK;
}

Expand Down