![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
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... | |
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 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 | |
Driver version | |
#define | FSL_ASRC_DRIVER_VERSION (MAKE_VERSION(2, 1, 3)) |
Version 2.1.3. | |
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... | |
struct _asrc_channel_pair_config |
Data Fields | |
asrc_audio_channel_t | audioDataChannels |
audio data channel numbers | |
asrc_clock_source_t | inClockSource |
input clock source, reference the clock source definition in SOC header file | |
uint32_t | inSourceClock_Hz |
input source clock frequency | |
asrc_clock_source_t | outClockSource |
output clock source, reference the clock source definition in SOC header file | |
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 |
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... | |
void* _asrc_transfer::inData |
size_t _asrc_transfer::inDataSize |
size_t _asrc_transfer::outDataSize |
struct _asrc_in_handle |
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 |
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 |
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 | |
#define ASRC_XFER_QUEUE_SIZE (4U) |
anonymous enum |
enum _asrc_channel_pair |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
enum _asrc_ratio |
enum _asrc_audio_channel |
enum _asrc_data_width |
enum _asrc_data_align |
enum _asrc_sign_extension |
uint32_t ASRC_GetInstance | ( | ASRC_Type * | base | ) |
base | ASRC 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
base | ASRC 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.
base | ASRC 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 | ||
) |
base | ASRC base pointer. |
channelPair | index of channel pair, reference _asrc_channel_pair. |
config | ASRC channel pair configuration pointer. |
inputSampleRate | input audio data sample rate. |
outputSampleRate | output 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 | ||
) |
base | asrc base pointer. |
channelPair | ASRC channel pair number. |
inSampleRate | input sample rate. |
outSampleRate | output sample rate. |
inSamplesize | input sampleS size. |
output | buffer size in byte. |
uint32_t ASRC_MapSamplesWidth | ( | ASRC_Type * | base, |
asrc_channel_pair_t | channelPair, | ||
uint32_t * | inWidth, | ||
uint32_t * | outWidth | ||
) |
base | asrc base pointer. |
channelPair | asrc channel pair index. |
inWidth | ASRC channel pair number. |
outWidth | input sample rate. |
input | sample mask value. |
uint32_t ASRC_GetRemainFifoSamples | ( | ASRC_Type * | base, |
asrc_channel_pair_t | channelPair, | ||
uint32_t * | buffer, | ||
uint32_t | outSampleWidth, | ||
uint32_t | remainSamples | ||
) |
base | asrc base pointer. |
channelPair | ASRC channel pair number. |
buffer | input sample numbers. |
outSampleWidth | output sample width. |
remainSamples | output sample rate. |
remain | samples number. |
|
inlinestatic |
base | ASRC base pointer. |
enable | true is enable, false is disable |
|
inlinestatic |
base | ASRC base pointer. |
channelPair | channel pair mask value, reference _asrc_channel_pair_mask. |
enable | true is enable, false is disable. |
|
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 |
channel | ASRC channel pair. |
|
inlinestatic |
base | ASRC base pointer |
channelPair | ASRC channel pair. |
|
inlinestatic |
Note: ASRC fifo width is 24bit.
base | ASRC base pointer. |
channelPair | ASRC channel pair. |
data | Data needs to be written. |
|
inlinestatic |
Note: ASRC fifo width is 24bit.
base | ASRC base pointer. |
channelPair | ASRC channel pair. |
value | read from fifo. |
|
inlinestatic |
Note: ASRC fifo width is 24bit.
base | ASRC base pointer. |
channelPair | ASRC channel pair. |
|
inlinestatic |
Note: ASRC fifo width is 24bit.
base | ASRC base pointer. |
channelPair | ASRC 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.
base | ASRC base pointer. |
channelPair | ASRC channel pair. |
inputSampleRate | input audio data sample rate. |
outputSampleRate | output 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 | ||
) |
base | ASRC base pointer. |
handle | ASRC transactional handle pointer. |
config | ASRC channel pair configuration pointer. |
inputSampleRate | input audio data sample rate. |
outputSampleRate | output 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.
base | ASRC base pointer |
handle | ASRC handle pointer. |
channelPair | ASRC channel pair. |
inCallback | Pointer to the user callback function. |
outCallback | Pointer to the user callback function. |
userData | User parameter passed to the callback function |
status_t ASRC_TransferNonBlocking | ( | ASRC_Type * | base, |
asrc_handle_t * | handle, | ||
asrc_transfer_t * | xfer | ||
) |
base | asrc base pointer. |
handle | Pointer to the asrc_handle_t structure which stores the transfer state. |
xfer | Pointer to the ASRC_transfer_t structure. |
kStatus_Success | Successfully started the data receive. |
kStatus_ASRCBusy | Previous receive still not finished. |
status_t ASRC_TransferBlocking | ( | ASRC_Type * | base, |
asrc_channel_pair_t | channelPair, | ||
asrc_transfer_t * | xfer | ||
) |
base | asrc base pointer. |
channelPair | channel pair index. |
xfer | Pointer to the ASRC_transfer_t structure. |
kStatus_Success | Successfully started the data receive. |
status_t ASRC_TransferGetConvertedCount | ( | ASRC_Type * | base, |
asrc_handle_t * | handle, | ||
size_t * | count | ||
) |
base | ASRC base pointer. |
handle | Pointer to the asrc_handle_t structure which stores the transfer state. |
count | Bytes count sent. |
kStatus_Success | Succeed get the transfer count. |
kStatus_ASRCIdle | There is not a non-blocking transaction currently in progress. |
void ASRC_TransferAbortConvert | ( | ASRC_Type * | base, |
asrc_handle_t * | handle | ||
) |
base | ASRC base pointer. |
handle | Pointer 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.
base | ASRC base pointer. |
handle | ASRC eDMA handle pointer. |
void ASRC_TransferHandleIRQ | ( | ASRC_Type * | base, |
asrc_handle_t * | handle | ||
) |
base | ASRC base pointer. |
handle | Pointer to the asrc_handle_t structure. |