Move system information related defines and code to libosmocore
This brings openbsc in sync with the following libosmocore commit: b5503136fa234690d5493b19a8aee3a4ef74190d
This commit is contained in:
parent
f142c97907
commit
80cffaf323
|
@ -1,45 +1,10 @@
|
|||
#ifndef _SYSTEM_INFO_H
|
||||
#define _SYSTEM_INFO_H
|
||||
|
||||
#include <osmocom/core/utils.h>
|
||||
|
||||
#define GSM_MACBLOCK_LEN 23
|
||||
#include <osmocom/gsm/sysinfo.h>
|
||||
|
||||
struct gsm_bts;
|
||||
|
||||
|
||||
enum osmo_sysinfo_type {
|
||||
SYSINFO_TYPE_NONE,
|
||||
SYSINFO_TYPE_1,
|
||||
SYSINFO_TYPE_2,
|
||||
SYSINFO_TYPE_3,
|
||||
SYSINFO_TYPE_4,
|
||||
SYSINFO_TYPE_5,
|
||||
SYSINFO_TYPE_6,
|
||||
SYSINFO_TYPE_7,
|
||||
SYSINFO_TYPE_8,
|
||||
SYSINFO_TYPE_9,
|
||||
SYSINFO_TYPE_10,
|
||||
SYSINFO_TYPE_13,
|
||||
SYSINFO_TYPE_16,
|
||||
SYSINFO_TYPE_17,
|
||||
SYSINFO_TYPE_18,
|
||||
SYSINFO_TYPE_19,
|
||||
SYSINFO_TYPE_20,
|
||||
SYSINFO_TYPE_2bis,
|
||||
SYSINFO_TYPE_2ter,
|
||||
SYSINFO_TYPE_2quater,
|
||||
SYSINFO_TYPE_5bis,
|
||||
SYSINFO_TYPE_5ter,
|
||||
/* FIXME all the various bis and ter */
|
||||
_MAX_SYSINFO_TYPE
|
||||
};
|
||||
|
||||
typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN];
|
||||
|
||||
extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE];
|
||||
uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type);
|
||||
const char *gsm_sitype_name(enum osmo_sysinfo_type si_type);
|
||||
int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,7 +101,7 @@ static int generate_and_rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i
|
|||
si_len = rc;
|
||||
}
|
||||
|
||||
DEBUGP(DRR, "SI%s: %s\n", gsm_sitype_name(i),
|
||||
DEBUGP(DRR, "SI%s: %s\n", get_value_string(osmo_sitype_strs, i),
|
||||
osmo_hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN));
|
||||
|
||||
switch (i) {
|
||||
|
@ -115,22 +115,22 @@ static int generate_and_rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i
|
|||
/* This assumes a combined BCCH and TCH on TS1...7 */
|
||||
for (j = 0; j < 4; j++)
|
||||
rsl_sacch_info_modify(&trx->ts[0].lchan[j],
|
||||
gsm_sitype2rsl(i),
|
||||
osmo_sitype2rsl(i),
|
||||
GSM_BTS_SI(bts, i), si_len);
|
||||
for (j = 1; j < 8; j++) {
|
||||
rsl_sacch_info_modify(&trx->ts[j].lchan[0],
|
||||
gsm_sitype2rsl(i),
|
||||
osmo_sitype2rsl(i),
|
||||
GSM_BTS_SI(bts, i), si_len);
|
||||
rsl_sacch_info_modify(&trx->ts[j].lchan[1],
|
||||
gsm_sitype2rsl(i),
|
||||
osmo_sitype2rsl(i),
|
||||
GSM_BTS_SI(bts, i), si_len);
|
||||
}
|
||||
} else
|
||||
rc = rsl_sacch_filling(trx, gsm_sitype2rsl(i),
|
||||
rc = rsl_sacch_filling(trx, osmo_sitype2rsl(i),
|
||||
GSM_BTS_SI(bts, i), rc);
|
||||
break;
|
||||
default:
|
||||
rc = rsl_bcch_info(trx, gsm_sitype2rsl(i),
|
||||
rc = rsl_bcch_info(trx, osmo_sitype2rsl(i),
|
||||
GSM_BTS_SI(bts, i), rc);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,32 +25,16 @@
|
|||
#include <stdio.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <osmocom/core/bitvec.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <osmocom/gsm/sysinfo.h>
|
||||
|
||||
#include <openbsc/debug.h>
|
||||
#include <openbsc/gsm_04_08.h>
|
||||
#include <openbsc/gsm_data.h>
|
||||
#include <openbsc/abis_rsl.h>
|
||||
#include <openbsc/rest_octets.h>
|
||||
#include <osmocom/core/bitvec.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <openbsc/debug.h>
|
||||
|
||||
#define GSM48_CELL_CHAN_DESC_SIZE 16
|
||||
#define GSM_MACBLOCK_PADDING 0x2b
|
||||
|
||||
/* verify the sizes of the system information type structs */
|
||||
|
||||
/* rest octets are not part of the struct */
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_header) == 3, _si_header_size);
|
||||
osmo_static_assert(sizeof(struct gsm48_rach_control) == 3, _si_rach_control);
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_1) == 22, _si1_size);
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_2) == 23, _si2_size);
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_3) == 19, _si3_size);
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_4) == 13, _si4_size);
|
||||
|
||||
/* bs11 forgot the l2 len, 0-6 rest octets */
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_5) == 18, _si5_size);
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_6) == 11, _si6_size);
|
||||
|
||||
osmo_static_assert(sizeof(struct gsm48_system_information_type_13) == 3, _si13_size);
|
||||
|
||||
/* Frequency Lists as per TS 04.08 10.5.2.13 */
|
||||
|
||||
|
@ -491,54 +475,6 @@ static int generate_si13(uint8_t *output, struct gsm_bts *bts)
|
|||
return sizeof (*si13) + ret;
|
||||
}
|
||||
|
||||
static const uint8_t sitype2rsl[_MAX_SYSINFO_TYPE] = {
|
||||
[SYSINFO_TYPE_1] = RSL_SYSTEM_INFO_1,
|
||||
[SYSINFO_TYPE_2] = RSL_SYSTEM_INFO_2,
|
||||
[SYSINFO_TYPE_3] = RSL_SYSTEM_INFO_3,
|
||||
[SYSINFO_TYPE_4] = RSL_SYSTEM_INFO_4,
|
||||
[SYSINFO_TYPE_5] = RSL_SYSTEM_INFO_5,
|
||||
[SYSINFO_TYPE_6] = RSL_SYSTEM_INFO_6,
|
||||
[SYSINFO_TYPE_7] = RSL_SYSTEM_INFO_7,
|
||||
[SYSINFO_TYPE_8] = RSL_SYSTEM_INFO_8,
|
||||
[SYSINFO_TYPE_9] = RSL_SYSTEM_INFO_9,
|
||||
[SYSINFO_TYPE_10] = RSL_SYSTEM_INFO_10,
|
||||
[SYSINFO_TYPE_13] = RSL_SYSTEM_INFO_13,
|
||||
[SYSINFO_TYPE_16] = RSL_SYSTEM_INFO_16,
|
||||
[SYSINFO_TYPE_17] = RSL_SYSTEM_INFO_17,
|
||||
[SYSINFO_TYPE_18] = RSL_SYSTEM_INFO_18,
|
||||
[SYSINFO_TYPE_19] = RSL_SYSTEM_INFO_19,
|
||||
[SYSINFO_TYPE_20] = RSL_SYSTEM_INFO_20,
|
||||
[SYSINFO_TYPE_2bis] = RSL_SYSTEM_INFO_2bis,
|
||||
[SYSINFO_TYPE_2ter] = RSL_SYSTEM_INFO_2ter,
|
||||
[SYSINFO_TYPE_2quater] = RSL_SYSTEM_INFO_2quater,
|
||||
[SYSINFO_TYPE_5bis] = RSL_SYSTEM_INFO_5bis,
|
||||
[SYSINFO_TYPE_5ter] = RSL_SYSTEM_INFO_5ter,
|
||||
};
|
||||
|
||||
static const uint8_t rsl2sitype[0xff] = {
|
||||
[RSL_SYSTEM_INFO_1] = SYSINFO_TYPE_1,
|
||||
[RSL_SYSTEM_INFO_2] = SYSINFO_TYPE_2,
|
||||
[RSL_SYSTEM_INFO_3] = SYSINFO_TYPE_3,
|
||||
[RSL_SYSTEM_INFO_4] = SYSINFO_TYPE_4,
|
||||
[RSL_SYSTEM_INFO_5] = SYSINFO_TYPE_5,
|
||||
[RSL_SYSTEM_INFO_6] = SYSINFO_TYPE_6,
|
||||
[RSL_SYSTEM_INFO_7] = SYSINFO_TYPE_7,
|
||||
[RSL_SYSTEM_INFO_8] = SYSINFO_TYPE_8,
|
||||
[RSL_SYSTEM_INFO_9] = SYSINFO_TYPE_9,
|
||||
[RSL_SYSTEM_INFO_10] = SYSINFO_TYPE_10,
|
||||
[RSL_SYSTEM_INFO_13] = SYSINFO_TYPE_13,
|
||||
[RSL_SYSTEM_INFO_16] = SYSINFO_TYPE_16,
|
||||
[RSL_SYSTEM_INFO_17] = SYSINFO_TYPE_17,
|
||||
[RSL_SYSTEM_INFO_18] = SYSINFO_TYPE_18,
|
||||
[RSL_SYSTEM_INFO_19] = SYSINFO_TYPE_19,
|
||||
[RSL_SYSTEM_INFO_20] = SYSINFO_TYPE_20,
|
||||
[RSL_SYSTEM_INFO_2bis] = SYSINFO_TYPE_2bis,
|
||||
[RSL_SYSTEM_INFO_2ter] = SYSINFO_TYPE_2ter,
|
||||
[RSL_SYSTEM_INFO_2quater] = SYSINFO_TYPE_2quater,
|
||||
[RSL_SYSTEM_INFO_5bis] = SYSINFO_TYPE_5bis,
|
||||
[RSL_SYSTEM_INFO_5ter] = SYSINFO_TYPE_5ter,
|
||||
};
|
||||
|
||||
typedef int (*gen_si_fn_t)(uint8_t *output, struct gsm_bts *bts);
|
||||
|
||||
static const gen_si_fn_t gen_si_fn[_MAX_SYSINFO_TYPE] = {
|
||||
|
@ -551,41 +487,6 @@ static const gen_si_fn_t gen_si_fn[_MAX_SYSINFO_TYPE] = {
|
|||
[SYSINFO_TYPE_13] = &generate_si13,
|
||||
};
|
||||
|
||||
const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE] = {
|
||||
{ SYSINFO_TYPE_1, "1" },
|
||||
{ SYSINFO_TYPE_2, "2" },
|
||||
{ SYSINFO_TYPE_3, "3" },
|
||||
{ SYSINFO_TYPE_4, "4" },
|
||||
{ SYSINFO_TYPE_5, "5" },
|
||||
{ SYSINFO_TYPE_6, "6" },
|
||||
{ SYSINFO_TYPE_7, "7" },
|
||||
{ SYSINFO_TYPE_8, "8" },
|
||||
{ SYSINFO_TYPE_9, "9" },
|
||||
{ SYSINFO_TYPE_10, "10" },
|
||||
{ SYSINFO_TYPE_13, "13" },
|
||||
{ SYSINFO_TYPE_16, "16" },
|
||||
{ SYSINFO_TYPE_17, "17" },
|
||||
{ SYSINFO_TYPE_18, "18" },
|
||||
{ SYSINFO_TYPE_19, "19" },
|
||||
{ SYSINFO_TYPE_20, "20" },
|
||||
{ SYSINFO_TYPE_2bis, "2bis" },
|
||||
{ SYSINFO_TYPE_2ter, "2ter" },
|
||||
{ SYSINFO_TYPE_2quater, "2quater" },
|
||||
{ SYSINFO_TYPE_5bis, "5bis" },
|
||||
{ SYSINFO_TYPE_5ter, "5ter" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type)
|
||||
{
|
||||
return sitype2rsl[si_type];
|
||||
}
|
||||
|
||||
const char *gsm_sitype_name(enum osmo_sysinfo_type si_type)
|
||||
{
|
||||
return get_value_string(osmo_sitype_strs, si_type);
|
||||
}
|
||||
|
||||
int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type)
|
||||
{
|
||||
gen_si_fn_t gen_si;
|
||||
|
|
Loading…
Reference in New Issue