gsm_data: handle l1_info with structs
in struct gsm_lchan and also in other places l1_info is handled in its binary form. Libosmocore now offers structs to handle l1 info, so lets use those structs to get rid of all the manual decoding of l1_info. Depends: libosmocore I23c1890b89d5a0574eb05dace9f64cc59d6f6df7 Change-Id: I5eb516d7849750f3dd174d48c9f07dabf2c80515
This commit is contained in:
parent
f8f806ff2a
commit
da084794a6
|
@ -323,7 +323,7 @@ struct gsm_lchan {
|
|||
uint8_t num_ul_meas;
|
||||
struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
|
||||
/* last L1 header from the MS */
|
||||
uint8_t l1_info[2];
|
||||
struct rsl_l1_info l1_info;
|
||||
struct gsm_meas_rep_unidir ul_res;
|
||||
int16_t ms_toa256;
|
||||
/* Frame number of the last measurement indication receceived */
|
||||
|
@ -411,11 +411,6 @@ struct gsm_lchan {
|
|||
struct msgb *rep_sacch;
|
||||
};
|
||||
|
||||
static inline uint8_t lchan_get_ta(const struct gsm_lchan *lchan)
|
||||
{
|
||||
return lchan->meas.l1_info[1];
|
||||
}
|
||||
|
||||
extern const struct value_string lchan_ciph_state_names[];
|
||||
static inline const char *lchan_ciph_state_name(uint8_t state) {
|
||||
return get_value_string(lchan_ciph_state_names, state);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <osmocom/gsm/l1sap.h>
|
||||
#include <osmocom/gsm/gsm_utils.h>
|
||||
#include <osmocom/gsm/rsl.h>
|
||||
#include <osmocom/gsm/protocol/gsm_44_004.h>
|
||||
#include <osmocom/core/gsmtap.h>
|
||||
#include <osmocom/core/gsmtap_util.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
|
@ -979,7 +980,7 @@ void repeated_dl_facch_active_decision(struct gsm_lchan *lchan, const uint8_t *l
|
|||
/* When the MS sets the SRR bit in the UL-SACCH L1 header
|
||||
* (repeated SACCH requested) then it makes sense to enable
|
||||
* FACCH repetition too. */
|
||||
if ((lchan->meas.l1_info[0] >> 1) & 1) {
|
||||
if (lchan->meas.l1_info.srr_sro) {
|
||||
lchan->repeated_dl_facch_active = true;
|
||||
return;
|
||||
}
|
||||
|
@ -1028,7 +1029,7 @@ static inline struct msgb *lapdm_phsap_dequeue_msg_sacch(struct gsm_lchan *lchan
|
|||
* SACCH repetition. */
|
||||
|
||||
if (lchan->rep_sacch) {
|
||||
if (((lchan->meas.l1_info[0] >> 1) & 1) == 0) {
|
||||
if (lchan->meas.l1_info.srr_sro == 0) {
|
||||
/* Toss previous repetition candidate */
|
||||
msgb_free(lchan->rep_sacch);
|
||||
lchan->rep_sacch = NULL;
|
||||
|
@ -1457,6 +1458,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
|
|||
uint32_t fn;
|
||||
int8_t rssi;
|
||||
enum osmo_ph_pres_info_type pr_info = data_ind->pdch_presence_info;
|
||||
struct gsm_sacch_l1_hdr *l1_hdr;
|
||||
|
||||
rssi = data_ind->rssi;
|
||||
chan_nr = data_ind->chan_nr;
|
||||
|
@ -1557,10 +1559,11 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
|
|||
* fields on the Um interface is different from the
|
||||
* order of fields in RSL. See 3GPP TS 44.004 (section 7.2)
|
||||
* vs. 3GPP TS 48.058 (section 9.3.10). */
|
||||
lchan->meas.l1_info[0] = data[0] << 3;
|
||||
lchan->meas.l1_info[0] |= ((data[0] >> 5) & 1) << 2; /* FPC/EPC */
|
||||
lchan->meas.l1_info[0] |= ((data[0] >> 6) & 1) << 1; /* SRR */
|
||||
lchan->meas.l1_info[1] = data[1];
|
||||
l1_hdr = (struct gsm_sacch_l1_hdr*)data;
|
||||
lchan->meas.l1_info.ms_pwr = l1_hdr->ms_pwr;
|
||||
lchan->meas.l1_info.fpc_epc = l1_hdr->fpc_epc;
|
||||
lchan->meas.l1_info.srr_sro = l1_hdr->srr_sro;
|
||||
lchan->meas.l1_info.ta = l1_hdr->ta;
|
||||
lchan->meas.flags |= LC_UL_M_F_L1_VALID;
|
||||
|
||||
lchan_ms_pwr_ctrl(lchan, data[0] & 0x1f, data_ind->rssi);
|
||||
|
|
|
@ -3202,8 +3202,8 @@ int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, const stru
|
|||
lchan->meas.ul_res.sub.rx_lev,
|
||||
lchan->meas.ul_res.full.rx_qual,
|
||||
lchan->meas.ul_res.sub.rx_qual,
|
||||
lchan->meas.l1_info[0],
|
||||
lchan->meas.l1_info[1], l3_len, ms_to2rsl(lchan, le) - MEAS_MAX_TIMING_ADVANCE);
|
||||
lchan->meas.l1_info.ms_pwr,
|
||||
lchan->meas.l1_info.ta, l3_len, ms_to2rsl(lchan, le) - MEAS_MAX_TIMING_ADVANCE);
|
||||
|
||||
msgb_tv_put(msg, RSL_IE_MEAS_RES_NR, lchan->meas.res_nr++);
|
||||
size_t ie_len = gsm0858_rsl_ul_meas_enc(&lchan->meas.ul_res,
|
||||
|
@ -3222,7 +3222,7 @@ int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, const stru
|
|||
* to know the total propagation time between MS and BTS, we need to add
|
||||
* the actual TA value applied by the MS plus the respective toa256 value in
|
||||
* 1/256 symbol periods. */
|
||||
int16_t ta256 = lchan_get_ta(lchan) * 256;
|
||||
int16_t ta256 = lchan->meas.l1_info.ta * 256;
|
||||
smi->toa256_mean = htons(ta256 + lchan->meas.ms_toa256);
|
||||
smi->toa256_min = htons(ta256 + lchan->meas.ext.toa256_min);
|
||||
smi->toa256_max = htons(ta256 + lchan->meas.ext.toa256_max);
|
||||
|
@ -3234,7 +3234,7 @@ int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, const stru
|
|||
}
|
||||
msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power_ctrl.current / 2);
|
||||
if (lchan->meas.flags & LC_UL_M_F_L1_VALID) {
|
||||
msgb_tv_fixed_put(msg, RSL_IE_L1_INFO, 2, lchan->meas.l1_info);
|
||||
msgb_tv_fixed_put(msg, RSL_IE_L1_INFO, sizeof(lchan->meas.l1_info), (uint8_t*)&lchan->meas.l1_info);
|
||||
lchan->meas.flags &= ~LC_UL_M_F_L1_VALID;
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ static int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t f
|
|||
DEBUGPFN(DMEAS, fn, "RX L1 frame %s chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS "
|
||||
"ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa=%.2f\n",
|
||||
gsm_lchan_name(lchan), chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.max),
|
||||
rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa);
|
||||
rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info.ta, lchan->rqd_ta, toa);
|
||||
|
||||
l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn);
|
||||
|
||||
|
|
Loading…
Reference in New Issue