jolly has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-e1d/+/35561?usp=email )
Change subject: Indicate change in received Sa bits
......................................................................
Indicate change in received Sa bits
Change-Id: I4ea2a11e221629a90ed227a0df33576c8607881b
---
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
3 files changed, 24 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/61/35561/1
diff --git a/src/e1d.h b/src/e1d.h
index ec264c7..74010ba 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -148,6 +148,8 @@
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 @@
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 @@
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 @@
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 */
--
To view, visit
https://gerrit.osmocom.org/c/osmo-e1d/+/35561?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I4ea2a11e221629a90ed227a0df33576c8607881b
Gerrit-Change-Number: 35561
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-MessageType: newchange