From 9a151091ccff8e8228e83e7e962d6bf1a234ec98 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Tue, 3 Jan 2023 18:50:53 +0100 Subject: [PATCH] Add function to set Sa bits to common part Change-Id: I4f5f975f0e5f708ae573a1e1ce41c6a08c207fad --- TODO-RELEASE | 1 + include/osmocom/abis/e1_input.h | 9 +++++++++ src/e1_input.c | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/TODO-RELEASE b/TODO-RELEASE index d0852fc..c021505 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-abis struct e1inp_driver Field added at the end (ABI break) diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index 7b97a46..a66f8eb 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -187,6 +187,9 @@ struct e1inp_driver { int default_delay; int has_keepalive; const char *bind_addr; + + /* Set Sa bits to transmit in TS0 (MSB to LSB): Sa8 Sa7 Sa5 Sa4 Sa64 Sa63 Sa62 Sa61/Sa6 */ + int (*set_sa_bits)(struct e1inp_line *line, uint8_t sa_bits); }; struct e1inp_line_ops { @@ -328,6 +331,12 @@ int e1inp_ts_config_hdlc(struct e1inp_ts *ts, struct e1inp_line *line, /* configure and initialize one timeslot dedicated to nothing */ int e1inp_ts_config_none(struct e1inp_ts *ts, struct e1inp_line *line); +/* + * configure Sa bits on TS0, if supported by driver (TABLE 5A and 5B of ITU-T G.704) + * sa_bits (MSB to LSB): Sa8 Sa7 Sa5 Sa4 Sa64 Sa63 Sa62 Sa61/Sa6 + */ +int e1inp_ts_set_sa_bits(struct e1inp_line *line, uint8_t sa_bits); + /* obtain a string identifier/name for the given timeslot */ void e1inp_ts_name(char *out, size_t out_len, const struct e1inp_ts *ts); diff --git a/src/e1_input.c b/src/e1_input.c index a7313dd..2d10513 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -455,6 +455,16 @@ int e1inp_ts_config_none(struct e1inp_ts *ts, struct e1inp_line *line) return 0; } +int e1inp_ts_set_sa_bits(struct e1inp_line *line, uint8_t sa_bits) +{ + struct e1inp_driver *driver; + + driver = line->driver; + if (!driver->set_sa_bits) + return -ENOTSUP; + return driver->set_sa_bits(line, sa_bits); +} + 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) {