jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/33608 )
Change subject: ASCI: Add TX support for UPLINK FREE/BUSY messages ......................................................................
ASCI: Add TX support for UPLINK FREE/BUSY messages
Change-Id: Ia27e0ebb5bf7edb1b9f84999cafc028231b9489f Related: OS#4852 --- M include/osmocom/bsc/gsm_04_08_rr.h M src/osmo-bsc/gsm_04_08_rr.c 2 files changed, 57 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/08/33608/1
diff --git a/include/osmocom/bsc/gsm_04_08_rr.h b/include/osmocom/bsc/gsm_04_08_rr.h index c0f8d4b..3106e77 100644 --- a/include/osmocom/bsc/gsm_04_08_rr.h +++ b/include/osmocom/bsc/gsm_04_08_rr.h @@ -34,6 +34,8 @@ const uint8_t *apdu_data, ssize_t apdu_data_len); int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t mode); int gsm48_send_uplink_release(struct gsm_lchan *lchan, uint8_t cause); +int gsm48_send_uplink_busy(struct gsm_lchan *lchan); +int gsm48_send_uplink_free(struct gsm_lchan *lchan, uint8_t acc_bit, uint8_t *uic); int gsm48_rx_rr_modif_ack(struct msgb *msg); int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg);
diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c index 5c2b0f8..6d74e43 100644 --- a/src/osmo-bsc/gsm_04_08_rr.c +++ b/src/osmo-bsc/gsm_04_08_rr.c @@ -770,6 +770,51 @@ return gsm48_sendmsg(msg); }
+/* TS 44.018 section 9.1.46 */ +int gsm48_send_uplink_busy(struct gsm_lchan *lchan) +{ + struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 UL BUSY"); + struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); + + msg->lchan = lchan; + gh->proto_discr = GSM48_PDISC_RR; + gh->msg_type = GSM48_MT_RR_UPLINK_BUSY; + + return gsm48_sendmsg_unit(msg); +} + +/* TS 44.018 section 9.1.47 */ +int gsm48_send_uplink_free(struct gsm_lchan *lchan, uint8_t acc_bit, uint8_t *uic) +{ + struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 UL FREE"); + struct gsm48_hdr_sh *sh = (struct gsm48_hdr_sh *) msgb_put(msg, sizeof(*sh) + 22); + struct bitvec *bv = bitvec_alloc(22, NULL); + + msg->lchan = lchan; + sh->rr_short_pd = GSM48_PDISC_SH_RR; + sh->msg_type = GSM48_MT_RR_SH_UL_FREE; + sh->l2_header = 0; + + /* < Uplink Access Request bit > */ + bitvec_set_bit(bv, (acc_bit) ? H : L); + + /* { L | H <Uplink Identity Code bit(6) > } */ + if (uic) { + bitvec_set_bit(bv, H); + sh->data[0] = 0x40 | *uic; + } else + bitvec_set_bit(bv, L); + + /* Emergency mode not supported */ + + /* Padding the rest with 0x2B and apply to msg. */ + bitvec_spare_padding(bv, 175); + bitvec_pack(bv, sh->data); + bitvec_free(bv); + + return gsm48_sendmsg_unit(msg); +} + int gsm48_rx_rr_modif_ack(struct msgb *msg) { struct gsm48_hdr *gh = msgb_l3(msg);