NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
|
Two-Wire Device Controller (TWD) HW driver header file. More...
#include <stdint.h>
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, int irq_rx_avail, int irq_rx_full, int irq_tx_empty) |
int | neorv32_twd_get_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_sense_scl (void) |
int | neorv32_twd_sense_sda (void) |
int | neorv32_twd_busy (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_FIFO_LSB = 15 , TWD_CTRL_FIFO_MSB = 18 , TWD_CTRL_RX_AVAIL = 25 , TWD_CTRL_RX_FULL = 26 , TWD_CTRL_TX_EMPTY = 27 , TWD_CTRL_TX_FULL = 28 , TWD_CTRL_SENSE_SCL = 29 , TWD_CTRL_SENSE_SDA = 30 , TWD_CTRL_BUSY = 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 access (neorv32_twd_t)
TWD control register bits
int neorv32_twd_available | ( | void | ) |
Check if TWD unit was synthesized.
int neorv32_twd_busy | ( | void | ) |
Check if there is a TWD bus operation in progress.
void neorv32_twd_clear_rx | ( | void | ) |
Clear TWD RX FIFO.
void neorv32_twd_clear_tx | ( | void | ) |
Clear TWD TX FIFO.
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_fifo_depth | ( | void | ) |
Get TWD FIFO depth.
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.
int neorv32_twd_sense_scl | ( | void | ) |
Get current state of SCL bus line.
int neorv32_twd_sense_sda | ( | void | ) |
Get current state of SDA bus line.
void neorv32_twd_setup | ( | int | device_addr, |
int | fsel, | ||
int | irq_rx_avail, | ||
int | irq_rx_full, | ||
int | irq_tx_empty ) |
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_rx_avail | IRQ if RX FIFO data available. |
[in] | irq_rx_full | IRQ if RX FIFO full. |
[in] | irq_tx_empty | IRQ if TX FIFO empty. |
int neorv32_twd_tx_empty | ( | void | ) |
Check if TX FIFO is empty.
int neorv32_twd_tx_full | ( | void | ) |
Check if TX FIFO is full.