From 8194febb09f75c9027d52e8376b679d3327e97a3 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 30 Jul 2020 18:28:46 +0700 Subject: layer23/mobile: implement handling of TCH test loop commands For more information, see 3GPP TS 44.014, sections: - 5.1 "Single-slot TCH loops", and - 8 "Message definitions and contents". This feature has nothing to do with the Mobility Management, so let's handle GSM48_PDISC_TEST messages in the Radio Resources layer implementation (gsm48_mm.c -> gsm48_rr.c). Change-Id: If8efc57c7017aa8ea47b37c472d1bbb1914389ca --- src/host/layer23/src/mobile/gsm48_rr.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/host/layer23/src/mobile/gsm48_rr.c') diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 0449ee31..64d64f1a 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -93,6 +93,7 @@ static int gsm48_rr_tx_meas_rep(struct osmocom_ms *ms); static int gsm48_rr_set_mode(struct osmocom_ms *ms, uint8_t chan_nr, uint8_t mode); static int gsm48_rr_rel_cnf(struct osmocom_ms *ms, struct msgb *msg); +int gsm414_rcv_test(struct osmocom_ms *ms, const struct msgb *msg); /* * support @@ -516,8 +517,8 @@ int gsm48_rr_upmsg(struct osmocom_ms *ms, struct msgb *msg) } /* push rsl header and send (RSL-SAP) */ -static int gsm48_send_rsl(struct osmocom_ms *ms, uint8_t msg_type, - struct msgb *msg, uint8_t link_id) +int gsm48_send_rsl(struct osmocom_ms *ms, uint8_t msg_type, + struct msgb *msg, uint8_t link_id) { struct gsm48_rrlayer *rr = &ms->rrlayer; @@ -879,7 +880,7 @@ static void stop_rr_t3126(struct gsm48_rrlayer *rr) */ /* send rr status request */ -static int gsm48_rr_tx_rr_status(struct osmocom_ms *ms, uint8_t cause) +int gsm48_rr_tx_rr_status(struct osmocom_ms *ms, uint8_t cause) { struct msgb *nmsg; struct gsm48_hdr *gh; @@ -3433,7 +3434,7 @@ static int gsm48_rr_set_mode(struct osmocom_ms *ms, uint8_t chan_nr, /* setting (new) timing advance */ LOGP(DRR, LOGL_INFO, "setting TCH mode to %d, audio mode to %d\n", mode, rr->audio_mode); - l1ctl_tx_tch_mode_req(ms, mode, rr->audio_mode); + l1ctl_tx_tch_mode_req(ms, mode, rr->audio_mode, rr->tch_loop_mode); return 0; } @@ -4627,9 +4628,9 @@ static int gsm48_rr_data_ind(struct osmocom_ms *ms, struct msgb *msg) struct gsm48_hdr *gh = msgb_l3(msg); struct gsm48_rr_hdr *rrh; uint8_t pdisc = gh->proto_discr & 0x0f; + int rc = -EINVAL; if (pdisc == GSM48_PDISC_RR) { - int rc = -EINVAL; uint8_t skip_ind = (gh->proto_discr & 0xf0) >> 4; /* ignore if skip indicator is not B'0000' */ @@ -4674,6 +4675,10 @@ static int gsm48_rr_data_ind(struct osmocom_ms *ms, struct msgb *msg) gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_MSG_TYPE_N); } + msgb_free(msg); + return rc; + } else if (pdisc == GSM48_PDISC_TEST) { + rc = gsm414_rcv_test(ms, msg); msgb_free(msg); return rc; } @@ -5505,6 +5510,7 @@ int gsm48_rr_init(struct osmocom_ms *ms) start_rr_t_meas(rr, 1, 0); rr->audio_mode = AUDIO_TX_MICROPHONE | AUDIO_RX_SPEAKER; + rr->tch_loop_mode = L1CTL_TCH_LOOP_OPEN; return 0; } @@ -5707,6 +5713,5 @@ int gsm48_rr_audio_mode(struct osmocom_ms *ms, uint8_t mode) && ch_type != RSL_CHAN_Lm_ACCHs) return 0; - return l1ctl_tx_tch_mode_req(ms, rr->cd_now.mode, mode); + return l1ctl_tx_tch_mode_req(ms, rr->cd_now.mode, mode, rr->tch_loop_mode); } - -- cgit v1.2.3