laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/41140?usp=email )
Change subject: Add CAS channel support ......................................................................
Add CAS channel support
CAS is currently supported by e1d driver only.
Change-Id: I81cc89e01bb4207dc899ab28f24a131f24b61c9c --- M TODO-RELEASE M include/osmocom/abis/e1_input.h M src/e1_input.c M src/input/e1d.c 4 files changed, 46 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE index d07457d..5664f80 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,3 +8,7 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmotrau add osmo_amrt_fill_with_dhf() +libosmoabis ABI break added field to struct e1inp_driver (field added at the end) +libosmoabis ABI break added field to struct input_signal_data (field added at the end) +libosmoabis added New API function: e1inp_ts_set_cas() +libosmoabis added New API signal: S_L_INP_LINE_CAS diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index 66985ea..244d0a4 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -195,6 +195,10 @@
/* Optional callback to perform driver specific initialization when the line is created. */ int (*line_create)(struct e1inp_line *line); + + /* Set CAS bits to transmit in TS16, that are associated with given time slot */ + int (*set_cas)(struct e1inp_ts *ts, uint8_t bits, bool query_rx); + };
struct e1inp_line_ops { @@ -274,6 +278,7 @@ S_L_INP_LINE_SA_BITS, S_L_INP_LINE_LOF, S_L_INP_LINE_NOLOF, + S_L_INP_LINE_CAS, };
extern const struct value_string e1inp_signal_names[]; @@ -344,6 +349,12 @@ */ int e1inp_ts_set_sa_bits(struct e1inp_line *line, uint8_t sa_bits);
+/* + * configure CAS bits on TS16 that are associated to given TS, if supported by driver + * cas (MSB to LSB): 0000ABCD + */ +int e1inp_ts_set_cas(struct e1inp_ts *ts, uint8_t bits, bool query_rx); + /* obtain a string identifier/name for the given timeslot */ void e1inp_ts_name(char *out, size_t out_len, const struct e1inp_ts *ts);
@@ -403,6 +414,7 @@ uint8_t sa_bits; struct gsm_bts_trx *trx; struct e1inp_line *line; + uint8_t cas; };
int abis_sendmsg(struct msgb *msg); diff --git a/src/e1_input.c b/src/e1_input.c index 066a572..c5ee38f 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -527,6 +527,16 @@ return driver->set_sa_bits(line, sa_bits); }
+int e1inp_ts_set_cas(struct e1inp_ts *ts, uint8_t bits, bool query_rx) +{ + struct e1inp_driver *driver; + + driver = ts->line->driver; + if (!driver->set_cas) + return -ENOTSUP; + return driver->set_cas(ts, bits, query_rx); +} + static int e1inp_line_use_cb(struct osmo_use_count_entry *use_count_entry, int32_t old_use_count, const char *file, int file_line) { diff --git a/src/input/e1d.c b/src/input/e1d.c index dd4e9fe..978b8cb 100644 --- a/src/input/e1d.c +++ b/src/input/e1d.c @@ -93,6 +93,7 @@ struct e1inp_line *e1_line; struct input_signal_data isd; int signal; + struct osmo_e1dp_cas_bits *cas;
memset(&isd, 0, sizeof(isd));
@@ -133,6 +134,13 @@ if (len < 1) return; isd.sa_bits = *data; + case E1DP_EVT_CAS: + signal = S_L_INP_LINE_CAS; + cas = (struct osmo_e1dp_cas_bits *)data; + if (len < sizeof(*cas)) + return; + isd.cas = cas->bits; + isd.ts_nr = ts; break; default: /* Ignore all other events. */ @@ -844,10 +852,22 @@ return osmo_e1dp_client_set_sa_bits(g_e1d, e1d_intf, e1d_line, sa_bits); }
+static int set_cas(struct e1inp_ts *ts, uint8_t bits, bool query_rx) +{ + /* we use higher 4 bits for interface, lower 4 bits for line, + * resulting in max. 16 interfaces with 16 lines each */ + uint8_t e1d_intf = (ts->line->port_nr >> 4) & 0xF; + uint8_t e1d_line = ts->line->port_nr & 0xF; + struct osmo_e1dp_cas_bits cas = { bits, query_rx }; + + return osmo_e1dp_client_set_cas(g_e1d, e1d_intf, e1d_line, ts->num, &cas); +} + struct e1inp_driver e1d_driver = { .name = "e1d", .want_write = e1d_want_write, .set_sa_bits = set_sa_bits, + .set_cas = set_cas, .line_update = e1d_line_update, .line_create = e1d_line_create, };