![]() |
API Reference
The NEORV32 RISC-V Processor
|
Two-Wire Device Controller (TWD) HW driver header file. More...
Go to the source code of this file.
Data Structures | |
| struct | neorv32_twd_t |
Functions | |
Prototypes | |
| int | neorv32_twd_available (void) |
| void | neorv32_twd_setup (int device_addr, int fsel, uint32_t irq_mask) |
| void | neorv32_twd_irq_config (int enable, uint32_t irq_mask) |
| int | neorv32_twd_get_rx_fifo_depth (void) |
| int | neorv32_twd_get_tx_fifo_depth (void) |
| void | neorv32_twd_disable (void) |
| void | neorv32_twd_enable (void) |
| void | neorv32_twd_clear_rx (void) |
| void | neorv32_twd_clear_tx (void) |
| int | neorv32_twd_com_state (void) |
| int | neorv32_twd_com_started (void) |
| int | neorv32_twd_com_ended (void) |
| int | neorv32_twd_rx_available (void) |
| int | neorv32_twd_rx_full (void) |
| int | neorv32_twd_tx_empty (void) |
| int | neorv32_twd_tx_full (void) |
| void | neorv32_twd_put (uint8_t data) |
| uint8_t | neorv32_twd_get (void) |
IO Device: Two-Wire Device Controller (TWD) | |
| #define | NEORV32_TWD ((neorv32_twd_t*) (NEORV32_TWD_BASE)) |
| enum | NEORV32_TWD_CTRL_enum { TWD_CTRL_EN = 0 , TWD_CTRL_CLR_RX = 1 , TWD_CTRL_CLR_TX = 2 , TWD_CTRL_FSEL = 3 , TWD_CTRL_DEV_ADDR0 = 4 , TWD_CTRL_DEV_ADDR6 = 10 , TWD_CTRL_IRQ_RX_AVAIL = 11 , TWD_CTRL_IRQ_RX_FULL = 12 , TWD_CTRL_IRQ_TX_EMPTY = 13 , TWD_CTRL_IRQ_TX_NFULL = 14 , TWD_CTRL_IRQ_COM_BEG = 15 , TWD_CTRL_IRQ_COM_END = 16 , TWD_CTRL_RX_FIFO_LSB = 17 , TWD_CTRL_RX_FIFO_MSB = 20 , TWD_CTRL_TX_FIFO_LSB = 21 , TWD_CTRL_TX_FIFO_MSB = 24 , TWD_CTRL_RX_AVAIL = 25 , TWD_CTRL_RX_FULL = 26 , TWD_CTRL_TX_EMPTY = 27 , TWD_CTRL_TX_FULL = 28 , TWD_CTRL_COM_BEG = 29 , TWD_CTRL_COM_END = 30 , TWD_CTRL_COM = 31 } |
| enum | NEORV32_TWD_DATA_enum { TWD_DATA_LSB = 0 , TWD_DATA_MSB = 7 } |
Two-Wire Device Controller (TWD) HW driver header file.
| #define NEORV32_TWD ((neorv32_twd_t*) (NEORV32_TWD_BASE)) |
TWD module hardware handle (neorv32_twd_t)
TWD control register bits
| int neorv32_twd_available | ( | void | ) |
Check if TWD unit was synthesized.
| void neorv32_twd_clear_rx | ( | void | ) |
Clear TWD RX FIFO.
| void neorv32_twd_clear_tx | ( | void | ) |
Clear TWD TX FIFO.
| int neorv32_twd_com_ended | ( | void | ) |
Check if the TWD communication has ended. This function also clears the "communication ended" flag it it was set.
| int neorv32_twd_com_started | ( | void | ) |
Check if the TWD communication has started. This function also clears the "communication started" flag it it was set.
| int neorv32_twd_com_state | ( | void | ) |
Check if a TWD communication is active.
| void neorv32_twd_disable | ( | void | ) |
Disable TWD controller.
| void neorv32_twd_enable | ( | void | ) |
Enable TWD controller.
| uint8_t neorv32_twd_get | ( | void | ) |
Get data byte from RX FIFO.
| int neorv32_twd_get_rx_fifo_depth | ( | void | ) |
Get TWD RX FIFO depth.
| int neorv32_twd_get_tx_fifo_depth | ( | void | ) |
Get TWD TX FIFO depth.
| void neorv32_twd_irq_config | ( | int | enable, |
| uint32_t | irq_mask ) |
Enable/disable IRQ TWD source(s).
| [in] | enable | Enable IRQ source(s) when non-zero, disable when zero. |
| [in] | irq_mask | Interrupt configuration bit mask (TWD_CTRL_IRQ_* bits). |
| void neorv32_twd_put | ( | uint8_t | data | ) |
Put data byte into TX FIFO.
| [in] | data | Data byte to be stored in TX FIFO. |
| int neorv32_twd_rx_available | ( | void | ) |
Check if RX data available.
| int neorv32_twd_rx_full | ( | void | ) |
Check if RX FIFO is full.
| void neorv32_twd_setup | ( | int | device_addr, |
| int | fsel, | ||
| uint32_t | irq_mask ) |
Enable and configure TWD controller. The TWD control register bits are listed in NEORV32_TWD_CTRL_enum.
| [in] | device_addr | 7-bit device address. |
| [in] | fsel | Bus sample clock / filter select. |
| [in] | irq_mask | Interrupt configuration bit mask (TWD_CTRL_IRQ_* bits). |
| int neorv32_twd_tx_empty | ( | void | ) |
Check if TX FIFO is empty.
| int neorv32_twd_tx_full | ( | void | ) |
Check if TX FIFO is full.