NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_sdi.c File Reference

Serial data interface controller (SDI) HW driver source file. More...

#include "neorv32.h"
#include "neorv32_sdi.h"

Functions

int neorv32_sdi_available (void)
 
void neorv32_sdi_setup (uint32_t irq_mask)
 
void neorv32_sdi_disable (void)
 
void neorv32_sdi_enable (void)
 
int neorv32_sdi_get_fifo_depth (void)
 
int neorv32_sdi_put (uint8_t data)
 
int neorv32_sdi_get (uint8_t *data)
 
int neorv32_sdi_check_cs (void)
 

Detailed Description

Serial data interface controller (SDI) HW driver source file.

Note
These functions should only be used if the SDI unit was synthesized (IO_SDI_EN = true).
See also
https://stnolting.github.io/neorv32/sw/files.html

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_check_cs()

int neorv32_sdi_check_cs ( void )

Get status of chip-select line.

Returns
1 if chip-select line is enabled/active (driven low), 0 otherwise.

◆ 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, 0 if success.

◆ neorv32_sdi_get_fifo_depth()

int neorv32_sdi_get_fifo_depth ( void )

Get SDI FIFO depth.

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

◆ 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, 0 if success.

◆ 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).