NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Functions
neorv32_spi_irq.c File Reference

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

#include "neorv32.h"
#include "neorv32_spi_irq.h"

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.c, 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).

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.