diff options
author | Harald Welte <laforge@osmocom.org> | 2020-06-20 22:07:36 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-02-03 08:49:07 +0000 |
commit | b3952c60f12fd2d2b2496a47ecb34dd5b966e0d8 (patch) | |
tree | c27f8c4131d8c5bd9b7581ad52f8302eccfa6a74 /src | |
parent | 0f404b600c5a639d900881666bb88b5a55893bee (diff) |
e1_input: Support I.460 timeslot type
Unlike the legacy TRAU mode, this only adds I460 mux/demux,
without any TRAU frame synchronization. The user must still be
adding the actual sub-channels using osmo_i460_subchan_add()
depending on his requirements.
Change-Id: I44da6dfec77ef475adb35001a0e4fa11d549aa02
Diffstat (limited to 'src')
-rw-r--r-- | src/e1_input.c | 26 | ||||
-rw-r--r-- | src/input/dahdi.c | 5 | ||||
-rw-r--r-- | src/input/e1d.c | 4 | ||||
-rw-r--r-- | src/input/misdn.c | 4 |
4 files changed, 35 insertions, 4 deletions
diff --git a/src/e1_input.c b/src/e1_input.c index df61c7b..04c464a 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -44,6 +44,7 @@ #include <osmocom/core/logging.h> #include <osmocom/core/signal.h> #include <osmocom/core/endian.h> +#include <osmocom/gsm/i460_mux.h> #include <osmocom/abis/e1_input.h> #define NUM_E1_TS 32 @@ -241,12 +242,13 @@ const char *e1inp_signtype_name(enum e1inp_sign_type tp) return get_value_string(e1inp_sign_type_names, tp); } -const struct value_string e1inp_ts_type_names[6] = { +const struct value_string e1inp_ts_type_names[] = { { E1INP_TS_TYPE_NONE, "None" }, { E1INP_TS_TYPE_SIGN, "Signalling" }, { E1INP_TS_TYPE_TRAU, "TRAU" }, { E1INP_TS_TYPE_RAW, "RAW" }, { E1INP_TS_TYPE_HDLC, "HDLC" }, + { E1INP_TS_TYPE_I460, "I460" }, { 0, NULL } }; @@ -313,6 +315,17 @@ int e1inp_ts_config_trau(struct e1inp_ts *ts, struct e1inp_line *line, return 0; } +int e1inp_ts_config_i460(struct e1inp_ts *ts, struct e1inp_line *line) +{ + if (ts->type == E1INP_TS_TYPE_I460 && ts->line && line) + return 0; + + ts->type = E1INP_TS_TYPE_I460; + ts->line = line; + osmo_i460_ts_init(&ts->i460.i460_ts); + return 0; +} + void e1inp_ts_name(char *out, size_t out_len, const struct e1inp_ts *ts) { if (ts->line->name) @@ -679,6 +692,10 @@ int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg, case E1INP_TS_TYPE_HDLC: ts->hdlc.recv_cb(ts, msg); break; + case E1INP_TS_TYPE_I460: + osmo_i460_demux_in(&ts->i460.i460_ts, msg->l2h, msgb_l2len(msg)); + msgb_free(msg); + break; default: ret = -EINVAL; LOGPITS(ts, DLMI, LOGL_ERROR, "unknown TS type %u\n", ts->type); @@ -809,6 +826,13 @@ struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts, /* Get msgb from tx_queue */ msg = msgb_dequeue(&e1i_ts->hdlc.tx_queue); break; + case E1INP_TS_TYPE_I460: + msg = msgb_alloc(TSX_ALLOC_SIZE, "I460_TX"); + if (!msg) + return NULL; + len = osmo_i460_mux_out(&e1i_ts->i460.i460_ts, msg->data, 160); + msgb_put(msg, len); + break; default: LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "unsupported E1 TS type %u\n", e1i_ts->type); return NULL; diff --git a/src/input/dahdi.c b/src/input/dahdi.c index a29a233..e59518a 100644 --- a/src/input/dahdi.c +++ b/src/input/dahdi.c @@ -199,7 +199,8 @@ static int ts_want_write(struct e1inp_ts *e1i_ts) /* We never include the DAHDI B-Channel FD into the * writeset, since it doesn't support poll() based * write flow control */ - if (e1i_ts->type == E1INP_TS_TYPE_TRAU) { + if (e1i_ts->type == E1INP_TS_TYPE_TRAU || + e1i_ts->type == E1INP_TS_TYPE_I460) { LOGPITS(e1i_ts, DLINP, LOGL_DEBUG, "Trying to write TRAU ts\n"); return 0; } @@ -498,6 +499,7 @@ static int dahdi_fd_cb(struct osmo_fd *bfd, unsigned int what) * writeset, since it doesn't support poll() based * write flow control */ break; + case E1INP_TS_TYPE_I460: case E1INP_TS_TYPE_RAW: if (what & OSMO_FD_EXCEPT) handle_dahdi_exception(e1i_ts); @@ -685,6 +687,7 @@ static int dahdi_e1_setup(struct e1inp_line *line) return ret; break; case E1INP_TS_TYPE_TRAU: + case E1INP_TS_TYPE_I460: case E1INP_TS_TYPE_RAW: /* close/release LAPD instance, if any */ if (e1i_ts->lapd) { diff --git a/src/input/e1d.c b/src/input/e1d.c index e3a3b82..3ae1d89 100644 --- a/src/input/e1d.c +++ b/src/input/e1d.c @@ -310,7 +310,8 @@ static int e1d_want_write(struct e1inp_ts *e1i_ts) { /* We never include the DAHDI B-Channel FD into the writeset */ - if (e1i_ts->type == E1INP_TS_TYPE_TRAU) { + if (e1i_ts->type == E1INP_TS_TYPE_TRAU || + e1i_ts->type == E1INP_TS_TYPE_I460) { LOGPITS(e1i_ts, DLINP, LOGL_DEBUG, "Trying to write TRAU ts\n"); return 0; } @@ -429,6 +430,7 @@ e1d_line_update(struct e1inp_line *line) bfd->when = OSMO_FD_READ; break; case E1INP_TS_TYPE_TRAU: + case E1INP_TS_TYPE_I460: case E1INP_TS_TYPE_RAW: /* close/release LAPD instance, if any */ if (e1i_ts->lapd) { diff --git a/src/input/misdn.c b/src/input/misdn.c index 52cd311..0237cb9 100644 --- a/src/input/misdn.c +++ b/src/input/misdn.c @@ -213,7 +213,8 @@ static int ts_want_write(struct e1inp_ts *e1i_ts) /* We never include the mISDN B-Channel FD into the * writeset, since it doesn't support poll() based * write flow control */ - if (e1i_ts->type == E1INP_TS_TYPE_TRAU) + if (e1i_ts->type == E1INP_TS_TYPE_TRAU || + e1i_ts->type == E1INP_TS_TYPE_I460) return 0; e1i_ts->driver.misdn.fd.when |= OSMO_FD_WRITE; @@ -611,6 +612,7 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2) bfd->when = OSMO_FD_READ; break; case E1INP_TS_TYPE_TRAU: + case E1INP_TS_TYPE_I460: case E1INP_TS_TYPE_RAW: bfd->fd = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_RAW); /* We never include the mISDN B-Channel FD into the |