From fd70a6cc47721acc547174df4cddbe7def3d9ffb Mon Sep 17 00:00:00 2001 From: Alex Badea Date: Thu, 3 Jan 2013 13:25:05 +0200 Subject: fw/l1: add CBCH flag to dedicated mode Add a .dm_flags member to struct l1ctl_dm_est_req. Define a flag bit to indicate CBCH mode. If set, this instructs L1 to use the CBCH variant of SDCCH for dedicated mode (no uplink, no SACCH). Add the new dm_flags field to l1ctl_tx_dm_est_req* API calls. Clear it everywhere, except for app_cbch_sniff which requests CBCH. Signed-off-by: Alex Badea Signed-off-by: Sylvain Munaut --- include/l1ctl_proto.h | 3 +++ 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 | 14 ++++++++------ src/target/firmware/layer1/mframe_sched.c | 14 ++++++++++++++ 8 files changed, 39 insertions(+), 14 deletions(-) diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h index 771bf1c3..c9585188 100644 --- a/include/l1ctl_proto.h +++ b/include/l1ctl_proto.h @@ -233,8 +233,11 @@ struct l1ctl_dm_est_req { }; uint8_t tch_mode; uint8_t audio_mode; + uint8_t dm_flags; } __attribute__((packed)); +#define L1CTL_DM_F_CBCH (1 << 0) + struct l1ctl_dm_freq_req { uint16_t fn; uint8_t tsc; diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h index 3534589d..68d17305 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 dm_flags); 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 dm_flags); /* 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 91bab897..69ad8019 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -472,7 +472,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 dm_flags) { struct msgb *msg; struct l1ctl_info_ul *ul; @@ -495,6 +495,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->dm_flags = dm_flags; return osmo_send_l1(ms, msg); } @@ -502,7 +503,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 dm_flags) { struct msgb *msg; struct l1ctl_info_ul *ul; @@ -530,6 +531,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->dm_flags = dm_flags; 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 8256eaf6..a62dd7c9 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, L1CTL_DM_F_CBCH); } 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, L1CTL_DM_F_CBCH); } } diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 76eaf8f5..ac87f444 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 ecdb1ec8..74e2d271 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 ae39e634..49aeb455 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,8 +225,9 @@ 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", - ntohs(est_req->h0.band_arfcn), ul->chan_nr, est_req->tsc); + printd("L1CTL_DM_EST_REQ (arfcn=%u, chan_nr=0x%02x, tsc=%u, flags=0x%x)\n", + ntohs(est_req->h0.band_arfcn), ul->chan_nr, est_req->tsc, + est_req->dm_flags); /* disable neighbour cell measurement of C0 TS 0 */ mframe_disable(MF_TASK_NEIGH_PM51_C0T0); @@ -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->dm_flags & L1CTL_DM_F_CBCH)); } /* 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 f3a6b433..0a9ff1e4 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: -- cgit v1.2.3