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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/23269 )
Change subject: Introduce init() APIs for PDCH and TRX objects
......................................................................
Introduce init() APIs for PDCH and TRX objects
This will make it easier to keep object specific initializations in
expected place.
Change-Id: Idf1dbdf8bc0b1e16d86eeeffb1193fdf3a57d6ef
---
M src/bts.cpp
M src/bts.h
M src/pdch.cpp
M src/pdch.h
4 files changed, 23 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/69/23269/1
diff --git a/src/bts.cpp b/src/bts.cpp
index 55d45b8..1d3f690 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -271,18 +271,8 @@
INIT_LLIST_HEAD(&bts->dl_tbfs);
/* initialize back pointers */
- for (size_t trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); ++trx_no) {
- struct gprs_rlcmac_trx *trx = &bts->trx[trx_no];
- trx->trx_no = trx_no;
- trx->bts = bts;
-
- 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;
- }
- }
+ for (size_t trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); ++trx_no)
+ bts_trx_init(&bts->trx[trx_no], bts, trx_no);
/* The static allocator might have already registered the counter group.
If this happens and we still called explicitly (in tests/ for example)
@@ -1161,6 +1151,15 @@
}
}
+void bts_trx_init(struct gprs_rlcmac_trx *trx, struct gprs_rlcmac_bts *bts, uint8_t trx_no)
+{
+ trx->trx_no = trx_no;
+ trx->bts = bts;
+
+ for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ts_no++)
+ pdch_init(&trx->pdch[ts_no], trx, ts_no);
+}
+
void bts_trx_reserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir,
uint8_t slots)
{
diff --git a/src/bts.h b/src/bts.h
index 15a72bd..3ddf501 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -65,6 +65,7 @@
#ifdef __cplusplus
extern "C" {
#endif
+void bts_trx_init(struct gprs_rlcmac_trx *trx, struct gprs_rlcmac_bts *bts, uint8_t trx_no);
void bts_trx_reserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
void bts_trx_unreserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
void bts_trx_free_all_tbf(struct gprs_rlcmac_trx *trx);
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 8a4a1d1..466eaa5 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -131,6 +131,16 @@
}
}
+void pdch_init(struct gprs_rlcmac_pdch *pdch, struct gprs_rlcmac_trx *trx, uint8_t ts_nr)
+{
+ pdch->ts_no = ts_nr;
+ pdch->trx = trx;
+
+ /* Initialize the PTCCH/D message (Packet Timing Advance Control Channel) */
+ memset(pdch->ptcch_msg, PTCCH_TAI_FREE, PTCCH_TAI_NUM);
+ memset(pdch->ptcch_msg + PTCCH_TAI_NUM, PTCCH_PADDING, 7);
+}
+
void gprs_rlcmac_pdch::enable()
{
/* TODO: Check if there are still allocated resources.. */
@@ -1039,13 +1049,6 @@
return trx->trx_no;
}
-/* 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;
diff --git a/src/pdch.h b/src/pdch.h
index fde183e..c83fe39 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -105,8 +105,6 @@
/* 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 */
@@ -190,6 +188,7 @@
#ifdef __cplusplus
extern "C" {
#endif
+void pdch_init(struct gprs_rlcmac_pdch *pdch, struct gprs_rlcmac_trx *trx, uint8_t ts_nr);
void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch);
void pdch_disable(struct gprs_rlcmac_pdch *pdch);
#ifdef __cplusplus
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/23269
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Idf1dbdf8bc0b1e16d86eeeffb1193fdf3a57d6ef
Gerrit-Change-Number: 23269
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210308/1af65416/attachment.htm>