|
typedef void(* | spi_dma_callback_t )(SPI_Type *base, spi_dma_handle_t *handle, status_t status, void *userData) |
| SPI DMA callback called at the end of transfer. More...
|
|
|
status_t | SPI_MasterTransferCreateHandleDMA (SPI_Type *base, spi_dma_handle_t *handle, spi_dma_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle) |
| Initialize the SPI master DMA handle. More...
|
|
status_t | SPI_MasterTransferDMA (SPI_Type *base, spi_dma_handle_t *handle, spi_transfer_t *xfer) |
| Perform a non-blocking SPI transfer using DMA. More...
|
|
status_t | SPI_MasterHalfDuplexTransferDMA (SPI_Type *base, spi_dma_handle_t *handle, spi_half_duplex_transfer_t *xfer) |
| Transfers a block of data using a DMA method. More...
|
|
static status_t | SPI_SlaveTransferCreateHandleDMA (SPI_Type *base, spi_dma_handle_t *handle, spi_dma_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle) |
| Initialize the SPI slave DMA handle. More...
|
|
static status_t | SPI_SlaveTransferDMA (SPI_Type *base, spi_dma_handle_t *handle, spi_transfer_t *xfer) |
| Perform a non-blocking SPI transfer using DMA. More...
|
|
void | SPI_MasterTransferAbortDMA (SPI_Type *base, spi_dma_handle_t *handle) |
| Abort a SPI transfer using DMA. More...
|
|
status_t | SPI_MasterTransferGetCountDMA (SPI_Type *base, spi_dma_handle_t *handle, size_t *count) |
| Gets the master DMA transfer remaining bytes. More...
|
|
static void | SPI_SlaveTransferAbortDMA (SPI_Type *base, spi_dma_handle_t *handle) |
| Abort a SPI transfer using DMA. More...
|
|
static status_t | SPI_SlaveTransferGetCountDMA (SPI_Type *base, spi_dma_handle_t *handle, size_t *count) |
| Gets the slave DMA transfer remaining bytes. More...
|
|
This section describes the programming interface of the SPI DMA driver.
typedef void(* spi_dma_callback_t)(SPI_Type *base, spi_dma_handle_t *handle, status_t status, void *userData) |
This function initializes the SPI master DMA handle which can be used for other SPI master transactional APIs. Usually, for a specified SPI instance, user need only call this API once to get the initialized handle.
- Parameters
-
base | SPI peripheral base address. |
handle | SPI handle pointer. |
callback | User callback function called at the end of a transfer. |
userData | User data for callback. |
txHandle | DMA handle pointer for SPI Tx, the handle shall be static allocated by users. |
rxHandle | DMA handle pointer for SPI Rx, the handle shall be static allocated by users. |
- Note
- This interface returned immediately after transfer initiates, users should call SPI_GetTransferStatus to poll the transfer status to check whether SPI transfer finished.
- Parameters
-
base | SPI peripheral base address. |
handle | SPI DMA handle pointer. |
xfer | Pointer to dma transfer structure. |
- Return values
-
kStatus_Success | Successfully start a transfer. |
kStatus_InvalidArgument | Input argument is invalid. |
kStatus_SPI_Busy | SPI is not idle, is running another transfer. |
This function using polling way to do the first half transimission and using DMA way to do the srcond half transimission, the transfer mechanism is half-duplex. When do the second half transimission, code will return right away. When all data is transferred, the callback function is called.
- Parameters
-
base | SPI base pointer |
handle | A pointer to the spi_master_dma_handle_t structure which stores the transfer state. |
transfer | A pointer to the spi_half_duplex_transfer_t structure. |
- Returns
- status of status_t.
This function initializes the SPI slave DMA handle which can be used for other SPI master transactional APIs. Usually, for a specified SPI instance, user need only call this API once to get the initialized handle.
- Parameters
-
base | SPI peripheral base address. |
handle | SPI handle pointer. |
callback | User callback function called at the end of a transfer. |
userData | User data for callback. |
txHandle | DMA handle pointer for SPI Tx, the handle shall be static allocated by users. |
rxHandle | DMA handle pointer for SPI Rx, the handle shall be static allocated by users. |
- Note
- This interface returned immediately after transfer initiates, users should call SPI_GetTransferStatus to poll the transfer status to check whether SPI transfer finished.
- Parameters
-
base | SPI peripheral base address. |
handle | SPI DMA handle pointer. |
xfer | Pointer to dma transfer structure. |
- Return values
-
kStatus_Success | Successfully start a transfer. |
kStatus_InvalidArgument | Input argument is invalid. |
kStatus_SPI_Busy | SPI is not idle, is running another transfer. |
void SPI_MasterTransferAbortDMA |
( |
SPI_Type * |
base, |
|
|
spi_dma_handle_t * |
handle |
|
) |
| |
- Parameters
-
base | SPI peripheral base address. |
handle | SPI DMA handle pointer. |
status_t SPI_MasterTransferGetCountDMA |
( |
SPI_Type * |
base, |
|
|
spi_dma_handle_t * |
handle, |
|
|
size_t * |
count |
|
) |
| |
This function gets the master DMA transfer remaining bytes.
- Parameters
-
base | SPI peripheral base address. |
handle | A pointer to the spi_dma_handle_t structure which stores the transfer state. |
count | A number of bytes transferred by the non-blocking transaction. |
- Returns
- status of status_t.
static void SPI_SlaveTransferAbortDMA |
( |
SPI_Type * |
base, |
|
|
spi_dma_handle_t * |
handle |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | SPI peripheral base address. |
handle | SPI DMA handle pointer. |
static status_t SPI_SlaveTransferGetCountDMA |
( |
SPI_Type * |
base, |
|
|
spi_dma_handle_t * |
handle, |
|
|
size_t * |
count |
|
) |
| |
|
inlinestatic |
This function gets the slave DMA transfer remaining bytes.
- Parameters
-
base | SPI peripheral base address. |
handle | A pointer to the spi_dma_handle_t structure which stores the transfer state. |
count | A number of bytes transferred by the non-blocking transaction. |
- Returns
- status of status_t.