MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | sai_edma_handle_t |
SAI DMA transfer handle, users should not touch the content of the handle. More... | |
Typedefs | |
typedef void(* | sai_edma_callback_t )(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData) |
SAI eDMA transfer callback function for finish and error. | |
Driver version | |
#define | FSL_SAI_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 3, 1)) |
Version 2.3.1. | |
eDMA Transactional | |
void | SAI_TransferTxCreateHandleEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *txDmaHandle) |
Initializes the SAI eDMA handle. More... | |
void | SAI_TransferRxCreateHandleEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *rxDmaHandle) |
Initializes the SAI Rx eDMA handle. More... | |
void | SAI_TransferTxSetFormatEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz) |
Configures the SAI Tx audio format. More... | |
void | SAI_TransferRxSetFormatEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz) |
Configures the SAI Rx audio format. More... | |
void | SAI_TransferTxSetConfigEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_transceiver_t *saiConfig) |
Configures the SAI Tx. More... | |
void | SAI_TransferRxSetConfigEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_transceiver_t *saiConfig) |
Configures the SAI Rx. More... | |
status_t | SAI_TransferSendEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer) |
Performs a non-blocking SAI transfer using DMA. More... | |
status_t | SAI_TransferReceiveEDMA (I2S_Type *base, sai_edma_handle_t *handle, sai_transfer_t *xfer) |
Performs a non-blocking SAI receive using eDMA. More... | |
void | SAI_TransferTerminateSendEDMA (I2S_Type *base, sai_edma_handle_t *handle) |
Terminate all SAI send. More... | |
void | SAI_TransferTerminateReceiveEDMA (I2S_Type *base, sai_edma_handle_t *handle) |
Terminate all SAI receive. More... | |
void | SAI_TransferAbortSendEDMA (I2S_Type *base, sai_edma_handle_t *handle) |
Aborts a SAI transfer using eDMA. More... | |
void | SAI_TransferAbortReceiveEDMA (I2S_Type *base, sai_edma_handle_t *handle) |
Aborts a SAI receive using eDMA. More... | |
status_t | SAI_TransferGetSendCountEDMA (I2S_Type *base, sai_edma_handle_t *handle, size_t *count) |
Gets byte count sent by SAI. More... | |
status_t | SAI_TransferGetReceiveCountEDMA (I2S_Type *base, sai_edma_handle_t *handle, size_t *count) |
Gets byte count received by SAI. More... | |
struct sai_edma_handle |
Data Fields | |
edma_handle_t * | dmaHandle |
DMA handler for SAI send. | |
uint8_t | nbytes |
eDMA minor byte transfer count initially configured. More... | |
uint8_t | bytesPerFrame |
Bytes in a frame. | |
uint8_t | channel |
Which data channel. | |
uint8_t | count |
The transfer data count in a DMA request. | |
uint32_t | state |
Internal state for SAI eDMA transfer. | |
sai_edma_callback_t | callback |
Callback for users while transfer finish or error occurs. | |
void * | userData |
User callback parameter. | |
uint8_t | tcd [(SAI_XFER_QUEUE_SIZE+1U)*sizeof(edma_tcd_t)] |
TCD pool for eDMA transfer. More... | |
sai_transfer_t | saiQueue [SAI_XFER_QUEUE_SIZE] |
Transfer queue storing queued transfer. More... | |
size_t | transferSize [SAI_XFER_QUEUE_SIZE] |
Data bytes need to transfer. | |
volatile uint8_t | queueUser |
Index for user to queue transfer. More... | |
volatile uint8_t | queueDriver |
Index for driver to get the transfer data and size. | |
uint8_t sai_edma_handle_t::nbytes |
uint8_t sai_edma_handle_t::tcd[(SAI_XFER_QUEUE_SIZE+1U)*sizeof(edma_tcd_t)] |
sai_transfer_t sai_edma_handle_t::saiQueue[SAI_XFER_QUEUE_SIZE] |
volatile uint8_t sai_edma_handle_t::queueUser |
void SAI_TransferTxCreateHandleEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_edma_callback_t | callback, | ||
void * | userData, | ||
edma_handle_t * | txDmaHandle | ||
) |
This function initializes the SAI master DMA handle, which can be used for other SAI master transactional APIs. Usually, for a specified SAI instance, call this API once to get the initialized handle.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
base | SAI peripheral base address. |
callback | Pointer to user callback function. |
userData | User parameter passed to the callback function. |
txDmaHandle | eDMA handle pointer, this handle shall be static allocated by users. |
void SAI_TransferRxCreateHandleEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_edma_callback_t | callback, | ||
void * | userData, | ||
edma_handle_t * | rxDmaHandle | ||
) |
This function initializes the SAI slave DMA handle, which can be used for other SAI master transactional APIs. Usually, for a specified SAI instance, call this API once to get the initialized handle.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
base | SAI peripheral base address. |
callback | Pointer to user callback function. |
userData | User parameter passed to the callback function. |
rxDmaHandle | eDMA handle pointer, this handle shall be static allocated by users. |
void SAI_TransferTxSetFormatEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_transfer_format_t * | format, | ||
uint32_t | mclkSourceClockHz, | ||
uint32_t | bclkSourceClockHz | ||
) |
The audio format can be changed at run-time. This function configures the sample rate and audio data format to be transferred. This function also sets the eDMA parameter according to formatting requirements.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
format | Pointer to SAI audio data format structure. |
mclkSourceClockHz | SAI master clock source frequency in Hz. |
bclkSourceClockHz | SAI bit clock source frequency in Hz. If bit clock source is master clock, this value should equals to masterClockHz in format. |
kStatus_Success | Audio format set successfully. |
kStatus_InvalidArgument | The input argument is invalid. |
void SAI_TransferRxSetFormatEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_transfer_format_t * | format, | ||
uint32_t | mclkSourceClockHz, | ||
uint32_t | bclkSourceClockHz | ||
) |
The audio format can be changed at run-time. This function configures the sample rate and audio data format to be transferred. This function also sets the eDMA parameter according to formatting requirements.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
format | Pointer to SAI audio data format structure. |
mclkSourceClockHz | SAI master clock source frequency in Hz. |
bclkSourceClockHz | SAI bit clock source frequency in Hz. If a bit clock source is the master clock, this value should equal to masterClockHz in format. |
kStatus_Success | Audio format set successfully. |
kStatus_InvalidArgument | The input argument is invalid. |
void SAI_TransferTxSetConfigEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_transceiver_t * | saiConfig | ||
) |
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
saiConfig | sai configurations. |
void SAI_TransferRxSetConfigEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_transceiver_t * | saiConfig | ||
) |
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
saiConfig | sai configurations. |
status_t SAI_TransferSendEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_transfer_t * | xfer | ||
) |
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
xfer | Pointer to the DMA transfer structure. |
kStatus_Success | Start a SAI eDMA send successfully. |
kStatus_InvalidArgument | The input argument is invalid. |
kStatus_TxBusy | SAI is busy sending data. |
status_t SAI_TransferReceiveEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
sai_transfer_t * | xfer | ||
) |
base | SAI base pointer |
handle | SAI eDMA handle pointer. |
xfer | Pointer to DMA transfer structure. |
kStatus_Success | Start a SAI eDMA receive successfully. |
kStatus_InvalidArgument | The input argument is invalid. |
kStatus_RxBusy | SAI is busy receiving data. |
void SAI_TransferTerminateSendEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle | ||
) |
This function will clear all transfer slots buffered in the sai queue. If users only want to abort the current transfer slot, please call SAI_TransferAbortSendEDMA.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
void SAI_TransferTerminateReceiveEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle | ||
) |
This function will clear all transfer slots buffered in the sai queue. If users only want to abort the current transfer slot, please call SAI_TransferAbortReceiveEDMA.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
void SAI_TransferAbortSendEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle | ||
) |
This function only aborts the current transfer slots, the other transfer slots' information still kept in the handler. If users want to terminate all transfer slots, just call SAI_TransferTerminateSendEDMA.
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
void SAI_TransferAbortReceiveEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle | ||
) |
This function only aborts the current transfer slots, the other transfer slots' information still kept in the handler. If users want to terminate all transfer slots, just call SAI_TransferTerminateReceiveEDMA.
base | SAI base pointer |
handle | SAI eDMA handle pointer. |
status_t SAI_TransferGetSendCountEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
size_t * | count | ||
) |
base | SAI base pointer. |
handle | SAI eDMA handle pointer. |
count | Bytes count sent by SAI. |
kStatus_Success | Succeed get the transfer count. |
kStatus_NoTransferInProgress | There is no non-blocking transaction in progress. |
status_t SAI_TransferGetReceiveCountEDMA | ( | I2S_Type * | base, |
sai_edma_handle_t * | handle, | ||
size_t * | count | ||
) |
base | SAI base pointer |
handle | SAI eDMA handle pointer. |
count | Bytes count received by SAI. |
kStatus_Success | Succeed get the transfer count. |
kStatus_NoTransferInProgress | There is no non-blocking transaction in progress. |