This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706 )
Change subject: icE1usb firmware: Detect A-bit in TS0; report via USB + LED
......................................................................
icE1usb firmware: Detect A-bit in TS0; report via USB + LED
Scan over every odd E1 frame TS0 byte to check if the A-bit is set,
indicating a remote alarm. If so, set yellow LED and report via the
error flags communicated to the host by USB interrupt transfer.
Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8
---
M firmware/ice40-riscv/icE1usb/e1.c
M firmware/ice40-riscv/icE1usb/e1.h
M firmware/ice40-riscv/icE1usb/ice1usb_proto.h
3 files changed, 30 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c
index 5e57480..f5e367e 100644
--- a/firmware/ice40-riscv/icE1usb/e1.c
+++ b/firmware/ice40-riscv/icE1usb/e1.c
@@ -290,9 +290,11 @@
unsigned int
e1_rx_need_data(unsigned int usb_addr, unsigned int max_frames, unsigned int *pos)
{
+ bool rai_received = false;
+ bool rai_possible = false;
unsigned int ofs;
int tot_frames = 0;
- int n_frames;
+ int n_frames, i;
while (max_frames) {
/* Get some data from the FIFO */
@@ -314,10 +316,34 @@
max_frames -= n_frames;
tot_frames += n_frames;
+ /* While DMA is running: Determine if remote end indicates any alarms */
+ for (i = 0; i < n_frames; i++) {
+ unsigned int frame_nr = ofs + i;
+ /* A bit is present in every odd frame TS0 */
+ if (frame_nr & 1) {
+ uint8_t ts0 = *e1_data_ptr(0, ofs + i, 0);
+ rai_possible = true;
+ if (ts0 & 0x20) {
+ rai_received = true;
+ break;
+ }
+ }
+ }
+
/* Wait for DMA completion */
while (dma_poll());
}
+ if (rai_possible) {
+ if (rai_received) {
+ g_e1.errors.flags |= E1_ERR_F_RAI;
+ e1_platform_led_set(0, E1P_LED_YELLOW, E1P_LED_ST_ON);
+ } else {
+ g_e1.errors.flags &= ~E1_ERR_F_RAI;
+ e1_platform_led_set(0, E1P_LED_YELLOW, E1P_LED_ST_OFF);
+ }
+ }
+
return tot_frames;
}
diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h
index 8ba9838..4394638 100644
--- a/firmware/ice40-riscv/icE1usb/e1.h
+++ b/firmware/ice40-riscv/icE1usb/e1.h
@@ -16,6 +16,7 @@
#define E1_ERR_F_ALIGN_ERR 0x01
#define E1_ERR_F_LOS 0x02
+#define E1_ERR_F_RAI 0x04
struct e1_error_count {
uint16_t crc;
diff --git a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
index 71f7236..d0d7304 100644
--- a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
+++ b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
@@ -85,9 +85,10 @@
ICE1USB_IRQ_T_ERRCNT = 1,
};
-/* Ensue ro keep those in sync with e1.h */
+/* Ensue to keep those in sync with e1.h */
#define ICE1USB_ERR_F_ALIGN_ERR 0x01
#define ICE1USB_ERR_F_LOS 0x02
+#define ICE1USB_ERR_F_RAI 0x04
struct ice1usb_irq_err {
/* 16-bit little-endian counters */
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26706
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1-hardware
Gerrit-Branch: master
Gerrit-Change-Id: Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8
Gerrit-Change-Number: 26706
Gerrit-PatchSet: 5
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20220102/61c4573c/attachment.htm>