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

Overview

Data Structures

struct  asrc_p2p_edma_config_t
 destination peripheral configuration More...
 
struct  asrc_in_edma_handle_t
 @ brief asrc in edma handler More...
 
struct  asrc_out_edma_handle_t
 @ brief asrc out edma handler More...
 
struct  asrc_edma_handle_t
 ASRC DMA transfer handle. More...
 

Macros

#define ASRC_XFER_IN_QUEUE_SIZE   4U
 < More...
 

Typedefs

typedef void(* asrc_edma_callback_t )(ASRC_Type *base, asrc_edma_handle_t *handle, status_t status, void *userData)
 ASRC eDMA transfer callback function for finish and error.
 
typedef void(* asrc_start_peripheral_t )(bool start)
 ASRC trigger peripheral function pointer.
 

Driver version

#define FSL_ASRC_EDMA_DRIVER_VERSION   (MAKE_VERSION(2, 1, 0))
 Version 2.1.0.
 

eDMA Transactional

void ASRC_TransferInCreateHandleEDMA (ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *inDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
 Initializes the ASRC IN eDMA handle. More...
 
void ASRC_TransferOutCreateHandleEDMA (ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *outDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
 Initializes the ASRC OUT eDMA handle. More...
 
status_t ASRC_TransferSetChannelPairConfigEDMA (ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_config_t *asrcConfig, uint32_t inSampleRate, uint32_t outSampleRate)
 Configures the ASRC P2P channel pair. More...
 
uint32_t ASRC_GetOutSamplesSizeEDMA (ASRC_Type *base, asrc_edma_handle_t *handle, uint32_t inSampleRate, uint32_t outSampleRate, uint32_t inSamplesize)
 Get output sample buffer size can be transferred by edma. More...
 
status_t ASRC_TransferEDMA (ASRC_Type *base, asrc_edma_handle_t *handle, asrc_transfer_t *xfer)
 Performs a non-blocking ASRC m2m convert using EDMA. More...
 
void ASRC_TransferInAbortEDMA (ASRC_Type *base, asrc_edma_handle_t *handle)
 Aborts a ASRC IN transfer using eDMA. More...
 
void ASRC_TransferOutAbortEDMA (ASRC_Type *base, asrc_edma_handle_t *handle)
 Aborts a ASRC OUT transfer using eDMA. More...
 
void ASRC_TransferInTerminalEDMA (ASRC_Type *base, asrc_edma_handle_t *handle)
 Terminate In ASRC Convert. More...
 
void ASRC_TransferOutTerminalEDMA (ASRC_Type *base, asrc_edma_handle_t *handle)
 Terminate Out ASRC Convert. More...
 

Data Structure Documentation

struct asrc_p2p_edma_config_t

Data Fields

uint8_t watermark
 peripheral watermark
 
uint8_t channel
 peripheral channel number
 
asrc_start_peripheral_t startPeripheral
 trigger peripheral start
 
struct asrc_in_edma_handle_t

Data Fields

edma_handle_tinDmaHandle
 DMA handler for ASRC in.
 
uint8_t tcd [(ASRC_XFER_IN_QUEUE_SIZE+1U)*sizeof(edma_tcd_t)]
 TCD pool for eDMA send. More...
 
uint32_t sampleWidth
 input data width
 
uint32_t fifoThreshold
 ASRC input fifo threshold.
 
uint32_t * asrcQueue [ASRC_XFER_IN_QUEUE_SIZE]
 Transfer queue storing queued transfer. More...
 
size_t transferSize [ASRC_XFER_IN_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.
 
uint32_t state
 Internal state for ASRC eDMA transfer.
 
const asrc_p2p_edma_config_tperipheralConfig
 peripheral configuration pointer
 

Field Documentation

uint8_t asrc_in_edma_handle_t::tcd[(ASRC_XFER_IN_QUEUE_SIZE+1U)*sizeof(edma_tcd_t)]
uint32_t* asrc_in_edma_handle_t::asrcQueue[ASRC_XFER_IN_QUEUE_SIZE]
volatile uint8_t asrc_in_edma_handle_t::queueUser
struct asrc_out_edma_handle_t

Data Fields

edma_handle_toutDmaHandle
 DMA handler for ASRC out.
 
uint8_t tcd [(ASRC_XFER_OUT_QUEUE_SIZE+1U)*sizeof(edma_tcd_t)]
 TCD pool for eDMA send. More...
 
uint32_t sampleWidth
 output data width
 
uint32_t fifoThreshold
 ASRC output fifo threshold.
 
uint32_t * asrcQueue [ASRC_XFER_OUT_QUEUE_SIZE]
 Transfer queue storing queued transfer. More...
 
size_t transferSize [ASRC_XFER_OUT_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.
 
uint32_t state
 Internal state for ASRC eDMA transfer.
 
const asrc_p2p_edma_config_tperipheralConfig
 peripheral configuration pointer
 

Field Documentation

uint8_t asrc_out_edma_handle_t::tcd[(ASRC_XFER_OUT_QUEUE_SIZE+1U)*sizeof(edma_tcd_t)]
uint32_t* asrc_out_edma_handle_t::asrcQueue[ASRC_XFER_OUT_QUEUE_SIZE]
volatile uint8_t asrc_out_edma_handle_t::queueUser
struct _asrc_edma_handle

Data Fields

asrc_in_edma_handle_t in
 asrc in handler
 
asrc_out_edma_handle_t out
 asrc out handler
 
asrc_channel_pair_t channelPair
 channel pair
 
void * userData
 User callback parameter.
 
asrc_edma_callback_t callback
 Callback for users while transfer finish or error occurs.
 

Macro Definition Documentation

#define ASRC_XFER_IN_QUEUE_SIZE   4U

ASRC IN edma QUEUE size

Function Documentation

void ASRC_TransferInCreateHandleEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle,
asrc_channel_pair_t  channelPair,
asrc_edma_callback_t  callback,
edma_handle_t inDmaHandle,
const asrc_p2p_edma_config_t periphConfig,
void *  userData 
)

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

Parameters
baseASRC base pointer.
channelPairASRC channel pair
handleASRC eDMA handle pointer.
callbackPointer to user callback function.
txDmaHandleASRC send edma handle pointer.
periphConfigperipheral configuration.
userDataUser parameter passed to the callback function.
void ASRC_TransferOutCreateHandleEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle,
asrc_channel_pair_t  channelPair,
asrc_edma_callback_t  callback,
edma_handle_t outDmaHandle,
const asrc_p2p_edma_config_t periphConfig,
void *  userData 
)

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

Parameters
baseASRC base pointer.
channelPairASRC channel pair
handleASRC eDMA handle pointer.
callbackPointer to user callback function.
txDmaHandleASRC send edma handle pointer.
periphConfigperipheral configuration.
userDataUser parameter passed to the callback function.
status_t ASRC_TransferSetChannelPairConfigEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle,
asrc_channel_pair_config_t asrcConfig,
uint32_t  inSampleRate,
uint32_t  outSampleRate 
)
Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.
asrcConfigasrc configurations.
inputSampleRateASRC input sample rate.
outputSampleRateASRC output sample rate.
uint32_t ASRC_GetOutSamplesSizeEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle,
uint32_t  inSampleRate,
uint32_t  outSampleRate,
uint32_t  inSamplesize 
)
Note
This API is depends on the ASRC output configuration, should be called after the ASRC_TransferSetChannelPairConfigEDMA.
Parameters
baseasrc base pointer.
handleASRC channel pair edma handle.
inSampleRateinput sample rate.
outSampleRateoutput sample rate.
inSamplesinput sampleS size.
Return values
outputbuffer size in byte.
status_t ASRC_TransferEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle,
asrc_transfer_t xfer 
)
Note
This interface returns immediately after the transfer initiates.
Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.
xferPointer to the DMA transfer structure.
Return values
kStatus_SuccessStart a ASRC eDMA send successfully.
kStatus_InvalidArgumentThe input argument is invalid.
kStatus_ASRCQueueFullASRC EDMA driver queue is full.
void ASRC_TransferInAbortEDMA ( ASRC_Type *  base,
asrc_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 ASRC_TransferTerminalP2PEDMA.

Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.
void ASRC_TransferOutAbortEDMA ( ASRC_Type *  base,
asrc_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 ASRC_TransferTerminalP2PEDMA.

Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.
void ASRC_TransferInTerminalEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle 
)

This function will clear all transfer slots buffered in the asrc queue. If users only want to abort the current transfer slot, please call ASRC_TransferAbortPP2PEDMA.

Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.
void ASRC_TransferOutTerminalEDMA ( ASRC_Type *  base,
asrc_edma_handle_t *  handle 
)

This function will clear all transfer slots buffered in the asrc queue. If users only want to abort the current transfer slot, please call ASRC_TransferAbortPP2PEDMA.

Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.