NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Data Structures
neorv32_sdi.h File Reference

Serial data interface controller (SPPI) HW driver header file. More...

Go to the source code of this file.

Data Structures

struct  neorv32_sdi_t
 

Functions

Prototypes
int neorv32_sdi_available (void)
 
void neorv32_sdi_setup (uint32_t irq_mask)
 
void neorv32_sdi_rx_clear (void)
 
void neorv32_sdi_disable (void)
 
void neorv32_sdi_enable (void)
 
int neorv32_sdi_get_fifo_depth (void)
 
int neorv32_sdi_put (uint8_t data)
 
void neorv32_sdi_put_nonblocking (uint8_t data)
 
int neorv32_sdi_get (uint8_t *data)
 
uint8_t neorv32_sdi_get_nonblocking (void)
 

IO Device: Serial Data Interface (SDI)

#define NEORV32_SDI   ((neorv32_sdi_t*) (NEORV32_SDI_BASE))
 
enum  NEORV32_SDI_CTRL_enum {
  SDI_CTRL_EN = 0 , SDI_CTRL_CLR_RX = 1 , SDI_CTRL_FIFO_LSB = 4 , SDI_CTRL_FIFO_MSB = 7 ,
  SDI_CTRL_IRQ_RX_AVAIL = 15 , SDI_CTRL_IRQ_RX_HALF = 16 , SDI_CTRL_IRQ_RX_FULL = 17 , SDI_CTRL_IRQ_TX_EMPTY = 18 ,
  SDI_CTRL_RX_AVAIL = 23 , SDI_CTRL_RX_HALF = 24 , SDI_CTRL_RX_FULL = 25 , SDI_CTRL_TX_EMPTY = 26 ,
  SDI_CTRL_TX_FULL = 27
}
 

Detailed Description

Serial data interface controller (SPPI) HW driver header file.

Note
These functions should only be used if the SDI unit was synthesized (IO_SDI_EN = true).

Macro Definition Documentation

◆ NEORV32_SDI

#define NEORV32_SDI   ((neorv32_sdi_t*) (NEORV32_SDI_BASE))

SDI module hardware access (neorv32_sdi_t)

Enumeration Type Documentation

◆ NEORV32_SDI_CTRL_enum

SDI control register bits

Enumerator
SDI_CTRL_EN 

SDI control register(00) (r/w): SID module enable

SDI_CTRL_CLR_RX 

SDI control register(01) (-/w): Clear RX FIFO when set, auto-clear

SDI_CTRL_FIFO_LSB 

SDI control register(04) (r/-): log2 of SDI FIFO size, LSB

SDI_CTRL_FIFO_MSB 

SDI control register(07) (r/-): log2 of SDI FIFO size, MSB

SDI_CTRL_IRQ_RX_AVAIL 

SDI control register(15) (r/w): IRQ when RX FIFO not empty

SDI_CTRL_IRQ_RX_HALF 

SDI control register(16) (r/w): IRQ when RX FIFO at least half full

SDI_CTRL_IRQ_RX_FULL 

SDI control register(17) (r/w): IRQ when RX FIFO full

SDI_CTRL_IRQ_TX_EMPTY 

SDI control register(18) (r/w): IRQ when TX FIFO empty

SDI_CTRL_RX_AVAIL 

SDI control register(23) (r/-): RX FIFO not empty

SDI_CTRL_RX_HALF 

SDI control register(24) (r/-): RX FIFO at least half full

SDI_CTRL_RX_FULL 

SDI control register(25) (r/-): RX FIFO full

SDI_CTRL_TX_EMPTY 

SDI control register(26) (r/-): TX FIFO empty

SDI_CTRL_TX_FULL 

SDI control register(27) (r/-): TX FIFO full

Function Documentation

◆ neorv32_sdi_available()

int neorv32_sdi_available ( void )

Check if SDI unit was synthesized.

Returns
0 if SDI was not synthesized, 1 if SPI is available.

◆ neorv32_sdi_disable()

void neorv32_sdi_disable ( void )

Disable SDI controller.

◆ neorv32_sdi_enable()

void neorv32_sdi_enable ( void )

Enable SDI controller.

◆ neorv32_sdi_get()

int neorv32_sdi_get ( uint8_t * data)

Get data from SDI input FIFO.

Parameters
[in,out]Pointerfro data byte read from RX FIFO.
Returns
-1 if RX FIFO is empty.

◆ neorv32_sdi_get_fifo_depth()

int neorv32_sdi_get_fifo_depth ( void )

Get SDI FIFO depth.

Returns
FIFO depth (number of entries), zero if no FIFO implemented

◆ neorv32_sdi_get_nonblocking()

uint8_t neorv32_sdi_get_nonblocking ( void )

Get data from SDI input FIFO (ignoring RX FIFO status).

Parameters
[in]dataByte read from RX FIFO.

◆ neorv32_sdi_put()

int neorv32_sdi_put ( uint8_t data)

Push data to SDI output FIFO.

Parameters
[in]dataByte to push into TX FIFO.
Returns
-1 if TX FIFO is full.

◆ neorv32_sdi_put_nonblocking()

void neorv32_sdi_put_nonblocking ( uint8_t data)

Push data to SDI output FIFO (ignoring TX FIFO status).

Parameters
[in]dataByte to push into TX FIFO.

◆ neorv32_sdi_rx_clear()

void neorv32_sdi_rx_clear ( void )

Clear SDI receive FIFO.

◆ neorv32_sdi_setup()

void neorv32_sdi_setup ( uint32_t irq_mask)

Reset, enable and configure SDI controller. The SDI control register bits are listed in NEORV32_SDI_CTRL_enum.

Parameters
[in]irq_maskInterrupt configuration mask (CTRL's irq_* bits).