MCUXpresso SDK API Reference Manual: ASRC SDMA Driver

| MCUXpresso SDK API Reference Manual Rev 2.11.1 NXP Semiconductors

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Typedefs
ASRC SDMA Driver
ASRC: Asynchronous sample rate converter

## Overview

## Data Structures
struct | asrc_p2p_sdma_config_t
| destination peripheral configuration More...
struct | asrc_sdma_in_handle_t
| ASRC sdma in handle. More...
struct | asrc_sdma_out_handle_t
| ASRC sdma out handle. More...
struct | asrc_sdma_handle_t
| ASRC DMA transfer handle, users should not touch the content of the handle. More...

## Macros
#define | ASRC_XFER_IN_QUEUE_SIZE 4U
| ASRC xfer queue size.

## Typedefs
typedef void(* | asrc_sdma_callback_t )(ASRC_Type *base, asrc_sdma_handle_t *handle, status_t status, void *userData)
| ASRC SDMA 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_SDMA_DRIVER_VERSION (MAKE_VERSION(2, 0, 3))
| Version 2.0.3.

## ASRC SDMA Transactional
void | ASRC_TransferInCreateHandleSDMA (ASRC_Type *base, asrc_sdma_handle_t *handle, asrc_sdma_callback_t callback, sdma_handle_t *dmaHandle, uint32_t eventSource, asrc_context_t context, const asrc_p2p_sdma_config_t *periphConfig, void *userData)
| Initializes the ASRC input SDMA handle. More...
void | ASRC_TransferOutCreateHandleSDMA (ASRC_Type *base, asrc_sdma_handle_t *handle, asrc_sdma_callback_t callback, sdma_handle_t *dmaHandle, uint32_t eventSource, asrc_context_t context, const asrc_p2p_sdma_config_t *periphConfig, void *userData)
| Initializes the ASRC output SDMA handle. More...
status_t | ASRC_TransferSetContextConfigSDMA (ASRC_Type *base, asrc_sdma_handle_t *handle, asrc_context_config_t *asrcConfig)
| Configures the ASRC context. More...
status_t | ASRC_TransferSDMA (ASRC_Type *base, asrc_sdma_handle_t *handle, asrc_transfer_t *xfer)
| Performs a non-blocking ASRC transfer using DMA. More...
void | ASRC_TransferAbortInSDMA (ASRC_Type *base, asrc_sdma_handle_t *handle)
| Aborts a ASRC in transfer using SDMA. More...
void | ASRC_TransferAbortOutSDMA (ASRC_Type *base, asrc_sdma_handle_t *handle)
| brief Aborts a ASRC out transfer using SDMA. More...

## Data Structure Documentation

struct asrc_p2p_sdma_config_t

### Data Fields
uint32_t | eventSource
| peripheral event source
uint8_t | watermark
| peripheral watermark
uint8_t | channel
| peripheral channel number
uint8_t | fifoWidth
| peripheral fifo width
bool | enableContinuous
    true is the amount of samples to be transferred is unknown and script will keep on
transferring as long as both events are detected and script must be stopped by application, false is The amount of samples to be transferred is equal to the count field of mode word
asrc_start_peripheral_t | startPeripheral
| trigger peripheral start

struct asrc_sdma_in_handle_t

### Data Fields
sdma_handle_t * | sdmaHandle
| DMA handler for ASRC.
uint32_t | eventSource
| ASRC event source number.
asrc_sdma_callback_t | callback
| Callback for users while transfer finish or error occurs.
void * | userData
| User callback parameter.
sdma_buffer_descriptor_t | bdPool [ASRC_XFER_IN_QUEUE_SIZE]
| BD pool for SDMA transfer. More...
uint8_t | asrcInWatermark
| The transfer data count in a DMA request.
uint8_t | bytesPerSample
| Bytes in a sample.
uint32_t * | asrcQueue [ASRC_XFER_IN_QUEUE_SIZE]
| Transfer queue storing queued transfer. More...
size_t | sdmaTransferSize [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.
const asrc_p2p_sdma_config_t * | peripheralConfig
| peripheral configuration
uint32_t | state
| Internal state for ASRC SDMA transfer.

#### Field Documentation

sdma_buffer_descriptor_t asrc_sdma_in_handle_t::bdPool[ASRC_XFER_IN_QUEUE_SIZE]

uint32_t* asrc_sdma_in_handle_t::asrcQueue[ASRC_XFER_IN_QUEUE_SIZE]

volatile uint8_t asrc_sdma_in_handle_t::queueUser

struct asrc_sdma_out_handle_t

### Data Fields
sdma_handle_t * | sdmaHandle
| DMA handler for ASRC.
void * | userData
| User callback parameter.
uint32_t | state
| Internal state for ASRC SDMA transfer.
uint8_t | bytesPerSample
| Bytes in a sample.
uint32_t | eventSource
| ASRC event source number.
asrc_sdma_callback_t | callback
| Callback for users while transfer finish or error occurs.
uint8_t | asrcOutWatermark
| The transfer data count in a DMA request.
sdma_buffer_descriptor_t | bdPool [ASRC_XFER_OUT_QUEUE_SIZE]
| BD pool for SDMA transfer. More...
uint32_t * | asrcQueue [ASRC_XFER_OUT_QUEUE_SIZE]
| Transfer queue storing queued transfer. More...
size_t | sdmaTransferSize [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.
const asrc_p2p_sdma_config_t * | peripheralConfig
| peripheral configuration
uint32_t | nonAlignSize
| non align size
void * | nonAlignAddr
| non align address

#### Field Documentation

sdma_buffer_descriptor_t asrc_sdma_out_handle_t::bdPool[ASRC_XFER_OUT_QUEUE_SIZE]

uint32_t* asrc_sdma_out_handle_t::asrcQueue[ASRC_XFER_OUT_QUEUE_SIZE]

volatile uint8_t asrc_sdma_out_handle_t::queueUser

struct _asrc_sdma_handle

ASRC sdma handle prototype.

### Data Fields
asrc_sdma_in_handle_t | inDMAHandle
| input dma handle
asrc_sdma_out_handle_t | outDMAHandle
| output dma handle
asrc_context_t | context
| ASRC context number.
uint8_t | dataChannels
| ASRC process data channel number.

## Function Documentation

void ASRC_TransferInCreateHandleSDMA | ( | ASRC_Type * | base,
|  | asrc_sdma_handle_t * | handle,
|  | asrc_sdma_callback_t | callback,
|  | sdma_handle_t * | dmaHandle,
|  | uint32_t | eventSource,
|  | asrc_context_t | context,
|  | const asrc_p2p_sdma_config_t * | periphConfig,
|  | void * | userData
| ) |  |

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

Parameters

  base | ASRC base pointer.
  handle | ASRC SDMA handle pointer.
  base | ASRC peripheral base address.
  callback | Pointer to user callback function.
  dmaHandle | SDMA handle pointer, this handle shall be static allocated by users.
  eventSource | ASRC input sdma event source.
  context | ASRC context number.
  periphConfig | peripheral configurations, used for case.
  userData | User parameter passed to the callback function.

void ASRC_TransferOutCreateHandleSDMA | ( | ASRC_Type * | base,
|  | asrc_sdma_handle_t * | handle,
|  | asrc_sdma_callback_t | callback,
|  | sdma_handle_t * | dmaHandle,
|  | uint32_t | eventSource,
|  | asrc_context_t | context,
|  | const asrc_p2p_sdma_config_t * | periphConfig,
|  | void * | userData
| ) |  |

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

Parameters

  base | ASRC base pointer.
  handle | ASRC SDMA handle pointer.
  callback | ASRC outcallback.
  dmaHandle | SDMA handle pointer, this handle shall be static allocated by users.
  eventSource | ASRC output event source.
  context | ASRC context number.
  periphConfig | peripheral configurations, used for case.
  userData | User parameter passed to the callback function.

status_t ASRC_TransferSetContextConfigSDMA | ( | ASRC_Type * | base,
|  | asrc_sdma_handle_t * | handle,
|  | asrc_context_config_t * | asrcConfig
| ) |  |

Parameters

  base | ASRC base pointer.
  handle | ASRC SDMA handle pointer.
  asrcConfig | asrc context configurations.

status_t ASRC_TransferSDMA | ( | ASRC_Type * | base,
|  | asrc_sdma_handle_t * | handle,
|  | asrc_transfer_t * | xfer
| ) |  |

Parameters

  base | ASRC base pointer.
  handle | ASRC SDMA handle pointer.
  xfer | ASRC xfer configurations pointer.

Return values

  kStatus_Success | Start a ASRC SDMA send successfully.
  kStatus_InvalidArgument | The input argument is invalid.
  kStatus_TxBusy | ASRC is busy sending data.

void ASRC_TransferAbortInSDMA | ( | ASRC_Type * | base,
|  | asrc_sdma_handle_t * | handle
| ) |  |

Parameters

  base | ASRC base pointer.
  handle | ASRC SDMA handle pointer.

void ASRC_TransferAbortOutSDMA | ( | ASRC_Type * | base,
|  | asrc_sdma_handle_t * | handle
| ) |  |

param base ASRC base pointer. param handle ASRC SDMA handle pointer.