AM275 FreeRTOS SDK  11.01.00
AASRC

The Asynchronous Audio Sample Rate Converter (AASRC) driver is a generic driver that can convert the sampling frequency of digital data samples of audio streams from one clock zone to another using ASRC interface. This is specially designed to transmit and receive the digital audio data.

Features Supported

  • Interrupt Mode operation
  • DMA Mode Operation
  • MONO, STEREO & GROUP Mode operation
  • SysConfig support for driver parameter configuration and initialization.
Note
The term "CHANNELS" mentioned in this document and over driver APIs refers to a specific transaction config in software context. This can be in MONO, STEREO, or GROUP operating modes and may involve multiple hardware SRCs, depending on the number of input lines required for the conversion. The maximum channel that can be allocated per AASRC instance is 8 which can thus allocate a minimum of 8 input lines taken from each SRCs in the case where each channel is assigned as MONO mode or a maximum of 16 input lines where all the input lines of 8 SRCs are utilised in the case where each channel is assigned as STEREO mode. The minium channel can be 1 and it results in the allocation of 1 input line of any SRC in case of MONO, or 2 input lines of any SRC in case of STEREO or from 2 to 16 input lines of SRCs in case of GROUP mode. "Channel Count" under each "CHANNEL" config refers to the number of hardware input lines of SRCs or in other terms the number of MONO channel count required for the specific "CHANNEL" config. For eg. for MONO mode it is 1, STEREO mode it is 2 , and for GROUP mode it can range from from 2 to 16

Usage Overview

  • The clock input for receive and transmit section can be provided from four different clock zones on each side
  • Application can provide an external buffer for loopjob buffer
    • This enables application to provide the transaction buffer itself as loopjob
  • Loopjob buffer size have to be divisible by the channel count
  • Input transaction buffer samples have to be in interleaved format based on count of MONO channel mentioned in the operating mode

API Sequence

To use the AASRC driver to covert sampling frequency of data over the AASRC interface, the application can call the following APIs:

Loopjob Configuration

AASRC driver allows loopjob enabled/disabled configuration to handle delayed application buffer submission at run time. Loopjob is a default buffer that gets transmitted / received into if the application fails to submit the buffers in time. When loopjob is disabled the last application buffers will be re programmed and re used in the case where transactions run out The application callback corresponding to the re programmed buffers is not called.

  • If the loopjob buffer is programmed, after sending the full loopjob buffer next submitted buffer is programmed.

Buffer Queuing

  • The application buffers need to be programmed before starting the conversion.
  • If the loopjob is enabled application can start without queuing any buffers, Driver will work with the loopjob buffers till application queues the actual buffers.
  • If loopjob is disabled at least 2 buffers should be queued before starting the mcasp transfer. New buffer will be programmed in the interrupt callback corresponding to current transfer. the application is expected to submit the new buffer before that else the same buffer is re programmed, so it is recommended to start the transfer with at least 3 buffers queued.

Example Usage

Include the below file to access the APIs

#include <drivers/aasrc.h>

Instance & Channel Open Example

int32_t status;
AASRC_OpenParams aasrcParams
AASRC_OpenParams_init(&aasrcParams); /* Initialize aasrc parameters */
gAasrcHandle = AASRC_open(CONFIG_AASRC0, &aasrcParams);
DebugP_assert(gAasrcHandle != NULL);
gAasrcChHandle = AASRC_chOpen(CONFIG_AASRC0_CH0, gAasrcHandle);
DebugP_assert(gAasrcChHandle != NULL);
status = AASRC_chConfig(gAasrcChHandle);

Instance Close Example

AASRC_close(gAasrcHandle);

Start Aasrc Transfer Example

int32_t status;
uint32_t i;
/* AASRC transaction objects for transmit and Receive */
AASRC_Transaction aasrcAudioTxnTx[APP_AUDIO_TRANSACTION_COUNT] = {0};
AASRC_Transaction aasrcAudioTxnRx[APP_AUDIO_TRANSACTION_COUNT] = {0};
/* Buffers for audio transmit and Receive */
uint32_t audioBufferTx[APP_AUDIO_TRANSACTION_COUNT][MONO_INPUT_TRANSACTION_SAMPLE_COUNT] __attribute__((aligned(256)));
uint32_t audioBufferRx[APP_AUDIO_TRANSACTION_COUNT][MONO_INPUT_TRANSACTION_SAMPLE_COUNT] __attribute__((aligned(256)));
for (i = 0U; i < APP_AUDIO_TRANSACTION_COUNT; i++)
{
/* Submit AASRC Trasmit Txn */
aasrcAudioTxnTx[i].buf = (void*) &audioBufferTx[i][0];
aasrcAudioTxnTx[i].sampleCount = MONO_INPUT_TRANSACTION_SAMPLE_COUNT;
AASRC_queueTransactionTx( aasrcChHandle, &aasrcAudioTxnTx[i]);
/* Submit AASRC Recieve Txn */
aasrcAudioTxnRx[i].buf = (void*) &audioBufferRx[i][0];
aasrcAudioTxnRx[i].sampleCount = MONO_INPUT_TRANSACTION_SAMPLE_COUNT;
AASRC_queueTransactionRx( aasrcChHandle, &gAasrcAudioTxnRx[i]);
}
status = AASRC_chEnable(chHandle);

Stop Aasrc Transfer Example

AASRC_chDisable(chHandle);

Callback Function Example

void aasrc_loopback_txcb (AASRC_ChHandle handle,
AASRC_Transaction *transaction)
{
/* Post semaphore to track transaction count */
SemaphoreP_post(&gCountSemAsrcConv);
}
void aasrc_loopback_rxcb (AASRC_ChHandle handle,
AASRC_Transaction *transaction)
{
}

API

APIs for AASRC

status
uint32_t status
Definition: tisci_lpm.h:1
AASRC_OpenParams
AASRC Parameters.
Definition: aasrc/v0/aasrc.h:102
AASRC_chConfig
int32_t AASRC_chConfig(AASRC_ChHandle chHandle)
Function to configure ASRC channels.
AASRC_queueTransactionTx
int32_t AASRC_queueTransactionTx(AASRC_ChHandle chHandle, AASRC_Transaction *transaction)
Function submit transactions to AASRC output queue.
AASRC_ChHandle
void * AASRC_ChHandle
AASRC channel handle which points to AASRC channnel status and configs.
Definition: aasrc_types.h:71
AASRC_chDisable
int32_t AASRC_chDisable(AASRC_ChHandle chHandle)
AASRC channel disable.
AASRC_Transaction
Data structure used with transfer call.
Definition: aasrc_transactions.h:128
AASRC_chEnable
int32_t AASRC_chEnable(AASRC_ChHandle chHandle)
AASRC channel enable.
AASRC_open
AASRC_Handle AASRC_open(uint8_t instNum, const AASRC_OpenParams *openParams)
This function opens a given AASRC IP Core.
AASRC_close
void AASRC_close(AASRC_Handle drvHandle)
Function to close a AASRC IP Core specified by the AASRC handle.
AASRC_Transaction::buf
void * buf
Definition: aasrc_transactions.h:132
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
AASRC_Transaction::sampleCount
uint32_t sampleCount
Definition: aasrc_transactions.h:135
__attribute__
void __attribute__((__noreturn__))(*Bootloader_SelfCoreJump)(void)
Function pointer to jump a self core to specific code location in AM62x SOC.
Definition: bootloader_soc.h:71
SemaphoreP_post
void SemaphoreP_post(SemaphoreP_Object *obj)
Post a semaphore object or unlock a mutex.
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:183
aasrc.h
AASRC_chOpen
AASRC_ChHandle AASRC_chOpen(uint8_t chIdx, AASRC_Handle drvHandle)
Function to allocate a required ASRC channel.
AASRC_queueTransactionRx
int32_t AASRC_queueTransactionRx(AASRC_ChHandle chHandle, AASRC_Transaction *transaction)
Function submit transactions to AASRC input queue.