Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 1 | #include <string.h> |
| 2 | #include <errno.h> |
| 3 | |
| 4 | #include <openbsc/gsm_data.h> |
| 5 | #include <openbsc/e1_input.h> |
Harald Welte | 39a1b71 | 2009-02-10 17:17:09 +0000 | [diff] [blame] | 6 | #include <openbsc/trau_mux.h> |
Holger Freyther | ff9592f | 2009-03-09 16:17:14 +0000 | [diff] [blame] | 7 | #include <openbsc/misdn.h> |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 8 | |
| 9 | #define SAPI_L2ML 0 |
| 10 | #define SAPI_OML 62 |
| 11 | #define SAPI_RSL 0 /* 63 ? */ |
| 12 | |
| 13 | #define TEI_L2ML 127 |
| 14 | #define TEI_OML 25 |
| 15 | #define TEI_RSL 1 |
| 16 | |
| 17 | /* do some compiled-in configuration for our BTS/E1 setup */ |
| 18 | int e1_config(struct gsm_bts *bts) |
| 19 | { |
| 20 | struct e1inp_line *line; |
| 21 | struct e1inp_ts *sign_ts; |
| 22 | struct e1inp_sign_link *oml_link, *rsl_link; |
| 23 | |
| 24 | line = malloc(sizeof(*line)); |
| 25 | if (!line) |
| 26 | return -ENOMEM; |
| 27 | memset(line, 0, sizeof(*line)); |
| 28 | |
| 29 | /* create E1 timeslots for signalling and TRAU frames */ |
| 30 | e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN); |
| 31 | e1inp_ts_config(&line->ts[2-1], line, E1INP_TS_TYPE_TRAU); |
Harald Welte | 93d3f37 | 2009-02-18 03:27:14 +0000 | [diff] [blame] | 32 | //e1inp_ts_config(&line->ts[3-1], line, E1INP_TS_TYPE_TRAU); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 33 | |
| 34 | /* create signalling links for TS1 */ |
| 35 | sign_ts = &line->ts[1-1]; |
| 36 | oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, |
| 37 | bts->c0, TEI_OML, SAPI_OML); |
| 38 | rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, |
| 39 | bts->c0, TEI_RSL, SAPI_RSL); |
| 40 | |
| 41 | /* create back-links from bts/trx */ |
| 42 | bts->oml_link = oml_link; |
| 43 | bts->c0->rsl_link = rsl_link; |
| 44 | |
Harald Welte | 11fa29c | 2009-02-19 17:24:39 +0000 | [diff] [blame] | 45 | /* enable subchannel demuxer on TS2 */ |
| 46 | subch_demux_activate(&line->ts[2-1].trau.demux, 1); |
| 47 | subch_demux_activate(&line->ts[2-1].trau.demux, 2); |
| 48 | subch_demux_activate(&line->ts[2-1].trau.demux, 3); |
Harald Welte | 93d3f37 | 2009-02-18 03:27:14 +0000 | [diff] [blame] | 49 | |
Harald Welte | 11fa29c | 2009-02-19 17:24:39 +0000 | [diff] [blame] | 50 | #if 0 |
| 51 | /* enable subchannel demuxer on TS3 */ |
| 52 | subch_demux_activate(&line->ts[3-1].trau.demux, 0); |
| 53 | subch_demux_activate(&line->ts[3-1].trau.demux, 1); |
| 54 | subch_demux_activate(&line->ts[3-1].trau.demux, 2); |
| 55 | subch_demux_activate(&line->ts[3-1].trau.demux, 3); |
| 56 | #endif |
| 57 | |
Harald Welte | 39a1b71 | 2009-02-10 17:17:09 +0000 | [diff] [blame] | 58 | #ifdef HAVE_TRX1 |
| 59 | /* create E1 timeslots for TRAU frames of TRX1 */ |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 60 | e1inp_ts_config(&line->ts[4-1], line, E1INP_TS_TYPE_TRAU); |
| 61 | e1inp_ts_config(&line->ts[5-1], line, E1INP_TS_TYPE_TRAU); |
| 62 | |
Harald Welte | 39a1b71 | 2009-02-10 17:17:09 +0000 | [diff] [blame] | 63 | /* create RSL signalling link for TRX1 */ |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 64 | sign_ts = &line->ts[1-1]; |
| 65 | rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, |
| 66 | &bts->trx[1], TEI_RSL+1, SAPI_RSL); |
| 67 | /* create back-links from trx */ |
| 68 | bts->trx[1].rsl_link = rsl_link; |
| 69 | #endif |
| 70 | |
Holger Freyther | ff9592f | 2009-03-09 16:17:14 +0000 | [diff] [blame] | 71 | return mi_setup(0, line); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 72 | } |
Harald Welte | 5fd8a54 | 2009-02-13 02:43:36 +0000 | [diff] [blame] | 73 | |
| 74 | /* do some compiled-in configuration for our BTS/E1 setup */ |
| 75 | int ia_config(struct gsm_bts *bts) |
| 76 | { |
| 77 | struct e1inp_line *line; |
Harald Welte | 5c1e458 | 2009-02-15 11:57:29 +0000 | [diff] [blame] | 78 | struct e1inp_ts *sign_ts, *rsl_ts; |
Harald Welte | 5fd8a54 | 2009-02-13 02:43:36 +0000 | [diff] [blame] | 79 | struct e1inp_sign_link *oml_link, *rsl_link; |
| 80 | |
| 81 | line = malloc(sizeof(*line)); |
| 82 | if (!line) |
| 83 | return -ENOMEM; |
| 84 | memset(line, 0, sizeof(*line)); |
| 85 | |
| 86 | /* create E1 timeslots for signalling and TRAU frames */ |
| 87 | e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN); |
Harald Welte | 5c1e458 | 2009-02-15 11:57:29 +0000 | [diff] [blame] | 88 | e1inp_ts_config(&line->ts[2-1], line, E1INP_TS_TYPE_SIGN); |
Harald Welte | 5fd8a54 | 2009-02-13 02:43:36 +0000 | [diff] [blame] | 89 | |
| 90 | /* create signalling links for TS1 */ |
| 91 | sign_ts = &line->ts[1-1]; |
Harald Welte | 5c1e458 | 2009-02-15 11:57:29 +0000 | [diff] [blame] | 92 | rsl_ts = &line->ts[2-1]; |
Harald Welte | 5fd8a54 | 2009-02-13 02:43:36 +0000 | [diff] [blame] | 93 | oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, |
| 94 | bts->c0, 0, 0xff); |
Harald Welte | 5c1e458 | 2009-02-15 11:57:29 +0000 | [diff] [blame] | 95 | rsl_link = e1inp_sign_link_create(rsl_ts, E1INP_SIGN_RSL, |
Harald Welte | 5fd8a54 | 2009-02-13 02:43:36 +0000 | [diff] [blame] | 96 | bts->c0, 0, 0); |
| 97 | |
| 98 | /* create back-links from bts/trx */ |
| 99 | bts->oml_link = oml_link; |
| 100 | bts->c0->rsl_link = rsl_link; |
| 101 | |
| 102 | return ipaccess_setup(line); |
| 103 | } |