aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2024-01-14 15:01:38 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2024-01-19 18:23:01 +0100
commitd5b99eb1bdccc6373cad430bd69a2bfb67ea91e6 (patch)
tree085b2eb443f57f765dbc8c5c7e2e18a820e710c2 /src
parente2cf7f119b1aed88c49f3ef870275920667b8377 (diff)
Indicate change in received Sa bits
Diffstat (limited to 'src')
-rw-r--r--src/e1d.h2
-rw-r--r--src/intf_line.c1
-rw-r--r--src/mux_demux.c13
3 files changed, 15 insertions, 1 deletions
diff --git a/src/e1d.h b/src/e1d.h
index 3188cfc..4b70c0f 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -148,6 +148,8 @@ struct e1_line {
uint8_t prev_errmask;
/*! timer to re-set the rx_crc4_err and rx_alarm above */
struct osmo_timer_list timer;
+ /*! last received frame with Sa bits */
+ uint8_t rx_frame;
} ts0;
/* watchdog timer to catch situations where no more USB data is received */
diff --git a/src/intf_line.c b/src/intf_line.c
index 4433e96..b3dafff 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -272,6 +272,7 @@ e1_line_new(struct e1_intf *intf, int line_id, void *drv_data)
line->intf = intf;
line->drv_data = drv_data;
line->mode = E1_LINE_MODE_CHANNELIZED;
+ line->ts0.rx_frame = 0xff;
for (int i = 0; i < 32; i++)
_ts_init(&line->ts[i], line, i);
diff --git a/src/mux_demux.c b/src/mux_demux.c
index abe01a3..71374ef 100644
--- a/src/mux_demux.c
+++ b/src/mux_demux.c
@@ -378,8 +378,8 @@ _e1_line_demux_in_ts0(struct e1_line *line, const uint8_t *buf, int ftr, uint8_t
const uint8_t *frame = buf + i*32;
uint8_t frame_nr = (frame_base + i) & 0xf;
- /* A bit is present in each odd frame */
if (frame_nr % 2) {
+ /* A bit is present in each odd frame */
if (frame[0] & 0x20) {
if (!(line->ts0.cur_errmask & E1L_TS0_RX_ALARM)) {
line->ts0.cur_errmask |= E1L_TS0_RX_ALARM;
@@ -394,6 +394,17 @@ _e1_line_demux_in_ts0(struct e1_line *line, const uint8_t *buf, int ftr, uint8_t
line->intf->id, line->id, 0, NULL, 0);
}
}
+ /* SA bits changed */
+ if (line->ts0.rx_frame != (frame[0] | 0xe0)) {
+ uint8_t sa_bits = ((frame[0] & 0x01) << 7) | /* Sa8 -> Bit 7 */
+ ((frame[0] & 0x02) << 5) | /* Sa7 -> Bit 6 */
+ ((frame[0] & 0x04) >> 2) | /* Sa6 -> Bit 0 */
+ ((frame[0] & 0x08) << 2) | /* Sa5 -> Bit 5 */
+ (frame[0] & 0x10); /* Sa4 -> Bit 4 */
+ line->ts0.rx_frame = frame[0] | 0xe0;
+ osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_SABITS,
+ line->intf->id, line->id, 0, &sa_bits, 1);
+ }
}
/* E bits are present in frame 13 + 15 */