tdma->sample_sync_offset = 960;
tdma->slot_cur = 0;
tdma->rx_callback = NULL;
+ tdma->tx_callback = NULL;
+ tdma->tx_burst_callback = NULL;
/* Allocate buffer for incoming samples */
/* TODO: We may only need a single slot's worth of samps -- look into this */
}
/* Convience function to look up a slot from it's index number */
-static slot_t * tdma_get_slot(tdma_t * tdma, u32 slot_idx){
+slot_t * tdma_get_slot(tdma_t * tdma, u32 slot_idx){
/* Don't try and index beyond the end */
if(slot_idx >= tdma->settings.n_slots) return NULL;
/* Send frame on to radio if callback is setup */
if(tdma->tx_burst_callback != NULL){
- tdma->tx_burst_callback(mod_samps,Ts*frame_size,tx_timestamp,tdma->tx_burst_cb_data);
+ tdma->tx_burst_callback(tdma,mod_samps,Ts*frame_size,tx_timestamp,tdma->tx_burst_cb_data);
}
}
return slot_samps;
}
+size_t tdma_nout(tdma_t * tdma){
+ struct TDMA_MODE_SETTINGS mode = tdma->settings;
+ size_t frame_size = mode.frame_size;
+ u32 Rs = mode.sym_rate;
+ u32 Fs = mode.samp_rate;
+ u32 Ts = Fs/Rs;
+ return frame_size*Ts;
+}
#pragma GCC diagnostic pop
typedef int (*tdma_cb_tx_frame)(u8* frame_bits,u32 slot_i, slot_t * slot, tdma_t * tdma, void * cb_data);
/* Callback to the radio front end to schedule a burst of TX samples */
-typedef int (*tdma_cb_tx_burst)(COMP* samples, size_t n_samples,i64 timestamp,void * cb_data);
+typedef int (*tdma_cb_tx_burst)(tdma_t * tdma,COMP* samples, size_t n_samples,i64 timestamp,void * cb_data);
/* TDMA modem */
struct TDMA_MODEM {
size_t tdma_nin(tdma_t * tdma);
+size_t tdma_nout(tdma_t * tdma);
+
+/* Convience function to look up a slot from it's index number */
+slot_t * tdma_get_slot(tdma_t * tdma, u32 slot_idx);
#endif