From: baobrien Date: Thu, 7 Sep 2017 03:32:15 +0000 (+0000) Subject: Began sketching out TDMA pilot RX path X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=ad6cabc77ad95250dc9bda49abf0dbea6cbb8d74;p=freetel-svn-tracking.git Began sketching out TDMA pilot RX path git-svn-id: https://svn.code.sf.net/p/freetel/code@3360 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/tdma.c b/codec2-dev/src/tdma.c index 2dd625db..6674e662 100644 --- a/codec2-dev/src/tdma.c +++ b/codec2-dev/src/tdma.c @@ -101,6 +101,50 @@ u32 tdma_get_N(struct TDMA_MODEM * tdma){ return slot_size * (Fs/Rs); } -void tdma_rx(struct TDMA_MODEM * tdma, COMP * samps){ +void tdma_rx_no_sync(struct TDMA_MODEM * tdma, COMP * samps, u64 timestamp){ + mode = tdma->settings; + u32 Rs = mode.sym_rate; + u32 Fs = mode.samp_rate; + u32 slot_size = mode.slot_size; + //u32 frame_size = mode.frame_size; + u32 n_slots = mode.n_slots; + u32 M = mode.fsk_m; + u32 Ts = Fs/Rs; + u32 bits_per_sym = M==2?1:2; + + //Number of bits per pilot modem chunk (half a slot) + u32 n_pilot_bits = (slot_size/2)*bits_per_sym; + //We look at a full slot for the UW + u8 pilot_bits[n_pilot_bits*2]; + + /* + Pseudocode: + copy into samp buffer (? may want to let the downstream stuff do this; We may not even really need a local samp buffer) + demod a half slot + look for UW in slot-wide bit buffer + if UW found + change to pilot sync state + set slot offset to match where a frame should be + go to slot_sync_rx to try and decode found frame + else + set up for next half slot, repeat + */ +} +void tdma_rx(struct TDMA_MODEM * tdma, COMP * samps,u64 timestamp){ + + /* Staate machine for TDMA modem */ + switch(tdma->state){ + no_sync: + tdma_rx_no_sync(tdma,samps,timestamp); + break; + pilot_sync: + break; + slot_sync; + break; + master_sync: + break; + default: + break; + } } \ No newline at end of file diff --git a/codec2-dev/src/tdma.h b/codec2-dev/src/tdma.h index 1357555b..7e473b9c 100644 --- a/codec2-dev/src/tdma.h +++ b/codec2-dev/src/tdma.h @@ -36,8 +36,9 @@ /* TODO: Replace these types with their full names */ /* I'm just feeling lazy right now */ +typedef uint64_t u64; typedef uint32_t u32; -typedef int32_t i32; +typedef int32_t i32; typedef uint8_t u8; typedef float f32;