ice1usb: define e1_data_ptr() using e1_data_ofs()
It's best to compute the offset only at one place and use that
computation elsewhere.
Change-Id: I9a6cce07ea8b6eff1527215de00621da960b0472
diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c
index e5108ce..776edba 100644
--- a/firmware/ice40-riscv/icE1usb/e1.c
+++ b/firmware/ice40-riscv/icE1usb/e1.c
@@ -80,19 +80,17 @@
static volatile struct e1_core * const e1_regs = (void *)(E1_CORE_BASE);
static volatile uint8_t * const e1_data = (void *)(E1_DATA_BASE);
-
-volatile uint8_t *
-e1_data_ptr(int mf, int frame, int ts)
-{
- return &e1_data[(mf << 9) | (frame << 5) | ts];
-}
-
unsigned int
e1_data_ofs(int mf, int frame, int ts)
{
return (mf << 9) | (frame << 5) | ts;
}
+volatile uint8_t *
+e1_data_ptr(int mf, int frame, int ts)
+{
+ return &e1_data[e1_data_ofs(mf, frame, ts)];
+}
// FIFOs
// -----