summaryrefslogtreecommitdiff
path: root/controller/fw/src/dsss_demod.h
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-09 10:17:14 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-09 10:17:14 +0100
commitb4d5293d045d68822ad5b2d0a7a5f392c596a0ba (patch)
tree39b89c79026d295ef5ab26ec271c27a00abc5d94 /controller/fw/src/dsss_demod.h
parent55ebbcbdbc6d9513012a60a143c92eddb90f631d (diff)
downloadmaster-thesis-b4d5293d045d68822ad5b2d0a7a5f392c596a0ba.tar.gz
master-thesis-b4d5293d045d68822ad5b2d0a7a5f392c596a0ba.tar.bz2
master-thesis-b4d5293d045d68822ad5b2d0a7a5f392c596a0ba.zip
decoding WIP
Diffstat (limited to 'controller/fw/src/dsss_demod.h')
-rw-r--r--controller/fw/src/dsss_demod.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/controller/fw/src/dsss_demod.h b/controller/fw/src/dsss_demod.h
index b6947bc..30ec3f7 100644
--- a/controller/fw/src/dsss_demod.h
+++ b/controller/fw/src/dsss_demod.h
@@ -5,6 +5,8 @@
#define DSSS_GOLD_CODE_COUNT ((1<<DSSS_GOLD_CODE_NBITS) + 1)
#define DSSS_CORRELATION_LENGTH (DSSS_GOLD_CODE_LENGTH * DSSS_DECIMATION)
+#define PAYLOAD_DATA_BYTE ((PAYLOAD_DATA_BIT+7)/8)
+
struct iir_biquad {
float a[2];
float b[3];
@@ -18,6 +20,24 @@ struct cwt_iir_filter_state {
struct iir_biquad_state st[3];
};
+struct {
+ int len; /* length of group in samples */
+ float max; /* signed value of largest peak in group on any channel */
+ uint64_t max_ts; /* absolute position of above peak */
+ int max_ch; /* channel (gold sequence index) of above peak */
+} group;
+
+struct decoder_state {
+ int last_phase;
+ int candidate_phase;
+
+ float last_score;
+ float candidate_score;
+
+ uint8_t data[PAYLOAD_DATA_BYTE];
+ int data_pos;
+};
+
struct dsss_demod_state {
float signal[DSSS_CORRELATION_LENGTH];
size_t signal_wpos;
@@ -27,18 +47,15 @@ struct dsss_demod_state {
struct cwt_iir_filter_state cwt_filter[DSSS_GOLD_CODE_COUNT];
- struct {
- int len; /* length of group in samples */
- float max; /* signed value of largest peak in group on any channel */
- int max_idx; /* position of above peak counted from start of group */
- int max_ch; /* channel (gold sequence index) of above peak */
- } group;
+ struct group group;
+
+ struct group group_cache[DSSS_GROUP_CACHE_SIZE];
};
#ifdef SIMULATION
-void dsss_demod_step(struct dsss_demod_state *st, float new_value, size_t sim_pos, int record_channel);
+void dsss_demod_step(struct dsss_demod_state *st, float new_value, uint64_t ts, int record_channel);
#else /* SIMULATION */
-void dsss_demod_step(struct dsss_demod_state *st, float new_value);
+void dsss_demod_step(struct dsss_demod_state *st, float new_value, uint64_t ts);
#endif /* SIMULATION */
#endif /* __DSSS_DEMOD_H__ */