debian: Update gsm_data_shared.c,h from the OpenBSC master.

Required by the new OsmoBTS code.
This commit is contained in:
Alexander Chemeris 2015-09-12 19:43:35 -04:00
parent d5e32dddbb
commit bb3bf59fbf
2 changed files with 81 additions and 27 deletions

View File

@ -13,6 +13,7 @@
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/rxlev_stat.h>
#include <osmocom/gsm/sysinfo.h>
#include <osmocom/gsm/meas_rep.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
@ -57,9 +58,6 @@ enum gsm_chreq_reason_t {
#define HARDCODED_BTS1_TS 6
#define HARDCODED_BTS2_TS 11
/* reserved according to GSM 03.03 § 2.4 */
#define GSM_RESERVED_TMSI 0xFFFFFFFF
enum gsm_hooks {
GSM_HOOK_NM_SWLOAD,
GSM_HOOK_RR_PAGING,
@ -152,10 +150,8 @@ struct bts_codec_conf {
struct amr_mode {
uint8_t mode;
uint8_t threshold_ms;
uint8_t hysteresis_ms;
uint8_t threshold_bts;
uint8_t hysteresis_bts;
uint8_t threshold;
uint8_t hysteresis;
};
struct amr_multirate_conf {
uint8_t gsm48_ie[2];
@ -199,6 +195,7 @@ struct gsm_lchan {
enum lchan_csd_mode csd_mode;
/* State */
enum gsm_lchan_state state;
const char *broken_reason;
/* Power levels for MS and BTS */
uint8_t bs_power;
uint8_t ms_power;
@ -210,8 +207,7 @@ struct gsm_lchan {
} encr;
/* AMR bits */
uint8_t mr_ms_lv[7];
uint8_t mr_bts_lv[7];
struct gsm48_multi_rate_conf mr_conf;
/* Established data link layer services */
uint8_t sapis[8];
@ -281,12 +277,7 @@ struct gsm_lchan {
struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
/* last L1 header from the MS */
uint8_t l1_info[2];
struct {
uint8_t rxlev_full;
uint8_t rxlev_sub;
uint8_t rxqual_full;
uint8_t rxqual_sub;
} res;
struct gsm_meas_rep_unidir ul_res;
} meas;
struct {
struct amr_multirate_conf amr_mr;
@ -294,9 +285,11 @@ struct gsm_lchan {
uint8_t buf[16];
uint8_t len;
} last_sid;
uint8_t last_cmr;
} tch;
/* BTS-side ciphering state (rx only, bi-directional, ...) */
uint8_t ciph_state;
uint8_t ciph_ns;
uint8_t loopback;
struct {
uint8_t active;
@ -310,6 +303,12 @@ struct gsm_lchan {
int s;
/* Kind of the release/activation. E.g. RSL or PCU */
int rel_act_kind;
/* power handling */
struct {
uint8_t current;
uint8_t fixed;
} ms_power_ctrl;
#endif
};
@ -374,11 +373,15 @@ struct gsm_bts_trx {
uint16_t arfcn;
int nominal_power; /* in dBm */
unsigned int max_power_red; /* in actual dB */
unsigned int power_reduce; /* in dB */
#ifndef ROLE_BSC
struct trx_power_params power_params;
int ms_power_control;
struct {
void *l1h;
} role_bts;
#endif
union {
struct {
@ -648,6 +651,7 @@ struct gsm_bts {
unsigned int configured:1,
skip_reset:1,
no_loc_rel_cnf:1,
bts_reset_timer_cnf,
did_reset:1,
wait_reset:1;
struct osmo_timer_list reset_timer;
@ -681,8 +685,9 @@ struct gsm_bts {
int num_trx;
struct llist_head trx_list;
/* SI compatibility hacks */
/* SI related items */
int force_combined_si;
int bcch_change_mark;
#ifdef ROLE_BSC
/* Abis NM queue */
@ -725,23 +730,23 @@ struct gsm_bts {
/* supported codecs beside FR */
struct bts_codec_conf codec;
/* full and half rate multirate config */
struct amr_multirate_conf mr_full;
struct amr_multirate_conf mr_half;
/* BTS dependencies bit field */
uint32_t depends_on[256/(8*4)];
#endif /* ROLE_BSC */
void *role;
};
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
const struct value_string gsm_pchant_names[10];
const struct value_string gsm_pchant_descs[10];
const struct value_string gsm_lchant_names[6];
const struct value_string gsm_pchant_names[12];
const struct value_string gsm_pchant_descs[12];
const struct value_string gsm_lchant_names[8];
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
const char *gsm_lchant_name(enum gsm_chan_t c);
@ -771,6 +776,9 @@ void gsm_bts_mo_reset(struct gsm_bts *bts);
uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr);
uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
/* return the gsm_lchan for the CBCH (if it exists at all) */
struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts);
/*
* help with parsing regexps
*/

View File

@ -51,7 +51,7 @@ static void gsm_mo_init(struct gsm_abis_mo *mo, struct gsm_bts *bts,
gsm_abis_mo_reset(mo);
}
const struct value_string gsm_pchant_names[10] = {
const struct value_string gsm_pchant_names[12] = {
{ GSM_PCHAN_NONE, "NONE" },
{ GSM_PCHAN_CCCH, "CCCH" },
{ GSM_PCHAN_CCCH_SDCCH4,"CCCH+SDCCH4" },
@ -61,10 +61,12 @@ const struct value_string gsm_pchant_names[10] = {
{ GSM_PCHAN_PDCH, "PDCH" },
{ GSM_PCHAN_TCH_F_PDCH, "TCH/F_PDCH" },
{ GSM_PCHAN_UNKNOWN, "UNKNOWN" },
{ GSM_PCHAN_CCCH_SDCCH4_CBCH, "CCCH+SDCCH4+CBCH" },
{ GSM_PCHAN_SDCCH8_SACCH8C_CBCH, "SDCCH8+CBCH" },
{ 0, NULL }
};
const struct value_string gsm_pchant_descs[10] = {
const struct value_string gsm_pchant_descs[12] = {
{ GSM_PCHAN_NONE, "Physical Channel not configured" },
{ GSM_PCHAN_CCCH, "FCCH + SCH + BCCH + CCCH (Comb. IV)" },
{ GSM_PCHAN_CCCH_SDCCH4,
@ -75,6 +77,8 @@ const struct value_string gsm_pchant_descs[10] = {
{ GSM_PCHAN_PDCH, "Packet Data Channel for GPRS/EDGE" },
{ GSM_PCHAN_TCH_F_PDCH, "Dynamic TCH/F or GPRS PDCH" },
{ GSM_PCHAN_UNKNOWN, "Unknown / Unsupported channel combination" },
{ GSM_PCHAN_CCCH_SDCCH4_CBCH, "FCCH + SCH + BCCH + CCCH + CBCH + 3 SDCCH + 2 SACCH (Comb. V)" },
{ GSM_PCHAN_SDCCH8_SACCH8C_CBCH, "7 SDCCH + 4 SACCH + CBCH (Comb. VII)" },
{ 0, NULL }
};
@ -88,12 +92,13 @@ enum gsm_phys_chan_config gsm_pchan_parse(const char *name)
return get_string_value(gsm_pchant_names, name);
}
const struct value_string gsm_lchant_names[6] = {
const struct value_string gsm_lchant_names[8] = {
{ GSM_LCHAN_NONE, "NONE" },
{ GSM_LCHAN_SDCCH, "SDCCH" },
{ GSM_LCHAN_TCH_F, "TCH/F" },
{ GSM_LCHAN_TCH_H, "TCH/H" },
{ GSM_LCHAN_UNKNOWN, "UNKNOWN" },
{ GSM_LCHAN_CBCH, "CBCH" },
{ 0, NULL }
};
@ -132,6 +137,21 @@ const char *gsm_chreq_name(enum gsm_chreq_reason_t c)
return get_value_string(chreq_names, c);
}
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
{
struct gsm_bts *bts;
if (num >= net->num_bts)
return NULL;
llist_for_each_entry(bts, &net->bts_list, list) {
if (bts->nr == num)
return bts;
}
return NULL;
}
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
{
struct gsm_bts_trx *trx = talloc_zero(bts, struct gsm_bts_trx);
@ -261,6 +281,9 @@ struct gsm_bts *gsm_bts_alloc(void *ctx)
bts->rach_ldavg_slots = -1;
bts->paging.free_chans_need = -1;
/* si handling */
bts->bcch_change_mark = 1;
return bts;
}
@ -497,10 +520,12 @@ uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr)
cbits += lchan_nr;
break;
case GSM_PCHAN_CCCH_SDCCH4:
case GSM_PCHAN_CCCH_SDCCH4_CBCH:
cbits = 0x04;
cbits += lchan_nr;
break;
case GSM_PCHAN_SDCCH8_SACCH8C:
case GSM_PCHAN_SDCCH8_SACCH8C_CBCH:
cbits = 0x08;
cbits += lchan_nr;
break;
@ -519,3 +544,24 @@ uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan)
{
return gsm_ts2chan_nr(lchan->ts, lchan->nr);
}
/* return the gsm_lchan for the CBCH (if it exists at all) */
struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts)
{
struct gsm_lchan *lchan = NULL;
struct gsm_bts_trx *trx = bts->c0;
if (trx->ts[0].pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
lchan = &trx->ts[0].lchan[2];
else {
int i;
for (i = 0; i < 8; i++) {
if (trx->ts[i].pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH) {
lchan = &trx->ts[i].lchan[2];
break;
}
}
}
return lchan;
}