[PATCH] l1: add CBCH flag to dedicated mode

Alex Badea vamposdecampos at gmail.com
Wed Jan 2 19:17:13 UTC 2013


Add a .cbch_mode member to struct l1ctl_dm_est_req.  If set, this
instructs L1 to use the CBCH variant of SDCCH for dedicated mode (no
uplink, no SACCH).

Add the new cbch_mode flag to l1ctl_tx_dm_est_req* API calls.  Clear it
everywhere, except for app_cbch_sniff.

Signed-off-by: Alex Badea <vamposdecampos at gmail.com>
---
The extra struct member might be a bit excessive;  an alternative would
be to abuse audio_mode, which is not used for signalling channels.

 include/l1ctl_proto.h                              |    1 +
 src/host/layer23/include/osmocom/bb/common/l1ctl.h |    5 +++--
 src/host/layer23/src/common/l1ctl.c                |    6 ++++--
 src/host/layer23/src/misc/app_cbch_sniff.c         |    4 ++--
 src/host/layer23/src/mobile/gsm48_rr.c             |    4 ++--
 src/target/firmware/include/layer1/mframe_sched.h  |    3 +++
 src/target/firmware/layer1/l23_api.c               |   12 +++++++-----
 src/target/firmware/layer1/mframe_sched.c          |   14 ++++++++++++++
 8 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h
index 771bf1c..55f0ffc 100644
--- a/include/l1ctl_proto.h
+++ b/include/l1ctl_proto.h
@@ -233,6 +233,7 @@ struct l1ctl_dm_est_req {
 	};
 	uint8_t tch_mode;
 	uint8_t audio_mode;
+	uint8_t cbch_mode;
 } __attribute__((packed));
 
 struct l1ctl_dm_freq_req {
diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
index 46a333e..f25a516 100644
--- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h
+++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
@@ -25,10 +25,11 @@ int l1ctl_tx_rach_req(struct osmocom_ms *ms, uint8_t ra, uint16_t offset,
 
 /* Transmit L1CTL_DM_EST_REQ */
 int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
-	uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode, uint8_t audio_mode);
+	uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode, uint8_t audio_mode,
+	uint8_t cbch_mode);
 int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
 	uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc,
-	uint8_t tch_mode, uint8_t audio_mode);
+	uint8_t tch_mode, uint8_t audio_mode, uint8_t cbch_mode);
 
 /* Transmit L1CTL_DM_FREQ_REQ */
 int l1ctl_tx_dm_freq_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index 5898b22..57003af 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -461,7 +461,7 @@ int l1ctl_tx_rach_req(struct osmocom_ms *ms, uint8_t ra, uint16_t offset,
 /* Transmit L1CTL_DM_EST_REQ */
 int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
                            uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode,
-			   uint8_t audio_mode)
+			   uint8_t audio_mode, uint8_t cbch_mode)
 {
 	struct msgb *msg;
 	struct l1ctl_info_ul *ul;
@@ -484,6 +484,7 @@ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
 	req->h0.band_arfcn = htons(band_arfcn);
 	req->tch_mode = tch_mode;
 	req->audio_mode = audio_mode;
+	req->cbch_mode = cbch_mode;
 
 	return osmo_send_l1(ms, msg);
 }
@@ -491,7 +492,7 @@ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
 int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
                            uint16_t *ma, uint8_t ma_len,
                            uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode,
-			   uint8_t audio_mode)
+			   uint8_t audio_mode, uint8_t cbch_mode)
 {
 	struct msgb *msg;
 	struct l1ctl_info_ul *ul;
@@ -519,6 +520,7 @@ int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
 		req->h1.ma[i] = htons(ma[i]);
 	req->tch_mode = tch_mode;
 	req->audio_mode = audio_mode;
+	req->cbch_mode = cbch_mode;
 
 	return osmo_send_l1(ms, msg);
 }
diff --git a/src/host/layer23/src/misc/app_cbch_sniff.c b/src/host/layer23/src/misc/app_cbch_sniff.c
index 8256eaf..6df2f11 100644
--- a/src/host/layer23/src/misc/app_cbch_sniff.c
+++ b/src/host/layer23/src/misc/app_cbch_sniff.c
@@ -57,12 +57,12 @@ static int try_cbch(struct osmocom_ms *ms, struct gsm48_sysinfo *s)
 		return l1ctl_tx_dm_est_req_h1(ms,
 			s->maio, s->hsn, s->hopping, s->hopp_len,
 			s->chan_nr, s->tsc,
-			GSM48_CMODE_SIGN, 0);
+			GSM48_CMODE_SIGN, 0, 1);
 	} else {
 		LOGP(DRR, LOGL_INFO, "chan_nr = 0x%02x TSC = %d  ARFCN = %d\n",
 			s->chan_nr, s->tsc, s->arfcn);
 		return l1ctl_tx_dm_est_req_h0(ms, s->arfcn,
-			s->chan_nr, s->tsc, GSM48_CMODE_SIGN, 0);
+			s->chan_nr, s->tsc, GSM48_CMODE_SIGN, 0, 1);
 	}
 }
 
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c
index 3d15494..a21758c 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -3002,10 +3002,10 @@ static int gsm48_rr_activate_channel(struct osmocom_ms *ms,
 	if (cd->h)
 		l1ctl_tx_dm_est_req_h1(ms, cd->maio, cd->hsn,
 			ma, ma_len, cd->chan_nr, cd->tsc, cd->mode,
-			rr->audio_mode);
+			rr->audio_mode, 0);
 	else
 		l1ctl_tx_dm_est_req_h0(ms, cd->arfcn, cd->chan_nr, cd->tsc,
-			cd->mode, rr->audio_mode);
+			cd->mode, rr->audio_mode, 0);
 	rr->dm_est = 1;
 
 	/* old SI 5/6 are not valid on a new dedicated channel */
diff --git a/src/target/firmware/include/layer1/mframe_sched.h b/src/target/firmware/include/layer1/mframe_sched.h
index ecdb1ec..74e2d27 100644
--- a/src/target/firmware/include/layer1/mframe_sched.h
+++ b/src/target/firmware/include/layer1/mframe_sched.h
@@ -23,6 +23,9 @@ enum mframe_task {
 	MF_TASK_SDCCH8_6,
 	MF_TASK_SDCCH8_7,
 
+	MF_TASK_SDCCH4_CBCH,
+	MF_TASK_SDCCH8_CBCH,
+
 	MF_TASK_TCH_F_EVEN,
 	MF_TASK_TCH_F_ODD,
 	MF_TASK_TCH_H_0,
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index ae39e63..215fc00 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -72,7 +72,7 @@ enum mf_type {
 	MF26ODD,
 	MF26EVEN
 };
-static uint32_t chan_nr2mf_task_mask(uint8_t chan_nr, uint8_t neigh_mode)
+static uint32_t chan_nr2mf_task_mask(uint8_t chan_nr, uint8_t neigh_mode, uint8_t cbch)
 {
 	uint8_t cbits = chan_nr >> 3;
 	uint8_t tn = chan_nr & 0x7;
@@ -90,11 +90,11 @@ static uint32_t chan_nr2mf_task_mask(uint8_t chan_nr, uint8_t neigh_mode)
 		master_task = MF_TASK_TCH_H_0 + lch_idx;
 	} else if ((cbits & 0x1c) == 0x04) {
 		lch_idx = cbits & 0x3;
-		master_task = MF_TASK_SDCCH4_0 + lch_idx;
+		master_task = cbch ? MF_TASK_SDCCH4_CBCH : (MF_TASK_SDCCH4_0 + lch_idx);
 		multiframe = MF51;
 	} else if ((cbits & 0x18) == 0x08) {
 		lch_idx = cbits & 0x7;
-		master_task = MF_TASK_SDCCH8_0 + lch_idx;
+		master_task = cbch ? MF_TASK_SDCCH8_CBCH : (MF_TASK_SDCCH8_0 + lch_idx);
 		multiframe = MF51;
 #if 0
 	} else if (cbits == 0x10) {
@@ -225,7 +225,8 @@ static void l1ctl_rx_dm_est_req(struct msgb *msg)
 	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
 	struct l1ctl_dm_est_req *est_req = (struct l1ctl_dm_est_req *) ul->payload;
 
-	printd("L1CTL_DM_EST_REQ (arfcn=%u, chan_nr=0x%02x, tsc=%u)\n",
+	printd("L1CTL_DM_EST_REQ %s(arfcn=%u, chan_nr=0x%02x, tsc=%u)\n",
+		est_req->cbch_mode ? "CBCH " : "",
 		ntohs(est_req->h0.band_arfcn), ul->chan_nr, est_req->tsc);
 
 	/* disable neighbour cell measurement of C0 TS 0 */
@@ -262,7 +263,8 @@ static void l1ctl_rx_dm_est_req(struct msgb *msg)
 	}
 
 	/* figure out which MF tasks to enable */
-	l1a_mftask_set(chan_nr2mf_task_mask(ul->chan_nr, NEIGH_MODE_PM));
+	l1a_mftask_set(chan_nr2mf_task_mask(ul->chan_nr, NEIGH_MODE_PM,
+		est_req->cbch_mode));
 }
 
 /* receive a L1CTL_DM_FREQ_REQ from L23 */
diff --git a/src/target/firmware/layer1/mframe_sched.c b/src/target/firmware/layer1/mframe_sched.c
index f3a6b43..0a9ff1e 100644
--- a/src/target/firmware/layer1/mframe_sched.c
+++ b/src/target/firmware/layer1/mframe_sched.c
@@ -198,6 +198,15 @@ static const struct mframe_sched_item mf_sdcch8_7[] = {
 	{ .sched_set = NULL }
 };
 
+static const struct mframe_sched_item mf_sdcch8_cbch[] = {
+	{ .sched_set = NB_QUAD_FH_DL, .modulo = 51, .frame_nr = 8 },
+	{ .sched_set = NULL }
+};
+static const struct mframe_sched_item mf_sdcch4_cbch[] = {
+	{ .sched_set = NB_QUAD_DL, .modulo = 51, .frame_nr = 32 },
+	{ .sched_set = NULL }
+};
+
 /* Measurement for MF 51 C0 */
 static const struct mframe_sched_item mf_neigh_pm51_c0t0[] = {
 	{ .sched_set = NEIGH_PM   , .modulo = 51, .frame_nr = 0 },
@@ -327,6 +336,9 @@ static const struct mframe_sched_item *sched_set_for_task[32] = {
 	[MF_TASK_SDCCH8_6] = mf_sdcch8_6,
 	[MF_TASK_SDCCH8_7] = mf_sdcch8_7,
 
+	[MF_TASK_SDCCH4_CBCH] = mf_sdcch4_cbch,
+	[MF_TASK_SDCCH8_CBCH] = mf_sdcch8_cbch,
+
 	[MF_TASK_TCH_F_EVEN] = mf_tch_f_even,
 	[MF_TASK_TCH_F_ODD]  = mf_tch_f_odd,
 	[MF_TASK_TCH_H_0]    = mf_tch_h_0,
@@ -361,6 +373,7 @@ uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts)
 		cbits = 0x04 + 1;
 		break;
 	case MF_TASK_SDCCH4_2:
+	case MF_TASK_SDCCH4_CBCH:
 		cbits = 0x04 + 2;
 		break;
 	case MF_TASK_SDCCH4_3:
@@ -373,6 +386,7 @@ uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts)
 		cbits = 0x08 + 1;
 		break;
 	case MF_TASK_SDCCH8_2:
+	case MF_TASK_SDCCH8_CBCH:
 		cbits = 0x08 + 2;
 		break;
 	case MF_TASK_SDCCH8_3:
-- 
1.7.0.4





More information about the baseband-devel mailing list