[VAMOS] gsm_data.h: introduce and use BTS_TSC macro

Change-Id: I0cf915d2d3a640aa1442cf6abe9a314261b4a64e
Related: SYS#5315, OS#4940
This commit is contained in:
Vadim Yanitskiy 2021-05-22 03:22:09 +02:00 committed by laforge
parent a344db979f
commit d4abdd80fe
8 changed files with 15 additions and 14 deletions

View File

@ -520,6 +520,7 @@ uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
enum gsm_phys_chan_config as_pchan);
#define BSIC2BCC(bsic) ((bsic) & 0x07)
#define BTS_TSC(bts) BSIC2BCC((bts)->bsic)
uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts);

View File

@ -277,7 +277,7 @@ uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
if (ts->tsc != -1)
return ts->tsc;
else
return ts->trx->bts->bsic & 7;
return BTS_TSC(ts->trx->bts);
}
/* determine logical channel based on TRX and channel number IE */

View File

@ -1975,10 +1975,10 @@ int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed *
/* The PHY may not support using different TSCs */
if (!osmo_bts_has_feature(trx->bts->features, BTS_FEAT_MULTI_TSC)
&& cd->h0.tsc != (trx->bts->bsic & 7)) {
&& cd->h0.tsc != BTS_TSC(trx->bts)) {
LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "This PHY does not support "
"lchan TSC %u != BSIC-TSC %u, sending NACK\n",
cd->h0.tsc, trx->bts->bsic & 7);
cd->h0.tsc, BTS_TSC(trx->bts));
return -RSL_ERR_SERV_OPT_UNIMPL;
}
}

View File

@ -964,7 +964,7 @@ static int oml_rx_set_chan_attr(struct gsm_bts_trx_ts *ts, struct msgb *msg)
ts->tsc = *TLVP_VAL(&tp, NM_ATT_TSC);
} else {
/* If there is no TSC specified, use the BCC */
ts->tsc = BSIC2BCC(bts->bsic);
ts->tsc = BTS_TSC(bts);
}
LOGPFOH(DOML, LOGL_INFO, foh, "SET CHAN ATTR (TSC=%u pchan=%s",
ts->tsc, gsm_pchan_name(ts->pchan));

View File

@ -432,7 +432,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->freqBand = lc15_band;
dev_par->u16Arfcn = trx->arfcn;
dev_par->u16BcchArfcn = trx->bts->c0->arfcn;
dev_par->u8NbTsc = trx->bts->bsic & 7;
dev_par->u8NbTsc = BTS_TSC(trx->bts);
if (!trx_ms_pwr_ctrl_is_osmo(trx)) {
/* Target is in the middle between lower and upper RxLev thresholds */
@ -1835,9 +1835,9 @@ int bts_model_check_oml(struct gsm_bts *bts, uint8_t msg_type,
* channels with a different TSC!! */
if (TLVP_PRESENT(new_attr, NM_ATT_TSC) &&
TLVP_LEN(new_attr, NM_ATT_TSC) >= 1 &&
*TLVP_VAL(new_attr, NM_ATT_TSC) != (bts->bsic & 7)) {
*TLVP_VAL(new_attr, NM_ATT_TSC) != BTS_TSC(bts)) {
LOGP(DOML, LOGL_ERROR, "Channel TSC %u != BSIC-TSC %u\n",
*TLVP_VAL(new_attr, NM_ATT_TSC), bts->bsic & 7);
*TLVP_VAL(new_attr, NM_ATT_TSC), BTS_TSC(bts));
return -NM_NACK_PARAM_RANGE;
}
break;

View File

@ -447,7 +447,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->freqBand = oc2g_band;
dev_par->u16Arfcn = trx->arfcn;
dev_par->u16BcchArfcn = trx->bts->c0->arfcn;
dev_par->u8NbTsc = trx->bts->bsic & 7;
dev_par->u8NbTsc = BTS_TSC(trx->bts);
if (!trx_ms_pwr_ctrl_is_osmo(trx)) {
/* Target is in the middle between lower and upper RxLev thresholds */
@ -1844,9 +1844,9 @@ int bts_model_check_oml(struct gsm_bts *bts, uint8_t msg_type,
* channels with a different TSC!! */
if (TLVP_PRESENT(new_attr, NM_ATT_TSC) &&
TLVP_LEN(new_attr, NM_ATT_TSC) >= 1 &&
*TLVP_VAL(new_attr, NM_ATT_TSC) != (bts->bsic & 7)) {
*TLVP_VAL(new_attr, NM_ATT_TSC) != BTS_TSC(bts)) {
LOGP(DOML, LOGL_ERROR, "Channel TSC %u != BSIC-TSC %u\n",
*TLVP_VAL(new_attr, NM_ATT_TSC), bts->bsic & 7);
*TLVP_VAL(new_attr, NM_ATT_TSC), BTS_TSC(bts));
return -NM_NACK_PARAM_RANGE;
}
break;

View File

@ -1352,7 +1352,7 @@ int l1if_trx_open(struct gsm_bts_trx *trx)
}
oc->Config.usBcchArfcn = trx->bts->c0->arfcn;
#endif
oc->Config.usTsc = trx->bts->bsic & 0x7;
oc->Config.usTsc = BTS_TSC(trx->bts);
oc->RfConfig.ulRxGainDb = plink->u.octphy.rx_gain_db;
/* FIXME: compute this based on nominal transmit power, etc. */
if (plink->u.octphy.tx_atten_flag) {

View File

@ -427,7 +427,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->freqBand = femto_band;
dev_par->u16Arfcn = trx->arfcn;
dev_par->u16BcchArfcn = trx->bts->c0->arfcn;
dev_par->u8NbTsc = trx->bts->bsic & 7;
dev_par->u8NbTsc = BTS_TSC(trx->bts);
if (!trx_ms_pwr_ctrl_is_osmo(trx)) {
/* Target is in the middle between lower and upper RxLev thresholds */
@ -1748,9 +1748,9 @@ int bts_model_check_oml(struct gsm_bts *bts, uint8_t msg_type,
* one one TRX, so we need to make sure not to activate
* channels with a different TSC!! */
if (TLVP_PRES_LEN(new_attr, NM_ATT_TSC, 1) &&
*TLVP_VAL(new_attr, NM_ATT_TSC) != (bts->bsic & 7)) {
*TLVP_VAL(new_attr, NM_ATT_TSC) != BTS_TSC(bts)) {
LOGP(DOML, LOGL_ERROR, "Channel TSC %u != BSIC-TSC %u\n",
*TLVP_VAL(new_attr, NM_ATT_TSC), bts->bsic & 7);
*TLVP_VAL(new_attr, NM_ATT_TSC), BTS_TSC(bts));
return -NM_NACK_PARAM_RANGE;
}
break;