From b15d2c9d2f8ebe56672ab2191a4dc39d22fa0ab8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 28 Dec 2014 15:18:09 +0100 Subject: Initial CBCH support This should handle OML channel combinations with CBCH and activate the CBCH SAPI towards the DSP correspondingly. What is still missing is sending any actual information over the CBCH in respons to the PH-RTS.ind coming up from L1. --- include/osmo-bts/bts.h | 1 + src/common/Makefile.am | 3 ++- src/common/cbch.c | 8 ++++++++ src/common/measurement.c | 4 ++++ src/common/oml.c | 18 ++++++++++++++++-- src/common/rsl.c | 6 ++++-- src/common/support.c | 4 ++++ src/osmo-bts-sysmo/l1_if.c | 4 ++++ src/osmo-bts-sysmo/oml.c | 17 +++++++++++++++++ 9 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 src/common/cbch.c diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index e4899736..de4870f9 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -33,6 +33,7 @@ int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt uint8_t *bts_sysinfo_get(struct gsm_bts *bts, struct gsm_time *g_time); uint8_t *lchan_sacch_get(struct gsm_lchan *lchan); +int bts_cbch_get(struct gsm_bts *bts, uint8_t *outbuf, struct gsm_time *g_time); int lchan_init_lapdm(struct gsm_lchan *lchan); void load_timer_start(struct gsm_bts *bts); diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 10627e2a..e45e2c1d 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -7,4 +7,5 @@ libbts_a_SOURCES = gsm_data_shared.c sysinfo.c logging.c abis.c oml.c bts.c \ rsl.c vty.c paging.c measurement.c amr.c lchan.c \ load_indication.c pcu_sock.c handover.c msg_utils.c \ load_indication.c pcu_sock.c handover.c msg_utils.c \ - tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c + tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \ + cbch.c diff --git a/src/common/cbch.c b/src/common/cbch.c new file mode 100644 index 00000000..e3ce8975 --- /dev/null +++ b/src/common/cbch.c @@ -0,0 +1,8 @@ + +#include + +int bts_cbch_get(struct gsm_bts *bts, uint8_t *outbuf, struct gsm_time *g_time) +{ + /* FIXME: Actaully schedule + return CBCH messages */ + return 0; +} diff --git a/src/common/measurement.c b/src/common/measurement.c index f497e40e..41a01708 100644 --- a/src/common/measurement.c +++ b/src/common/measurement.c @@ -70,11 +70,13 @@ static int is_meas_complete(enum gsm_phys_chan_config pchan, unsigned int ts, rc = 1; break; case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: fn_mod = fn % 102; if (fn_mod == 11) rc = 1; break; case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: fn_mod = fn % 102; if (fn_mod == 36) rc = 1; @@ -214,9 +216,11 @@ static const uint8_t subslots_per_pchan[_GSM_PCHAN_MAX] = { [GSM_PCHAN_NONE] = 0, [GSM_PCHAN_CCCH] = 0, [GSM_PCHAN_CCCH_SDCCH4] = 4, + [GSM_PCHAN_CCCH_SDCCH4_CBCH] = 4, [GSM_PCHAN_TCH_F] = 1, [GSM_PCHAN_TCH_H] = 2, [GSM_PCHAN_SDCCH8_SACCH8C] = 8, + [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = 8, /* FIXME: what about dynamic TCH_F_TCH_H ? */ [GSM_PCHAN_TCH_F_PDCH] = 1, }; diff --git a/src/common/oml.c b/src/common/oml.c index 65152953..5f9c0a2b 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -601,10 +601,17 @@ static int conf_lchans_for_pchan(struct gsm_bts_trx_ts *ts) unsigned int i; switch (ts->pchan) { + case GSM_PCHAN_CCCH_SDCCH4_CBCH: + /* fallthrough */ case GSM_PCHAN_CCCH_SDCCH4: for (i = 0; i < 4; i++) { lchan = &ts->lchan[i]; - lchan->type = GSM_LCHAN_SDCCH; + if (ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH + && i == 2) { + lchan->type = GSM_LCHAN_CBCH; + } else { + lchan->type = GSM_LCHAN_SDCCH; + } } /* fallthrough */ case GSM_PCHAN_CCCH: @@ -621,10 +628,17 @@ static int conf_lchans_for_pchan(struct gsm_bts_trx_ts *ts) lchan->type = GSM_LCHAN_TCH_H; } break; + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: + /* fallthrough */ case GSM_PCHAN_SDCCH8_SACCH8C: for (i = 0; i < 8; i++) { lchan = &ts->lchan[i]; - lchan->type = GSM_LCHAN_SDCCH; + if (ts->pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH + && i == 2) { + lchan->type = GSM_LCHAN_CBCH; + } else { + lchan->type = GSM_LCHAN_SDCCH; + } } break; case GSM_PCHAN_PDCH: diff --git a/src/common/rsl.c b/src/common/rsl.c index 11c7c715..000c1797 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -162,12 +162,14 @@ struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr) chan_nr, ts->pchan); } else if ((cbits & 0x1c) == 0x04) { lch_idx = cbits & 0x3; /* SDCCH/4 */ - if (ts->pchan != GSM_PCHAN_CCCH_SDCCH4) + if (ts->pchan != GSM_PCHAN_CCCH_SDCCH4 && + ts->pchan != GSM_PCHAN_CCCH_SDCCH4_CBCH) LOGP(DRSL, LOGL_ERROR, "chan_nr=0x%02x but pchan=%u\n", chan_nr, ts->pchan); } else if ((cbits & 0x18) == 0x08) { lch_idx = cbits & 0x7; /* SDCCH/8 */ - if (ts->pchan != GSM_PCHAN_SDCCH8_SACCH8C) + if (ts->pchan != GSM_PCHAN_SDCCH8_SACCH8C && + ts->pchan != GSM_PCHAN_SDCCH8_SACCH8C_CBCH) LOGP(DRSL, LOGL_ERROR, "chan_nr=0x%02x but pchan=%u\n", chan_nr, ts->pchan); } else if (cbits == 0x10 || cbits == 0x11 || cbits == 0x12) { diff --git a/src/common/support.c b/src/common/support.c index e271b957..d47a6a99 100644 --- a/src/common/support.c +++ b/src/common/support.c @@ -70,8 +70,12 @@ char *bts_support_comb_name(uint8_t chan_comb) return("BCCH"); if (chan_comb == NM_CHANC_BCCHComb) return("BCCH+SDCCH/4"); + if (chan_comb == NM_CHANC_BCCH_CBCH) + return("BCCH+CBCH+SDCCH/4"); if (chan_comb == NM_CHANC_SDCCH) return("SDCCH/8"); + if (chan_comb == NM_CHANC_SDCCH_CBCH) + return("SDCCH/8+CBCH"); if (chan_comb == NM_CHANC_TCHFull) return("TCH/F"); if (chan_comb == NM_CHANC_TCHHalf) diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 4b9ab3e8..44eff967 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -587,6 +587,10 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, case GsmL1_Sapi_Prach: goto empty_frame; break; + case GsmL1_Sapi_Cbch: + /* get them from bts->si_buf[] */ + bts_cbch_get(bts, msu_param->u8Buffer, &g_time); + break; default: memcpy(msu_param->u8Buffer, fill_frame, GSM_MACBLOCK_LEN); break; diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index f2aabb9f..2bfc241c 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -63,9 +63,11 @@ static const enum GsmL1_LogChComb_t pchan_to_logChComb[_GSM_PCHAN_MAX] = { [GSM_PCHAN_NONE] = GsmL1_LogChComb_0, [GSM_PCHAN_CCCH] = GsmL1_LogChComb_IV, [GSM_PCHAN_CCCH_SDCCH4] = GsmL1_LogChComb_V, + [GSM_PCHAN_CCCH_SDCCH4_CBCH] = GsmL1_LogChComb_V, [GSM_PCHAN_TCH_F] = GsmL1_LogChComb_I, [GSM_PCHAN_TCH_H] = GsmL1_LogChComb_II, [GSM_PCHAN_SDCCH8_SACCH8C] = GsmL1_LogChComb_VII, + [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = GsmL1_LogChComb_VII, [GSM_PCHAN_PDCH] = GsmL1_LogChComb_XIII, //[GSM_PCHAN_TCH_F_PDCH] = FIXME, [GSM_PCHAN_UNKNOWN] = GsmL1_LogChComb_0, @@ -207,9 +209,12 @@ static int opstart_compl(struct gsm_abis_mo *mo, struct msgb *l1_msg) /* ugly hack to auto-activate all SAPIs for the BCCH/CCCH on TS0 */ if (mo->obj_class == NM_OC_CHANNEL && mo->obj_inst.trx_nr == 0 && mo->obj_inst.ts_nr == 0) { + struct gsm_lchan *cbch = gsm_bts_get_cbch(mo->bts); DEBUGP(DL1C, "====> trying to activate lchans of BCCH\n"); mo->bts->c0->ts[0].lchan[4].rel_act_kind = LCHAN_REL_ACT_OML; lchan_activate(&mo->bts->c0->ts[0].lchan[4]); + if (cbch) + lchan_activate(cbch); } /* Send OPSTART ack */ @@ -430,11 +435,13 @@ GsmL1_SubCh_t lchan_to_GsmL1_SubCh_t(const struct gsm_lchan *lchan) { switch (lchan->ts->pchan) { case GSM_PCHAN_CCCH_SDCCH4: + case GSM_PCHAN_CCCH_SDCCH4_CBCH: if (lchan->type == GSM_LCHAN_CCCH) return GsmL1_SubCh_NA; /* fall-through */ case GSM_PCHAN_TCH_H: case GSM_PCHAN_SDCCH8_SACCH8C: + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: return lchan->nr; case GSM_PCHAN_NONE: case GSM_PCHAN_CCCH: @@ -487,6 +494,12 @@ static const struct sapi_dir sdcch_sapis[] = { { GsmL1_Sapi_Sacch, GsmL1_Dir_RxUplink }, }; +static const struct sapi_dir cbch_sapis[] = { + { GsmL1_Sapi_Cbch, GsmL1_Dir_TxDownlink }, + /* Does the CBCH really have a SACCH in Downlink? */ + { GsmL1_Sapi_Sacch, GsmL1_Dir_TxDownlink }, +}; + static const struct sapi_dir pdtch_sapis[] = { { GsmL1_Sapi_Pdtch, GsmL1_Dir_TxDownlink }, { GsmL1_Sapi_Pdtch, GsmL1_Dir_RxUplink }, @@ -528,6 +541,10 @@ static const struct lchan_sapis sapis_for_lchan[_GSM_LCHAN_MAX] = { .sapis = pdtch_sapis, .num_sapis = ARRAY_SIZE(pdtch_sapis), }, + [GSM_LCHAN_CBCH] = { + .sapis = cbch_sapis, + .num_sapis = ARRAY_SIZE(cbch_sapis), + }, }; static const struct lchan_sapis sapis_for_ho = { -- cgit v1.2.3