diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-10-05 21:57:14 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2019-11-17 02:35:18 +0700 |
commit | bd0dac3783a27023b0aaaa2c7db99c021866b7b5 (patch) | |
tree | 04827c4be21344b9c8276cf4380a9a5fabed0f9d /src/pdch.cpp | |
parent | 0bf622e0573ae44b90f14a0bbc2a9ef21f5bf457 (diff) |
PTCCH: implement basic message codec and API
Change-Id: Id79e95aafdde4a71977c64385fce48b729a51ca9
Related: OS#1545
Diffstat (limited to 'src/pdch.cpp')
-rw-r--r-- | src/pdch.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pdch.cpp b/src/pdch.cpp index e4b25e1b..beb2c13b 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -48,6 +48,7 @@ extern "C" { } #include <errno.h> +#include <stdlib.h> #include <arpa/inet.h> extern void *tall_pcu_ctx; @@ -961,3 +962,37 @@ inline gprs_rlcmac_bts *gprs_rlcmac_pdch::bts_data() const { return trx->bts->bts_data(); } + +/* PTCCH (Packet Timing Advance Control Channel) */ +void gprs_rlcmac_pdch::init_ptcch_msg(void) +{ + memset(ptcch_msg, PTCCH_TAI_FREE, PTCCH_TAI_NUM); + memset(ptcch_msg + PTCCH_TAI_NUM, PTCCH_PADDING, 7); +} + +uint8_t gprs_rlcmac_pdch::reserve_tai(uint8_t ta) +{ + uint8_t tai; + + for (tai = 0; tai < PTCCH_TAI_NUM; tai++) { + if (ptcch_msg[tai] == PTCCH_TAI_FREE) { + ptcch_msg[tai] = ta; + return tai; + } + } + + /* Special case: no free TAI available */ + return PTCCH_TAI_FREE; +} + +void gprs_rlcmac_pdch::release_tai(uint8_t tai) +{ + OSMO_ASSERT(tai < PTCCH_TAI_NUM); + ptcch_msg[tai] = PTCCH_TAI_FREE; +} + +void gprs_rlcmac_pdch::update_ta(uint8_t tai, uint8_t ta) +{ + OSMO_ASSERT(tai < PTCCH_TAI_NUM); + ptcch_msg[tai] = ta; +} |