aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmo-bts/bts.h
blob: 70642207588d717d92dd73f7ef62a72b0cb32dfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#ifndef _BTS_H
#define _BTS_H

#define BTS_SI_NUM 23 /* MUAR match the entries in BTS_SI_LIST */

#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, \
}

#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", \
}

#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;
};

/* 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;
};

/* 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;
};

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);

#endif /* _BTS_H */