NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
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, uint8_t csn, void *spi, uint32_t len)
 
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,
uint8_t csn,
void * spi,
uint32_t len )

Starts ISR driven read/write SPI transfer.

Parameters
[in,out]*selfSPI driver common data handle. See t_neorv32_spi.
[in]csnUsed chip select index for transfer.
[in,out]*spiwrite/read data buffer for SPI. Before transmission contents the write data and after the read data.
[in]lennumber of bytes to transfer.
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.