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@246tNt.com>
Change-Id: I425c38e93fb235d5c5fc6f3a5027ac49cf3466d9
This commit is contained in:
Sylvain Munaut 2022-01-10 12:44:53 +01:00
parent ace0932340
commit 29d82097d7
1 changed files with 11 additions and 4 deletions

View File

@ -58,13 +58,20 @@ struct e1_fifo {
/* 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 @@ e1_init(int port, uint16_t rx_cr, uint16_t tx_cr)
/* 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);