RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures
Asrc_driver

Data Structures

struct  _asrc_channel_pair_config
 asrc channel pair configuation More...
 
struct  _asrc_transfer
 SAI transfer structure. More...
 
struct  _asrc_in_handle
 asrc in handler More...
 
struct  _asrc_out_handle
 output handler More...
 
struct  _asrc_handle
 ASRC handle structure. More...
 

Driver version

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 { kASRC_ChannelPairA = 0 , kASRC_ChannelPairB = 1 , kASRC_ChannelPairC = 2 }
 ASRC 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 { kASRC_RatioNotUsed = 0U , kASRC_RatioUseInternalMeasured , kASRC_RatioUseIdealRatio }
 ASRC ideal ratio. More...
 
enum  _asrc_audio_channel {
  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 { kASRC_DataWidth24Bit = 0U , kASRC_DataWidth16Bit = 1U , kASRC_DataWidth8Bit = 2U }
 data width More...
 
enum  _asrc_data_align { kASRC_DataAlignMSB = 1U , kASRC_DataAlignLSB = 0U }
 data alignment More...
 
enum  _asrc_sign_extension { kASRC_NoSignExtension = 0U , kASRC_SignExtension = 1U }
 sign extension More...
 
typedef enum _asrc_channel_pair asrc_channel_pair_t
 ASRC channel pair mask.
 
typedef enum _asrc_ratio asrc_ratio_t
 ASRC ideal ratio.
 
typedef enum _asrc_audio_channel asrc_audio_channel_t
 Number of channels in audio data.
 
typedef enum _asrc_data_width asrc_data_width_t
 data width
 
typedef enum _asrc_data_align asrc_data_align_t
 data alignment
 
typedef enum _asrc_sign_extension asrc_sign_extension_t
 sign extension
 
typedef struct _asrc_channel_pair_config asrc_channel_pair_config_t
 asrc channel pair configuation
 
typedef struct _asrc_transfer asrc_transfer_t
 SAI transfer structure.
 
typedef struct _asrc_handle asrc_handle_t
 asrc handler
 
typedef void(* asrc_transfer_callback_t) (ASRC_Type *base, asrc_handle_t *handle, status_t status, void *userData)
 ASRC transfer callback prototype.
 
typedef struct _asrc_in_handle asrc_in_handle_t
 asrc in handler
 
typedef struct _asrc_out_handle asrc_out_handle_t
 output handler
 
#define FSL_ASRC_DRIVER_VERSION   (MAKE_VERSION(2, 1, 2))
 
#define ASRC_XFER_QUEUE_SIZE   (4U)
 ASRC transfer queue size, user can refine it according to use case.
 
#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.
 
#define ASRC_ASRCTR_RATIO_MASK(index)   ((uint32_t)3U << (ASRC_ASRCTR_IDRA_SHIFT + (uint32_t)(index)*2U))
 
#define ASRC_ASRCTR_RATIO(ratio, index)    (((uint32_t)((uint32_t)(ratio) << (ASRC_ASRCTR_IDRA_SHIFT + (uint32_t)(index)*2U))) & ASRC_ASRCTR_RATIO_MASK(index))
 
#define ASRC_ASRIER_INPUT_INTERRUPT_MASK(index)   ((uint32_t)1U << (ASRC_ASRIER_ADIEA_SHIFT + (uint32_t)(index)))
 
#define ASRC_ASRIER_OUTPUTPUT_INTERRUPT_MASK(index)   ((uint32_t)1U << (ASRC_ASRIER_ADOEA_SHIFT + (uint32_t)(index)))
 
#define ASRC_ASRCNCR_CHANNEL_COUNTER_MASK(index)   ((uint32_t)0xFU << (ASRC_ASRCNCR_ANCA_SHIFT + (uint32_t)(index)*4U))
 
#define ASRC_ASRCNCR_CHANNEL_COUNTER(counter, index)
 
#define ASRC_ASRCFG_PRE_MODE_MASK(index)   ((uint32_t)3U << (ASRC_ASRCFG_PREMODA_SHIFT + (uint32_t)(index)*4U))
 
#define ASRC_ASRCFG_PRE_MODE(mode, index)
 
#define ASRC_ASRCFG_POST_MODE_MASK(index)   ((uint32_t)3U << (ASRC_ASRCFG_POSTMODA_SHIFT + (uint32_t)(index)*4U))
 
#define ASRC_ASRCFG_POST_MODE(mode, index)
 
#define ASRC_ASRCFG_INIT_DONE_MASK(index)   ((uint32_t)1U << (ASRC_ASRCFG_INIRQA_SHIFT + (uint32_t)(index)))
 
#define ASRC_ASRCSR_INPUT_CLOCK_SOURCE_MASK(index)   ((uint32_t)0xFU << (ASRC_ASRCSR_AICSA_SHIFT + (uint32_t)(index)*4U))
 
#define ASRC_ASRCSR_INPUT_CLOCK_SOURCE(source, index)
 
#define ASRC_ASRCSR_OUTPUT_CLOCK_SOURCE_MASK(index)   ((uint32_t)0xFU << (ASRC_ASRCSR_AOCSA_SHIFT + (uint32_t)(index)*4U))
 
#define ASRC_ASRCSR_OUTPUT_CLOCK_SOURCE(source, index)
 
#define ASRC_ASRCDR_INPUT_PRESCALER_MASK(index)    ((uint32_t)(index) < 2U ? ((uint32_t)7U << (ASRC_ASRCDR1_AICPA_SHIFT + (uint32_t)(index)*6U)) : 7U)
 
#define ASRC_ASRCDR_INPUT_PRESCALER(prescaler, index)
 
#define ASRC_ASRCDR_INPUT_DIVIDER_MASK(index)
 
#define ASRC_ASRCDR_INPUT_DIVIDER(divider, index)
 
#define ASRC_ASRCDR_OUTPUT_PRESCALER_MASK(index)    ((uint32_t)(index) < 2U ? ((uint32_t)7U << (ASRC_ASRCDR1_AOCPA_SHIFT + (uint32_t)(index)*6U)) : (7U << 6U))
 
#define ASRC_ASRCDR_OUTPUT_PRESCALER(prescaler, index)
 
#define ASRC_ASRCDR_OUTPUT_DIVIDER_MASK(index)    ((uint32_t)(index) < 2U ? ((uint32_t)7U << (ASRC_ASRCDR1_AOCDA_SHIFT + (uint32_t)(index)*6U)) : (7UL << 9U))
 
#define ASRC_ASRCDR_OUTPUT_DIVIDER(divider, index)
 
#define ASCR_ASRCDR_OUTPUT_CLOCK_DIVIDER_PRESCALER(value, index)
 
#define ASCR_ASRCDR_INPUT_CLOCK_DIVIDER_PRESCALER(value, index)    (((uint32_t)(index) < 2U ? ((uint32_t)(value) << ((uint32_t)(index)*6U)) : ((uint32_t)(value))))
 
#define ASRC_IDEAL_RATIO_HIGH(base, index)   *(volatile uint32_t *)((uint32_t)(&(base)->ASRIDRHA) + (uint32_t)(index)*8U)
 
#define ASRC_IDEAL_RATIO_LOW(base, index)   *(volatile uint32_t *)((uint32_t)(&(base)->ASRIDRLA) + (uint32_t)(index)*8U)
 
#define ASRC_ASRMCR(base, index)   *(volatile uint32_t *)((uint32_t)(&(base)->ASRMCRA) + (uint32_t)(index)*8U)
 
#define ASRC_ASRMCR1(base, index)   *(volatile uint32_t *)((uint32_t)(&((base)->ASRMCR1[(index)])))
 
#define ASRC_ASRDI(base, index)   *(volatile uint32_t *)((uint32_t)(&(base)->ASRDIA) + (uint32_t)(index)*8U)
 
#define ASRC_ASRDO(base, index)   *(volatile uint32_t *)((uint32_t)(&(base)->ASRDOA) + (uint32_t)(index)*8U)
 
#define ASRC_ASRDI_ADDR(base, index)   (volatile uint32_t *)((uint32_t)(&(base)->ASRDIA) + (uint32_t)(index)*8U)
 
#define ASRC_ASRDO_ADDR(base, index)   (volatile uint32_t *)((uint32_t)(&(base)->ASRDOA) + (uint32_t)(index)*8U)
 
#define ASRC_ASRFST_ADDR(base, index)   (*(volatile uint32_t *)((uint32_t)(&(base)->ASRFSTA) + (uint32_t)(index)*8U))
 
#define ASRC_GET_CHANNEL_COUNTER(base, index)   (((base)->ASRCNCR >> ((uint32_t)(index)*4U)) & 0xFU)
 

Initialization and deinitialization

uint32_t ASRC_GetInstance (ASRC_Type *base)
 Get instance number of the ASRC peripheral.
 
void ASRC_Init (ASRC_Type *base, uint32_t asrcPeripheralClock_Hz)
 
void ASRC_Deinit (ASRC_Type *base)
 De-initializes the ASRC peripheral.
 
void ASRC_SoftwareReset (ASRC_Type *base)
 Do software reset .
 
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.
 
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.
 
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.
 
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.
 

Bus Operations

status_t ASRC_SetIdealRatioConfig (ASRC_Type *base, asrc_channel_pair_t channelPair, uint32_t inputSampleRate, uint32_t outputSampleRate)
 ASRC configure ideal ratio. The ideal ratio should be used when input clock source is not avalible.
 

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.
 
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.
 
status_t ASRC_TransferNonBlocking (ASRC_Type *base, asrc_handle_t *handle, asrc_transfer_t *xfer)
 Performs an interrupt non-blocking convert on asrc.
 
status_t ASRC_TransferBlocking (ASRC_Type *base, asrc_channel_pair_t channelPair, asrc_transfer_t *xfer)
 Performs an blocking convert on asrc.
 
status_t ASRC_TransferGetConvertedCount (ASRC_Type *base, asrc_handle_t *handle, size_t *count)
 Get converted byte count.
 
void ASRC_TransferAbortConvert (ASRC_Type *base, asrc_handle_t *handle)
 Aborts the current convert.
 
void ASRC_TransferTerminateConvert (ASRC_Type *base, asrc_handle_t *handle)
 Terminate all ASRC convert.
 
void ASRC_TransferHandleIRQ (ASRC_Type *base, asrc_handle_t *handle)
 ASRC convert interrupt handler.
 

Detailed Description

Macro Definition Documentation

◆ ASCR_ASRCDR_OUTPUT_CLOCK_DIVIDER_PRESCALER

#define ASCR_ASRCDR_OUTPUT_CLOCK_DIVIDER_PRESCALER (   value,
  index 
)
Value:
(((uint32_t)(index) < 2U ? ((uint32_t)(value) << (ASRC_ASRCDR1_AOCPA_SHIFT + (uint32_t)(index)*6U)) : \
((uint32_t)(value) << 6U)))

◆ ASRC_ASRCDR_INPUT_DIVIDER

#define ASRC_ASRCDR_INPUT_DIVIDER (   divider,
  index 
)
Value:
(((uint32_t)(index) < 2U ? ((uint32_t)(divider) << (ASRC_ASRCDR1_AICDA_SHIFT + (uint32_t)(index)*6U)) : \
((uint32_t)(divider) << ASRC_ASRCDR1_AICDA_SHIFT)) & \
ASRC_ASRCDR_INPUT_DIVIDER_MASK(index))

◆ ASRC_ASRCDR_INPUT_DIVIDER_MASK

#define ASRC_ASRCDR_INPUT_DIVIDER_MASK (   index)
Value:
((uint32_t)(index) < 2U ? ((uint32_t)7U << (ASRC_ASRCDR1_AICDA_SHIFT + (uint32_t)(index)*6U)) : \
(7U << ASRC_ASRCDR1_AICDA_SHIFT))

◆ ASRC_ASRCDR_INPUT_PRESCALER

#define ASRC_ASRCDR_INPUT_PRESCALER (   prescaler,
  index 
)
Value:
(((index) < 2U ? ((uint32_t)(prescaler) << (ASRC_ASRCDR1_AICPA_SHIFT + (uint32_t)(index)*6U)) : (prescaler)) & \
ASRC_ASRCDR1_INPUT_PRESCALER_MASK(index))

◆ ASRC_ASRCDR_OUTPUT_DIVIDER

#define ASRC_ASRCDR_OUTPUT_DIVIDER (   divider,
  index 
)
Value:
(((uint32_t)(index) < 2U ? ((uint32_t)(divider) << (ASRC_ASRCDR1_AOCDA_SHIFT + (uint32_t)(index)*6U)) : \
((uint32_t)(divider) << 9U)) & \
ASRC_ASRCDR_OUTPUT_DIVIDER_MASK(index))

◆ ASRC_ASRCDR_OUTPUT_PRESCALER

#define ASRC_ASRCDR_OUTPUT_PRESCALER (   prescaler,
  index 
)
Value:
(((uint32_t)(index) < 2U ? ((uint32_t)(prescaler) << (ASRC_ASRCDR1_AOCPA_SHIFT + (uint32_t)(index)*6U)) : \
((uint32_t)(prescaler) << 6U)) & \
ASRC_ASRCDR_OUTPUT_PRESCALER_MASK(index))

◆ ASRC_ASRCFG_POST_MODE

#define ASRC_ASRCFG_POST_MODE (   mode,
  index 
)
Value:
((uint32_t)((uint32_t)(mode) << (ASRC_ASRCFG_POSTMODA_SHIFT + (uint32_t)(index)*4U)) & \
ASRC_ASRCFG_POST_MODE_MASK(index))

◆ ASRC_ASRCFG_PRE_MODE

#define ASRC_ASRCFG_PRE_MODE (   mode,
  index 
)
Value:
((uint32_t)((uint32_t)(mode) << (ASRC_ASRCFG_PREMODA_SHIFT + (uint32_t)(index)*4U)) & \
ASRC_ASRCFG_PRE_MODE_MASK(index))

◆ ASRC_ASRCNCR_CHANNEL_COUNTER

#define ASRC_ASRCNCR_CHANNEL_COUNTER (   counter,
  index 
)
Value:
((uint32_t)((uint32_t)(counter) << (ASRC_ASRCNCR_ANCA_SHIFT + (uint32_t)(index)*4U)) & \
ASRC_ASRCNCR_CHANNEL_COUNTER_MASK(index))

◆ ASRC_ASRCSR_INPUT_CLOCK_SOURCE

#define ASRC_ASRCSR_INPUT_CLOCK_SOURCE (   source,
  index 
)
Value:
((uint32_t)((uint32_t)(source) << (ASRC_ASRCSR_AICSA_SHIFT + (uint32_t)(index)*4U)) & \
ASRC_ASRCSR_INPUT_CLOCK_SOURCE_MASK(index))

◆ ASRC_ASRCSR_OUTPUT_CLOCK_SOURCE

#define ASRC_ASRCSR_OUTPUT_CLOCK_SOURCE (   source,
  index 
)
Value:
((uint32_t)((uint32_t)(source) << (ASRC_ASRCSR_AOCSA_SHIFT + (uint32_t)(index)*4U)) & \
ASRC_ASRCSR_OUTPUT_CLOCK_SOURCE_MASK(index))

◆ FSL_ASRC_DRIVER_VERSION

#define FSL_ASRC_DRIVER_VERSION   (MAKE_VERSION(2, 1, 2))

Version 2.1.2

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

ASRC return status .

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

◆ anonymous enum

anonymous enum

ASRC support sample rate .

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

anonymous enum

The ASRC interrupt enable flag .

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

anonymous enum

The ASRC interrupt status .

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

anonymous enum

ASRC channel pair status .

Enumerator
kASRC_OutputFifoNearFull 

channel pair output fifo near full

kASRC_InputFifoNearEmpty 

channel pair input fifo near empty

◆ _asrc_audio_channel

Number of channels in audio data.

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

◆ _asrc_channel_pair

ASRC channel pair mask.

Enumerator
kASRC_ChannelPairA 

channel pair A value

kASRC_ChannelPairB 

channel pair B value

kASRC_ChannelPairC 

channel pair C value

◆ _asrc_data_align

data alignment

Enumerator
kASRC_DataAlignMSB 

data alignment MSB

kASRC_DataAlignLSB 

data alignment LSB

◆ _asrc_data_width

data width

Enumerator
kASRC_DataWidth24Bit 

data width 24bit

kASRC_DataWidth16Bit 

data width 16bit

kASRC_DataWidth8Bit 

data width 8bit

◆ _asrc_ratio

ASRC ideal ratio.

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

◆ _asrc_sign_extension

sign extension

Enumerator
kASRC_NoSignExtension 

no sign extension

kASRC_SignExtension 

sign extension

Function Documentation

◆ ASRC_Deinit()

void ASRC_Deinit ( ASRC_Type base)

De-initializes the ASRC peripheral.

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

Parameters
baseASRC base pointer.

brief De-initializes the ASRC peripheral.

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

param base ASRC base pointer.

◆ ASRC_GetInstance()

uint32_t ASRC_GetInstance ( ASRC_Type base)

Get instance number of the ASRC peripheral.

Parameters
baseASRC base pointer.

◆ ASRC_GetOutSamplesSize()

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.

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.
inSamplesizeinput sampleS size.
Return values
outputbuffer size in byte.

brief Get output sample buffer size.

note This API is depends on the ASRC output configuration, should be called after the ASRC_SetChannelPairConfig.

param base asrc base pointer. param channelPair ASRC channel pair number. param inSampleRate input sample rate. param outSampleRate output sample rate. param inSamples input sampleS size. retval output buffer size in byte.

◆ ASRC_GetRemainFifoSamples()

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.

Parameters
baseasrc base pointer.
channelPairASRC channel pair number.
bufferinput sample numbers.
outSampleWidthoutput sample width.
remainSamplesoutput sample rate.
Return values
remainsamples number.

brief Get left samples in fifo.

param base asrc base pointer. param channelPair ASRC channel pair number. param buffer input sample numbers. param outSampleWidth output sample width. param remainSamples output sample rate. retval remain samples number.

◆ ASRC_Init()

void ASRC_Init ( ASRC_Type base,
uint32_t  asrcPeripheralClock_Hz 
)

brief Initializes the asrc peripheral.

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.

◆ ASRC_MapSamplesWidth()

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.

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.

brief Map register sample width to real sample width.

note This API is depends on the ASRC configuration, should be called after the ASRC_SetChannelPairConfig. param base asrc base pointer. param channelPair asrc channel pair index. param inWidth ASRC channel pair number. param outWidth input sample rate. retval input sample mask value.

◆ ASRC_SetChannelPairConfig()

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.

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.

brief ASRC configure channel pair.

param base ASRC base pointer. param channelPair index of channel pair, reference _asrc_channel_pair. param config ASRC channel pair configuration pointer. param inputSampleRate in audio data sample rate. param outSampleRate out audio data sample rate.

◆ ASRC_SetIdealRatioConfig()

status_t ASRC_SetIdealRatioConfig ( ASRC_Type base,
asrc_channel_pair_t  channelPair,
uint32_t  inputSampleRate,
uint32_t  outputSampleRate 
)

ASRC configure ideal ratio. 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.

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

param base ASRC base pointer. param channelPair ASRC channel pair. param inputSampleRate input audio data sample rate. param outputSampleRate output audio data sample rate.

◆ ASRC_SoftwareReset()

void ASRC_SoftwareReset ( ASRC_Type base)

Do software reset .

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

brief Do software reset .

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.

param base ASRC base pointer

◆ ASRC_TransferAbortConvert()

void ASRC_TransferAbortConvert ( ASRC_Type base,
asrc_handle_t handle 
)

Aborts the current convert.

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.

brief Aborts the current convert.

note This API can be called any time when an interrupt non-blocking transfer initiates to abort the transfer early.

param base asrc base pointer. param handle Pointer to the ASRC_handle_t structure which stores the transfer state.

◆ ASRC_TransferBlocking()

status_t ASRC_TransferBlocking ( ASRC_Type base,
asrc_channel_pair_t  channelPair,
asrc_transfer_t xfer 
)

Performs an blocking convert on asrc.

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.

brief Performs an blocking convert on asrc.

note This API returns immediately after the convert finished.

param base asrc base pointer. param channelPair channel pair index. param xfer Pointer to the ASRC_transfer_t structure. retval kStatus_Success Successfully started the data receive.

◆ ASRC_TransferCreateHandle()

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.

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.
channelPairASRC channel pair.
inCallbackPointer to the user callback function.
outCallbackPointer to the user callback function.
userDataUser parameter passed to the callback function

brief Initializes the ASRC handle.

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

param base ASRC base pointer param handle ASRC handle pointer. param inCallback Pointer to the user callback function. param outCallback Pointer to the user callback function. param userData User parameter passed to the callback function

◆ ASRC_TransferGetConvertedCount()

status_t ASRC_TransferGetConvertedCount ( ASRC_Type base,
asrc_handle_t handle,
size_t *  count 
)

Get converted byte 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.

brief Gets a set byte count.

param base asrc base pointer. param handle Pointer to the ASRC_handle_t structure which stores the transfer state. param count Bytes count sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.

◆ ASRC_TransferHandleIRQ()

void ASRC_TransferHandleIRQ ( ASRC_Type base,
asrc_handle_t handle 
)

ASRC convert interrupt handler.

Parameters
baseASRC base pointer.
handlePointer to the asrc_handle_t structure.

brief ASRC convert interrupt handler.

param base asrc base pointer. param handle Pointer to the asrc_handle_t structure.

◆ ASRC_TransferNonBlocking()

status_t ASRC_TransferNonBlocking ( ASRC_Type base,
asrc_handle_t handle,
asrc_transfer_t xfer 
)

Performs an interrupt non-blocking convert on asrc.

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.

brief Performs an interrupt non-blocking convert on asrc.

note This API returns immediately after the transfer initiates, application should check the wait and check the callback status.

param base asrc base pointer. param handle Pointer to the asrc_handle_t structure which stores the transfer state. param xfer Pointer to the ASRC_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_ASRCBusy Previous receive still not finished.

◆ ASRC_TransferSetChannelPairConfig()

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.

Parameters
baseASRC base pointer.
handleASRC transactional handle pointer.
configASRC channel pair configuration pointer.
inputSampleRateinput audio data sample rate.
outputSampleRateoutput audio data sample rate.

brief ASRC configure channel pair.

param base ASRC base pointer. param handle ASRC transactional handle pointer. param config ASRC channel pair configuration pointer. param inputSampleRate in audio data sample rate. param outputSampleRate out audio data sample rate.

◆ ASRC_TransferTerminateConvert()

void ASRC_TransferTerminateConvert ( ASRC_Type base,
asrc_handle_t handle 
)

Terminate all ASRC convert.

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.

brief Terminate all asrc convert.

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_TransferAbortSend.

param base asrc base pointer. param handle asrc eDMA handle pointer.