NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
neorv32_spi_irq.h File Reference

Addition to neorv32_spi.h, which provides an IRQ driven data flow. More...

Go to the source code of this file.

Data Structures

struct  t_neorv32_spi
 

Macros

#define min(a, b)
 

Typedefs

typedef struct t_neorv32_spi t_neorv32_spi
 

Functions

void neorv32_spi_init (t_neorv32_spi *self)
 
void neorv32_spi_isr (t_neorv32_spi *self)
 
int neorv32_spi_rw (t_neorv32_spi *self, void *spi, uint8_t csn, uint32_t num_elem, uint8_t data_byte)
 
int neorv32_spi_rw_busy (t_neorv32_spi *self)
 

Detailed Description

Addition to neorv32_spi.h, which provides an IRQ driven data flow.

Author
Andreas Kaeberlein
Note
These functions should only be used if the SPI unit was synthesized (IO_SPI_EN = true).

Macro Definition Documentation

◆ min

#define min (   a,
 
)
Value:
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })

Function Documentation

◆ neorv32_spi_init()

void neorv32_spi_init ( t_neorv32_spi self)

Initializes SPI flow control handle. The data structure elements are listed in t_neorv32_spi.

Parameters
[in,out]*selfSPI driver common data handle. See t_neorv32_spi.

◆ neorv32_spi_isr()

void neorv32_spi_isr ( t_neorv32_spi self)

SPI interrupt service routine. The data structure elements are listed in t_neorv32_spi.

Parameters
[in,out]*selfSPI driver common data handle. See t_neorv32_spi.

◆ neorv32_spi_rw()

int neorv32_spi_rw ( t_neorv32_spi self,
void *  spi,
uint8_t  csn,
uint32_t  num_elem,
uint8_t  data_byte 
)

Starts ISR driven read/write SPI transfer.

Parameters
[in,out]*selfSPI driver common data handle. See t_neorv32_spi.
[in,out]*spiwrite/read data buffer for SPI. Before transmission contents the write data and after the read data.
[in]csnUsed chip select index for transfer.
[in]num_elemNumber of elements to transfer.
[in]data_byteNumber of data bytes per element in *spi.
Returns
int status of function.
Return values
0new transfer started.
1transfer active, refused request.
2unsupported data size, only 1/2/4 allowed.

◆ neorv32_spi_rw_busy()

int neorv32_spi_rw_busy ( t_neorv32_spi self)

Check if transfer is active. see neorv32_spi_rw

Parameters
[in,out]*selfSPI driver common data handle. See t_neorv32_spi.
Returns
int status of function.
Return values
0idle.
1busy.