aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/abis/e1_input.h7
-rw-r--r--src/e1_input.c26
-rw-r--r--src/input/dahdi.c5
-rw-r--r--src/input/e1d.c4
-rw-r--r--src/input/misdn.c4
5 files changed, 41 insertions, 5 deletions
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 44708bb..9b99f12 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -9,6 +9,7 @@
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
+#include <osmocom/gsm/i460_mux.h>
#include <osmocom/abis/subchan_demux.h>
#include <osmocom/abis/lapd.h>
@@ -73,9 +74,10 @@ enum e1inp_ts_type {
E1INP_TS_TYPE_TRAU,
E1INP_TS_TYPE_RAW,
E1INP_TS_TYPE_HDLC,
+ E1INP_TS_TYPE_I460,
};
const char *e1inp_tstype_name(enum e1inp_ts_type tp);
-extern const struct value_string e1inp_ts_type_names[6];
+extern const struct value_string e1inp_ts_type_names[];
/* A timeslot in the E1 interface */
struct e1inp_ts {
@@ -115,6 +117,9 @@ struct e1inp_ts {
/* queue of pending to-be-transmitted msgbs */
struct llist_head tx_queue;
} hdlc;
+ struct {
+ struct osmo_i460_timeslot i460_ts;
+ } i460;
};
union {
struct {
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