Skip to content

Include/AWEInstance.h

The AWEInstance API Header File.

Classes

Name
struct _AWEInstance
The AWE instance.
struct AWEBuildVersionInfo
Build versioning structure returned by awe_getBuildVersionInfo.

Types

Name
typedef void()(struct _AWEInstance pAWE, INT32 level, UINT32 type, void *payload, INT32 payloadSizeInBytes) cbAweLogging_t
OPTIONAL This callback is invoked from multiple places in the AWE framework to log any message to the BSP.
typedef INT32()(struct _AWEInstance pAWE, INT32 eventType, UINT32 moduleObjId, void payload, INT32 payloadSizeInBytes, void userHandle) cbAweEventTrigger_t
OPTIONAL These callback are invoked only from the Event Module.
typedef INT32()(struct _AWEInstance pAWE, INT32 eventType, UINT32 moduleObjId, INT32 payloadSizeInBytes, void **userHandle) cbAweEventRegister_t
The Event Register callback is called by an Event Module when it is constructed.
typedef INT32()(struct _AWEInstance pAWE, INT32 eventType, UINT32 moduleObjId, void **userHandle) cbAweEventDeregister_t
The Event Deregister callback is called by the Event Module when it is destroyed.
typedef struct _AWEInstance AWEInstance
The AWE instance.
typedef struct AWEBuildVersionInfo AWEBuildVersionInfo_t
Build versioning structure returned by awe_getBuildVersionInfo.
typedef INT32(AWEInstance *pAWE) packetProcessFunction

Functions

Name
INT32 awe_init(AWEInstance * pAWE)
Initialize the instance.
INT32 awe_initPin(IOPinDescriptor * pPin, UINT32 channels, const char * name)
Initialize an input or output pin.
void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance)
Initialize the file system.
INT32 awe_packetProcess(AWEInstance * pAWE)
Process an AWEInstance's newly received tuning packet.
INT32 awe_packetProcessMulti(AWEInstance * pAWE, BOOL isTuningInstance)
Multi-instance Wrapper for tuning packet processing.
INT32 awe_audioPump(AWEInstance * pAWE, UINT32 layoutIndex)
Audio pump function.
INT32 awe_audioImportSamples(const AWEInstance * pAWE, const void * inSamples, INT32 inStride, INT32 channel, SampleType inType)
Import samples from a user buffer to a channel.
INT32 awe_audioExportSamples(const AWEInstance * pAWE, void * outSamples, INT32 outStride, INT32 channel, SampleType outType)
Export samples to a user buffer from a channel.
INT32 awe_audioIsStarted(const AWEInstance * pAWE)
Check if this instance is running.
INT32 awe_audioIsStartedMulti(const AWEInstance * pAWE)
Check if all instances are running in multi-instance system.
INT32 awe_audioGetPumpMask(AWEInstance * pAWE)
Test if AWE is ready to run.
INT32 awe_audioIsReadyToPumpMulti(AWEInstance * pAWE, UINT32 instanceID)
Test if AWE is ready to run on secondary instances (ID > 0).
UINT32 awe_audioStartPreemption(AWEInstance * pAWE, INT32 coreAffinity)
Function to correct overhead outside of the Audio Weaver, like Audio DMA ISR.
UINT32 awe_audioEndPreemption(AWEInstance * pAWE, UINT32 start_time, INT32 coreAffinity)
Function to correct overhead outside of the Audio Weaver, like Audio DMA ISR.
INT32 awe_deferredSetCall(AWEInstance * pAWE)
Perform deferred awe set on a module.
INT32 awe_loadAWBfromArray(AWEInstance * pAWE, const UINT32 * pCommands, UINT32 arraySize, UINT32 * pPos)
Executes packet commands from an in-memory array.
INT32 awe_loadSubcanvasAWBfromArray(AWEInstance * pAWE, UINT32 SubcanvasModObjectID, const UINT32 * pCommands, UINT32 arraySize, UINT32 * pPos)
Executes packet commands from an in-memory array and loads AWB in Subcanvas module.
INT32 awe_loadAWBfromFile(AWEInstance * pAWE, const char * binaryFile, UINT32 * pPos)
Load an AWB file from stdio.
INT32 awe_loadSubcanvasAWBfromFile(AWEInstance * pAWE, UINT32 SubcanvasModObjectID, const char * binaryFile, UINT32 * pPos)
Load an AWB file from stdio into Subcanvas module.
INT32 awe_loadAWBfromFlash(AWEInstance * pAWE, const char * binaryFile, UINT32 * pPos)
Load an AWB file from the flash.
INT32 awe_loadSubcanvasAWBfromFlash(AWEInstance * pAWE, UINT32 SubcanvasModObjectID, const char * binaryFile, UINT32 * pPos)
Load an AWB file from the flash.
void awe_layoutGetChannelCount(const AWEInstance * pAWE, UINT32 pinIdx, UINT32 * inCount, UINT32 * outCount)
Returns the number of channels in the Layout's input and output pins.
INT32 awe_layoutGetInputBlockSize(const AWEInstance * pAWE, UINT32 pinIdx, UINT32 * blockSize)
Returns the block size of a pin.
INT32 awe_layoutGetInputSampleRate(const AWEInstance * pAWE, UINT32 pinIdx, FLOAT32 * sampleRate)
Returns the sample rate of an input pin.
INT32 awe_layoutIsValid(const AWEInstance * pAWE)
Determines if a layout is loaded and valid.
INT32 awe_ctrlSetValue(AWEInstance * pAWE, UINT32 handle, const void * value, INT32 arrayOffset, UINT32 length)
Set a scalar or array value of a module variable by handle.
INT32 awe_ctrlGetValue(AWEInstance * pAWE, UINT32 handle, void * value, INT32 arrayOffset, UINT32 length)
Get a scalar or array value of a module variable by handle.
INT32 awe_ctrlSetStatus(AWEInstance * pAWE, UINT32 handle, UINT32 status)
Set the runtime status of a module.
INT32 awe_ctrlGetStatus(AWEInstance * pAWE, UINT32 handle, UINT32 * status)
Get the runtime status of a module.
INT32 awe_ctrlSetValueMask(AWEInstance * pAWE, UINT32 handle, const void * value, INT32 arrayOffset, UINT32 length, UINT32 mask)
Set a scalar or array value of a module variable by handle with mask.
INT32 awe_ctrlGetValueMask(AWEInstance * pAWE, UINT32 handle, void * value, INT32 arrayOffset, UINT32 length, UINT32 mask)
Get a scalar or array value of a module variable by handle with mask.
INT32 awe_ctrlGetModuleClass(AWEInstance * pAWE, UINT32 handle, UINT32 * pClassID)
Get an object class from its handle.
INT32 awe_setProfilingStatus(AWEInstance * pAWE, UINT32 status)
Enable or disable the profiling ability of the AWE Core.
INT32 awe_setProfilingOptions(AWEInstance * pAWE, UINT32 optionsMask, UINT32 profilingOptions)
Function to set profiling options like average or peak profiling on modules and turn on or off accurate profiling.
INT32 awe_getProfilingOptions(AWEInstance * pAWE, UINT32 * profilingOptions)
Function to get current profiling options.
INT32 awe_getAverageLayoutCycles(AWEInstance * pAWE, UINT32 layoutIdx, UINT32 * averageCycles)
Get the average cycles of a running layout, in units of cycles at profileSpeed.
void awe_setInstancesInfo(AWEInstance ** pInstances, INT32 numAweInstancesOnCore)
Setup function only intended for systems with multiple AWE Instances in a single core.
INT32 awe_fwSetLayoutCoreAffinity(AWEInstance * pAWE, INT32 layoutNumber, INT32 coreAffinity)
Set the core affinity of the layout in layoutNumber.
INT32 awe_fwGetLayoutCoreAffinity(AWEInstance * pAWE, INT32 layoutNumber)
Get the core affinity of the layout in layoutNumber, initializes to 0 and can be set with awe_fwSetLayoutCoreAffinity.
INT32 awe_getBuildVersionInfo(AWEBuildVersionInfo_t * pBuildVersionInfo)
Get the AWECore build number and version information.
INT32 awe_setInstanceStandaloneAWBLoad(AWEInstance * pAWE, INT32 status)
This function can be used to achieve Progressive Loading on a multi-instance system.
INT32 awe_registerLoggingCallback(AWEInstance * pAWE, cbAweLogging_t cbAweLogging, INT32 logLevel, UINT32 logTypeMask)
Register the logging callback with required logging level and logging type mask.
INT32 awe_registerEventCallbacks(AWEInstance * pAWE, cbAweEventTrigger_t cbAweEventTrigger, cbAweEventRegister_t cbAweEventRegister, cbAweEventDeregister_t cbAweEventDeregister)
Register the event callbacks used by the Event Module.
INT32 awe_resetState(AWEInstance * pAWE)
Walk through each module in each layout in an instance and calls reset function, if exists, clears wire buffers and clears IO buffers and layout masks.

Defines

Name
AWE_PROFILING_DISABLE_BOTH_LAYOUT_MODULE
Public macros to control profiling status.
AWE_PROFILING_ENABLE_BOTH_LAYOUT_MODULE
AWE_PROFILING_ENABLE_ONLY_MODULE
AWE_PROFILING_ENABLE_ONLY_LAYOUT
AWE_MODULE_PROFILING_BIT_POS
Profiling options bit masks and values.
AWE_MODULE_PROFILING_BIT_MASK
AWE_MODULE_PROFILING_AVERAGE
AWE_MODULE_PROFILING_PEAK
AWE_ACCURATE_PROFILING_BIT_POS
AWE_ACCURATE_PROFILING_BIT_MASK
AWE_ENABLE_ACCURATE_PROFILING
AWE_DISABLE_ACCURATE_PROFILING
AWE_CACHE_CALLBACK_TYPE_INVALIDATE
Macros for cache coherence handling.
AWE_CACHE_CALLBACK_TYPE_WRITEBACK
MAX_TARGET_THREADS
Max number of layout threads per AWE Instance.

Types Documentation

typedef cbAweLogging_t

typedef void(* cbAweLogging_t) (struct _AWEInstance *pAWE, INT32 level, UINT32 type, void *payload, INT32 payloadSizeInBytes);

OPTIONAL This callback is invoked from multiple places in the AWE framework to log any message to the BSP.

User should register the callback via awe_registerLoggingCallback, which requires logging level and type mask. type is a 32-bit bitfield, with each bit representing a type of message. These types are defined in the framework and provide information about where the logging messages come from. Type can be used to filter or do custom handling of certain messages. The payload pointer can be treated as a char *.

typedef cbAweEventTrigger_t

typedef INT32(* cbAweEventTrigger_t) (struct _AWEInstance *pAWE, INT32 eventType, UINT32 moduleObjId, void *payload, INT32 payloadSizeInBytes, void *userHandle);

OPTIONAL These callback are invoked only from the Event Module.

Use the awe_registerEventCallbacks to register them The Event Trigger callback is called when an Event Module is triggered in the layout. Depending on the Event Module configuration, this may happen inline in the module processing, or it may happen during deferred processing. In the latter case, there may be a delay between the actual event trigger and calling this Event Trigger callback. If this returns a negative number, then it is assumed that the Event Trigger was not successfully processed and the module's numFailedTriggers parameter will increment. If there is no Event Trigger callback registered, then the Event Module can never generate an event.

typedef cbAweEventRegister_t

typedef INT32(* cbAweEventRegister_t) (struct _AWEInstance *pAWE, INT32 eventType, UINT32 moduleObjId, INT32 payloadSizeInBytes, void **userHandle);

The Event Register callback is called by an Event Module when it is constructed.

The userHandle is free to use for whatever custom purpose is required. The user is responsible for managing any memory allocated to the userHandle. The user must not define a Event Register callback if no preparation is necessary to handle an Event. If a negative value is returned, then the module will fail to initialize and the layout will fail to load.

typedef cbAweEventDeregister_t

typedef INT32(* cbAweEventDeregister_t) (struct _AWEInstance *pAWE, INT32 eventType, UINT32 moduleObjId, void **userHandle);

The Event Deregister callback is called by the Event Module when it is destroyed.

When this is called, the user is responsible for freeing any memory allocated to the userHandle in the Event Register callback. The return value from this function is ignored.

typedef AWEInstance

typedef struct _AWEInstance AWEInstance;

The AWE instance.

The AWE Instance struct must have its members/pointers assigned at init time. The AWEInstance is the most important structure, and it must be initialized properly. After assigning all of the required members, the BSP author will call the awe_init() function. All members are required to be assigned unless they are marked optional in the detailed description below..

typedef AWEBuildVersionInfo_t

typedef struct AWEBuildVersionInfo AWEBuildVersionInfo_t;

Build versioning structure returned by awe_getBuildVersionInfo.

typedef packetProcessFunction

typedef INT32 packetProcessFunction(AWEInstance *pAWE);

Functions Documentation

function awe_init

INT32 awe_init(
    AWEInstance * pAWE
)

Initialize the instance.

Parameters:

  • pAWE instance to initialize

Return: E_SUCCESS, E_NULL_PACKET_BUFFER_POINTER, E_NULL_REPLY_BUFFER_POINTER, E_ZERO_PACKET_BUFFER_LENGTH, E_EXCEPTION, E_PARAMETER_ERROR, E_NOT_CREATED

Call this once you have assigned all of the required members/pointers of the AWE Instance, and after calling awe_InitPin on both input and output pins. Calling awe_init before assigning all members of the instance structure or initializing the pins will result in crashes/erratic behavior.

function awe_initPin

INT32 awe_initPin(
    IOPinDescriptor * pPin,
    UINT32 channels,
    const char * name
)

Initialize an input or output pin.

Parameters:

  • pPin the pin instance to initialize
  • channels number of channels
  • name optional pin name

Return: E_SUCCESS, E_NOT_OBJECT

This function must be called for both the input and output pins. Must be called BEFORE the awe_init API function.

function awe_initFlashFS

void awe_initFlashFS(
    AWEInstance * pAWE,
    AWEFlashFSInstance * pAWEFlashFSInstance
)

Initialize the file system.

Parameters:

  • pAWE instance to initialize
  • pAWEFlashFSInstance the file system instance

function awe_packetProcess

INT32 awe_packetProcess(
    AWEInstance * pAWE
)

Process an AWEInstance's newly received tuning packet.

Parameters:

  • pAWE The AWE instance pointer to process

Return: error E_SUCCESS, E_COMMAND_NOT_IMPLEMENTED, E_MESSAGE_LENGTH_TOO_LONG, E_CRC_ERROR, E_BADPACKET

function awe_packetProcessMulti

INT32 awe_packetProcessMulti(
    AWEInstance * pAWE,
    BOOL isTuningInstance
)

Multi-instance Wrapper for tuning packet processing.

Parameters:

  • pAWE The AWE instance pointer to process
  • isTuningInstance Boolean marking if the instance calling this API implements the tuning interface

Return: error E_SUCCESS, E_MULTI_PACKET_WAITING, E_COMMAND_NOT_IMPLEMENTED, E_MESSAGE_LENGTH_TOO_LONG, E_CRC_ERROR, E_BADPACKET

If called by the tuning instance, call whenever a complete packet is received. Wait until the return value is not E_MULTI_PACKET_WAITING to forward reply back to the tuning interface. If called by a non-tuning instance, poll continuously in a low-priority task.

function awe_audioPump

INT32 awe_audioPump(
    AWEInstance * pAWE,
    UINT32 layoutIndex
)

Audio pump function.

Parameters:

  • pAWE AWE instance pointer
  • layoutIndex the layout index to pump

Return: E_SUCCESS, E_NO_LAYOUTS, or 1 (indicating that deferred set is needed, see documentation)

Call this in your audio thread once you have imported the data you wish to process. Before pumping, you must also check that the AudioWeaver buffers have been filled (awe_getPumpMask) and that audio has been started (awe_audioIsStarted). This function will return 1 if awe_deferredSetCall needs to be called. This is for modules that need to do more time consuming calculations, like calculating filter coefficients. For example, a SOF Control module needs to calculate new coeffs when the frequency is modified by the control input.

function awe_audioImportSamples

INT32 awe_audioImportSamples(
    const AWEInstance * pAWE,
    const void * inSamples,
    INT32 inStride,
    INT32 channel,
    SampleType inType
)

Import samples from a user buffer to a channel.

Parameters:

  • pAWE AWE instance
  • inSamples pointer to first sample in buffer to import for current channel
  • inStride input buffer import stride
  • channel channel to write to
  • inType type of input data

Return: E_SUCCESS, E_AUDIO_NOT_STARTED, E_PARAMETER_ERROR

The value of the fundamentalBlockSize member of the AWEInstance determines the number of samples that are imported with each call. Call this function once for each audio input channel on the hardware. Channel matching between hardware capabilities and layout will be done automatically. For example, if the target has only 1 audio input channel, and if a layout with 3 input channels is loaded, the second and third channels of the layout input will be all zeros. Inversely, if there are more HW input channels than the layout expects, then they are ignored.

The value of inStride defines the number of samples to skip between each read, and should be the number of interleaved channels in the inSamples buffer being read from. A typical usage for a single source, interleaved stereo input could look like:

awe_audioImportSamples(pAWE, inSamples + 0, 2, 0, Sample32bit);
awe_audioImportSamples(pAWE, inSamples + 1, 2, 1, Sample32bit);

function awe_audioExportSamples

INT32 awe_audioExportSamples(
    const AWEInstance * pAWE,
    void * outSamples,
    INT32 outStride,
    INT32 channel,
    SampleType outType
)

Export samples to a user buffer from a channel.

Parameters:

  • pAWE AWE instance
  • outSamples pointer to first sample in buffer to export to
  • outStride output buffer export stride
  • channel channel to read from
  • outType type of output data

Return: E_SUCCESS, E_AUDIO_NOT_STARTED, E_PARAMETER_ERROR

The value of the fundamentalBlockSize member of the AWEInstance determines the number of samples that are exported with each call. Call this function once for each audio output channel on the hardware. Like awe_audioImportSamples, this will do channel matching automatically. For example, if the target has 3 audio output channels, and if a layout with 1 output channel is loaded, the second and third channels of the exported output will be all zeros. Inversely, if the layout has more output channels than the target supports, they are ignored.

The value of outStride defines the number of samples to skip between each write. It should be equal to the number of interleaved channels in the outSamples buffer being written to. A typical usage for exporting to an interleaved 3 channel output could look like:

awe_audioExportSamples(pAWE, &outSamples[0], 3, 0, Sample32bit);
awe_audioExportSamples(pAWE, &outSamples[1], 3, 1, Sample32bit);
awe_audioExportSamples(pAWE, &outSamples[2], 3, 2, Sample32bit);

function awe_audioIsStarted

INT32 awe_audioIsStarted(
    const AWEInstance * pAWE
)

Check if this instance is running.

Parameters:

  • pAWE instance pointer

Return: 0 if audio is not started, 1 if audio is started. No error conditions

A BSP author can use this to determine if the instance is already running to avoid pumping audio through a dead layout.

function awe_audioIsStartedMulti

INT32 awe_audioIsStartedMulti(
    const AWEInstance * pAWE
)

Check if all instances are running in multi-instance system.

Parameters:

  • pAWE instance pointer

Return: 0 if audio is not started or no sharedHeap, 1 if audio is started. No error conditions

This is intended to call only in multi-instance systems and if it is called from other systems (pSharedHeap == NULL) then it returns False. A BSP author (multi-instance) can use this to determine if all the instances are already running to synchronize pumping of all instances.

function awe_audioGetPumpMask

INT32 awe_audioGetPumpMask(
    AWEInstance * pAWE
)

Test if AWE is ready to run.

Parameters:

  • pAWE AWE instance

Return: bit vector of threads to run, 0 if no threads, E_AUDIO_NOT_STARTED

This will return the "layout mask" which is a bit vector of threads to run. For a simple, single threaded system, the bitvector will be 0x1. If a previous pump is not complete and the layout is ready to pump again, an overflow is detected by this function. In this condition, the layoutMask bit for the overflowed layout will be zero, which prevents the layout from being pumped again. Example: int layoutMask = awe_audioGetPumpMask(&g_AWEInstance); if (layoutMask > 0) { if (layoutMask & 0x1) { int ret = awe_audioPump(&g_AWEInstance, 0); } }

function awe_audioIsReadyToPumpMulti

INT32 awe_audioIsReadyToPumpMulti(
    AWEInstance * pAWE,
    UINT32 instanceID
)

Test if AWE is ready to run on secondary instances (ID > 0).

Parameters:

  • pAWE AWE instance
  • instanceID AWE instance ID

Return: true or false

This must be used in multi-instance applications to determine when to trigger secondary instances. Failure to do so can result in pumping at the wrong rates. This avoids unneccessary interrupts on secondary instances where layout block size is higher than the fundamental block size. This function returns TRUE or FALSE. When it returns TRUE, corresponding secondary instance is ready to signal. When this function is called with instance ID 0 or invalid ID, then always False is returned. Example: int pumpSlaveInstance = awe_audioIsReadyToPumpMulti(&g_AWEInstance, 1); if (pumpSlaveInstance) { Signal slave core to get pump mask raise(); }

function awe_audioStartPreemption

UINT32 awe_audioStartPreemption(
    AWEInstance * pAWE,
    INT32 coreAffinity
)

Function to correct overhead outside of the Audio Weaver, like Audio DMA ISR.

Parameters:

  • pAWE AWE instance
  • coreAffinity Core affinity from which this function is called

Return: start time stamp in cycles at profiling clock

Call this function at the very beginning of the DMA ISR and store the returned value, which is an argument to following end function call. For the use case where multiple instances exists on the same core, this function can be called with any instance's AWEInstance pointer, provided that the user called awe_setInstancesInfo during the startup. Example: UINT32 start_time = awe_audioStartPreemption(&g_AWEInstance, coreAffinity);

function awe_audioEndPreemption

UINT32 awe_audioEndPreemption(
    AWEInstance * pAWE,
    UINT32 start_time,
    INT32 coreAffinity
)

Function to correct overhead outside of the Audio Weaver, like Audio DMA ISR.

Parameters:

  • pAWE AWE instance
  • start_time Start time returned by the corresponding start function "awe_audioStartPreemption"
  • coreAffinity Core affinity from which this function is called

Return: Elapsed time between start preempt and this function

Call this function at the end in the DMA ISR with start_time returned by awe_audioStartPreemption(). If the DMA ISR has low latency audio pump calls, then this function must be called before the audio pump and call awe_audioStartPreemption() again after pump. Note that the funtion awe_audioStartPreemption() must be called first, before calling awe_audioEndPreemption(). For the use case where multiple instances exists on the same core, this function can be called with any instance's AWEInstance pointer, provided that the user called awe_setInstancesInfo during the startup. Example: awe_audioEndPreemption(&g_AWEInstance, start_time, coreAffinity);

function awe_deferredSetCall

INT32 awe_deferredSetCall(
    AWEInstance * pAWE
)

Perform deferred awe set on a module.

Parameters:

  • pAWE AWE instance pointer

Return: finishedProcessing Will return 1 when processing is incomplete, 0 when complete. No error codes.

Each call to awe_deferredSetCall processes a single module. Usually this function would be called repeatedly until the return value is 0.

function awe_loadAWBfromArray

INT32 awe_loadAWBfromArray(
    AWEInstance * pAWE,
    const UINT32 * pCommands,
    UINT32 arraySize,
    UINT32 * pPos
)

Executes packet commands from an in-memory array.

Parameters:

  • pAWE AWE instance pointer
  • pCommands Buffer with commands to execute
  • arraySize Number of DWords in command buffer
  • pPos Report failing word index

Return: E_SUCCESSE_EXCEPTIONE_UNEXPECTED_EOFE_END_OF_FILEE_MESSAGE_LENGTH_TOO_LONGE_BADPACKET

Designer can generate AWB arrays directly from a layout.

function awe_loadSubcanvasAWBfromArray

INT32 awe_loadSubcanvasAWBfromArray(
    AWEInstance * pAWE,
    UINT32 SubcanvasModObjectID,
    const UINT32 * pCommands,
    UINT32 arraySize,
    UINT32 * pPos
)

Executes packet commands from an in-memory array and loads AWB in Subcanvas module.

Parameters:

  • pAWE AWE instance pointer
  • SubcanvasModObjectID Object ID of the Subcanvas module
  • pCommands Buffer with commands to execute
  • arraySize Number of DWords in command buffer
  • pPos Report failing word index

Return: E_SUCCESSE_CLASS_NOT_SUPPORTEDE_EXCEPTIONE_UNEXPECTED_EOFE_END_OF_FILEE_MESSAGE_LENGTH_TOO_LONGE_BADPACKET

Designer can generate AWB arrays directly from a Subcanvas layout.

function awe_loadAWBfromFile

INT32 awe_loadAWBfromFile(
    AWEInstance * pAWE,
    const char * binaryFile,
    UINT32 * pPos
)

Load an AWB file from stdio.

Parameters:

  • pAWE AWE instance pointer
  • binaryFile AWB file to be loaded
  • pPos Report failing word index

Return: E_SUCCESSE_EXCEPTIONE_UNEXPECTED_EOFE_END_OF_FILEE_MESSAGE_LENGTH_TOO_LONGE_BADPACKETE_CANTOPEN

function awe_loadSubcanvasAWBfromFile

INT32 awe_loadSubcanvasAWBfromFile(
    AWEInstance * pAWE,
    UINT32 SubcanvasModObjectID,
    const char * binaryFile,
    UINT32 * pPos
)

Load an AWB file from stdio into Subcanvas module.

Parameters:

  • pAWE AWE instance pointer
  • SubcanvasModObjectID Object ID of the Subcanvas module
  • binaryFile AWB file to be loaded
  • pPos Report failing word index

Return: E_SUCCESSE_CLASS_NOT_SUPPORTEDE_EXCEPTIONE_UNEXPECTED_EOFE_END_OF_FILEE_MESSAGE_LENGTH_TOO_LONGE_BADPACKETE_CANTOPEN

function awe_loadAWBfromFlash

INT32 awe_loadAWBfromFlash(
    AWEInstance * pAWE,
    const char * binaryFile,
    UINT32 * pPos
)

Load an AWB file from the flash.

Parameters:

  • pAWE AWE instance pointer
  • binaryFile AWB file to be loaded
  • pPos Report failing word index

Return: E_SUCCESSE_EXCEPTIONE_UNEXPECTED_EOFE_END_OF_FILEE_MESSAGE_LENGTH_TOO_LONGE_BADPACKETE_CANTOPEN

function awe_loadSubcanvasAWBfromFlash

INT32 awe_loadSubcanvasAWBfromFlash(
    AWEInstance * pAWE,
    UINT32 SubcanvasModObjectID,
    const char * binaryFile,
    UINT32 * pPos
)

Load an AWB file from the flash.

Parameters:

  • pAWE AWE instance pointer
  • SubcanvasModObjectID Object ID of the Subcanvas module
  • binaryFile AWB file to be loaded
  • pPos Report failing word index

Return: E_SUCCESSE_CLASS_NOT_SUPPORTEDE_EXCEPTIONE_UNEXPECTED_EOFE_END_OF_FILEE_MESSAGE_LENGTH_TOO_LONGE_BADPACKETE_CANTOPEN

function awe_layoutGetChannelCount

void awe_layoutGetChannelCount(
    const AWEInstance * pAWE,
    UINT32 pinIdx,
    UINT32 * inCount,
    UINT32 * outCount
)

Returns the number of channels in the Layout's input and output pins.

Parameters:

  • pAWE AWE instance pointer
  • pinIdx which input pin (always 0)
  • inCount channels in primary input pin
  • outCount channels in primary output pin

function awe_layoutGetInputBlockSize

INT32 awe_layoutGetInputBlockSize(
    const AWEInstance * pAWE,
    UINT32 pinIdx,
    UINT32 * blockSize
)

Returns the block size of a pin.

Parameters:

  • pAWE The AWE Instance
  • pinIdx which input pin (always 0)
  • blockSize block size of input pin

Return: E_SUCCESS, E_NO_LAYOUTS, E_PIN_ID_NOT_FOUND

Because the block size of the output pin is inherited from the input pin, the user only needs to check the input pin.

function awe_layoutGetInputSampleRate

INT32 awe_layoutGetInputSampleRate(
    const AWEInstance * pAWE,
    UINT32 pinIdx,
    FLOAT32 * sampleRate
)

Returns the sample rate of an input pin.

Parameters:

  • pAWE The AWE Instance
  • pinIdx which input pin (always 0)
  • sampleRate the input pin sample rate

Return: E_SUCCESS, E_NO_LAYOUTS, E_PIN_ID_NOT_FOUND

Because the sample rate of the output pin is inherited from the input pin, the user only needs to check the input pin.

function awe_layoutIsValid

INT32 awe_layoutIsValid(
    const AWEInstance * pAWE
)

Determines if a layout is loaded and valid.

Parameters:

  • pAWE The AWE Instance

Return: 0 if layout is not valid/loaded, 1 if layout is valid. No error codes.

function awe_ctrlSetValue

INT32 awe_ctrlSetValue(
    AWEInstance * pAWE,
    UINT32 handle,
    const void * value,
    INT32 arrayOffset,
    UINT32 length
)

Set a scalar or array value of a module variable by handle.

Parameters:

  • pAWE instance pointer
  • handle packed object handle
  • value value(s) to set
  • arrayOffset array index if array
  • length number of elements. 1 if scaler

Return: E_SUCCESS, E_ARGUMENT_ERROR, E_BAD_MEMBER_INDEX, E_CLASS_NOT_SUPPORTED, E_LINKEDLIST_CORRUPT, E_NO_MORE_OBJECTS

This is a 32 bit interface, when setting values in a fract16 array, you must always set the adjacent member as well. Indexes in the array are 1 index for 2 packed fract16 words.

function awe_ctrlGetValue

INT32 awe_ctrlGetValue(
    AWEInstance * pAWE,
    UINT32 handle,
    void * value,
    INT32 arrayOffset,
    UINT32 length
)

Get a scalar or array value of a module variable by handle.

Parameters:

  • pAWE instance pointer
  • handle packed object handle
  • value value(s) to get
  • arrayOffset array index if array
  • length number of elements. 1 if scaler

Return: E_SUCCESS, E_ARGUMENT_ERROR, E_BAD_MEMBER_INDEX, E_CLASS_NOT_SUPPORTED, E_LINKEDLIST_CORRUPT, E_NO_MORE_OBJECTS

This is a 32 bit interface, when getting values from a packed fract16 array you must also get its adjacent value and mask and convert the low or high word as appropriate. Indexes in the array are 1 index for 2 packed fract16 words.

function awe_ctrlSetStatus

INT32 awe_ctrlSetStatus(
    AWEInstance * pAWE,
    UINT32 handle,
    UINT32 status
)

Set the runtime status of a module.

Parameters:

  • pAWE instance pointer
  • handle packed object handle
  • status status to set

Return: E_SUCCESS, E_NOT_MODULE, E_LINKEDLIST_CORRUPT, E_NO_MORE_OBJECTS

0 = Active, 1 = Bypass, 2 = Mute, 3 = Inactive

function awe_ctrlGetStatus

INT32 awe_ctrlGetStatus(
    AWEInstance * pAWE,
    UINT32 handle,
    UINT32 * status
)

Get the runtime status of a module.

Parameters:

  • pAWE instance pointer
  • handle packed object handle
  • status pointer to return status value

Return: E_SUCCESS, E_NOT_MODULE, E_LINKEDLIST_CORRUPT, E_NO_MORE_OBJECTS, E_PARAMETER_ERROR

0 = Active, 1 = Bypass, 2 = Mute, 3 = Inactive

function awe_ctrlSetValueMask

INT32 awe_ctrlSetValueMask(
    AWEInstance * pAWE,
    UINT32 handle,
    const void * value,
    INT32 arrayOffset,
    UINT32 length,
    UINT32 mask
)

Set a scalar or array value of a module variable by handle with mask.

Parameters:

  • pAWE instance pointer
  • handle packed object handle
  • value value(s) to set
  • arrayOffset array index if array
  • length number of elements if array. 1 if scaler
  • mask mask to use - 0 to not call set function

Return: E_SUCCESS, E_ARGUMENT_ERROR, E_BAD_MEMBER_INDEX, E_CLASS_NOT_SUPPORTED, E_OBJECT_ID_NOT_FOUND, E_NOT_MODULE

A mask allows you to only call module's set function for a single variable.

function awe_ctrlGetValueMask

INT32 awe_ctrlGetValueMask(
    AWEInstance * pAWE,
    UINT32 handle,
    void * value,
    INT32 arrayOffset,
    UINT32 length,
    UINT32 mask
)

Get a scalar or array value of a module variable by handle with mask.

Parameters:

  • pAWE instance pointer
  • handle packed object handle
  • value value(s) to get
  • arrayOffset array index if array
  • length number of elements if array. 1 if scaler
  • mask mask to use - 0 to not call get function

Return: E_SUCCESS, E_ARGUMENT_ERROR, E_BAD_MEMBER_INDEX, E_CLASS_NOT_SUPPORTED, E_OBJECT_ID_NOT_FOUND, E_NOT_MODULE

A mask allows you to only call module's set function for a single variable.

function awe_ctrlGetModuleClass

INT32 awe_ctrlGetModuleClass(
    AWEInstance * pAWE,
    UINT32 handle,
    UINT32 * pClassID
)

Get an object class from its handle.

Parameters:

  • pAWE instance pointer
  • handle handle of object to find
  • pClassID pointer to found object class

Return: E_SUCCESS, E_NO_MORE_OBJECTS, E_LINKEDLIST_CORRUPT

function awe_setProfilingStatus

INT32 awe_setProfilingStatus(
    AWEInstance * pAWE,
    UINT32 status
)

Enable or disable the profiling ability of the AWE Core.

Parameters:

  • pAWE instance pointer
  • status 0 to disable both, 1 to enable both, 2 to enable module level only, 3 to enable top level only

Return: E_SUCCESS, E_NOT_OBJECT, E_PARAMETER_ERROR

Both top and module level profiling and preemption overhead correction enabled by default at awe_init. Use this function if you wish to selectively enable or disable per pump profiling during runtime. Disabling profiling saves a small amount of cycles per pump. User can also enable or disable independently module level profiling and top level profiling and overhead correction due to preemption. It is recommended to call this function during initialization before starting a layout to have correct profiling behavior.

function awe_setProfilingOptions

INT32 awe_setProfilingOptions(
    AWEInstance * pAWE,
    UINT32 optionsMask,
    UINT32 profilingOptions
)

Function to set profiling options like average or peak profiling on modules and turn on or off accurate profiling.

Parameters:

  • pAWE [in] instance pointer
  • optionsMask [in] mask AWE_MODULE_PROFILING_BIT_MASK to control module profiling type and AWE_ACCURATE_PROFILING_BIT_MASK to control accurate profiling.
  • profilingOptions [in] profiling options value corresponding to the mask to set.

Return: E_SUCCESS, E_NOT_OBJECT

To set module peak profiling and to enable accurate profiling, call the function with optionsMask as AWE_MODULE_PROFILING_BIT_MASK|AWE_ACCURATE_PROFILING_BIT_MASK and profilingOptions as AWE_MODULE_PROFILING_PEAK|AWE_ENABLE_ACCURATE_PROFILING. It is recommended to call this function during initialization before starting a layout to have correct profiling behavior.

function awe_getProfilingOptions

INT32 awe_getProfilingOptions(
    AWEInstance * pAWE,
    UINT32 * profilingOptions
)

Function to get current profiling options.

Parameters:

  • pAWE [in] instance pointer
  • profilingOptions [out] pointer to return current setting of all profiling options. When failure occured, the value of all zeros returned.

Return: E_SUCCESS, E_NOT_OBJECT, E_PARAMETER_ERROR

function awe_getAverageLayoutCycles

INT32 awe_getAverageLayoutCycles(
    AWEInstance * pAWE,
    UINT32 layoutIdx,
    UINT32 * averageCycles
)

Get the average cycles of a running layout, in units of cycles at profileSpeed.

Parameters:

  • pAWE instance pointer
  • layoutIdx Layout index (typically 0, except in advanced use cases)
  • averageCycles Pointer the output (average layout cycles)

Return: E_SUCCESS, E_PARAMETER_ERROR, E_NO_LAYOUTS

Returns cycles in 24.8 format, so shift right by 8 bits for integer value. To get CPU cycles, multiply by target cpuSpeed / profileSpeed. If a previous pump is not complete and the layout is ready to pump again, an overflow is detected. When in this state, the awe_getAverageLayoutCycles api will return the averageCycles = AWE_PUMP_OVF_MAX_AVG_CYCLES (0xFFFFFFFF).

function awe_setInstancesInfo

void awe_setInstancesInfo(
    AWEInstance ** pInstances,
    INT32 numAweInstancesOnCore
)

Setup function only intended for systems with multiple AWE Instances in a single core.

Parameters:

  • pInstances Array of AWE Instance pointers that process on one core. Array must

exist as long as the system is active. * numAweInstancesOnCore Number of AWE Instances in pInstances array.

Call this function at startup after awe_init is done in the sequence. Enables both accurate profiling and loading of multi-instance designs.

function awe_fwSetLayoutCoreAffinity

INT32 awe_fwSetLayoutCoreAffinity(
    AWEInstance * pAWE,
    INT32 layoutNumber,
    INT32 coreAffinity
)

Set the core affinity of the layout in layoutNumber.

Parameters:

  • pAWE AWE instance pointer (this)
  • layoutNumber the layout index to set the core affinity.
  • coreAffinity core affinity to set in the layout.

Return: E_SUCCESS or E_INVALID_LAYOUT_INDEX if no layout

Used to get more accurate profiling in multithreaded systems.

function awe_fwGetLayoutCoreAffinity

INT32 awe_fwGetLayoutCoreAffinity(
    AWEInstance * pAWE,
    INT32 layoutNumber
)

Get the core affinity of the layout in layoutNumber, initializes to 0 and can be set with awe_fwSetLayoutCoreAffinity.

Parameters:

  • pAWE AWE instance pointer (this)
  • layoutNumber the layout index to get the core affinity.

Return: the core affinity of the requested layout, or E_INVALID_LAYOUT_INDEX if no layout

function awe_getBuildVersionInfo

INT32 awe_getBuildVersionInfo(
    AWEBuildVersionInfo_t * pBuildVersionInfo
)

Get the AWECore build number and version information.

Parameters:

  • pBuildVersionInfo Pointer of type AWEBuildVersionInfo_t to return build version information

Return: Return E_SUCCESS up on success. If pBuildVersionInfo is NULL, E_NOT_OBJECT returned.

function awe_setInstanceStandaloneAWBLoad

INT32 awe_setInstanceStandaloneAWBLoad(
    AWEInstance * pAWE,
    INT32 status
)

This function can be used to achieve Progressive Loading on a multi-instance system.

Parameters:

  • pAWE AWE instance pointer (this)
  • status Boolean flag indicates to enable or disable standalone loading. 1 - to enable standalone mode, 0 - to disable standalone mode. Default disabled.

Return: E_NO_HEAP_MEMORY if no shared memory exists and E_SUCCESS otherwise.

Indicates this instance loads AWB in standalone mode.

function awe_registerLoggingCallback

INT32 awe_registerLoggingCallback(
    AWEInstance * pAWE,
    cbAweLogging_t cbAweLogging,
    INT32 logLevel,
    UINT32 logTypeMask
)

Register the logging callback with required logging level and logging type mask.

Parameters:

  • pAWE AWE instance pointer
  • cbAweLogging Function pointer of the logging callback.
  • logLevel Logging level. 0 = AWE_LOG_LEVEL_NONE (DISABLED), 1 = AWE_LOG_LEVEL_ERROR, 2 = AWE_LOG_LEVEL_WARNING, 3 = AWE_LOG_LEVEL_INFO, 4 = AWE_LOG_LEVEL_DEBUG
  • logTypeMask Logging type mask. Combination of any logging type like AWE_LOG_SYSTEM_MSG | AWE_LOG_CPU_OVERFLOW_MSG. Use AWE_LOG_ALL_TYPE_MASK to subscribe to all logging message types Note that logging messages are always char * and never end with a newline. The user callback must apply newlines as desired.

Return: E_SUCCESS or E_NOT_OBJECT if invalid pAWE or E_PARAMETER_ERROR if invalid cbAweLogging.

The type mask is used to filter out undesired event types

function awe_registerEventCallbacks

INT32 awe_registerEventCallbacks(
    AWEInstance * pAWE,
    cbAweEventTrigger_t cbAweEventTrigger,
    cbAweEventRegister_t cbAweEventRegister,
    cbAweEventDeregister_t cbAweEventDeregister
)

Register the event callbacks used by the Event Module.

Parameters:

  • pAWE AWE instance pointer
  • cbAweEventTrigger Function pointer of the event trigger callback
  • cbAweEventRegister Function pointer of the event register callback (optional)
  • cbAweEventDeregister Function pointer of the event deregister callback (optional)

Return: E_SUCCESS on success, or E_NOT_OBJECT if invalid pAWE, or E_PARAMETER_ERROR if invalid cbAweEventTrigger.

cbAweEventTrigger must be non-null. The cbAweEventRegister and cbAweEventDeregister can be null.

function awe_resetState

INT32 awe_resetState(
    AWEInstance * pAWE
)

Walk through each module in each layout in an instance and calls reset function, if exists, clears wire buffers and clears IO buffers and layout masks.

Parameters:

  • pAWE AWE instance pointer (this)

Return: E_SUCCESS on success, or E_NOT_OBJECT if invalid pAWE, or E_NOT_OBJECT_POINTER if an invalid object in the instance layout.

Calling this function while audio processing is ongoing can cause audio glitches. It is recommended to stop audio before calling the layout reset function.

Macros Documentation

define AWE_PROFILING_DISABLE_BOTH_LAYOUT_MODULE

#define AWE_PROFILING_DISABLE_BOTH_LAYOUT_MODULE 0u

Public macros to control profiling status.

define AWE_PROFILING_ENABLE_BOTH_LAYOUT_MODULE

#define AWE_PROFILING_ENABLE_BOTH_LAYOUT_MODULE 1u

define AWE_PROFILING_ENABLE_ONLY_MODULE

#define AWE_PROFILING_ENABLE_ONLY_MODULE 2u

define AWE_PROFILING_ENABLE_ONLY_LAYOUT

#define AWE_PROFILING_ENABLE_ONLY_LAYOUT 3u

define AWE_MODULE_PROFILING_BIT_POS

#define AWE_MODULE_PROFILING_BIT_POS 0

Profiling options bit masks and values.

define AWE_MODULE_PROFILING_BIT_MASK

#define AWE_MODULE_PROFILING_BIT_MASK 1

define AWE_MODULE_PROFILING_AVERAGE

#define AWE_MODULE_PROFILING_AVERAGE (0x0u << AWE_MODULE_PROFILING_BIT_POS)

define AWE_MODULE_PROFILING_PEAK

#define AWE_MODULE_PROFILING_PEAK (0x1u << AWE_MODULE_PROFILING_BIT_POS)

define AWE_ACCURATE_PROFILING_BIT_POS

#define AWE_ACCURATE_PROFILING_BIT_POS 1

define AWE_ACCURATE_PROFILING_BIT_MASK

#define AWE_ACCURATE_PROFILING_BIT_MASK 2

define AWE_ENABLE_ACCURATE_PROFILING

#define AWE_ENABLE_ACCURATE_PROFILING (0x0u << AWE_ACCURATE_PROFILING_BIT_POS)

define AWE_DISABLE_ACCURATE_PROFILING

#define AWE_DISABLE_ACCURATE_PROFILING (0x1u << AWE_ACCURATE_PROFILING_BIT_POS)

define AWE_CACHE_CALLBACK_TYPE_INVALIDATE

#define AWE_CACHE_CALLBACK_TYPE_INVALIDATE 0

Macros for cache coherence handling.

define AWE_CACHE_CALLBACK_TYPE_WRITEBACK

#define AWE_CACHE_CALLBACK_TYPE_WRITEBACK 1

define MAX_TARGET_THREADS

#define MAX_TARGET_THREADS (32)

Max number of layout threads per AWE Instance.

Source code

/*******************************************************************************
*
*               Audio Framework
*               ---------------
*
********************************************************************************
*     AWEInstance.h
********************************************************************************
*
*     Description:  Public API AWEInstance structure and functions
*
*     Copyright:    (c) 2007-2024 DSP Concepts, Inc. All rights reserved.
*                   3235 Kifer Road
*                   Santa Clara, CA 95054
*
*******************************************************************************/

#ifndef _AWECOREINSTANCE_H
#define _AWECOREINSTANCE_H

#include <stdlib.h>
#include <string.h>
#include <stddef.h>

#include "TargetProcessor.h" //Include the TargetProcessor header that includes another processor specific header file. 
#include "FlashFSInstance.h"
#include "Pin.h"
#include "ModuleDescriptorList.h"

#ifdef  __cplusplus
extern "C" {
#endif

#define AWE_PROFILING_DISABLE_BOTH_LAYOUT_MODULE            0u
#define AWE_PROFILING_ENABLE_BOTH_LAYOUT_MODULE             1u
#define AWE_PROFILING_ENABLE_ONLY_MODULE                    2u
#define AWE_PROFILING_ENABLE_ONLY_LAYOUT                    3u

#define AWE_MODULE_PROFILING_BIT_POS        0
#define AWE_MODULE_PROFILING_BIT_MASK       1
#define AWE_MODULE_PROFILING_AVERAGE        (0x0u << AWE_MODULE_PROFILING_BIT_POS)
#define AWE_MODULE_PROFILING_PEAK           (0x1u << AWE_MODULE_PROFILING_BIT_POS)
#define AWE_ACCURATE_PROFILING_BIT_POS      1
#define AWE_ACCURATE_PROFILING_BIT_MASK     2
#define AWE_ENABLE_ACCURATE_PROFILING       (0x0u << AWE_ACCURATE_PROFILING_BIT_POS)
#define AWE_DISABLE_ACCURATE_PROFILING      (0x1u << AWE_ACCURATE_PROFILING_BIT_POS)

#define AWE_CACHE_CALLBACK_TYPE_INVALIDATE  0
#define AWE_CACHE_CALLBACK_TYPE_WRITEBACK   1

#define MAX_TARGET_THREADS                        (32)   


/*------------------AWE LOGGING------------------*/
#include "AWELoggingDefs.h"

typedef void (*cbAweLogging_t)(struct _AWEInstance* pAWE, INT32 level, UINT32 type, void* payload, INT32 payloadSizeInBytes);

/*------------------AWE EVENTS ------------------*/

typedef INT32(*cbAweEventTrigger_t)(struct _AWEInstance* pAWE, INT32 eventType, UINT32 moduleObjId, void* payload, INT32 payloadSizeInBytes, void* userHandle);

typedef INT32(*cbAweEventRegister_t)(struct _AWEInstance* pAWE, INT32 eventType, UINT32 moduleObjId, INT32 payloadSizeInBytes, void** userHandle);

typedef INT32(*cbAweEventDeregister_t)(struct _AWEInstance* pAWE, INT32 eventType, UINT32 moduleObjId, void** userHandle);

typedef struct _AWEInstance
{
    UINT32 instanceId; 

    /*------------------HEAPS------------------*/
    UINT32 *pFastHeapA; 

    UINT32 *pFastHeapB;

    UINT32 *pSlowHeap;

    UINT32 fastHeapASize;

    UINT32 fastHeapBSize;

    UINT32 slowHeapSize;

    /*------------------AUDIO CALLBACKS------------------*/

    INT32 (*cbAudioStart)(struct _AWEInstance *PAWE); 

    INT32 (*cbAudioStop)(struct _AWEInstance *pAWE);

    /*------------------DESTROY CALLBACK------------------*/

    INT32 (*cbPostDestroy)(struct _AWEInstance *pAWE);

    /*------------------CACHE COHERENCE CALLBACK------------------*/

    INT32 (*cbCacheInvalidate)(struct _AWEInstance *pAWE, void *nStartingAddress, UINT32 lengthInWords, INT32 CacheCallbackType);

    /*------------------THREAD PRIORITY CALLBACK------------------*/

    INT32(*cbGetLayoutThreadPriority)(struct _AWEInstance* pAWE, INT32 layoutNum);

    /*------------------PACKET FORWARD CALLBACK------------------*/

    INT32(*cbAweForwardPacket)(struct _AWEInstance* pAWE, INT32 instanceID);

    /*------------------IO PINS------------------*/

    IOPinDescriptor *pInputPin;

    IOPinDescriptor *pOutputPin;

    /*------------------MODULES------------------*/

    UINT32 numModules;

    const ModClassModule **pModuleDescriptorTable;

    ModuleDescriptorList *moduleDescriptors;

    /*------------------PACKET BUFFERS------------------*/

    UINT32 *pPacketBuffer;

    UINT32 *pReplyBuffer;

    UINT32 packetBufferSize;

    UINT32 userVersion;

    float coreSpeed;

    float profileSpeed;

#ifdef __ADSP21000__ 

    const UINT32 *pName;
#else

    const char *pName;
#endif

    UINT32 numThreads;

    float sampleRate;

    UINT32 fundamentalBlockSize;

    AWEFlashFSInstance *pFlashFileSystem;

  /*------------------MULTI-INSTANCE SUPPORT------------------*/
    volatile UINT32 *pSharedHeap;

    UINT32 sharedHeapSize;

    UINT32 numProcessingInstances;

#ifdef AWEINSTANCE_FRAMEWORK
    AWEINSTANCE_FRAMEWORK
#else

    #ifdef BUILD64
    UINT32 _Reserved[596];
    #else
    UINT32 _Reserved[316];
    #endif
#endif

} AWEInstance;

typedef struct AWEBuildVersionInfo
{
    UINT32 tuningVer;                   
    char majorVer;                      
    UINT32 minorVer;                    
    UINT32 procVer;                     
    char hotFixVer;                     
    UINT32 buildNumber;                 
} AWEBuildVersionInfo_t;


/*------------------------------------------Initialization----------------------------------------------------*/
INT32 awe_init(AWEInstance *pAWE);


INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name);


void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance);

typedef INT32 packetProcessFunction(AWEInstance * pAWE);


/*------------------------------------------Packet----------------------------------------------------*/
INT32 awe_packetProcess(AWEInstance * pAWE);

INT32 awe_packetProcessMulti(AWEInstance * pAWE, BOOL isTuningInstance);

/*------------------------------------------Audio----------------------------------------------------*/
INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex);

INT32 awe_audioImportSamples(const AWEInstance *pAWE, const void *inSamples, INT32 inStride, INT32 channel, SampleType inType);

INT32 awe_audioExportSamples(const AWEInstance *pAWE,  void *outSamples, INT32 outStride, INT32 channel, SampleType outType);

INT32 awe_audioIsStarted(const AWEInstance *pAWE);

INT32 awe_audioIsStartedMulti(const AWEInstance* pAWE);

INT32 awe_audioGetPumpMask(AWEInstance *pAWE);

INT32 awe_audioIsReadyToPumpMulti(AWEInstance* pAWE, UINT32 instanceID);

UINT32 awe_audioStartPreemption(AWEInstance* pAWE, INT32 coreAffinity);

UINT32 awe_audioEndPreemption(AWEInstance* pAWE, UINT32 start_time, INT32 coreAffinity);

/*------------------------------------------Deferred Functions----------------------------------------------------*/
INT32 awe_deferredSetCall(AWEInstance * pAWE);


/*------------------------------------------Loader Functions----------------------------------------------------*/
INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos);

INT32 awe_loadSubcanvasAWBfromArray(AWEInstance* pAWE, UINT32 SubcanvasModObjectID, const UINT32* pCommands, UINT32 arraySize, UINT32* pPos);

INT32 awe_loadAWBfromFile(AWEInstance *pAWE, const char *binaryFile, UINT32 *pPos);

INT32 awe_loadSubcanvasAWBfromFile(AWEInstance* pAWE, UINT32 SubcanvasModObjectID, const char* binaryFile, UINT32* pPos);

INT32 awe_loadAWBfromFlash(AWEInstance* pAWE, const char* binaryFile, UINT32* pPos);

INT32 awe_loadSubcanvasAWBfromFlash(AWEInstance* pAWE, UINT32 SubcanvasModObjectID, const char* binaryFile, UINT32* pPos);


/*------------------------------------------Layout Functions----------------------------------------------------*/
void awe_layoutGetChannelCount(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *inCount, UINT32 *outCount);

INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize);

INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate);

INT32 awe_layoutIsValid(const AWEInstance *pAWE);


/*------------------------------------------Control Interface Functions----------------------------------------------------*/

INT32 awe_ctrlSetValue(AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length);

INT32 awe_ctrlGetValue(AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);

INT32 awe_ctrlSetStatus(AWEInstance *pAWE, UINT32 handle, UINT32 status);

INT32 awe_ctrlGetStatus(AWEInstance *pAWE, UINT32 handle, UINT32 *status);

INT32 awe_ctrlSetValueMask(AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);

INT32 awe_ctrlGetValueMask(AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);

INT32 awe_ctrlGetModuleClass(AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID);

INT32 awe_setProfilingStatus(AWEInstance *pAWE, UINT32 status);

INT32 awe_setProfilingOptions(AWEInstance* pAWE, UINT32 optionsMask, UINT32 profilingOptions);

INT32 awe_getProfilingOptions(AWEInstance* pAWE, UINT32 *profilingOptions);

INT32 awe_getAverageLayoutCycles(AWEInstance *pAWE, UINT32 layoutIdx, UINT32 * averageCycles);

void awe_setInstancesInfo(AWEInstance **pInstances, INT32 numAweInstancesOnCore);

INT32 awe_fwSetLayoutCoreAffinity(AWEInstance* pAWE, INT32 layoutNumber, INT32 coreAffinity);

INT32 awe_fwGetLayoutCoreAffinity(AWEInstance* pAWE, INT32 layoutNumber);

INT32 awe_getBuildVersionInfo(AWEBuildVersionInfo_t *pBuildVersionInfo);

INT32 awe_setInstanceStandaloneAWBLoad(AWEInstance* pAWE, INT32 status);

INT32 awe_registerLoggingCallback(AWEInstance* pAWE, cbAweLogging_t cbAweLogging, INT32 logLevel, UINT32 logTypeMask);

INT32 awe_registerEventCallbacks(AWEInstance* pAWE, cbAweEventTrigger_t cbAweEventTrigger, cbAweEventRegister_t cbAweEventRegister, cbAweEventDeregister_t cbAweEventDeregister);

INT32 awe_resetState(AWEInstance* pAWE);

#ifdef  __cplusplus
}
#endif

#endif  // _AWECOREINSTANCE_H

Updated on 2026-02-10 at 15:44:31 -0500