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