icE1usb fw: Misc cosmetic cleanup in e1.{c,h} / usb_e1.c
Moving things around, comments, spacing, ... nothing functional.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Icc2a6ef6b03c89dd92e661a01d219e42dbf7067d
diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c
index 59be063..6a4c73c 100644
--- a/firmware/ice40-riscv/icE1usb/e1.c
+++ b/firmware/ice40-riscv/icE1usb/e1.c
@@ -18,9 +18,16 @@
#include "led.h" // FIXME
+// HW access
+// ---------
+
static volatile struct e1_core * const e1_regs = (void *)(E1_CORE_BASE);
static volatile uint8_t * const e1_data = (void *)(E1_DATA_BASE);
+
+// Helpers
+// -------
+
static unsigned int
e1_data_ofs(int mf, int frame, int ts)
{
@@ -33,6 +40,7 @@
return &e1_data[e1_data_ofs(mf, frame, ts)];
}
+
// FIFOs
// -----
/* Note: FIFO works at 'frame' level (i.e. 32 bytes) */
@@ -98,7 +106,6 @@
return (ofs >> 4);
}
-
/* Debug */
static void
e1f_debug(struct e1_fifo *fifo, const char *name)
@@ -207,7 +214,6 @@
}
-
// Main logic
// ----------
@@ -232,12 +238,11 @@
int in_flight;
enum e1_pipe_state state;
} tx;
+
struct e1_error_count errors;
} g_e1;
-
-
void
e1_init(uint16_t rx_cr, uint16_t tx_cr)
{
@@ -285,8 +290,6 @@
e1_regs->rx.csr = g_e1.rx.cr;
}
-#include "dma.h"
-
unsigned int
e1_rx_need_data(unsigned int usb_addr, unsigned int max_frames, unsigned int *pos)
{