![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | asrc_data_format_t |
asrc context data format More... | |
struct | asrc_access_ctrl_t |
asrc context access control The ASRC provides interleaving support in hardware to ensure that a variety of sample source can be internally combined tp confir with this format. More... | |
struct | asrc_context_input_config_t |
asrc context input configuration More... | |
struct | asrc_context_output_config_t |
asrc context output configuration More... | |
struct | asrc_context_prefilter_config_t |
asrc context prefilter configuration More... | |
struct | asrc_context_resampler_config_t |
asrc context resampler configuration More... | |
struct | asrc_context_config_t |
asrc context configuration More... | |
struct | asrc_transfer_t |
ASRC transfer. More... | |
Macros | |
#define | FSL_ASRC_INPUT_FIFO_DEPTH (128U) |
ASRC fifo depth. | |
#define | ASRC_SUPPORT_MAXIMUM_CONTEXT_PROCESSOR_NUMBER 4U |
ASRC support maximum channel number of context. | |
Driver version | |
#define | FSL_ASRC_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
Version 2.0.1. | |
Initialization and deinitialization | |
uint32_t | ASRC_GetInstance (ASRC_Type *base) |
Get instance number of the ASRC peripheral. More... | |
void | ASRC_Init (ASRC_Type *base) |
brief Initializes the asrc peripheral. More... | |
void | ASRC_Deinit (ASRC_Type *base) |
De-initializes the ASRC peripheral. More... | |
void | ASRC_GetContextDefaultConfig (asrc_context_config_t *config, uint32_t channels, uint32_t inSampleRate, uint32_t outSampleRate) |
ASRC get context default configuration. More... | |
status_t | ASRC_SetContextConfig (ASRC_Type *base, asrc_context_t context, asrc_context_config_t *config) |
ASRC configure context. More... | |
status_t | ASRC_SetContextOutputConfig (ASRC_Type *base, asrc_context_t context, asrc_context_output_config_t *config) |
ASRC configure context output. More... | |
status_t | ASRC_SetContextInputConfig (ASRC_Type *base, asrc_context_t context, asrc_context_input_config_t *config) |
ASRC configure context input. More... | |
static void | ASRC_EnableContextRun (ASRC_Type *base, asrc_context_t context, bool enable) |
ASRC context enable run. More... | |
static void | ASRC_EnableContextRunStop (ASRC_Type *base, asrc_context_t context, bool enable) |
ASRC context enable run stop. More... | |
static void | ASRC_EnableContextInDMA (ASRC_Type *base, asrc_context_t context, bool enable) |
ASRC context input DMA request enable. More... | |
static void | ASRC_EnableContextOutDMA (ASRC_Type *base, asrc_context_t context, bool enable) |
ASRC context output DMA request enable. More... | |
static void | ASRC_EnablePreFilterBypass (ASRC_Type *base, asrc_context_t context, bool bypass) |
ASRC prefilter bypass mode This function enable the ASRC prefilter bypass mode. More... | |
static void | ASRC_EnableResamplerBypass (ASRC_Type *base, asrc_context_t context, bool bypass) |
ASRC resampler bypass mode This function enable the ASRC resampler bypass mode. More... | |
static void | ASRC_SetContextChannelNumber (ASRC_Type *base, asrc_context_t context, uint32_t channels) |
ASRC set context channel number. More... | |
uint32_t | ASRC_GetContextOutSampleSize (uint32_t inSampleRate, uint32_t inSamplesSize, uint32_t inWidth, uint32_t outSampleRate, uint32_t outWidth) |
ASRC get output sample count. 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_GetInterruptStatus (ASRC_Type *base) |
Gets the ASRC interrupt status flag state. More... | |
static void | ASRC_ClearInterruptStatus (ASRC_Type *base, uint32_t status) |
clear the ASRC interrupt status flag state. More... | |
static uint32_t | ASRC_GetFifoStatus (ASRC_Type *base, asrc_context_t context) |
Gets the ASRC fifo status flag. More... | |
fifo Operations | |
static void | ASRC_WriteContextFifo (ASRC_Type *base, asrc_context_t context, uint32_t data) |
write the ASRC context fifo. More... | |
static uint32_t | ASRC_ReadContextFifo (ASRC_Type *base, asrc_context_t context) |
read the ASRC context fifo. More... | |
static uint32_t | ASRC_GetWriteContextFifoAddr (ASRC_Type *base, asrc_context_t context) |
Get ASRC write fifo address. More... | |
static uint32_t | ASRC_GetReadContextFifoAddr (ASRC_Type *base, asrc_context_t context) |
Get the ASRC read context fifo address. More... | |
uint32_t | ASRC_ReadFIFORemainedSample (ASRC_Type *base, asrc_context_t context, uint32_t *outAddr, uint32_t outWidth, uint32_t sampleCount) |
Get the ASRC read fifo remained samples. More... | |
Transactional | |
status_t | ASRC_TransferBlocking (ASRC_Type *base, asrc_context_t context, asrc_transfer_t *xfer) |
ASRC blocking convert audio sample rate. More... | |
struct asrc_data_format_t |
Data Fields | |
uint8_t | dataPosition |
context input data sample position | |
asrc_data_endianness_t | dataEndianness |
context input data endianness | |
asrc_data_width_t | dataWidth |
context input data width | |
asrc_data_type_t | dataType |
context input data type | |
asrc_data_sign_t | dataSign |
context input data signed or unsigned | |
struct asrc_access_ctrl_t |
The interleave patter is controlled using 3 register fields: GROUP_LENGTH, ACCESS_LENGTH, ITERATIONIS. This is intended to support hardware configurations which distribute a single context across samples from multiple audio sources. Take a example as below: accessGroupLen = 6, the sample group length is 6 samples accessIterations = 2, the 2 sequential ACCESS_LENGTH read from single source accessLen = 2, the 2 samples fetch from one source.
Data Fields | |
uint8_t | accessIterations |
number of sequential fetches per source | |
uint8_t | accessGroupLen |
number of channels in a context | |
uint8_t | accessLen |
number of channels per source1 | |
struct asrc_context_input_config_t |
Data Fields | |
uint32_t | sampleRate |
input audio data sample rate | |
uint8_t | watermark |
input water mark per samples | |
asrc_access_ctrl_t | accessCtrl |
input access control | |
asrc_data_format_t | dataFormat |
input data format | |
struct asrc_context_output_config_t |
Data Fields | |
uint32_t | sampleRate |
output audio data sample rate | |
uint8_t | watermark |
output water mark per samples | |
asrc_access_ctrl_t | accessCtrl |
output access control | |
asrc_data_format_t | dataFormat |
output data format | |
bool | enableDither |
output path contains a TPDF dither function. More... | |
bool | enableIEC60958 |
output IEC60958 bit field insertion enable | |
bool asrc_context_output_config_t::enableDither |
The dither function support all fixed output modes(16, 20, 24, 32bits) dither is not supported in 32bit floating point output mode
struct asrc_context_prefilter_config_t |
Data Fields | |
asrc_sampleBuffer_init_mode_t | initMode |
prefilter initial mode | |
asrc_sampleBuffer_stop_mode_t | stopMode |
prefilter stop mode | |
asrc_prefilter_stage1_result_t | stage1Result |
stage1 data store format | |
uint32_t | filterSt1Taps |
prefilter stage1 taps | |
uint32_t | filterSt2Taps |
prefilter stage2 taps | |
uint32_t | filterSt1Exp |
prefilter stage1 expansion factor | |
const uint32_t * | filterCoeffAddress |
prefilter coeff address | |
struct asrc_context_resampler_config_t |
Data Fields | |
asrc_sampleBuffer_init_mode_t | initMode |
initial mode | |
asrc_sampleBuffer_stop_mode_t | stopMode |
resampler stop mode | |
asrc_resampler_taps_t | tap |
resampleer taps | |
uint32_t | filterPhases |
interpolation phases | |
uint64_t | filterCenterTap |
interpolation center tap | |
const uint32_t * | filterCoeffAddress |
interpolation coeff address | |
struct asrc_context_config_t |
Data Fields | |
uint8_t | contextChannelNums |
context channel numbers | |
asrc_context_input_config_t | contextInput |
context input configuration | |
asrc_context_output_config_t | contextOutput |
context output configuration | |
asrc_context_prefilter_config_t | contextPrefilter |
context pre filter configuration | |
asrc_context_resampler_config_t | contextResampler |
context resampler configuration | |
struct asrc_transfer_t |
Data Fields | |
uint32_t * | inDataAddr |
address of audio data to be converted | |
uint32_t | inDataSize |
size of the audio data | |
uint32_t * | outDataAddr |
address of audio data that is been converted | |
uint32_t | outDataSize |
size of the audio data | |
enum _asrc_status |
enum asrc_context_t |
enum _asrc_interrupt_mask |
enum _asrc_fifo_status |
enum asrc_data_width_t |
enum asrc_data_type_t |
enum asrc_data_sign_t |
enum _asrc_sample_rate |
uint32_t ASRC_GetInstance | ( | ASRC_Type * | base | ) |
base | ASRC base pointer. |
void ASRC_Init | ( | ASRC_Type * | base | ) |
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.
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
base | ASRC base pointer. |
void ASRC_GetContextDefaultConfig | ( | asrc_context_config_t * | config, |
uint32_t | channels, | ||
uint32_t | inSampleRate, | ||
uint32_t | outSampleRate | ||
) |
config | ASRC context configuration pointer. |
channels | input audio data channel numbers. |
inSampleRate | input sample rate. |
outSampleRate | output sample rate. |
status_t ASRC_SetContextConfig | ( | ASRC_Type * | base, |
asrc_context_t | context, | ||
asrc_context_config_t * | config | ||
) |
base | ASRC base pointer. |
context | index of asrc context, reference asrc_context_t. |
config | ASRC context configuration pointer. |
kStatus_InvalidArgument | invalid parameters. kStatus_ASRCConfigureFailed context configure failed. kStatus_Success context configure success. |
status_t ASRC_SetContextOutputConfig | ( | ASRC_Type * | base, |
asrc_context_t | context, | ||
asrc_context_output_config_t * | config | ||
) |
base | ASRC base pointer. |
context | index of asrc context, reference asrc_context_t. |
config | ASRC context output configuration pointer. |
status_t ASRC_SetContextInputConfig | ( | ASRC_Type * | base, |
asrc_context_t | context, | ||
asrc_context_input_config_t * | config | ||
) |
base | ASRC base pointer. |
context | index of asrc context, reference asrc_context_t. |
config | ASRC context input configuration pointer. |
|
inlinestatic |
All control fileds associated with a context must be stable prior to setting context run enable.
base | ASRC base pointer. |
context | ASRC context index. |
enable | true is enable, inform the datapath begin processing sample data for the context. false is disable, data processing will halt immediately. |
|
inlinestatic |
This function used to flush the ASRC pipeline and completely end processing for a context.
base | ASRC base pointer. |
context | ASRC context index. |
enable | true is enable, false is disable. |
|
inlinestatic |
base | ASRC base pointer. |
context | ASRC context index. |
enable | true is enable, false is disable. |
|
inlinestatic |
base | ASRC base pointer. |
context | ASRC context index. |
enable | true is enable, false is disable. |
|
inlinestatic |
base | ASRC peripheral base address. |
context | context processor number. |
bypass | true is bypass, false is normal mode. |
|
inlinestatic |
base | ASRC peripheral base address. |
context | context processor number. |
bypass | true is bypass, false is normal mode. |
|
inlinestatic |
Note: The maximum channel number in one context can not exceed 32.
base | ASRC peripheral base address. |
context | context number. |
channels | channel number, should <= 32. |
uint32_t ASRC_GetContextOutSampleSize | ( | uint32_t | inSampleRate, |
uint32_t | inSamplesSize, | ||
uint32_t | inWidth, | ||
uint32_t | outSampleRate, | ||
uint32_t | outWidth | ||
) |
inSampleRate | output sample rate. |
inSamplesSize | input sample rate. |
inWidth | input samples buffer size, the size of buffer should be converted to align with 4 byte . |
outSampleRate | input sample width. |
outWidth | Output width. |
output | samples size. |
|
inlinestatic |
base | ASRC peripheral base address. |
mask | The interrupts to enable. Logical OR of _asrc_interrupt_mask. |
|
inlinestatic |
base | ASRC peripheral base address. |
mask | The interrupts to disable. Logical OR of _asrc_interrupt_mask. |
|
inlinestatic |
base | ASRC base pointer |
|
inlinestatic |
base | ASRC base pointer |
status | status flag to be cleared. |
|
inlinestatic |
base | ASRC base pointer |
|
inlinestatic |
base | ASRC base pointer. |
context | context id. |
data | data to write. |
|
inlinestatic |
base | ASRC base pointer. |
context | context id. |
read | data. |
|
inlinestatic |
base | ASRC base pointer. |
context | context id. |
write | fifo address. |
|
inlinestatic |
base | ASRC base pointer. |
context | context id. |
read | fifo address. |
uint32_t ASRC_ReadFIFORemainedSample | ( | ASRC_Type * | base, |
asrc_context_t | context, | ||
uint32_t * | outAddr, | ||
uint32_t | outWidth, | ||
uint32_t | sampleCount | ||
) |
Since the DMA request will be triggered only when the sample group in read fifo is bigger then the watermark, so when the data size cannot be divisible by the (watermark + 1), then part of sample will left in read fifo, application should call this api to get the left samples.
base | ASRC base pointer. |
context | context id. |
outAddr | address to receive remained sample in read fifo. |
outWidth | output data width. |
sampleCount | specify the read sample count. |
sample | counts actual read from output fifo. |
status_t ASRC_TransferBlocking | ( | ASRC_Type * | base, |
asrc_context_t | context, | ||
asrc_transfer_t * | xfer | ||
) |
This function depends on the configuration of input and output, so it should be called after the ASRC_SetContextConfig. The data format it supports: 1.16bit 16bit per sample in input buffer, input buffer size should be calculate as: samples 2U output buffer size can be calculated by call function ASRC_GetContextOutSampleSize, the parameter outWidth should be 2 2.20bit 24bit per sample in input buffer, input buffer size should be calculate as: samples 3U output buffer size can be calculated by call function ASRC_GetContextOutSampleSize, the outWidth should be 3. 3.24bit 24bit per sample in input buffer, input buffer size should be calculate as: samples * 3U output buffer size can be calculated by call function ASRC_GetContextOutSampleSize, the outWidth should be 3. 4.32bit 32bit per sample in input buffer, input buffer size should be calculate as: samples * 4U output buffer size can be calculated by call function ASRC_GetContextOutSampleSize, the outWidth should be 4.
base | ASRC base pointer. |
context | context id. |
xfer | .xfer configuration. |
kStatus_Success. |