icE1usb fw: Expose error conditions from E1 driver
This will allow the USB interface code to report the errors to the
host PC.
Related: OS#4674
Change-Id: Iba3e00a2b28a2fef6dbd986bfc706c1619c3a3ed
diff --git a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
index 61e12ad..71f7236 100644
--- a/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
+++ b/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
@@ -75,3 +75,32 @@
struct ice1usb_rx_config {
uint8_t mode; /*!< enum ice1usb_rx_mode */
} __attribute__((packed));
+
+
+/***********************************************************************
+ * Interrupt Endpoint
+ ***********************************************************************/
+
+enum ice1usb_irq_type {
+ ICE1USB_IRQ_T_ERRCNT = 1,
+};
+
+/* Ensue ro keep those in sync with e1.h */
+#define ICE1USB_ERR_F_ALIGN_ERR 0x01
+#define ICE1USB_ERR_F_LOS 0x02
+
+struct ice1usb_irq_err {
+ /* 16-bit little-endian counters */
+ uint16_t crc;
+ uint16_t align;
+ uint16_t ovfl;
+ uint16_t unfl;
+ uint8_t flags;
+} __attribute__((packed));
+
+struct ice1usb_irq {
+ uint8_t type; /*!< enum ice1usb_irq_type */
+ union {
+ struct ice1usb_irq_err errors;
+ } u;
+} __attribute__((packed));