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 uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/21715 )
Change subject: icE1usb fw: Expose error conditions from E1 driver
......................................................................
icE1usb fw: Expose error conditions from E1 driver
This will allow the USB interface code to report the errors to the
host PC.
Change-Id: Iba3e00a2b28a2fef6dbd986bfc706c1619c3a3ed
---
M firmware/ice40-riscv/icE1usb/e1.c
M firmware/ice40-riscv/icE1usb/e1.h
2 files changed, 22 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/15/21715/1
diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c
index 5d4d3ee..83cbd92 100644
--- a/firmware/ice40-riscv/icE1usb/e1.c
+++ b/firmware/ice40-riscv/icE1usb/e1.c
@@ -291,6 +291,7 @@
int in_flight;
enum e1_pipe_state state;
} tx;
+ uint32_t errors; /* E1_ERR_ bitmask */
} g_e1;
@@ -395,6 +396,15 @@
return e1f_valid_frames(&g_e1.rx.fifo);
}
+/* get cumulative error bit mask since last call of this function */
+uint32_t
+e1_get_and_clear_errors(void)
+{
+ uint32_t err = g_e1.errors;
+ g_e1.errors = 0;
+ return err;
+}
+
void
e1_poll(void)
{
@@ -421,8 +431,10 @@
while ( (bd = e1_regs->rx.bd) & E1_BD_VALID ) {
/* FIXME: CRC status ? */
e1f_multiframe_write_commit(&g_e1.rx.fifo);
- if ((bd & (E1_BD_CRC0 | E1_BD_CRC1)) != (E1_BD_CRC0 | E1_BD_CRC1))
+ if ((bd & (E1_BD_CRC0 | E1_BD_CRC1)) != (E1_BD_CRC0 | E1_BD_CRC1)) {
printf("b: %03x\n", bd);
+ g_e1.errors |= E1_ERR_CRC;
+ }
g_e1.rx.in_flight--;
}
@@ -441,6 +453,7 @@
if (!(e1_regs->rx.csr & E1_RX_SR_ALIGNED)) {
printf("[!] E1 rx misalign\n");
g_e1.rx.state = RECOVER;
+ g_e1.errors |= E1_ERR_ALIGN;
}
}
@@ -449,6 +462,7 @@
if (e1_regs->rx.csr & E1_RX_SR_OVFL) {
printf("[!] E1 overflow %d\n", g_e1.rx.in_flight);
g_e1.rx.state = RECOVER;
+ g_e1.errors |= E1_ERR_OVFL;
}
}
@@ -480,6 +494,7 @@
if (e1_regs->tx.csr & E1_TX_SR_UNFL) {
printf("[!] E1 underflow %d\n", g_e1.tx.in_flight);
g_e1.tx.state = RECOVER;
+ g_e1.errors |= E1_ERR_UNFL;
}
}
diff --git a/firmware/ice40-riscv/icE1usb/e1.h b/firmware/ice40-riscv/icE1usb/e1.h
index e68514f..c56cf0c 100644
--- a/firmware/ice40-riscv/icE1usb/e1.h
+++ b/firmware/ice40-riscv/icE1usb/e1.h
@@ -11,5 +11,11 @@
void e1_poll(void);
void e1_debug_print(bool data);
+#define E1_ERR_ALIGN 0x01 /* at least one alignment error */
+#define E1_ERR_CRC 0x02 /* at least one CRC error */
+#define E1_ERR_OVFL 0x04 /* at least one Rx overflow */
+#define E1_ERR_UNFL 0x08 /* at least one Tx underflow */
+uint32_t e1_get_and_clear_errors(void);
+
volatile uint8_t *e1_data_ptr(int mf, int frame, int ts);
unsigned int e1_data_ofs(int mf, int frame, int ts);
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/21715
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: Iba3e00a2b28a2fef6dbd986bfc706c1619c3a3ed
Gerrit-Change-Number: 21715
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201214/03339337/attachment.htm>