|
PER Firmware
|
G4 SPI. More...
#include "common/phal_G4/spi/spi.h"#include "common/phal_G4/spi/spi_priv.h"#include "common/phal_G4/gpio/gpio.h"#include "common/phal_G4/dma/dma.h"#include "common/utils/clamp.h"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 |
G4 SPI.
| bool PHAL_SPI_busy | ( | const SPI_InitConfig_t * | cfg | ) |
Check whether the SPI peripheral is busy.
| cfg | SPI configuration. |
| bool PHAL_SPI_init | ( | SPI_InitConfig_t * | handle | ) |
Initilize SPI peripheral with the configuired structure.
Initialize an SPI peripheral for DMA-based transfers.
| handle | SPI handle to configure. |
Peripheral configuration (See RM0440 42.5.7 Configuration of SPI section)
| 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.
| spi | SPI configuration. |
| out_data | Transmit buffer, or NULL to transmit dummy (zero) bytes. |
| in_data | Receive buffer, or NULL to discard received bytes. |
| data_len | Number of bytes to transfer (includes both TX and RX). |
| 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.
| spi | SPI configuration. |
| out_data | Transmit buffer, or NULL to transmit dummy (zero) bytes. |
| in_data | Receive buffer, or NULL to discard received bytes. |
| data_len | Number of bytes to transfer (includes both TX and RX). |
| 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.
| spi | SPI configuration that completed the transfer. |
|
static |
|
static |
|
static |