diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2024-01-14 14:59:14 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2024-01-19 18:23:01 +0100 |
commit | e2cf7f119b1aed88c49f3ef870275920667b8377 (patch) | |
tree | ef7b006962a1e41c9b2400e8abbc45e26824e400 | |
parent | 52e9c56f728c3f6466e251c429ddaf9b2562cebc (diff) |
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
-rw-r--r-- | src/intf_line.c | 2 | ||||
-rw-r--r-- | 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 <osmocom/core/stats.h> #include <osmocom/core/rate_ctr.h> #include <osmocom/e1d/proto.h> +#include <osmocom/e1d/proto_srv.h> #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 */ } } |