MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

Data Structures

struct  esai_edma_handle_t
 ESAI DMA transfer handle, users should not touch the content of the handle. More...
 

Typedefs

typedef void(* esai_edma_callback_t )(ESAI_Type *base, esai_edma_handle_t *handle, status_t status, void *userData)
 ESAI eDMA transfer callback function for finish and error.
 

eDMA Transactional

void ESAI_TransferTxCreateHandleEDMA (ESAI_Type *base, esai_edma_handle_t *handle, esai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
 Initializes the ESAI eDMA handle. More...
 
void ESAI_TransferRxCreateHandleEDMA (ESAI_Type *base, esai_edma_handle_t *handle, esai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
 Initializes the ESAI Rx eDMA handle. More...
 
void ESAI_TransferTxSetFormatEDMA (ESAI_Type *base, esai_edma_handle_t *handle, esai_format_t *format, uint32_t hckClockHz, uint32_t hclkSourceClockHz)
 Configures the ESAI Tx audio format. More...
 
void ESAI_TransferRxSetFormatEDMA (ESAI_Type *base, esai_edma_handle_t *handle, esai_format_t *format, uint32_t hckClockHz, uint32_t hclkSourceClockHz)
 Configures the ESAI Rx audio format. More...
 
status_t ESAI_TransferSendEDMA (ESAI_Type *base, esai_edma_handle_t *handle, esai_transfer_t *xfer)
 Performs a non-blocking ESAI transfer using DMA. More...
 
status_t ESAI_TransferReceiveEDMA (ESAI_Type *base, esai_edma_handle_t *handle, esai_transfer_t *xfer)
 Performs a non-blocking ESAI receive using eDMA. More...
 
void ESAI_TransferAbortSendEDMA (ESAI_Type *base, esai_edma_handle_t *handle)
 Aborts a ESAI transfer using eDMA. More...
 
void ESAI_TransferAbortReceiveEDMA (ESAI_Type *base, esai_edma_handle_t *handle)
 Aborts a ESAI receive using eDMA. More...
 
status_t ESAI_TransferGetSendCountEDMA (ESAI_Type *base, esai_edma_handle_t *handle, size_t *count)
 Gets byte count sent by ESAI. More...
 
status_t ESAI_TransferGetReceiveCountEDMA (ESAI_Type *base, esai_edma_handle_t *handle, size_t *count)
 Gets byte count received by ESAI. More...
 

Data Structure Documentation

struct _esai_edma_handle

Data Fields

edma_handle_tdmaHandle
 DMA handler for ESAI send.
 
uint8_t nbytes
 eDMA minor byte transfer count initially configured. More...
 
uint8_t bitWidth
 Bit width for transfer, 8/16/24/32 bits.
 
uint8_t slotLen
 Slot length of the audio data.
 
uint8_t count
 The transfer data count in a DMA request.
 
uint8_t sectionMap
 Section enabled for transfer.
 
uint32_t state
 Internal state for ESAI eDMA transfer.
 
esai_edma_callback_t callback
 Callback for users while transfer finish or error occurs.
 
void * userData
 User callback parameter.
 
edma_tcd_t tcd [ESAI_XFER_QUEUE_SIZE+1U]
 TCD pool for eDMA transfer. More...
 
esai_transfer_t esaiQueue [ESAI_XFER_QUEUE_SIZE]
 Transfer queue storing queued transfer. More...
 
size_t transferSize [ESAI_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.
 

Field Documentation

uint8_t esai_edma_handle_t::nbytes
edma_tcd_t esai_edma_handle_t::tcd[ESAI_XFER_QUEUE_SIZE+1U]
esai_transfer_t esai_edma_handle_t::esaiQueue[ESAI_XFER_QUEUE_SIZE]
volatile uint8_t esai_edma_handle_t::queueUser

Function Documentation

void ESAI_TransferTxCreateHandleEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
esai_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaHandle 
)

This function initializes the ESAI master DMA handle, which can be used for other ESAI master transactional APIs. Usually, for a specified ESAI instance, call this API once to get the initialized handle.

Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
baseESAI peripheral base address.
callbackPointer to user callback function.
userDataUser parameter passed to the callback function.
dmaHandleeDMA handle pointer, this handle shall be static allocated by users.
void ESAI_TransferRxCreateHandleEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
esai_edma_callback_t  callback,
void *  userData,
edma_handle_t dmaHandle 
)

This function initializes the ESAI slave DMA handle, which can be used for other ESAI master transactional APIs. Usually, for a specified ESAI instance, call this API once to get the initialized handle.

Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
baseESAI peripheral base address.
callbackPointer to user callback function.
userDataUser parameter passed to the callback function.
dmaHandleeDMA handle pointer, this handle shall be static allocated by users.
void ESAI_TransferTxSetFormatEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
esai_format_t format,
uint32_t  hckClockHz,
uint32_t  hclkSourceClockHz 
)

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.

Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
formatPointer to ESAI audio data format structure.
hckClockHzHCK clock frequency in Hz.
hclkSourceClockHzHCK clock source frequency in Hz.
Return values
kStatus_SuccessAudio format set successfully.
kStatus_InvalidArgumentThe input argument is invalid.
void ESAI_TransferRxSetFormatEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
esai_format_t format,
uint32_t  hckClockHz,
uint32_t  hclkSourceClockHz 
)

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.

Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
formatPointer to ESAI audio data format structure.
hckClockHzHCK clock frequency in Hz.
hclkSourceClockHzHCK clock source frequency in Hz.
Return values
kStatus_SuccessAudio format set successfully.
kStatus_InvalidArgumentThe input argument is invalid.
status_t ESAI_TransferSendEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
esai_transfer_t xfer 
)
Note
This interface returns immediately after the transfer initiates. Call ESAI_GetTransferStatus to poll the transfer status and check whether the ESAI transfer is finished.
Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
xferPointer to the DMA transfer structure.
Return values
kStatus_SuccessStart a ESAI eDMA send successfully.
kStatus_InvalidArgumentThe input argument is invalid.
kStatus_TxBusyESAI is busy sending data.
status_t ESAI_TransferReceiveEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
esai_transfer_t xfer 
)
Note
This interface returns immediately after the transfer initiates. Call the ESAI_GetReceiveRemainingBytes to poll the transfer status and check whether the ESAI transfer is finished.
Parameters
baseESAI base pointer
handleESAI eDMA handle pointer.
xferPointer to DMA transfer structure.
Return values
kStatus_SuccessStart a ESAI eDMA receive successfully.
kStatus_InvalidArgumentThe input argument is invalid.
kStatus_RxBusyESAI is busy receiving data.
void ESAI_TransferAbortSendEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle 
)
Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
void ESAI_TransferAbortReceiveEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle 
)
Parameters
baseESAI base pointer
handleESAI eDMA handle pointer.
status_t ESAI_TransferGetSendCountEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
size_t *  count 
)
Parameters
baseESAI base pointer.
handleESAI eDMA handle pointer.
countBytes count sent by ESAI.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is no non-blocking transaction in progress.
status_t ESAI_TransferGetReceiveCountEDMA ( ESAI_Type *  base,
esai_edma_handle_t *  handle,
size_t *  count 
)
Parameters
baseESAI base pointer
handleESAI eDMA handle pointer.
countBytes count received by ESAI.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_NoTransferInProgressThere is no non-blocking transaction in progress.