laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26851
)
Change subject: icE1usb fw: Distinguish between E1 FIFO init and reset
......................................................................
icE1usb fw: Distinguish between E1 FIFO init and reset
Currently it's called 'reset' but really it's the init because
it sets up the memory allocation and such. We rename that to e1f_init
and introduce a true e1f_reset that only clears the fifo and resets
the pointers
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: I425c38e93fb235d5c5fc6f3a5027ac49cf3466d9
---
M firmware/ice40-riscv/icE1usb/e1.c
1 file changed, 11 insertions(+), 4 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 ed3e13f..1b6d978 100644
--- a/firmware/ice40-riscv/icE1usb/e1.c
+++ b/firmware/ice40-riscv/icE1usb/e1.c
@@ -58,13 +58,20 @@
/* Utils */
static void
-e1f_reset(struct e1_fifo *fifo, unsigned int base, unsigned int len)
+e1f_init(struct e1_fifo *fifo, unsigned int base, unsigned int len)
{
memset(fifo, 0x00, sizeof(struct e1_fifo));
fifo->base = base;
fifo->mask = len - 1;
}
+static void
+e1f_reset(struct e1_fifo *fifo)
+{
+ fifo->wptr[0] = fifo->wptr[1] = 0;
+ fifo->rptr[0] = fifo->rptr[1] = 0;
+}
+
static unsigned int
e1f_allocd_frames(struct e1_fifo *fifo)
{
@@ -282,9 +289,9 @@
/* Global state init */
memset(e1, 0x00, sizeof(struct e1_state));
- /* Reset FIFOs */
- e1f_reset(&e1->rx.fifo, (512 * port) + 0, 256);
- e1f_reset(&e1->tx.fifo, (512 * port) + 256, 256);
+ /* Initialize FIFOs */
+ e1f_init(&e1->rx.fifo, (512 * port) + 0, 256);
+ e1f_init(&e1->tx.fifo, (512 * port) + 256, 256);
/* Enable Rx */
e1->rx.cr = E1_RX_CR_ENABLE | (rx_cr & RXCR_PERMITTED);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26851
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: I425c38e93fb235d5c5fc6f3a5027ac49cf3466d9
Gerrit-Change-Number: 26851
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged