Change in osmo-pcu[master]: PTCCH: implement basic message codec and API

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Nov 23 08:02:19 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/16082 )

Change subject: PTCCH: implement basic message codec and API
......................................................................

PTCCH: implement basic message codec and API

Change-Id: Id79e95aafdde4a71977c64385fce48b729a51ca9
Related: OS#1545
---
M src/bts.cpp
M src/pdch.cpp
M src/pdch.h
3 files changed, 54 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/bts.cpp b/src/bts.cpp
index a9ff553..24666af 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -252,6 +252,7 @@
 
 		for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ++ts_no) {
 			struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts_no];
+			pdch->init_ptcch_msg();
 			pdch->ts_no = ts_no;
 			pdch->trx = trx;
 		}
diff --git a/src/pdch.cpp b/src/pdch.cpp
index e4b25e1..beb2c13 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -48,6 +48,7 @@
 }
 
 #include <errno.h>
+#include <stdlib.h>
 #include <arpa/inet.h>
 
 extern void *tall_pcu_ctx;
@@ -961,3 +962,37 @@
 {
 	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;
+}
diff --git a/src/pdch.h b/src/pdch.h
index 3015023..d55f58e 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -35,6 +35,11 @@
 
 #include <stdint.h>
 
+/* PTCCH (Packet Timing Advance Control Channel) */
+#define PTCCH_TAI_FREE		0x7f	/*!< Special value for unused TA Indexes */
+#define PTCCH_TAI_NUM		16	/*!< Number of PTCCH/U slots and thus TA Indexes */
+#define PTCCH_PADDING		0x2b	/*!< PTCCH/D messages need to be padded to 23 octets */
+
 /*
  * PDCH instance
  */
@@ -88,6 +93,19 @@
 	struct llist_head paging_list; /* list of paging messages */
 	uint32_t last_rts_fn; /* store last frame number of RTS */
 
+	/* PTCCH (Packet Timing Advance Control Channel) */
+	uint8_t ptcch_msg[GSM_MACBLOCK_LEN]; /* 'ready to use' PTCCH/D message */
+#ifdef __cplusplus
+	/* Initialize the PTCCH/D message */
+	void init_ptcch_msg(void);
+	/* Obtain an unused TA Index for a TBF */
+	uint8_t reserve_tai(uint8_t ta);
+	/* Mark a given TA Index as free, so it can be used again */
+	void release_tai(uint8_t tai);
+	/* Update the actual Timing Advance value for a given TA Index */
+	void update_ta(uint8_t tai, uint8_t ta);
+#endif
+
 	/* back pointers */
 	struct gprs_rlcmac_trx *trx;
 	uint8_t ts_no;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/16082
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Id79e95aafdde4a71977c64385fce48b729a51ca9
Gerrit-Change-Number: 16082
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191123/5e7b704f/attachment.htm>


More information about the gerrit-log mailing list