[PATCH] osmocom-bb[master]: host/trxcon/l1ctl.c: implement L1CTL_CCCH_MODE_{REQ/CONF}

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:32:42 UTC 2018


Review at  https://gerrit.osmocom.org/6704

host/trxcon/l1ctl.c: implement L1CTL_CCCH_MODE_{REQ/CONF}

Change-Id: I72f36a99aebcbafd657ceb475fd1c50cc79e2094
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl.h
2 files changed, 47 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/04/6704/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 255177e..beb5734 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -151,6 +151,21 @@
 	return l1ctl_link_send(l1l, msg);
 }
 
+int l1ctl_tx_ccch_mode_conf(struct l1ctl_link *l1l, uint8_t mode)
+{
+	struct l1ctl_ccch_mode_conf *conf;
+	struct msgb *msg;
+
+	msg = l1ctl_alloc_msg(L1CTL_CCCH_MODE_CONF);
+	if (msg == NULL)
+		return -ENOMEM;
+
+	conf = (struct l1ctl_ccch_mode_conf *) msgb_put(msg, sizeof(*conf));
+	conf->ccch_mode = mode;
+
+	return l1ctl_link_send(l1l, msg);
+}
+
 int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data)
 {
 	struct l1ctl_info_dl *dl;
@@ -311,6 +326,35 @@
 	return l1ctl_link_send(l1l, msg);
 }
 
+static int l1ctl_rx_ccch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
+{
+	struct l1ctl_ccch_mode_req *req;
+	int mode, rc = 0;
+
+	req = (struct l1ctl_ccch_mode_req *) msg->l1h;
+	if (msgb_l1len(msg) < sizeof(*req)) {
+		LOGP(DL1C, LOGL_ERROR, "MSG too short Reset Req: %u\n",
+			msgb_l1len(msg));
+		rc = -EINVAL;
+		goto exit;
+	}
+
+	LOGP(DL1C, LOGL_DEBUG, "Recv CCCH Mode Req (%u)\n", req->ccch_mode);
+
+	/* Reconfigure TS0 */
+	mode = req->ccch_mode == CCCH_MODE_COMBINED ?
+		GSM_PCHAN_CCCH_SDCCH4 : GSM_PCHAN_CCCH;
+	rc = sched_trx_configure_ts(l1l->trx, 0, mode);
+
+	/* Confirm reconfiguration */
+	if (!rc)
+		rc = l1ctl_tx_ccch_mode_conf(l1l, req->ccch_mode);
+
+exit:
+	msgb_free(msg);
+	return rc;
+}
+
 int l1ctl_rx_cb(struct l1ctl_link *l1l, struct msgb *msg)
 {
 	struct l1ctl_hdr *l1h;
@@ -327,6 +371,8 @@
 		return l1ctl_rx_reset_req(l1l, msg);
 	case L1CTL_ECHO_REQ:
 		return l1ctl_rx_echo_req(l1l, msg);
+	case L1CTL_CCCH_MODE_REQ:
+		return l1ctl_rx_ccch_mode_req(l1l, msg);
 	default:
 		LOGP(DL1C, LOGL_ERROR, "Unknown MSG: %u\n", l1h->msg_type);
 		msgb_free(msg);
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index 124074b..dae75e9 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -7,6 +7,7 @@
 #include "l1ctl_proto.h"
 
 int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result, uint8_t bsic);
+int l1ctl_tx_ccch_mode_conf(struct l1ctl_link *l1l, uint8_t mode);
 int l1ctl_tx_pm_conf(struct l1ctl_link *l1l, uint16_t band_arfcn,
 	int dbm, int last);
 int l1ctl_tx_reset_conf(struct l1ctl_link *l1l, uint8_t type);

-- 
To view, visit https://gerrit.osmocom.org/6704
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72f36a99aebcbafd657ceb475fd1c50cc79e2094
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list