AWE Core 8.D.13 Documentation
Loading...
Searching...
No Matches
AWEInstance.h
Go to the documentation of this file.
1/*******************************************************************************
2*
3* Audio Framework
4* ---------------
5*
6********************************************************************************
7* AWEInstance.h
8********************************************************************************
9*
10* Description: Public API AWEInstance structure and functions
11*
12* Copyright: (c) 2007-2024 DSP Concepts, Inc. All rights reserved.
13* 3235 Kifer Road
14* Santa Clara, CA 95054
15*
16*******************************************************************************/
17
28#ifndef _AWECOREINSTANCE_H
29#define _AWECOREINSTANCE_H
30
31#include <stdlib.h>
32#include <string.h>
33#include <stddef.h>
34
35#include "TargetProcessor.h" //Include the TargetProcessor header that includes another processor specific header file.
36#include "FlashFSInstance.h"
37#include "Pin.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
45#define AWE_PROFILING_DISABLE_BOTH_LAYOUT_MODULE 0u
46#define AWE_PROFILING_ENABLE_BOTH_LAYOUT_MODULE 1u
47#define AWE_PROFILING_ENABLE_ONLY_MODULE 2u
48#define AWE_PROFILING_ENABLE_ONLY_LAYOUT 3u
49
51#define AWE_MODULE_PROFILING_BIT_POS 0
52#define AWE_MODULE_PROFILING_BIT_MASK 1
53#define AWE_MODULE_PROFILING_AVERAGE (0x0u << AWE_MODULE_PROFILING_BIT_POS)
54#define AWE_MODULE_PROFILING_PEAK (0x1u << AWE_MODULE_PROFILING_BIT_POS)
55#define AWE_ACCURATE_PROFILING_BIT_POS 1
56#define AWE_ACCURATE_PROFILING_BIT_MASK 2
57#define AWE_ENABLE_ACCURATE_PROFILING (0x0u << AWE_ACCURATE_PROFILING_BIT_POS)
58#define AWE_DISABLE_ACCURATE_PROFILING (0x1u << AWE_ACCURATE_PROFILING_BIT_POS)
59
61#define AWE_CACHE_CALLBACK_TYPE_INVALIDATE 0
62#define AWE_CACHE_CALLBACK_TYPE_WRITEBACK 1
63
65#define MAX_TARGET_THREADS (32)
66
67
68/*------------------AWE LOGGING------------------*/
69#include "AWELoggingDefs.h"
70
76typedef void (*cbAweLogging_t)(struct _AWEInstance* pAWE, INT32 level, UINT32 type, void* payload, INT32 payloadSizeInBytes);
77
78/*------------------AWE EVENTS ------------------*/
79
90typedef INT32(*cbAweEventTrigger_t)(struct _AWEInstance* pAWE, INT32 eventType, UINT32 moduleObjId, void* payload, INT32 payloadSizeInBytes, void* userHandle);
91
96typedef INT32(*cbAweEventRegister_t)(struct _AWEInstance* pAWE, INT32 eventType, UINT32 moduleObjId, INT32 payloadSizeInBytes, void** userHandle);
97
102typedef INT32(*cbAweEventDeregister_t)(struct _AWEInstance* pAWE, INT32 eventType, UINT32 moduleObjId, void** userHandle);
103
112typedef struct _AWEInstance
113{
118 UINT32 instanceId;
119
120 /*------------------HEAPS------------------*/
122 UINT32 *pFastHeapA;
123
125 UINT32 *pFastHeapB;
126
128 UINT32 *pSlowHeap;
129
134
137
140
141 /*------------------AUDIO CALLBACKS------------------*/
142
147 INT32 (*cbAudioStart)(struct _AWEInstance *PAWE);
148
153 INT32 (*cbAudioStop)(struct _AWEInstance *pAWE);
154
155 /*------------------DESTROY CALLBACK------------------*/
156
161 INT32 (*cbPostDestroy)(struct _AWEInstance *pAWE);
162
163 /*------------------CACHE COHERENCE CALLBACK------------------*/
164
171 INT32 (*cbCacheInvalidate)(struct _AWEInstance *pAWE, void *nStartingAddress, UINT32 lengthInWords, INT32 CacheCallbackType);
172
173 /*------------------THREAD PRIORITY CALLBACK------------------*/
174
178 INT32(*cbGetLayoutThreadPriority)(struct _AWEInstance* pAWE, INT32 layoutNum);
179
180 /*------------------PACKET FORWARD CALLBACK------------------*/
181
185 INT32(*cbAweForwardPacket)(struct _AWEInstance* pAWE, INT32 instanceID);
186
187 /*------------------IO PINS------------------*/
188
193 IOPinDescriptor *pInputPin;
194
199 IOPinDescriptor *pOutputPin;
200
201 /*------------------MODULES------------------*/
202
210
218
221
222 /*------------------PACKET BUFFERS------------------*/
223
231
240
247
252
255
258
260#ifdef __ADSP21000__
262 const UINT32 *pName;
263#else
265 const char *pName;
266#endif
267
270
273
277
282
283 /*------------------MULTI-INSTANCE SUPPORT------------------*/
287 volatile UINT32 *pSharedHeap;
288
291
294
295#ifdef AWEINSTANCE_FRAMEWORK
296 AWEINSTANCE_FRAMEWORK
297#else
299 #ifdef BUILD64
300 UINT32 _Reserved[596];
301 #else
302 UINT32 _Reserved[316];
303 #endif
304#endif
305
307
319
320
321/*------------------------------------------Initialization----------------------------------------------------*/
332
333
342INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name);
343
344
350void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance);
351
352typedef INT32 packetProcessFunction(AWEInstance * pAWE);
353
354
355/*------------------------------------------Packet----------------------------------------------------*/
363
374INT32 awe_packetProcessMulti(AWEInstance * pAWE, BOOL isTuningInstance);
375
376/*------------------------------------------Audio----------------------------------------------------*/
387INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex);
388
410INT32 awe_audioImportSamples(const AWEInstance *pAWE, const void *inSamples, INT32 inStride, INT32 channel, SampleType inType);
411
434INT32 awe_audioExportSamples(const AWEInstance *pAWE, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);
435
443
452
471
488INT32 awe_audioIsReadyToPumpMulti(AWEInstance* pAWE, UINT32 instanceID);
489
502UINT32 awe_audioStartPreemption(AWEInstance* pAWE, INT32 coreAffinity);
503
519UINT32 awe_audioEndPreemption(AWEInstance* pAWE, UINT32 start_time, INT32 coreAffinity);
520
521/*------------------------------------------Deferred Functions----------------------------------------------------*/
529
530
531/*------------------------------------------Loader Functions----------------------------------------------------*/
545INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos);
546
562INT32 awe_loadSubcanvasAWBfromArray(AWEInstance* pAWE, UINT32 SubcanvasModObjectID, const UINT32* pCommands, UINT32 arraySize, UINT32* pPos);
563
577INT32 awe_loadAWBfromFile(AWEInstance *pAWE, const char *binaryFile, UINT32 *pPos);
578
594INT32 awe_loadSubcanvasAWBfromFile(AWEInstance* pAWE, UINT32 SubcanvasModObjectID, const char* binaryFile, UINT32* pPos);
595
609INT32 awe_loadAWBfromFlash(AWEInstance* pAWE, const char* binaryFile, UINT32* pPos);
610
626INT32 awe_loadSubcanvasAWBfromFlash(AWEInstance* pAWE, UINT32 SubcanvasModObjectID, const char* binaryFile, UINT32* pPos);
627
628
629/*------------------------------------------Layout Functions----------------------------------------------------*/
637void awe_layoutGetChannelCount(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *inCount, UINT32 *outCount);
638
647INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize);
648
657INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate);
658
665
666
667/*------------------------------------------Control Interface Functions----------------------------------------------------*/
668
680INT32 awe_ctrlSetValue(AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length);
681
694INT32 awe_ctrlGetValue(AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
695
704INT32 awe_ctrlSetStatus(AWEInstance *pAWE, UINT32 handle, UINT32 status);
705
714INT32 awe_ctrlGetStatus(AWEInstance *pAWE, UINT32 handle, UINT32 *status);
715
728INT32 awe_ctrlSetValueMask(AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
729
742INT32 awe_ctrlGetValueMask(AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
743
751INT32 awe_ctrlGetModuleClass(AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID);
752
762INT32 awe_setProfilingStatus(AWEInstance *pAWE, UINT32 status);
763
773INT32 awe_setProfilingOptions(AWEInstance* pAWE, UINT32 optionsMask, UINT32 profilingOptions);
774
781INT32 awe_getProfilingOptions(AWEInstance* pAWE, UINT32 *profilingOptions);
782
793INT32 awe_getAverageLayoutCycles(AWEInstance *pAWE, UINT32 layoutIdx, UINT32 * averageCycles);
794
803void awe_setInstancesInfo(AWEInstance **pInstances, INT32 numAweInstancesOnCore);
804
814INT32 awe_fwSetLayoutCoreAffinity(AWEInstance* pAWE, INT32 layoutNumber, INT32 coreAffinity);
815
823INT32 awe_fwGetLayoutCoreAffinity(AWEInstance* pAWE, INT32 layoutNumber);
824
831
839
849INT32 awe_registerLoggingCallback(AWEInstance* pAWE, cbAweLogging_t cbAweLogging, INT32 logLevel, UINT32 logTypeMask);
850
859INT32 awe_registerEventCallbacks(AWEInstance* pAWE, cbAweEventTrigger_t cbAweEventTrigger, cbAweEventRegister_t cbAweEventRegister, cbAweEventDeregister_t cbAweEventDeregister);
860
868
869#ifdef __cplusplus
870}
871#endif
872
873#endif // _AWECOREINSTANCE_H
void ModClassModule
Opaque declaration for framework structure ModClassModule.
Definition AWECore.h:43
INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate)
Returns the sample rate of an input pin.
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_fwSetLayoutCoreAffinity(AWEInstance *pAWE, INT32 layoutNumber, INT32 coreAffinity)
Set the core affinity of the layout in layoutNumber.
INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name)
Initialize an input or output pin.
INT32 awe_getProfilingOptions(AWEInstance *pAWE, UINT32 *profilingOptions)
Function to get current profiling options.
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...
Definition AWEInstance.h:76
INT32 awe_packetProcessMulti(AWEInstance *pAWE, BOOL isTuningInstance)
Multi-instance Wrapper for tuning packet processing.
INT32 awe_deferredSetCall(AWEInstance *pAWE)
Perform deferred awe set on a module.
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_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_getBuildVersionInfo(AWEBuildVersionInfo_t *pBuildVersionInfo)
Get the AWECore build number and version information.
INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex)
Audio pump function.
INT32 awe_ctrlGetModuleClass(AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID)
Get an object class from its handle.
INT32 awe_ctrlGetStatus(AWEInstance *pAWE, UINT32 handle, UINT32 *status)
Get the runtime status of a module.
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_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.
void awe_setInstancesInfo(AWEInstance **pInstances, INT32 numAweInstancesOnCore)
Setup function only intended for systems with multiple AWE Instances in a single core.
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_registerLoggingCallback(AWEInstance *pAWE, cbAweLogging_t cbAweLogging, INT32 logLevel, UINT32 logTypeMask)
Register the logging callback with required logging level and logging type mask.
INT32 awe_audioIsStartedMulti(const AWEInstance *pAWE)
Check if all instances are running in multi-instance system.
INT32 awe_resetState(AWEInstance *pAWE)
Walk through each module in each layout in an instance and calls reset function, if exists,...
INT32 awe_loadSubcanvasAWBfromFlash(AWEInstance *pAWE, UINT32 SubcanvasModObjectID, const char *binaryFile, UINT32 *pPos)
Load an AWB file from the flash.
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.
Definition AWEInstance.h:96
INT32 awe_getAverageLayoutCycles(AWEInstance *pAWE, UINT32 layoutIdx, UINT32 *averageCycles)
Get the average cycles of a running layout, in units of cycles at profileSpeed.
INT32 awe_setInstanceStandaloneAWBLoad(AWEInstance *pAWE, INT32 status)
This function can be used to achieve Progressive Loading on a multi-instance system.
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.
Definition AWEInstance.h:90
void awe_initFlashFS(AWEInstance *pAWE, AWEFlashFSInstance *pAWEFlashFSInstance)
Initialize the file system.
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 accura...
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_layoutIsValid(const AWEInstance *pAWE)
Determines if a layout is loaded and valid.
INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos)
Executes packet commands from an in-memory array.
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_audioGetPumpMask(AWEInstance *pAWE)
Test if AWE is ready to run.
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_fwGetLayoutCoreAffinity(AWEInstance *pAWE, INT32 layoutNumber)
Get the core affinity of the layout in layoutNumber, initializes to 0 and can be set with awe_fwSetLa...
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.
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_setProfilingStatus(AWEInstance *pAWE, UINT32 status)
Enable or disable the profiling ability of the AWE Core.
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.
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.
Definition AWEInstance.h:102
INT32 awe_packetProcess(AWEInstance *pAWE)
Process an AWEInstance's newly received tuning packet.
INT32 awe_loadAWBfromFile(AWEInstance *pAWE, const char *binaryFile, UINT32 *pPos)
Load an AWB file from stdio.
INT32 awe_init(AWEInstance *pAWE)
Initialize the instance.
INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize)
Returns the block size of a pin.
struct AWEBuildVersionInfo AWEBuildVersionInfo_t
Build versioning structure returned by awe_getBuildVersionInfo.
INT32 awe_ctrlSetStatus(AWEInstance *pAWE, UINT32 handle, UINT32 status)
Set the runtime status of a module.
INT32 awe_audioIsStarted(const AWEInstance *pAWE)
Check if this instance is running.
The AWEFlashFSInstance API Header File.
enum _SampleType SampleType
Type of data for I/O.
struct _AWEInstance AWEInstance
The AWE instance.
The AWE instance.
Definition AWEInstance.h:113
IOPinDescriptor * pInputPin
A BSP author must define/allocate an input pin in their BSP and assign it to this member NOTE: AudioW...
Definition AWEInstance.h:193
const char * pName
The name of the AWE Instance that will be displayed in Server.
Definition AWEInstance.h:265
float profileSpeed
Profiling clock speed in Hz.
Definition AWEInstance.h:257
UINT32 * pReplyBuffer
Reply buffer pointer.
Definition AWEInstance.h:239
UINT32 _Reserved[316]
Internal members.
Definition AWEInstance.h:302
UINT32 * pFastHeapB
The second fast heap, B .
Definition AWEInstance.h:125
ModuleDescriptorList * moduleDescriptors
Pointer to a _ModuleDescriptorList struct.
Definition AWEInstance.h:220
INT32(* cbCacheInvalidate)(struct _AWEInstance *pAWE, void *nStartingAddress, UINT32 lengthInWords, INT32 CacheCallbackType)
OPTIONAL This callback is invoked wherever cache flush or invalidation is required,...
Definition AWEInstance.h:171
UINT32 numThreads
Number of threads supported for multithreaded systems(1-4).
Definition AWEInstance.h:269
IOPinDescriptor * pOutputPin
A BSP author must define/allocate an output pin in their BSP and assign it to this member NOTE: Audio...
Definition AWEInstance.h:199
UINT32 * pPacketBuffer
The Packet buffer pointer.
Definition AWEInstance.h:230
INT32(* cbAudioStart)(struct _AWEInstance *PAWE)
OPTIONAL This callback is invoked when a layout is run or when a StartAudio command is sent.
Definition AWEInstance.h:147
INT32(* cbAudioStop)(struct _AWEInstance *pAWE)
OPTIONAL.
Definition AWEInstance.h:153
UINT32 slowHeapSize
The slow heap size.
Definition AWEInstance.h:139
INT32(* cbPostDestroy)(struct _AWEInstance *pAWE)
OPTIONAL.
Definition AWEInstance.h:161
UINT32 fundamentalBlockSize
Base frame size of this instance.
Definition AWEInstance.h:276
UINT32 * pSlowHeap
The slow heap.
Definition AWEInstance.h:128
UINT32 userVersion
User Version word.
Definition AWEInstance.h:251
float sampleRate
Default sample rate of this instance.
Definition AWEInstance.h:272
UINT32 packetBufferSize
Packet buffer size.
Definition AWEInstance.h:246
volatile UINT32 * pSharedHeap
AWE Core shared memory definitions.
Definition AWEInstance.h:287
UINT32 fastHeapBSize
The fast heap B size.
Definition AWEInstance.h:136
INT32(* cbAweForwardPacket)(struct _AWEInstance *pAWE, INT32 instanceID)
OPTIONAL This callback is invoked from awe_packetProcessMulti when the received packet is to secondar...
Definition AWEInstance.h:185
UINT32 numProcessingInstances
The number of audio processing instances of AWE Core configured on a single target.
Definition AWEInstance.h:293
UINT32 sharedHeapSize
The shared heap size, in 32-bit words.
Definition AWEInstance.h:290
AWEFlashFSInstance * pFlashFileSystem
DSPC Flash file system instance.
Definition AWEInstance.h:281
INT32(* cbGetLayoutThreadPriority)(struct _AWEInstance *pAWE, INT32 layoutNum)
OPTIONAL This callback is invoked from a module which is going to split the internal processing into ...
Definition AWEInstance.h:178
float coreSpeed
A BSP author will set this to the speed of the CPU they are integrating into.
Definition AWEInstance.h:254
UINT32 instanceId
The ID of this instance.
Definition AWEInstance.h:118
UINT32 numModules
Number of modules in module table.
Definition AWEInstance.h:209
const ModClassModule ** pModuleDescriptorTable
Pointer to module table.
Definition AWEInstance.h:217
UINT32 fastHeapASize
The fast heap A size in 32-bit words.
Definition AWEInstance.h:133
UINT32 * pFastHeapA
Fast heap A.
Definition AWEInstance.h:122
Build versioning structure returned by awe_getBuildVersionInfo.
Definition AWEInstance.h:310
UINT32 buildNumber
Library build number.
Definition AWEInstance.h:316
UINT32 minorVer
Minor API version.
Definition AWEInstance.h:313
char hotFixVer
Hot fix version, if the build is a hot fix release.
Definition AWEInstance.h:315
char majorVer
Major API version (single letter)
Definition AWEInstance.h:312
UINT32 procVer
Processor specific version.
Definition AWEInstance.h:314
UINT32 tuningVer
Tuning version.
Definition AWEInstance.h:311
The DSPC Flash File System Instance.
Definition FlashFSInstance.h:40
Linked list containing module descriptor entries.
Definition ModuleDescriptorList.h:63