A bit more work on the TDMA header and notes
authorbaobrien <baobrien@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 21 Feb 2017 02:54:48 +0000 (02:54 +0000)
committerbaobrien <baobrien@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 21 Feb 2017 02:54:48 +0000 (02:54 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3042 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/notes_and_todo_tdma
codec2-dev/src/tdma.h

index 7830df912b16524dc01e8d95415ef120bbfee701..a27d02b68c1b279d1f45a6744a7c8e05a14714c7 100644 (file)
@@ -4,7 +4,7 @@ Random Thoughts and todos for FreeDV FSK TDMA:
 
 Ideas for TDMA layer structure-
 -TDMAModem Struct containing
-    -half-frame 'pilot' modem struct for pilot sync 
+    -half-frame 'pilot' modem struct for pilot sync
         -Pilot modem used to locate a UW in half frame chunks with a large bit error tolerance
         -Once a frame is located, TDMA can set up coarse timing for slot modems
         -Pilot modem would not keep freq est info between half frame chunks
@@ -17,25 +17,26 @@ Ideas for TDMA layer structure-
         Unsynched - No sync at all
         Pilot sync - Pilot demod has found UW but slot demods have not locked on
         Full sync - Any slot has pulled out a UW and is individually in 'sync' state\
-        Master - 
+        Master -
     -TX -- Need some way of scheduling TX bursts
         -Should be fairly hardware-independant
         -Hardware timer of some sort synched with ADC?
         -Should ADC keep sampling during TX period or throw away samples? Software option, maybe?
         -Maybe start a 'sample' timer in hardware synched to what the ADC sample number should be?
-        --reset sample timer on pilot sync 
-        
+        --reset sample timer on pilot sync
+
 API Skeleton-
 
 TDMA_init/TDMA_destory - do what you think they do
     Should TDMA init take a simple mode or a more granular config? Different inits for both?
     - Probably just a mode to begin with
 TDMA_rx(samples) - Accept some number of samps -- probably variable n samples up to some number
+    -- probably shouldn't be variable sample number, tracking will happen in slot modems
 TDMA_get_frames() - Get frame structs if any frames have been decoded by rx -- only hold up to 1 frame per slot -- could probably be rolled into TDMA_rx
 TDMA_reset_slot(n) - reset the estimators/sync state for any single slot -- useful from a protocol point of view if a master is scheduling slots to multiple clients
 TDMA_sched_tx(slot_n,tx_frame,tx_samps_out,tx_time_out) - Schedule a frame transmission
     -Difficult part is to actually ensure timing here
-    
+
 Random TODOs:
 [ ] Deframer work:
   [x] Framer for shorter frames (minus padding bits)
@@ -46,3 +47,6 @@ Random TODOs:
             -Possibly just expose UW matching and let TDMA handle the rest. Frames will be extracted by slot demods
         [ ] Add bit extraction code for new UW frame
 
+More specific TODOs:
+  [ ] Write TDMA RX simulator in octave/c/python/whatever
+  [ ] Get TDMA to point of picking up on pilot sync
index faf988815780044cbe1c0638306977c60f73d275..96e837cfce6bad6c9f3c65fa2d69926f1d1e4a24 100644 (file)
@@ -31,6 +31,8 @@
 #include "fsk.h"
 #include "freedv_vhf_framing.h"
 
+//typedef void (*tdma_cb_rx_frame)()
+
 /* The state for an individual slot */
 enum slot_state {
     rx_no_sync,         /* Not synched */
@@ -47,6 +49,19 @@ enum tdma_state {
     master_sync,        /* This modem is the TDMA master */
 };
 
+/* TDMA frame type */
+enum tdma_frame_type{
+    frame_master,
+    frame_client,
+};
+
+/* TDMA frame struct */
+struct TDMA_FRAME {
+    enum tdma_frame_type type;      /* Type of frame */
+    int slot_idx;                   /* Index of slot from where frame was rx-ed */
+    uint8_t frame_payload[];        /* Frame payload. TODO: figure out how to sling payloads around */
+};
+
 /* TDMA slot struct */
 
 struct TDMA_SLOT {
@@ -54,11 +69,16 @@ struct TDMA_SLOT {
     enum slot_state state;          /* Current local slot state */
     int slot_local_frame_offset;    /* Where the RX frame starts, in samples, from the perspective of the modem */
     struct TDMA_SLOT * next_slot;   /* Next slot in a linked list of slots */
-    
+
 };
 
 /* TDMA modem */
 struct TDMA_MODEM {
+    struct FSK * fsk_pilot;         /* Pilot modem */
+    enum tdma_state state;          /* Current state of modem */
+    struct TDMA_SLOT * slots;       /* Linked list of slot structs */
+
+    int total_slot_count;
 
 };