blob: cf3a94b09f33f3375eaec8274be97d0e349b90ab [file] [log] [blame]
Harald Welte1fa60c82009-02-09 18:13:26 +00001#include <string.h>
2#include <errno.h>
3
4#include <openbsc/gsm_data.h>
5#include <openbsc/e1_input.h>
6
7#define SAPI_L2ML 0
8#define SAPI_OML 62
9#define SAPI_RSL 0 /* 63 ? */
10
11#define TEI_L2ML 127
12#define TEI_OML 25
13#define TEI_RSL 1
14
15/* do some compiled-in configuration for our BTS/E1 setup */
16int e1_config(struct gsm_bts *bts)
17{
18 struct e1inp_line *line;
19 struct e1inp_ts *sign_ts;
20 struct e1inp_sign_link *oml_link, *rsl_link;
21
22 line = malloc(sizeof(*line));
23 if (!line)
24 return -ENOMEM;
25 memset(line, 0, sizeof(*line));
26
27 /* create E1 timeslots for signalling and TRAU frames */
28 e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN);
29 e1inp_ts_config(&line->ts[2-1], line, E1INP_TS_TYPE_TRAU);
30 e1inp_ts_config(&line->ts[3-1], line, E1INP_TS_TYPE_TRAU);
31
32 /* create signalling links for TS1 */
33 sign_ts = &line->ts[1-1];
34 oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
35 bts->c0, TEI_OML, SAPI_OML);
36 rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
37 bts->c0, TEI_RSL, SAPI_RSL);
38
39 /* create back-links from bts/trx */
40 bts->oml_link = oml_link;
41 bts->c0->rsl_link = rsl_link;
42
43#if 0
44 /* create E1 timeslots for signalling and TRAU frames */
45 e1inp_ts_config(&line->ts[4-1], line, E1INP_TS_TYPE_TRAU);
46 e1inp_ts_config(&line->ts[5-1], line, E1INP_TS_TYPE_TRAU);
47
48 /* create signalling links for TS1 */
49 sign_ts = &line->ts[1-1];
50 rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
51 &bts->trx[1], TEI_RSL+1, SAPI_RSL);
52 /* create back-links from trx */
53 bts->trx[1].rsl_link = rsl_link;
54#endif
55
56 return mi_setup(0, line, NULL);
57}