icE1usb fw: Reorganize functions in e1.{c,h}

RX before TX for consistency ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Idcb1890a3a3f4fd2129f73585c4ce9f8475f1e21
This commit is contained in:
Sylvain Munaut 2022-01-10 12:28:28 +01:00
parent e9fe0dca2f
commit 4fd7155e93
2 changed files with 18 additions and 18 deletions

View File

@ -299,15 +299,6 @@ e1_init(int port, uint16_t rx_cr, uint16_t tx_cr)
e1->tx.state = BOOT;
}
void
e1_tx_config(int port, uint16_t cr)
{
volatile struct e1_core *e1_regs = _get_regs(port);
struct e1_state *e1 = _get_state(port);
e1->tx.cr = (e1->tx.cr & ~TXCR_PERMITTED) | (cr & TXCR_PERMITTED);
e1_regs->tx.csr = e1->tx.cr;
}
void
e1_rx_config(int port, uint16_t cr)
{
@ -317,6 +308,15 @@ e1_rx_config(int port, uint16_t cr)
e1_regs->rx.csr = e1->rx.cr;
}
void
e1_tx_config(int port, uint16_t cr)
{
volatile struct e1_core *e1_regs = _get_regs(port);
struct e1_state *e1 = _get_state(port);
e1->tx.cr = (e1->tx.cr & ~TXCR_PERMITTED) | (cr & TXCR_PERMITTED);
e1_regs->tx.csr = e1->tx.cr;
}
unsigned int
e1_rx_need_data(int port, unsigned int usb_addr, unsigned int max_frames, unsigned int *pos)
{
@ -408,13 +408,6 @@ e1_tx_feed_data(int port, unsigned int usb_addr, unsigned int frames)
return frames;
}
unsigned int
e1_tx_level(int port)
{
struct e1_state *e1 = _get_state(port);
return e1f_valid_frames(&e1->tx.fifo);
}
unsigned int
e1_rx_level(int port)
{
@ -422,6 +415,13 @@ e1_rx_level(int port)
return e1f_valid_frames(&e1->rx.fifo);
}
unsigned int
e1_tx_level(int port)
{
struct e1_state *e1 = _get_state(port);
return e1f_valid_frames(&e1->tx.fifo);
}
const struct e1_error_count *
e1_get_error_count(int port)
{

View File

@ -14,16 +14,16 @@ void e1_init(int port, uint16_t rx_cr, uint16_t tx_cr);
void e1_poll(int port);
void e1_debug_print(int port, bool data);
void e1_tx_config(int port, uint16_t cr);
void e1_rx_config(int port, uint16_t cr);
void e1_tx_config(int port, uint16_t cr);
/* data flow */
unsigned int e1_rx_need_data(int port, unsigned int usb_addr, unsigned int max_len, unsigned int *pos);
unsigned int e1_tx_feed_data(int port, unsigned int usb_addr, unsigned int len);
unsigned int e1_tx_level(int port);
unsigned int e1_rx_level(int port);
unsigned int e1_tx_level(int port);
/* error reporting */