aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-06-27 11:25:35 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-27 11:25:35 +0200
commitc6b4c87e5d57b91b29894835e7ac8e42f6e67f32 (patch)
tree2dfca5a61c881e88e6f29d03c29bb26e1c643332 /include
parent8e47fb89bfd0e2b54b714393ac2a80ca76df56a9 (diff)
re-work original osmo-bts with support for sysmocom femtobts
This code re-works osmo-bts to add support for the upcoming sysmocom BTS. It also tries to add some level of abstraction between the generic part of a BTS (A-bis, RSL, OML, data structures, paging scheduling, BCCH/AGCH scheduling, etc.) and the actual hardware-specific bits. The hardware-specific bits are currently only implemented for the sysmocom femtobts, but should be (re-)added for osmocom-bb, as well as a virtual BTS for simulation purpose later. The sysmocom bts specific parts require hardware-specific header files which are (at least currently) not publicly distributed.
Diffstat (limited to 'include')
l---------include/openbsc/gsm_data.h1
-rw-r--r--include/osmo-bts/Makefile.am2
-rw-r--r--include/osmo-bts/abis.h10
-rw-r--r--include/osmo-bts/bts.h137
-rw-r--r--include/osmo-bts/bts_model.h33
-rw-r--r--include/osmo-bts/gsm_data.h57
-rw-r--r--include/osmo-bts/logging.h10
-rw-r--r--include/osmo-bts/oml.h20
-rw-r--r--include/osmo-bts/paging.h24
-rw-r--r--include/osmo-bts/rsl.h21
-rw-r--r--include/osmo-bts/signal.h14
-rw-r--r--include/osmo-bts/support.h30
-rw-r--r--include/osmo-bts/vty.h22
13 files changed, 212 insertions, 169 deletions
diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h
new file mode 120000
index 00000000..f0d49f25
--- /dev/null
+++ b/include/openbsc/gsm_data.h
@@ -0,0 +1 @@
+../osmo-bts/gsm_data.h \ No newline at end of file
diff --git a/include/osmo-bts/Makefile.am b/include/osmo-bts/Makefile.am
index 4b4f2b63..64711f86 100644
--- a/include/osmo-bts/Makefile.am
+++ b/include/osmo-bts/Makefile.am
@@ -1 +1 @@
-noinst_HEADERS = bts.h abis.h rsl.h oml.h support.h rtp.h logging.h
+noinst_HEADERS = abis.h bts.h bts_model.h gsm_data.h logging.h oml.h paging.h rsl.h rtp.h signal.h vty.h
diff --git a/include/osmo-bts/abis.h b/include/osmo-bts/abis.h
index 91b44631..1195cae8 100644
--- a/include/osmo-bts/abis.h
+++ b/include/osmo-bts/abis.h
@@ -5,13 +5,15 @@
#include <osmocom/core/timer.h>
#include <osmocom/gsm/protocol/ipaccess.h>
+#include <osmo-bts/gsm_data.h>
+
#define OML_RETRY_TIMER 5
#define OML_PING_TIMER 20
struct ipabis_link {
int state;
- struct osmocom_bts *bts; /* set, if OML link */
- struct osmobts_trx *trx; /* set, if RSL link */
+ struct gsm_bts *bts; /* set, if OML link */
+ struct gsm_bts_trx *trx; /* set, if RSL link */
struct osmo_fd bfd;
struct osmo_timer_list timer;
struct msgb *rx_msg;
@@ -33,4 +35,8 @@ void abis_push_ipa(struct msgb *msg, uint8_t proto);
int abis_open(struct ipabis_link *link, uint32_t ip);
void abis_close(struct ipabis_link *link);
+
+int abis_oml_sendmsg(struct msgb *msg);
+int abis_rsl_sendmsg(struct msgb *msg);
+
#endif /* _ABIS_H */
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 70642207..0d0a0b44 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -1,132 +1,29 @@
#ifndef _BTS_H
#define _BTS_H
-#define BTS_SI_NUM 23 /* MUAR match the entries in BTS_SI_LIST */
+#include <osmo-bts/gsm_data.h>
-#define BTS_SI_LIST { \
- RSL_SYSTEM_INFO_8, \
- RSL_SYSTEM_INFO_1, \
- RSL_SYSTEM_INFO_2, \
- RSL_SYSTEM_INFO_3, \
- RSL_SYSTEM_INFO_4, \
- RSL_SYSTEM_INFO_5, \
- RSL_SYSTEM_INFO_6, \
- RSL_SYSTEM_INFO_7, \
- RSL_SYSTEM_INFO_16, \
- RSL_SYSTEM_INFO_17, \
- RSL_SYSTEM_INFO_2bis, \
- RSL_SYSTEM_INFO_2ter, \
- RSL_SYSTEM_INFO_5bis, \
- RSL_SYSTEM_INFO_5ter, \
- RSL_SYSTEM_INFO_10, \
- REL_EXT_MEAS_ORDER, \
- RSL_MEAS_INFO, \
- RSL_SYSTEM_INFO_13, \
- RSL_SYSTEM_INFO_2quater, \
- RSL_SYSTEM_INFO_9, \
- RSL_SYSTEM_INFO_18, \
- RSL_SYSTEM_INFO_19, \
- RSL_SYSTEM_INFO_20, \
-}
+extern void *tall_bts_ctx;
-#define BTS_SI_NAME char *bts_si_name[] = { \
- "RSL_SYSTEM_INFO_8", \
- "RSL_SYSTEM_INFO_1", \
- "RSL_SYSTEM_INFO_2", \
- "RSL_SYSTEM_INFO_3", \
- "RSL_SYSTEM_INFO_4", \
- "RSL_SYSTEM_INFO_5", \
- "RSL_SYSTEM_INFO_6", \
- "RSL_SYSTEM_INFO_7", \
- "RSL_SYSTEM_INFO_16", \
- "RSL_SYSTEM_INFO_17", \
- "RSL_SYSTEM_INFO_2bis", \
- "RSL_SYSTEM_INFO_2ter", \
- "RSL_SYSTEM_INFO_5bis", \
- "RSL_SYSTEM_INFO_5ter", \
- "RSL_SYSTEM_INFO_10", \
- "REL_EXT_MEAS_ORDER", \
- "RSL_MEAS_INFO", \
- "RSL_SYSTEM_INFO_13", \
- "RSL_SYSTEM_INFO_2quater", \
- "RSL_SYSTEM_INFO_9", \
- "RSL_SYSTEM_INFO_18", \
- "RSL_SYSTEM_INFO_19", \
- "RSL_SYSTEM_INFO_20", \
-}
+int bts_init(struct gsm_bts *bts);
-#define BTS_SI_USE 1
-#define BTS_SI_NEW 2
-
-/* store sysinfos of a BTS */
-struct osmobts_sysinfo {
- uint8_t flags[BTS_SI_NUM];
- uint8_t si[BTS_SI_NUM][23];
- struct osmo_timer_list timer;
-};
-
-struct osmobts_slot;
-
-/* one physical radio */
-struct osmobts_ms {
- struct llist_head entry;
- struct osmobts_trx *trx;
-};
-
-/* one logical channel instance */
-struct osmobts_lchan {
- struct osmobts_slot *slot;
- uint8_t lchan_nr;
- uint8_t chan_nr; /* CBITS+TN */
- struct lapdm_channel lapdm_channel;
- struct osmobts_rtp rtp;
-};
-
-/* one timeslot instance */
-struct osmobts_slot {
- struct osmobts_trx *trx;
- uint8_t slot_nr;
- uint8_t acch_type; /* TS 08.58 9.3.1 (bits 8..4) */
- uint8_t has_bcch;
- uint8_t chan_comb;
- struct osmobts_lchan *lchan[8];
- struct osmobts_ms *tx_ms, *rx_ms;
-};
+struct gsm_bts *create_bts(uint8_t num_trx, char *id);
+int create_ms(struct gsm_bts_trx *trx, int maskc, uint8_t *maskv_tx,
+ uint8_t *maskv_rx);
+void destroy_bts(struct gsm_bts *bts);
+int work_bts(struct gsm_bts *bts);
+int bts_link_estab(struct gsm_bts *bts);
+int trx_link_estab(struct gsm_bts_trx *trx);
+void bts_new_si(void *arg);
+void bts_setup_slot(struct gsm_bts_trx_ts *slot, uint8_t comb);
-/* one TRX instance */
-struct osmobts_trx {
- struct osmocom_bts *bts;
- uint8_t trx_nr;
- struct osmobts_slot slot[8];
- struct llist_head ms_list;
- struct ipabis_link link;
- struct osmobts_sysinfo si;
- uint8_t rf_red;
- uint16_t arfcn_list[128];
- int arfcn_num;
-};
+int lchan_init_lapdm(struct gsm_lchan *lchan);
-/* the BTS instance */
-struct osmocom_bts {
- char *id;
- uint8_t num_trx;
- struct osmobts_trx *trx[8];
- struct ipabis_link link;
- uint8_t max_ta;
- uint16_t bcch_arfcn;
- uint8_t bcc, ncc;
- uint16_t start_time;
-};
+int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg);
+struct msgb *bts_agch_dequeue(struct gsm_bts *bts);
-struct osmocom_bts *create_bts(uint8_t num_trx, char *id);
-int create_ms(struct osmobts_trx *trx, int maskc, uint8_t *maskv_tx,
- uint8_t *maskv_rx);
-void destroy_bts(struct osmocom_bts *bts);
-int work_bts(struct osmocom_bts *bts);
-int bts_link_estab(struct osmocom_bts *bts);
-int trx_link_estab(struct osmobts_trx *trx);
-void bts_new_si(void *arg);
-void bts_setup_slot(struct osmobts_slot *slot, uint8_t comb);
+uint8_t *bts_sysinfo_get(struct gsm_bts *bts, struct gsm_time *g_time);
+uint8_t *lchan_sacch_get(struct gsm_lchan *lchan, struct gsm_time *g_time);
#endif /* _BTS_H */
diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
new file mode 100644
index 00000000..81b30e94
--- /dev/null
+++ b/include/osmo-bts/bts_model.h
@@ -0,0 +1,33 @@
+#ifndef BTS_MODEL_H
+#define BTS_MODEL_H
+
+#include <stdint.h>
+
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/gsm/gsm_utils.h>
+
+#include <osmo-bts/gsm_data.h>
+
+/* BTS model specific functions needed by the common code */
+
+int bts_model_init(struct gsm_bts *bts);
+
+struct gsm_time *bts_model_get_time(struct gsm_bts *bts);
+
+int bts_model_check_oml(struct gsm_bts *bts, uint8_t msg_type,
+ struct tlv_parsed *old_attr, struct tlv_parsed *new_attr,
+ void *obj);
+
+int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+ struct tlv_parsed *new_attr, void *obj);
+
+int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
+ void *obj);
+
+int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo,
+ void *obj, uint8_t adm_state);
+
+int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp);
+int bts_model_rsl_chan_rel(struct gsm_lchan *lchan);
+
+#endif
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
new file mode 100644
index 00000000..2498f7d0
--- /dev/null
+++ b/include/osmo-bts/gsm_data.h
@@ -0,0 +1,57 @@
+#ifndef _GSM_DATA_H
+#define _GSM_DATA_H
+
+#include <osmocom/core/timer.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/gsm/lapdm.h>
+
+#include <osmo-bts/paging.h>
+
+struct gsm_network {
+
+};
+
+/* data structure for BTS related data specific to the BTS role */
+struct gsm_bts_role_bts {
+ struct {
+ /* Interference Boundaries for OML */
+ int16_t boundary[6];
+ uint8_t intave;
+ } interference;
+ unsigned int t200_ms[7];
+ unsigned int t3105_ms;
+ struct {
+ uint8_t overload_period;
+ struct {
+ /* Input parameters from OML */
+ uint8_t load_ind_thresh; /* percent */
+ uint8_t load_ind_period; /* seconds */
+ /* Internal data */
+ struct osmo_timer_list timer;
+ unsigned int pch_total;
+ unsigned int pch_used;
+ } ccch;
+ struct {
+ /* Input parameters from OML */
+ int16_t busy_thresh; /* in dBm */
+ uint16_t averaging_slots;
+ } rach;
+ } load;
+ uint8_t ny1;
+ uint8_t max_ta;
+ struct llist_head agch_queue;
+ struct paging_state *paging_state;
+};
+
+#define bts_role_bts(x) ((struct gsm_bts_role_bts *)(x)->role)
+
+#include "../../openbsc/openbsc/include/openbsc/gsm_data_shared.h"
+
+struct femtol1_hdl;
+
+static inline struct femtol1_hdl *trx_femtol1_hdl(struct gsm_bts_trx *trx)
+{
+ return trx->role_bts.l1h;
+}
+
+#endif /* _GSM_DATA_H */
diff --git a/include/osmo-bts/logging.h b/include/osmo-bts/logging.h
index 601fb2f5..e63b0cfa 100644
--- a/include/osmo-bts/logging.h
+++ b/include/osmo-bts/logging.h
@@ -9,19 +9,17 @@ enum {
DOML,
DRLL,
DRR,
- DMM,
- DCC,
- DSMS,
DMEAS,
DPAG,
- DLAPDM,
DL1C,
- DSAP,
+ DL1P,
DABIS,
DRTP,
DSUM,
};
-extern const struct log_info log_info;
+extern const struct log_info bts_log_info;
+
+int bts_log_init(const char *category_mask);
#endif /* _LOGGING_H */
diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h
index 09ad1abd..afc52d4f 100644
--- a/include/osmo-bts/oml.h
+++ b/include/osmo-bts/oml.h
@@ -1,9 +1,21 @@
#ifndef _OML_H
#define _OML_H
-int down_oml(struct osmocom_bts *bts, struct msgb *msg);
-int oml_tx_sw_act_rep(struct ipabis_link *link, uint8_t obj_class, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr);
-int oml_tx_state_changed(struct ipabis_link *link, uint8_t op_state, uint8_t avail_status, uint8_t obj_class, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr);
+int oml_init(void);
+int down_oml(struct gsm_bts *bts, struct msgb *msg);
-#endif // _OML_H */
+struct msgb *oml_msgb_alloc(void);
+int oml_send_msg(struct msgb *msg, int is_mauf);
+int oml_mo_send_msg(struct gsm_abis_mo *mo, struct msgb *msg, uint8_t msg_type);
+int oml_mo_opstart_ack(struct gsm_abis_mo *mo);
+int oml_mo_opstart_nack(struct gsm_abis_mo *mo, uint8_t nack_cause);
+int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state);
+
+int oml_mo_tx_sw_act_rep(struct gsm_abis_mo *mo);
+
+int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause);
+int oml_mo_fom_ack_nack(struct gsm_abis_mo *mo, uint8_t orig_msg_type,
+ uint8_t cause);
+
+#endif // _OML_H */
diff --git a/include/osmo-bts/paging.h b/include/osmo-bts/paging.h
new file mode 100644
index 00000000..793a2a14
--- /dev/null
+++ b/include/osmo-bts/paging.h
@@ -0,0 +1,24 @@
+#ifndef OSMO_BTS_PAGING_H
+#define OSMO_BTS_PAGING_H
+
+#include <stdint.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+
+struct paging_state;
+
+/* initialize paging code */
+struct paging_state *paging_init(void *ctx, unsigned int num_paging_max,
+ unsigned int paging_lifetime);
+
+/* update with new SYSTEM INFORMATION parameters */
+int paging_si_update(struct paging_state *ps, struct gsm48_control_channel_descr *chan_desc);
+
+/* Add an identity to the paging queue */
+int paging_add_identity(struct paging_state *ps, uint8_t paging_group,
+ const uint8_t *identity_lv, uint8_t chan_needed);
+
+/* generate paging message for given gsm time */
+int paging_gen_msg(struct paging_state *ps, uint8_t *out_buf, struct gsm_time *gt);
+
+#endif
diff --git a/include/osmo-bts/rsl.h b/include/osmo-bts/rsl.h
index 3f9c2c9a..62bc9b1b 100644
--- a/include/osmo-bts/rsl.h
+++ b/include/osmo-bts/rsl.h
@@ -1,12 +1,21 @@
#ifndef _RSL_H
#define _RSL_H
-int down_rsl(struct osmobts_trx *trx, struct msgb *msg);
-int rsl_tx_rf_res(struct osmobts_trx *trx);
-int rsl_tx_chan_rqd(struct osmobts_trx *trx);
-int rsl_tx_est_ind(struct osmobts_lchan *lchan, uint8_t link_id, uint8_t *data, int len);
-int rsl_tx_rll(struct msgb *msg, struct osmol2_entity *l2_entity);
-int rsl_tx_ipac_dlcx_ind(struct osmobts_lchan *lchan, uint8_t cause);
+int down_rsl(struct gsm_bts_trx *trx, struct msgb *msg);
+int rsl_tx_rf_res(struct gsm_bts_trx *trx);
+int rsl_tx_chan_rqd(struct gsm_bts_trx *trx, struct gsm_time *gtime,
+ uint8_t ra, uint8_t acc_delay);
+int rsl_tx_est_ind(struct gsm_lchan *lchan, uint8_t link_id, uint8_t *data, int len);
+
+int rsl_tx_chan_act_ack(struct gsm_lchan *lchan, struct gsm_time *gtime);
+int rsl_tx_rf_rel_ack(struct gsm_lchan *lchan);
+
+/* call-back for LAPDm code, called when it wants to send msgs UP */
+int lapdm_rll_tx_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx);
+
+int rsl_tx_ipac_dlcx_ind(struct gsm_lchan *lchan, uint8_t cause);
+
+struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr);
#endif // _RSL_H */
diff --git a/include/osmo-bts/signal.h b/include/osmo-bts/signal.h
new file mode 100644
index 00000000..c27ad7b4
--- /dev/null
+++ b/include/osmo-bts/signal.h
@@ -0,0 +1,14 @@
+#ifndef OSMO_BTS_SIGNAL_H
+#define OSMO_BTS_SIGNAL_H
+
+#include <osmocom/core/signal.h>
+
+enum sig_subsys {
+ SS_GLOBAL,
+};
+
+enum signals_global {
+ S_NEW_SYSINFO,
+};
+
+#endif
diff --git a/include/osmo-bts/support.h b/include/osmo-bts/support.h
deleted file mode 100644
index ed378753..00000000
--- a/include/osmo-bts/support.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _BTS_SUPPORT_H
-#define _BTS_SUPPORT_H
-
-struct bts_support {
- /* crypto supprot */
- uint8_t a5_1;
- uint8_t a5_2;
- uint8_t a5_3;
- uint8_t a5_4;
- uint8_t a5_5;
- uint8_t a5_6;
- uint8_t a5_7;
- /* radio support */
- uint8_t freq_map[128];
- /* codecs */
- uint8_t chan_comb[256];
- uint8_t full_v1;
- uint8_t full_v2;
- uint8_t full_v3;
- uint8_t half_v1;
- uint8_t half_v3;
-};
-
-extern struct bts_support bts_support;
-void bts_support_init(void);
-char *bts_support_comb_name(uint8_t chan_comb);
-
-#endif /* _SUPPORT_H */
-
-
diff --git a/include/osmo-bts/vty.h b/include/osmo-bts/vty.h
new file mode 100644
index 00000000..f0b7ea4b
--- /dev/null
+++ b/include/osmo-bts/vty.h
@@ -0,0 +1,22 @@
+#ifndef OSMOBTS_VTY_H
+#define OSMOBTS_VTY_H
+
+#include <osmocom/vty/vty.h>
+#include <osmocom/vty/command.h>
+
+enum bts_vty_node {
+ BTS_NODE = _LAST_OSMOVTY_NODE + 1,
+ TRX_NODE,
+ TS_NODE,
+ LCHAN_NODE,
+};
+
+extern struct cmd_element ournode_exit_cmd;
+extern struct cmd_element ournode_end_cmd;
+
+enum node_type bts_vty_go_parent(struct vty *vty);
+int bts_vty_is_config_node(struct vty *vty, int node);
+
+extern struct vty_app_info bts_vty_info;
+
+#endif