aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-07-21 00:54:42 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-09-22 00:49:11 +0700
commit8e2bd1e79d1f5e5e3341a76044fe443dad3f2722 (patch)
tree375a85ca2569e1dc79e657e53a58bdabf7cb3f69
parent40a9e603b9179ce7193344797997a4bc6f01bd72 (diff)
pcuif_proto: version 10: add frequency hopping parameters
-rw-r--r--include/osmocom/pcu/pcuif_proto.h15
-rw-r--r--src/pcu_l1_if.cpp25
2 files changed, 34 insertions, 6 deletions
diff --git a/include/osmocom/pcu/pcuif_proto.h b/include/osmocom/pcu/pcuif_proto.h
index e88607e6..61c63af6 100644
--- a/include/osmocom/pcu/pcuif_proto.h
+++ b/include/osmocom/pcu/pcuif_proto.h
@@ -5,7 +5,7 @@
#define PCU_SOCK_DEFAULT "/tmp/pcu_bts"
-#define PCU_IF_VERSION 0x09
+#define PCU_IF_VERSION 0x0a
#define TXT_MAX_LEN 128
/* msg_type */
@@ -112,12 +112,21 @@ struct gsm_pcu_if_rach_ind {
uint8_t ts_nr;
} __attribute__ ((packed));
+struct gsm_pcu_if_info_ts {
+ uint8_t tsc;
+ uint8_t h;
+ uint8_t hsn;
+ uint8_t maio;
+ uint8_t ma_bit_len;
+ uint8_t ma[8];
+} __attribute__ ((packed));
+
struct gsm_pcu_if_info_trx {
uint16_t arfcn;
- uint8_t pdch_mask; /* PDCH channels per TS */
+ uint8_t pdch_mask; /* PDCH timeslot mask */
uint8_t spare;
- uint8_t tsc[8]; /* TSC per channel */
uint32_t hlayer1;
+ struct gsm_pcu_if_info_ts ts[8]; /* timeslots per TRX */
} __attribute__ ((packed));
struct gsm_pcu_if_info_ind {
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 2374606b..c2cc2c16 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -630,6 +630,7 @@ bssgp_failed:
}
for (ts_nr = 0; ts_nr < ARRAY_SIZE(bts->trx[0].pdch); ts_nr++) {
+ const struct gsm_pcu_if_info_ts *its = &info_ind->trx[trx_nr].ts[ts_nr];
struct gprs_rlcmac_pdch *pdch = &bts->trx[trx_nr].pdch[ts_nr];
if ((info_ind->trx[trx_nr].pdch_mask & (1 << ts_nr))) {
/* FIXME: activate dynamically at RLCMAC */
@@ -643,9 +644,27 @@ bssgp_failed:
pcu_tx_act_req(trx_nr, ts_nr, 1);
pdch->enable();
}
- pdch->tsc = info_ind->trx[trx_nr].tsc[ts_nr];
- LOGP(DL1IF, LOGL_INFO, "PDCH: trx=%d ts=%d\n",
- trx_nr, ts_nr);
+
+ pdch->tsc = its->tsc;
+
+ /* (Optional) frequency hopping parameters */
+ if (its->h) {
+ pdch->fh.enabled = true;
+ pdch->fh.maio = its->maio;
+ pdch->fh.hsn = its->hsn;
+
+ OSMO_ASSERT(its->ma_bit_len <= sizeof(pdch->fh.ma) * 8);
+ pdch->fh.ma_oct_len = OSMO_BYTES_FOR_BITS(its->ma_bit_len);
+ pdch->fh.ma_bit_len = its->ma_bit_len;
+
+ /* Mobile Allocation + padding (byte/bit order as on the wire):
+ * | 00 00 00 00 00 cc bb aa | -> | cc bb aa 00 00 00 00 00 | */
+ unsigned int offset = sizeof(pdch->fh.ma) - pdch->fh.ma_oct_len;
+ memcpy(pdch->fh.ma, its->ma + offset, pdch->fh.ma_oct_len);
+ }
+
+ LOGP(DL1IF, LOGL_INFO, "PDCH (trx=%u, ts=%u): tsc=%u, hopping=%s\n",
+ trx_nr, ts_nr, pdch->tsc, pdch->fh.enabled ? "yes" : "no");
} else {
if (pdch->is_enabled()) {
pcu_tx_act_req(trx_nr, ts_nr, 0);