From: baobrien Date: Tue, 5 Sep 2017 08:09:07 +0000 (+0000) Subject: A small bit of work on TDMA X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=e509c8fea7ee5823eaeadeac491bb2fc74d9115a;p=freetel-svn-tracking.git A small bit of work on TDMA git-svn-id: https://svn.code.sf.net/p/freetel/code@3358 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/CMakeLists.txt b/codec2-dev/src/CMakeLists.txt index 66a6fe15..4feaca40 100644 --- a/codec2-dev/src/CMakeLists.txt +++ b/codec2-dev/src/CMakeLists.txt @@ -205,6 +205,7 @@ set(CODEC2_SRCS fm.c fsk.c fmfsk.c + tdma.c kiss_fft.c kiss_fftr.c linreg.c diff --git a/codec2-dev/src/tdma.c b/codec2-dev/src/tdma.c deleted file mode 100644 index f03e20fa..00000000 --- a/codec2-dev/src/tdma.c +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - - FILE........: tdma.c - AUTHOR......: Brady O'Brien - DATE CREATED: 18 September 2016 - - Skeletion of the TDMA FSK modem - -\*---------------------------------------------------------------------------*/ - -/* - Copyright (C) 2017 Brady O'Brien - - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 2.1, as - published by the Free Software Foundation. This program is - distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, see . -*/ - - -#include "fsk.h" -#include "freedv_vhf_framing.h" -#include "tdma.h" -#include - -/* Structure for tracking basic TDMA modem config */ -struct TDMA_MODE_SETTINGS { - uint8_t n_slots; - -} \ No newline at end of file diff --git a/codec2-dev/src/tdma.h b/codec2-dev/src/tdma.h index 69a8811f..7740d7ad 100644 --- a/codec2-dev/src/tdma.h +++ b/codec2-dev/src/tdma.h @@ -31,6 +31,7 @@ #include "fsk.h" #include "freedv_vhf_framing.h" #include +#include "comp_prim.h" //typedef void (*tdma_cb_rx_frame)() @@ -75,15 +76,19 @@ struct TDMA_SLOT { /* Structure for tracking basic TDMA modem config */ struct TDMA_MODE_SETTINGS { - uint32_t bit_rate; /* Modem bitrate */ + uint32_t sym_rate; /* Modem symbol rate */ + uint32_t fsk_m; /* Number of modem tones */ uint32_t samp_rate; /* Modem samplerate */ - uint32_t slot_size; /* Number of bits per slot, including quiet padding time */ - uint8_t n_slots; /* Number of TDMA slots */ - uint8_t frame_type; /* Frame type number for framer/deframer */ -} + uint32_t slot_size; /* Number of symbols per slot, including quiet padding time */ + uint32_t frame_size; /* Number of symbols per frame, not inclduing quiet padding */ + uint32_t n_slots; /* Number of TDMA slots */ + uint32_t frame_type; /* Frame type number for framer/deframer */ +}; /* Declaration of basic 4800bps freedv tdma mode, defined in tdma.h */ -struct TDMA_MODE_SETTINGS FREEDV_4800T; +//struct TDMA_MODE_SETTINGS FREEDV_4800T; + +#define FREEDV_4800T {2400,4,48000,48,44,2,FREEDV_VHF_FRAME_AT} /* TDMA modem */ struct TDMA_MODEM { @@ -91,12 +96,13 @@ struct TDMA_MODEM { enum tdma_state state; /* Current state of modem */ struct TDMA_SLOT * slots; /* Linked list of slot structs */ struct TDMA_MODE_SETTINGS settings; /* Basic TDMA config parameters */ - float * sample_buffer; /* Buffer of incoming samples */ - size_t sample_sync_offset; /* Offset into the sample buffer where slot 1 starts */ + COMP * sample_buffer; /* Buffer of incoming samples */ + size_t sample_sync_offset; /* Offset into the sample buffer where slot 0 starts */ }; /* Allocate and setup a new TDMA modem */ struct TDMA_MODEM * tdma_create(struct TDMA_MODE_SETTINGS mode); +/* Tear down and free a TDMA modem */ void tdma_destroy(struct TDMA_MODEM * tdma); #endif