From e2cf7f119b1aed88c49f3ef870275920667b8377 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 14 Jan 2024 14:59:14 +0100 Subject: [PATCH] Indicate remote alarm bit as remote alarm inidication The flag that stores the current alarm is not cleared periodically. Instead it is cleared when the alarm ceases. Change-Id: Id6cd193c71330c350c27e02b3a692d2c7e0b3fbe --- src/intf_line.c | 2 +- src/mux_demux.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/intf_line.c b/src/intf_line.c index f41214e..4433e96 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -239,7 +239,7 @@ _ts0_tmr_cb(void *_line) } line->ts0.prev_errmask = line->ts0.cur_errmask; - line->ts0.cur_errmask = 0; + line->ts0.cur_errmask &= ~E1L_TS0_RX_CRC4_ERR; osmo_timer_schedule(&line->ts0.timer, 1, 0); } diff --git a/src/mux_demux.c b/src/mux_demux.c index cd5c286..abe01a3 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "e1d.h" #include "log.h" @@ -380,8 +381,18 @@ _e1_line_demux_in_ts0(struct e1_line *line, const uint8_t *buf, int ftr, uint8_t /* A bit is present in each odd frame */ if (frame_nr % 2) { if (frame[0] & 0x20) { - line->ts0.cur_errmask |= E1L_TS0_RX_ALARM; - line_ctr_add(line, LINE_CTR_RX_REMOTE_A, 1); + if (!(line->ts0.cur_errmask & E1L_TS0_RX_ALARM)) { + line->ts0.cur_errmask |= E1L_TS0_RX_ALARM; + line_ctr_add(line, LINE_CTR_RX_REMOTE_A, 1); + osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_RAI_ON, + line->intf->id, line->id, 0, NULL, 0); + } + } else { + if ((line->ts0.cur_errmask & E1L_TS0_RX_ALARM)) { + line->ts0.cur_errmask &= ~E1L_TS0_RX_ALARM; + osmo_e1dp_server_event(line->intf->e1d->srv, E1DP_EVT_RAI_OFF, + line->intf->id, line->id, 0, NULL, 0); + } } } @@ -395,7 +406,7 @@ _e1_line_demux_in_ts0(struct e1_line *line, const uint8_t *buf, int ftr, uint8_t line_ctr_add(line, LINE_CTR_RX_REMOTE_E, 1); } } - /* cur_errmask is being cleared once per second via line->ts0.timer */ + /* CRC error in cur_errmask is being cleared once per second via line->ts0.timer */ } }