Platform API

AudioCore API updates

DequeueAll

There is a new public method in AudioCore that can be used to force dequeueing all messages.

void AudioCore::dequeueAll();

This method simply calls the normal dequeue method with unlimited time.  It doesn’t have a purpose in the normal use of AudioCore but is provided in case there is a situation where a message MUST be processed immediately.

AudioCore Buffer Changes

The alignment requirements for AudioCore buffers are updated.  The buffers must now be 16 byte aligned.  This change is driven by the requirement in AudioProcessing.  Note if you use AudioProcessing directly you will have to ensure those buffers are 16 byte aligned too.

To be clear, each buffer within inputs (inputs[0], inputs[1]) must be allocated on a  16 byte boundry.

xAF_Error AudioCore::calc(xAFAudio** inputs, xAFAudio** outputs);

xAF_Error CAudioProcessing::calc(xAFAudio** inputs, xAFAudio** outputs)

Hardware Abstraction Layer (HAL) updates

Following are the additions to the HAL APIs:

/**
* \brief Create the HAL instance in parallel to core class using singleton design pattern method.
* If the API is called first time and instance is not created, API will create instance.
* Otherwise it will return an error for trying to create the singleton twice.
* \param alloc function for allocating memory
* \param dealloc function for deallocating memory
* \param osal pointer to application OSAL
* \return xAF_SUCCESS after successfull instantiation of HAL instance
*/
static xAF_Error createHalInstance(memAllocRef alloc, memDeAllocRef dealloc, COsal* osal);

OS Abstraction Layer (OSAL)

The audio framework and HAL can access OS resources by using the COsal supported by the target platform. The OSAL exposes APIs that can be used by audio framework and HAL to perform their tasks. COsal should be instantiated by the platform similar to instantiating core class. COsal should be instantiated once per device and same instance should be registered for multiple instances of core class or framework instance. The APIs in COsal class are listed below.

/**
* Creates a semaphore object, allocates required resources and assigns the values of maxValue and initialValue to it.
* \param maxValue Maximum count value for the semaphore object
* \param initialValue Initial value for the semaphore object
* \return Pointer to semaphore object.
*/
virtual XAF_OSAL_SEM_HANDLE* osalSemCreate(xUInt8 maxValue, xUInt8 initialValue) const = 0;

/**
* Deletes the semaphore object and releases the allocated resources
* \param sem Semaphore object to be deleted
* \return xAF_SUCCESS when successful otherwise errorcode.
*/
virtual xAF_Error osalSemDestroy(XAF_OSAL_SEM_HANDLE* sem) const = 0;

/**
* \brief Takes the semaphore object if it is available. Otherwise the calling task or thread
* will be blocked. This should not be called from interrupt service routine.
* \param sem Semaphore object for synchronization
* \return xAF_SUCCESS when successful otherwise errorcode.
*/
virtual xAF_Error osalSemWait(XAF_OSAL_SEM_HANDLE* sem) const = 0;

/**
* \brief Takes the semaphore object if it is available. If the semaphore is not available,
* the calling task or thread will not be blocked.
* \param sem Semaphore object for synchronization
* \return xAF_SUCCESS when successful otherwise errorcode.
*/
virtual xAF_Error osalSemTryWait(XAF_OSAL_SEM_HANDLE* sem) const = 0;

/**
* Releases or signals the semaphore object.
* \param sem Semaphore object for synchronization
* \return xAF_SUCCESS when successful otherwise errorcode.
*/
virtual xAF_Error osalSemPost(XAF_OSAL_SEM_HANDLE* sem) const = 0;

/**
* \brief Enables protection for shared resources from concurrency access
* The instructions below this API will be executed atomically
* \return xAF_SUCCESS when successful otherwise errorcode.
*/
virtual xAF_Error osalEnterCriticalRegion() const = 0;

/**
* \brief Disables protection for shared resources from concurrency access
* The instructions above this API will be executed atomically
* \return xAF_SUCCESS when successful otherwise errorcode.
*/
virtual xAF_Error osalExitCriticalRegion() const = 0;

_________________

Rate this post!