Merge commit 'dc0ebdfbdf3b1a381754c6ef4a59b0354eba7705'
[osmocom-bb.git] / src / host / layer23 / include / osmocom / bb / common / osmocom_data.h
1 #ifndef osmocom_data_h
2 #define osmocom_data_h
3
4 #include <osmocore/select.h>
5 #include <osmocore/gsm_utils.h>
6 #include <osmocore/write_queue.h>
7
8 struct osmocom_ms;
9
10         /* FIXME no 'mobile' specific stuff should be here */
11 #include <osmocom/bb/mobile/support.h>
12 #include <osmocom/bb/mobile/settings.h>
13 #include <osmocom/bb/mobile/subscriber.h>
14 #include <osmocom/bb/common/lapdm.h>
15 #include <osmocom/bb/common/sap_interface.h>
16 #include <osmocom/bb/mobile/gsm48_rr.h>
17 #include <osmocom/bb/mobile/sysinfo.h>
18 #include <osmocom/bb/mobile/gsm322.h>
19 #include <osmocom/bb/mobile/gsm48_mm.h>
20 #include <osmocom/bb/mobile/gsm48_cc.h>
21 #include <osmocom/bb/common/sim.h>
22
23 /* A layer2 entity */
24 struct osmol2_entity {
25         struct lapdm_entity lapdm_dcch;
26         struct lapdm_entity lapdm_acch;
27         osmol2_cb_t msg_handler;
28 };
29
30 struct osmosap_entity {
31         osmosap_cb_t msg_handler;
32 };
33
34 /* RX measurement statistics */
35 struct rx_meas_stat {
36         uint32_t last_fn;
37
38         /* cumulated values of current cell from SACCH dl */
39         uint32_t frames;
40         uint32_t snr;
41         uint32_t berr;
42         uint32_t rxlev;
43
44         /* counters loss criterion */
45         int16_t dsc, ds_fail;
46         int16_t s, rl_fail;
47 };
48
49 /* One Mobilestation for osmocom */
50 struct osmocom_ms {
51         struct llist_head entity;
52         char name[32];
53         struct write_queue l2_wq, sap_wq;
54         uint16_t test_arfcn;
55
56         struct gsm_support support;
57         struct gsm_settings settings;
58         struct gsm_subscriber subscr;
59         struct gsm_sim sim;
60         struct osmol2_entity l2_entity;
61         struct osmosap_entity sap_entity;
62         struct rx_meas_stat meas;
63         struct gsm48_rrlayer rrlayer;
64         struct gsm322_plmn plmn;
65         struct gsm322_cellsel cellsel;
66         struct gsm48_mmlayer mmlayer;
67         struct gsm48_cclayer cclayer;
68         struct llist_head trans_list;
69 };
70
71 enum osmobb_sig_subsys {
72         SS_L1CTL,
73 };
74
75 enum osmobb_meas_sig {
76         S_L1CTL_FBSB_ERR,
77         S_L1CTL_FBSB_RESP,
78         S_L1CTL_RESET,
79         S_L1CTL_PM_RES,
80         S_L1CTL_PM_DONE,
81         S_L1CTL_CCCH_MODE_CONF,
82         S_L1CTL_TCH_MODE_CONF,
83         S_L1CTL_LOSS_IND,
84 };
85
86 struct osmobb_fbsb_res {
87         struct osmocom_ms *ms;
88         int8_t snr;
89         uint8_t bsic;
90 };
91
92 struct osmobb_meas_res {
93         struct osmocom_ms *ms;
94         uint16_t band_arfcn;
95         uint8_t rx_lev;
96 };
97
98 struct osmobb_ccch_mode_conf {
99         struct osmocom_ms *ms;
100         uint8_t ccch_mode;
101 };
102
103 struct osmobb_tch_mode_conf {
104         struct osmocom_ms *ms;
105         uint8_t tch_mode;
106 };
107
108 #endif