PER Firmware
Loading...
Searching...
No Matches
spi.c File Reference

G4 SPI. More...

Include dependency graph for spi.c:

Functions

void PHAL_SPI_txCallback (SPI_InitConfig_t *spi)
 Weak callback fired when a DMA-backed SPI transfer completes.
 
static void spi_tx_dma_callback (void *ctx)
 
bool PHAL_SPI_init (SPI_InitConfig_t *cfg)
 Initilize SPI peripheral with the configuired structure.
 
void PHAL_SPI_transfer (SPI_InitConfig_t *spi, const uint8_t *out_data, uint8_t *in_data, uint32_t data_len)
 Start a DMA-backed SPI transfer.
 
void PHAL_SPI_transferBlocking (SPI_InitConfig_t *spi, const uint8_t *out_data, uint8_t *in_data, uint32_t data_len)
 Perform a blocking DMA-backed SPI transfer. (Wrapper around PHAL_SPI_transfer.)
 
bool PHAL_SPI_busy (const SPI_InitConfig_t *cfg)
 Check whether the SPI peripheral is busy.
 

Variables

static uint16_t trash_can
 
static uint16_t zero
 

Detailed Description

G4 SPI.

Author
Ronak Jain (jain7.nosp@m.17@p.nosp@m.urdue.nosp@m..edu)
Shriya Balu (balu@.nosp@m.purd.nosp@m.ue.ed.nosp@m.u)
Version
0.1

Function Documentation

◆ PHAL_SPI_busy()

bool PHAL_SPI_busy ( const SPI_InitConfig_t * cfg)

Check whether the SPI peripheral is busy.

Parameters
cfgSPI configuration.
Returns
true if a transfer is currently in progress.

◆ PHAL_SPI_init()

bool PHAL_SPI_init ( SPI_InitConfig_t * handle)

Initilize SPI peripheral with the configuired structure.

Initialize an SPI peripheral for DMA-based transfers.

Parameters
handleSPI handle to configure.
Returns
true
false

Peripheral configuration (See RM0440 42.5.7 Configuration of SPI section)

Here is the call graph for this function:

◆ PHAL_SPI_transfer()

void PHAL_SPI_transfer ( SPI_InitConfig_t * spi,
const uint8_t * out_data,
uint8_t * in_data,
uint32_t data_len )

Start a DMA-backed SPI transfer.

Non-blocking: returns immediately after the DMA transfer has been started. If another transfer is already in progress, block until it completes before starting the new transfer.

Passing NULL for either buffer transmits or receives dummy data.

Parameters
spiSPI configuration.
out_dataTransmit buffer, or NULL to transmit dummy (zero) bytes.
in_dataReceive buffer, or NULL to discard received bytes.
data_lenNumber of bytes to transfer (includes both TX and RX).
Here is the call graph for this function:

◆ PHAL_SPI_transferBlocking()

void PHAL_SPI_transferBlocking ( SPI_InitConfig_t * spi,
const uint8_t * out_data,
uint8_t * in_data,
uint32_t data_len )

Perform a blocking DMA-backed SPI transfer. (Wrapper around PHAL_SPI_transfer.)

Blocks until the SPI peripheral is available, starts the transfer, and does not return until the transfer has completed.

Passing NULL for either buffer transmits or receives dummy data.

Parameters
spiSPI configuration.
out_dataTransmit buffer, or NULL to transmit dummy (zero) bytes.
in_dataReceive buffer, or NULL to discard received bytes.
data_lenNumber of bytes to transfer (includes both TX and RX).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_SPI_txCallback()

void PHAL_SPI_txCallback ( SPI_InitConfig_t * spi)

Weak callback fired when a DMA-backed SPI transfer completes.

Called after the transfer has completed and the SPI handle has been marked idle.

Default implementation does nothing.

Parameters
spiSPI configuration that completed the transfer.
Here is the caller graph for this function:

◆ spi_tx_dma_callback()

static void spi_tx_dma_callback ( void * ctx)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ trash_can

uint16_t trash_can
static

◆ zero

uint16_t zero
static