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

Overview

Data Structures

struct  asrc_channel_pair_config_t
 asrc channel pair configuation More...
 
struct  asrc_transfer_t
 SAI transfer structure. More...
 
struct  asrc_in_handle_t
 asrc in handler More...
 
struct  asrc_out_handle_t
 output handler More...
 
struct  asrc_handle_t
 ASRC handle structure. More...
 

Macros

#define ASRC_XFER_QUEUE_SIZE   (4U)
 ASRC transfer queue size, user can refine it according to use case. More...
 
#define FSL_ASRC_CHANNEL_PAIR_COUNT   (4U)
 ASRC channel pair count.
 
#define FSL_ASRC_CHANNEL_PAIR_FIFO_DEPTH   (64U)
 ASRC FIFO depth.
 
#define ASRC_ASRCTR_AT_MASK(index)   ((uint32_t)1U << (ASRC_ASRCTR_ATSA_SHIFT + (uint32_t)(index)))
 ASRC register access macro.
 

Typedefs

typedef void(* asrc_transfer_callback_t )(ASRC_Type *base, asrc_handle_t *handle, status_t status, void *userData)
 ASRC transfer callback prototype.
 

Enumerations

enum  {
  kStatus_ASRCIdle = MAKE_STATUS(kStatusGroup_ASRC, 0),
  kStatus_ASRCInIdle = MAKE_STATUS(kStatusGroup_ASRC, 1),
  kStatus_ASRCOutIdle = MAKE_STATUS(kStatusGroup_ASRC, 2),
  kStatus_ASRCBusy = MAKE_STATUS(kStatusGroup_ASRC, 3),
  kStatus_ASRCInvalidArgument = MAKE_STATUS(kStatusGroup_ASRC, 4),
  kStatus_ASRCClockConfigureFailed = MAKE_STATUS(kStatusGroup_ASRC, 5),
  kStatus_ASRCChannelPairConfigureFailed = MAKE_STATUS(kStatusGroup_ASRC, 6),
  kStatus_ASRCConvertError = MAKE_STATUS(kStatusGroup_ASRC, 7),
  kStatus_ASRCNotSupport = MAKE_STATUS(kStatusGroup_ASRC, 8),
  kStatus_ASRCQueueFull = MAKE_STATUS(kStatusGroup_ASRC, 9),
  kStatus_ASRCOutQueueIdle = MAKE_STATUS(kStatusGroup_ASRC, 10),
  kStatus_ASRCInQueueIdle = MAKE_STATUS(kStatusGroup_ASRC, 11)
}
 ASRC return status. More...
 
enum  asrc_channel_pair_t {
  kASRC_ChannelPairA = 0,
  kASRC_ChannelPairB = 1,
  kASRC_ChannelPairC = 2
}
 channel pair mask More...
 
enum  {
  kASRC_SampleRate_8000HZ = 8000U,
  kASRC_SampleRate_11025HZ = 11025U,
  kASRC_SampleRate_12000HZ = 12000U,
  kASRC_SampleRate_16000HZ = 16000U,
  kASRC_SampleRate_22050HZ = 22050U,
  kASRC_SampleRate_24000HZ = 24000U,
  kASRC_SampleRate_30000HZ = 30000U,
  kASRC_SampleRate_32000HZ = 32000U,
  kASRC_SampleRate_44100HZ = 44100U,
  kASRC_SampleRate_48000HZ = 48000U,
  kASRC_SampleRate_64000HZ = 64000U,
  kASRC_SampleRate_88200HZ = 88200U,
  kASRC_SampleRate_96000HZ = 96000U,
  kASRC_SampleRate_128000HZ = 128000U,
  kASRC_SampleRate_176400HZ = 176400U,
  kASRC_SampleRate_192000HZ = 192000U
}
 ASRC support sample rate. More...
 
enum  {
  kASRC_FPInWaitStateInterruptEnable = ASRC_ASRIER_AFPWE_MASK,
  kASRC_OverLoadInterruptMask = ASRC_ASRIER_AOLIE_MASK,
  kASRC_DataOutputCInterruptMask = ASRC_ASRIER_ADOEC_MASK,
  kASRC_DataOutputBInterruptMask = ASRC_ASRIER_ADOEB_MASK,
  kASRC_DataOutputAInterruptMask = ASRC_ASRIER_ADOEA_MASK,
  kASRC_DataInputCInterruptMask = ASRC_ASRIER_ADIEC_MASK,
  kASRC_DataInputBInterruptMask = ASRC_ASRIER_ADIEB_MASK,
  kASRC_DataInputAInterruptMask = ASRC_ASRIER_ADIEA_MASK
}
 The ASRC interrupt enable flag. More...
 
enum  {
  kASRC_StatusDSLCounterReady = ASRC_ASRSTR_DSLCNT_MASK,
  kASRC_StatusTaskQueueOverLoad = ASRC_ASRSTR_ATQOL_MASK,
  kASRC_StatusPairCOutputOverLoad = ASRC_ASRSTR_AOOLC_MASK,
  kASRC_StatusPairBOutputOverLoad = ASRC_ASRSTR_AOOLB_MASK,
  kASRC_StatusPairAOutputOverLoad = ASRC_ASRSTR_AOOLA_MASK,
  kASRC_StatusPairCInputOverLoad = ASRC_ASRSTR_AIOLC_MASK,
  kASRC_StatusPairBInputOverLoad = ASRC_ASRSTR_AIOLB_MASK,
  kASRC_StatusPairAInputOverLoad = ASRC_ASRSTR_AIOLA_MASK,
  kASRC_StatusPairCOutputOverflow = ASRC_ASRSTR_AODOC_MASK,
  kASRC_StatusPairBOutputOverflow = ASRC_ASRSTR_AODOB_MASK,
  kASRC_StatusPairAOutputOverflow = ASRC_ASRSTR_AODOA_MASK,
  kASRC_StatusPairCInputUnderflow = ASRC_ASRSTR_AIDUC_MASK,
  kASRC_StatusPairBInputUnderflow = ASRC_ASRSTR_AIDUB_MASK,
  kASRC_StatusPairAInputUnderflow = ASRC_ASRSTR_AIDUA_MASK,
  kASRC_StatusFPInWaitState = ASRC_ASRSTR_FPWT_MASK,
  kASRC_StatusOverloadError = ASRC_ASRSTR_AOLE_MASK,
  kASRC_StatusInputError,
  kASRC_StatusOutputError,
  kASRC_StatusPairCOutputReady = ASRC_ASRSTR_AODFC_MASK,
  kASRC_StatusPairBOutputReady = ASRC_ASRSTR_AODFB_MASK,
  kASRC_StatusPairAOutputReady = ASRC_ASRSTR_AODFA_MASK,
  kASRC_StatusPairCInputReady = ASRC_ASRSTR_AIDEC_MASK,
  kASRC_StatusPairBInputReady = ASRC_ASRSTR_AIDEB_MASK,
  kASRC_StatusPairAInputReady = ASRC_ASRSTR_AIDEA_MASK,
  kASRC_StatusPairAInterrupt = kASRC_StatusPairAInputReady | kASRC_StatusPairAOutputReady,
  kASRC_StatusPairBInterrupt = kASRC_StatusPairBInputReady | kASRC_StatusPairBOutputReady,
  kASRC_StatusPairCInterrupt = kASRC_StatusPairCInputReady | kASRC_StatusPairCOutputReady
}
 The ASRC interrupt status. More...
 
enum  {
  kASRC_OutputFifoNearFull = ASRC_ASRFSTA_OAFA_MASK,
  kASRC_InputFifoNearEmpty = ASRC_ASRFSTA_IAEA_MASK
}
 ASRC channel pair status. More...
 
enum  asrc_ratio_t {
  kASRC_RatioNotUsed = 0U,
  kASRC_RatioUseInternalMeasured,
  kASRC_RatioUseIdealRatio
}
 ASRC ideal ratio. More...
 
enum  asrc_clock_source_t {
  kASRC_ClockSourceNotAvalible = -1U,
  kASRC_ClockSourceBitClock0 = 0U,
  kASRC_ClockSourceBitClock1 = 1U,
  kASRC_ClockSourceBitClock2 = 2U,
  kASRC_ClockSourceBitClock3 = 3U,
  kASRC_ClockSourceBitClock4 = 4U,
  kASRC_ClockSourceBitClock5 = 5U,
  kASRC_ClockSourceBitClock6 = 6U,
  kASRC_ClockSourceBitClock7 = 7U,
  kASRC_ClockSourceBitClock8 = 8U,
  kASRC_ClockSourceBitClock9 = 9U,
  kASRC_ClockSourceBitClocka = 10U,
  kASRC_ClockSourceBitClockb = 11U,
  kASRC_ClockSourceBitClockc = 12U,
  kASRC_ClockSourceBitClockd = 13U,
  kASRC_ClockSourceBitClocke = 14U
}
 The ASRC clock source. More...
 
enum  asrc_audio_channel_t {
  kASRC_ChannelsNumber1 = 1U,
  kASRC_ChannelsNumber2 = 2U,
  kASRC_ChannelsNumber3 = 3U,
  kASRC_ChannelsNumber4 = 4U,
  kASRC_ChannelsNumber5 = 5U,
  kASRC_ChannelsNumber6 = 6U,
  kASRC_ChannelsNumber7 = 7U,
  kASRC_ChannelsNumber8 = 8U,
  kASRC_ChannelsNumber9 = 9U,
  kASRC_ChannelsNumber10 = 10U
}
 Number of channels in audio data. More...
 
enum  asrc_data_width_t {
  kASRC_DataWidth24Bit = 0U,
  kASRC_DataWidth16Bit = 1U,
  kASRC_DataWidth8Bit = 2U
}
 data width More...
 
enum  asrc_data_align_t {
  kASRC_DataAlignMSB = 1U,
  kASRC_DataAlignLSB = 0U
}
 data alignment More...
 
enum  asrc_sign_extension_t {
  kASRC_NoSignExtension = 0U,
  kASRC_SignExtension = 1U
}
 sign extension More...
 

Driver version

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

Initialization and deinitialization

uint32_t ASRC_GetInstance (ASRC_Type *base)
 Get instance number of the ASRC peripheral. More...
 
void ASRC_Init (ASRC_Type *base, uint32_t asrcPeripheralClock_Hz)
 brief Initializes the asrc peripheral. More...
 
void ASRC_Deinit (ASRC_Type *base)
 De-initializes the ASRC peripheral. More...
 
void ASRC_SoftwareReset (ASRC_Type *base)
 Do software reset . More...
 
status_t ASRC_SetChannelPairConfig (ASRC_Type *base, asrc_channel_pair_t channelPair, asrc_channel_pair_config_t *config, uint32_t inputSampleRate, uint32_t outputSampleRate)
 ASRC configure channel pair. More...
 
uint32_t ASRC_GetOutSamplesSize (ASRC_Type *base, asrc_channel_pair_t channelPair, uint32_t inSampleRate, uint32_t outSampleRate, uint32_t inSamplesize)
 Get output sample buffer size. More...
 
uint32_t ASRC_MapSamplesWidth (ASRC_Type *base, asrc_channel_pair_t channelPair, uint32_t *inWidth, uint32_t *outWidth)
 Map register sample width to real sample width. More...
 
uint32_t ASRC_GetRemainFifoSamples (ASRC_Type *base, asrc_channel_pair_t channelPair, uint32_t *buffer, uint32_t outSampleWidth, uint32_t remainSamples)
 Get left samples in fifo. More...
 
static void ASRC_ModuleEnable (ASRC_Type *base, bool enable)
 ASRC module enable. More...
 
static void ASRC_ChannelPairEnable (ASRC_Type *base, asrc_channel_pair_t channelPair, bool enable)
 ASRC enable channel pair. More...
 

Interrupts

static void ASRC_EnableInterrupt (ASRC_Type *base, uint32_t mask)
 ASRC interrupt enable This function enable the ASRC interrupt with the provided mask. More...
 
static void ASRC_DisableInterrupt (ASRC_Type *base, uint32_t mask)
 ASRC interrupt disable This function disable the ASRC interrupt with the provided mask. More...
 

Status

static uint32_t ASRC_GetStatus (ASRC_Type *base)
 Gets the ASRC status flag state. More...
 
static bool ASRC_GetChannelPairInitialStatus (ASRC_Type *base, asrc_channel_pair_t channel)
 Gets the ASRC channel pair initialization state. More...
 
static uint32_t ASRC_GetChannelPairFifoStatus (ASRC_Type *base, asrc_channel_pair_t channelPair)
 Gets the ASRC channel A fifo a status flag state. More...
 

Bus Operations

static void ASRC_ChannelPairWriteData (ASRC_Type *base, asrc_channel_pair_t channelPair, uint32_t data)
 Writes data into ASRC channel pair FIFO. More...
 
static uint32_t ASRC_ChannelPairReadData (ASRC_Type *base, asrc_channel_pair_t channelPair)
 Read data from ASRC channel pair FIFO. More...
 
static uint32_t ASRC_GetInputDataRegisterAddress (ASRC_Type *base, asrc_channel_pair_t channelPair)
 Get input data fifo address. More...
 
static uint32_t ASRC_GetOutputDataRegisterAddress (ASRC_Type *base, asrc_channel_pair_t channelPair)
 Get output data fifo address. More...
 
status_t ASRC_SetIdealRatioConfig (ASRC_Type *base, asrc_channel_pair_t channelPair, uint32_t inputSampleRate, uint32_t outputSampleRate)
 ASRC configure ideal ratio. More...
 

Transactional

status_t ASRC_TransferSetChannelPairConfig (ASRC_Type *base, asrc_handle_t *handle, asrc_channel_pair_config_t *config, uint32_t inputSampleRate, uint32_t outputSampleRate)
 ASRC configure channel pair. More...
 
void ASRC_TransferCreateHandle (ASRC_Type *base, asrc_handle_t *handle, asrc_channel_pair_t channelPair, asrc_transfer_callback_t inCallback, asrc_transfer_callback_t outCallback, void *userData)
 Initializes the ASRC handle. More...
 
status_t ASRC_TransferNonBlocking (ASRC_Type *base, asrc_handle_t *handle, asrc_transfer_t *xfer)
 Performs an interrupt non-blocking convert on asrc. More...
 
status_t ASRC_TransferBlocking (ASRC_Type *base, asrc_channel_pair_t channelPair, asrc_transfer_t *xfer)
 Performs an blocking convert on asrc. More...
 
status_t ASRC_TransferGetConvertedCount (ASRC_Type *base, asrc_handle_t *handle, size_t *count)
 Get converted byte count. More...
 
void ASRC_TransferAbortConvert (ASRC_Type *base, asrc_handle_t *handle)
 Aborts the current convert. More...
 
void ASRC_TransferTerminateConvert (ASRC_Type *base, asrc_handle_t *handle)
 Terminate all ASRC convert. More...
 
void ASRC_TransferHandleIRQ (ASRC_Type *base, asrc_handle_t *handle)
 ASRC convert interrupt handler. More...
 

Data Structure Documentation

struct asrc_channel_pair_config_t

Data Fields

asrc_audio_channel_t audioDataChannels
 audio data channel numbers
 
asrc_clock_source_t inClockSource
 input clock source
 
uint32_t inSourceClock_Hz
 input source clock frequency
 
asrc_clock_source_t outClockSource
 output clock source
 
uint32_t outSourceClock_Hz
 output source clock frequency
 
asrc_ratio_t sampleRateRatio
 sample rate ratio type
 
asrc_data_width_t inDataWidth
 input data width
 
asrc_data_align_t inDataAlign
 input data alignment
 
asrc_data_width_t outDataWidth
 output data width
 
asrc_data_align_t outDataAlign
 output data alignment
 
asrc_sign_extension_t outSignExtension
 output extension
 
uint8_t outFifoThreshold
 output fifo threshold
 
uint8_t inFifoThreshold
 input fifo threshold
 
bool bufStallWhenFifoEmptyFull
 stall Pair A conversion in case of Buffer near empty full condition
 
struct asrc_transfer_t

Data Fields

void * inData
 Data address to convert. More...
 
size_t inDataSize
 input data size. More...
 
void * outData
 Data address to store converted data.
 
size_t outDataSize
 output data size. More...
 

Field Documentation

void* asrc_transfer_t::inData
size_t asrc_transfer_t::inDataSize
size_t asrc_transfer_t::outDataSize
struct asrc_in_handle_t

Data Fields

asrc_transfer_callback_t callback
 Callback function called at convert complete.
 
uint32_t sampleWidth
 data width
 
uint32_t sampleMask
 data mask
 
uint32_t fifoThreshold
 fifo threshold
 
uint8_t * asrcQueue [ASRC_XFER_QUEUE_SIZE]
 Transfer queue storing queued transfer.
 
size_t transferSamples [ASRC_XFER_QUEUE_SIZE]
 Data bytes need to convert.
 
volatile uint8_t queueUser
 Index for user to queue transfer.
 
volatile uint8_t queueDriver
 Index for driver to get the transfer data and size.
 
struct asrc_out_handle_t

Data Fields

asrc_transfer_callback_t callback
 Callback function called at convert complete.
 
uint32_t sampleWidth
 data width
 
uint32_t fifoThreshold
 fifo threshold
 
uint8_t * asrcQueue [ASRC_XFER_QUEUE_SIZE]
 Transfer queue storing queued transfer.
 
size_t transferSamples [ASRC_XFER_QUEUE_SIZE]
 Data bytes need to convert.
 
volatile uint8_t queueUser
 Index for user to queue transfer.
 
volatile uint8_t queueDriver
 Index for driver to get the transfer data and size.
 
struct _asrc_handle

asrc handler

Data Fields

ASRC_Type * base
 base address
 
uint32_t state
 Transfer status.
 
void * userData
 Callback parameter passed to callback function.
 
asrc_audio_channel_t audioDataChannels
 audio channel number
 
asrc_channel_pair_t channelPair
 channel pair mask
 
asrc_in_handle_t in
 asrc input handler
 
asrc_out_handle_t out
 asrc output handler
 

Macro Definition Documentation

#define ASRC_XFER_QUEUE_SIZE   (4U)

Enumeration Type Documentation

anonymous enum

Enumerator
kStatus_ASRCIdle 

ASRC is idle.

kStatus_ASRCInIdle 

ASRC in is idle.

kStatus_ASRCOutIdle 

ASRC out is idle.

kStatus_ASRCBusy 

ASRC is busy.

kStatus_ASRCInvalidArgument 

ASRC invalid argument.

kStatus_ASRCClockConfigureFailed 

ASRC clock configure failed.

kStatus_ASRCChannelPairConfigureFailed 

ASRC clock configure failed.

kStatus_ASRCConvertError 

ASRC clock configure failed.

kStatus_ASRCNotSupport 

ASRC not support.

kStatus_ASRCQueueFull 

ASRC queue is full.

kStatus_ASRCOutQueueIdle 

ASRC out queue is idle.

kStatus_ASRCInQueueIdle 

ASRC in queue is idle.

Enumerator
kASRC_ChannelPairA 

channel pair A value

kASRC_ChannelPairB 

channel pair B value

kASRC_ChannelPairC 

channel pair C value

anonymous enum

Enumerator
kASRC_SampleRate_8000HZ 

asrc sample rate 8KHZ

kASRC_SampleRate_11025HZ 

asrc sample rate 11.025KHZ

kASRC_SampleRate_12000HZ 

asrc sample rate 12KHZ

kASRC_SampleRate_16000HZ 

asrc sample rate 16KHZ

kASRC_SampleRate_22050HZ 

asrc sample rate 22.05KHZ

kASRC_SampleRate_24000HZ 

asrc sample rate 24KHZ

kASRC_SampleRate_30000HZ 

asrc sample rate 30KHZ

kASRC_SampleRate_32000HZ 

asrc sample rate 32KHZ

kASRC_SampleRate_44100HZ 

asrc sample rate 44.1KHZ

kASRC_SampleRate_48000HZ 

asrc sample rate 48KHZ

kASRC_SampleRate_64000HZ 

asrc sample rate 64KHZ

kASRC_SampleRate_88200HZ 

asrc sample rate 88.2KHZ

kASRC_SampleRate_96000HZ 

asrc sample rate 96KHZ

kASRC_SampleRate_128000HZ 

asrc sample rate 128KHZ

kASRC_SampleRate_176400HZ 

asrc sample rate 176.4KHZ

kASRC_SampleRate_192000HZ 

asrc sample rate 192KHZ

anonymous enum

Enumerator
kASRC_FPInWaitStateInterruptEnable 

FP in wait state mask.

kASRC_OverLoadInterruptMask 

overload interrupt mask

kASRC_DataOutputCInterruptMask 

data output c interrupt mask

kASRC_DataOutputBInterruptMask 

data output b interrupt mask

kASRC_DataOutputAInterruptMask 

data output a interrupt mask

kASRC_DataInputCInterruptMask 

data input c interrupt mask

kASRC_DataInputBInterruptMask 

data input b interrupt mask

kASRC_DataInputAInterruptMask 

data input a interrupt mask

anonymous enum

Enumerator
kASRC_StatusDSLCounterReady 

DSL counter.

kASRC_StatusTaskQueueOverLoad 

task queue overload

kASRC_StatusPairCOutputOverLoad 

pair c output overload

kASRC_StatusPairBOutputOverLoad 

pair b output overload

kASRC_StatusPairAOutputOverLoad 

pair a output overload

kASRC_StatusPairCInputOverLoad 

pair c input overload

kASRC_StatusPairBInputOverLoad 

pair b input overload

kASRC_StatusPairAInputOverLoad 

pair a input overload

kASRC_StatusPairCOutputOverflow 

pair c output overflow

kASRC_StatusPairBOutputOverflow 

pair b output overflow

kASRC_StatusPairAOutputOverflow 

pair a output overflow

kASRC_StatusPairCInputUnderflow 

pair c input underflow

kASRC_StatusPairBInputUnderflow 

pair b input under flow

kASRC_StatusPairAInputUnderflow 

pair a input underflow

kASRC_StatusFPInWaitState 

FP in wait state.

kASRC_StatusOverloadError 

overload error

kASRC_StatusInputError 

input error status

kASRC_StatusOutputError 

output error status

kASRC_StatusPairCOutputReady 

pair c output ready

kASRC_StatusPairBOutputReady 

pair b output ready

kASRC_StatusPairAOutputReady 

pair a output ready

kASRC_StatusPairCInputReady 

pair c input ready

kASRC_StatusPairBInputReady 

pair b input ready

kASRC_StatusPairAInputReady 

pair a input ready

kASRC_StatusPairAInterrupt 

pair A interrupt

kASRC_StatusPairBInterrupt 

pair B interrupt

kASRC_StatusPairCInterrupt 

pair C interrupt

anonymous enum

Enumerator
kASRC_OutputFifoNearFull 

channel pair output fifo near full

kASRC_InputFifoNearEmpty 

channel pair input fifo near empty

Enumerator
kASRC_RatioNotUsed 

ideal ratio not used

kASRC_RatioUseInternalMeasured 

ideal ratio use internal measure ratio, can be used for real time streaming audio

kASRC_RatioUseIdealRatio 

ideal ratio use manual configure ratio, can be used for the non-real time streaming audio

Enumerator
kASRC_ClockSourceNotAvalible 

clock source not avalible

kASRC_ClockSourceBitClock0 

clock source from bit clock 0

kASRC_ClockSourceBitClock1 

clock source from bit clock 1

kASRC_ClockSourceBitClock2 

clock source from bit clock 2

kASRC_ClockSourceBitClock3 

clock source from bit clock 3

kASRC_ClockSourceBitClock4 

clock source from bit clock 4

kASRC_ClockSourceBitClock5 

clock source from bit clock 5

kASRC_ClockSourceBitClock6 

clock source from bit clock 6

kASRC_ClockSourceBitClock7 

clock source from bit clock 7

kASRC_ClockSourceBitClock8 

clock source from bit clock 8

kASRC_ClockSourceBitClock9 

clock source from bit clock 9

kASRC_ClockSourceBitClocka 

clock source from bit clock a

kASRC_ClockSourceBitClockb 

clock source from bit clock b

kASRC_ClockSourceBitClockc 

clock source from bit clock c

kASRC_ClockSourceBitClockd 

clock source from bit clock d

kASRC_ClockSourceBitClocke 

clock source from bit clock e

Enumerator
kASRC_ChannelsNumber1 

channel number is 1

kASRC_ChannelsNumber2 

channel number is 2

kASRC_ChannelsNumber3 

channel number is 3

kASRC_ChannelsNumber4 

channel number is 4

kASRC_ChannelsNumber5 

channel number is 5

kASRC_ChannelsNumber6 

channel number is 6

kASRC_ChannelsNumber7 

channel number is 7

kASRC_ChannelsNumber8 

channel number is 8

kASRC_ChannelsNumber9 

channel number is 9

kASRC_ChannelsNumber10 

channel number is 10

Enumerator
kASRC_DataWidth24Bit 

data width 24bit

kASRC_DataWidth16Bit 

data width 16bit

kASRC_DataWidth8Bit 

data width 8bit

Enumerator
kASRC_DataAlignMSB 

data alignment MSB

kASRC_DataAlignLSB 

data alignment LSB

Enumerator
kASRC_NoSignExtension 

no sign extension

kASRC_SignExtension 

sign extension

Function Documentation

uint32_t ASRC_GetInstance ( ASRC_Type *  base)
Parameters
baseASRC base pointer.
void ASRC_Init ( ASRC_Type *  base,
uint32_t  asrcPeripheralClock_Hz 
)

This API gates the asrc clock. The asrc module can't operate unless ASRC_Init is called to enable the clock.

param base asrc base pointer. param asrcPeripheralClock_Hz peripheral clock of ASRC.

void ASRC_Deinit ( ASRC_Type *  base)

This API gates the ASRC clock and disable ASRC module. The ASRC module can't operate unless ASRC_Init

Parameters
baseASRC base pointer.
void ASRC_SoftwareReset ( ASRC_Type *  base)

This software reset bit is self-clear bit, it will generate a software reset signal inside ASRC. After 9 cycles of the ASRC processing clock, this reset process will stop and this bit will cleared automatically.

Parameters
baseASRC base pointer
status_t ASRC_SetChannelPairConfig ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
asrc_channel_pair_config_t config,
uint32_t  inputSampleRate,
uint32_t  outputSampleRate 
)
Parameters
baseASRC base pointer.
channelPairindex of channel pair, reference _asrc_channel_pair.
configASRC channel pair configuration pointer.
inputSampleRateinput audio data sample rate.
outputSampleRateoutput audio data sample rate.
uint32_t ASRC_GetOutSamplesSize ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
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_SetChannelPairConfig.
Parameters
baseasrc base pointer.
channelPairASRC channel pair number.
inSampleRateinput sample rate.
outSampleRateoutput sample rate.
inSamplesinput sampleS size.
Return values
outputbuffer size in byte.
uint32_t ASRC_MapSamplesWidth ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
uint32_t *  inWidth,
uint32_t *  outWidth 
)
Note
This API is depends on the ASRC configuration, should be called after the ASRC_SetChannelPairConfig.
Parameters
baseasrc base pointer.
channelPairasrc channel pair index.
inWidthASRC channel pair number.
outWidthinput sample rate.
Return values
inputsample mask value.
uint32_t ASRC_GetRemainFifoSamples ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
uint32_t *  buffer,
uint32_t  outSampleWidth,
uint32_t  remainSamples 
)
Parameters
baseasrc base pointer.
channelPairASRC channel pair number.
bufferinput sample numbers.
outSampleWidthoutput sample width.
remainSamplesoutput sample rate.
Return values
remainsamples number.
static void ASRC_ModuleEnable ( ASRC_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseASRC base pointer.
enabletrue is enable, false is disable
static void ASRC_ChannelPairEnable ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
bool  enable 
)
inlinestatic
Parameters
baseASRC base pointer.
channelPairMaskchannel pair mask value, reference _asrc_channel_pair_mask.
enabletrue is enable, false is disable.
static void ASRC_EnableInterrupt ( ASRC_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseASRC peripheral base address.
maskThe interrupts to enable. Logical OR of _asrc_interrupt_mask.
static void ASRC_DisableInterrupt ( ASRC_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
baseASRC peripheral base address.
maskThe interrupts to disable. Logical OR of _asrc_interrupt_mask.
static uint32_t ASRC_GetStatus ( ASRC_Type *  base)
inlinestatic
Parameters
baseASRC base pointer
Returns
ASRC Tx status flag value. Use the Status Mask to get the status value needed.
static bool ASRC_GetChannelPairInitialStatus ( ASRC_Type *  base,
asrc_channel_pair_t  channel 
)
inlinestatic
Parameters
baseASRC base pointer
Returns
ASRC Tx status flag value. Use the Status Mask to get the status value needed.
static uint32_t ASRC_GetChannelPairFifoStatus ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair 
)
inlinestatic
Parameters
baseASRC base pointer
Returns
ASRC channel pair a fifo status flag value. Use the Status Mask to get the status value needed.
static void ASRC_ChannelPairWriteData ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
uint32_t  data 
)
inlinestatic

Note: ASRC fifo width is 24bit.

Parameters
baseASRC base pointer.
channelPairASRC channel pair.
dataData needs to be written.
static uint32_t ASRC_ChannelPairReadData ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair 
)
inlinestatic

Note: ASRC fifo width is 24bit.

Parameters
baseASRC base pointer.
channelPairASRC channel pair.
Return values
valueread from fifo.
static uint32_t ASRC_GetInputDataRegisterAddress ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair 
)
inlinestatic

Note: ASRC fifo width is 24bit.

Parameters
baseASRC base pointer.
channelPairASRC channel pair.
static uint32_t ASRC_GetOutputDataRegisterAddress ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair 
)
inlinestatic

Note: ASRC fifo width is 24bit.

Parameters
baseASRC base pointer.
channelPairASRC channel pair.
status_t ASRC_SetIdealRatioConfig ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
uint32_t  inputSampleRate,
uint32_t  outputSampleRate 
)

The ideal ratio should be used when input clock source is not avalible.

Parameters
baseASRC base pointer.
channelPairASRC channel pair.
inputSampleRateinput audio data sample rate.
outputSampleRateoutput audio data sample rate.
status_t ASRC_TransferSetChannelPairConfig ( ASRC_Type *  base,
asrc_handle_t *  handle,
asrc_channel_pair_config_t config,
uint32_t  inputSampleRate,
uint32_t  outputSampleRate 
)
Parameters
baseASRC base pointer.
handleASRC transactional handle pointer.
configASRC channel pair configuration pointer.
inputSampleRateinput audio data sample rate.
outputSampleRateoutput audio data sample rate.
void ASRC_TransferCreateHandle ( ASRC_Type *  base,
asrc_handle_t *  handle,
asrc_channel_pair_t  channelPair,
asrc_transfer_callback_t  inCallback,
asrc_transfer_callback_t  outCallback,
void *  userData 
)

This function initializes the handle for the ASRC transactional APIs. Call this function once to get the handle initialized.

Parameters
baseASRC base pointer
handleASRC handle pointer.
inCallbackPointer to the user callback function.
outCallbackPointer to the user callback function.
userDataUser parameter passed to the callback function
status_t ASRC_TransferNonBlocking ( ASRC_Type *  base,
asrc_handle_t *  handle,
asrc_transfer_t xfer 
)
Note
This API returns immediately after the transfer initiates, application should check the wait and check the callback status.
Parameters
baseasrc base pointer.
handlePointer to the asrc_handle_t structure which stores the transfer state.
xferPointer to the ASRC_transfer_t structure.
Return values
kStatus_SuccessSuccessfully started the data receive.
kStatus_ASRCBusyPrevious receive still not finished.
status_t ASRC_TransferBlocking ( ASRC_Type *  base,
asrc_channel_pair_t  channelPair,
asrc_transfer_t xfer 
)
Note
This API returns immediately after the convert finished.
Parameters
baseasrc base pointer.
channelPairchannel pair index.
xferPointer to the ASRC_transfer_t structure.
Return values
kStatus_SuccessSuccessfully started the data receive.
status_t ASRC_TransferGetConvertedCount ( ASRC_Type *  base,
asrc_handle_t *  handle,
size_t *  count 
)
Parameters
baseASRC base pointer.
handlePointer to the asrc_handle_t structure which stores the transfer state.
countBytes count sent.
Return values
kStatus_SuccessSucceed get the transfer count.
kStatus_ASRCIdleThere is not a non-blocking transaction currently in progress.
void ASRC_TransferAbortConvert ( ASRC_Type *  base,
asrc_handle_t *  handle 
)
Note
This API can be called any time when an interrupt non-blocking transfer initiates to abort the transfer early.
Parameters
baseASRC base pointer.
handlePointer to the asrc_handle_t structure which stores the transfer state.
void ASRC_TransferTerminateConvert ( ASRC_Type *  base,
asrc_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_TransferAbortConvert.

Parameters
baseASRC base pointer.
handleASRC eDMA handle pointer.
void ASRC_TransferHandleIRQ ( ASRC_Type *  base,
asrc_handle_t *  handle 
)
Parameters
baseASRC base pointer.
handlePointer to the asrc_handle_t structure.