AWECore 8.C.10 API Document
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-2021 DSP Concepts, Inc. All rights reserved.
13 * 3235 Kifer Road
14 * Santa Clara, CA 95054
15 *
16 *******************************************************************************/
17 
23 #ifndef _AWECOREINSTANCE_H
24 #define _AWECOREINSTANCE_H
25 
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stddef.h>
29 
30 #include "TargetProcessor.h" //Include the TargetProcessor header that includes another processor specific header file.
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
44 typedef struct _AWEInstance
45 {
50  UINT32 instanceId;
51 
52  /*------------------HEAPS------------------*/
54  UINT32 *pFastHeapA;
55 
57  UINT32 *pFastHeapB;
58 
60  UINT32 *pSlowHeap;
61 
65  UINT32 fastHeapASize;
66 
68  UINT32 fastHeapBSize;
69 
71  UINT32 slowHeapSize;
72 
73  /*------------------AUDIO CALLBACKS------------------*/
74 
79  INT32 (*cbAudioStart)(struct _AWEInstance *PAWE);
80 
85  INT32 (*cbAudioStop)(struct _AWEInstance *pAWE);
86 
87 
88  /*------------------IO PINS------------------*/
89 
94  IOPinDescriptor *pInputPin;
95 
100  IOPinDescriptor *pOutputPin;
101 
102  /*------------------MODULES------------------*/
103 
110  UINT32 numModules;
111 
118  const ModClassModule **pModuleDescriptorTable;
119 
120  /*------------------PACKET BUFFERS------------------*/
121 
128  UINT32 *pPacketBuffer;
129 
137  UINT32 *pReplyBuffer;
138 
145 
149  UINT32 userVersion;
150 
152  float coreSpeed;
153 
156 
157 /*The name of the AWE Instance that will be displayed in Server. Can be any string of XYZ length?*/
158 #ifdef __ADSP21000__
159 
160  const UINT32 *pName;
161 #else
162 
163  const char *pName;
164 #endif
165 
167  UINT32 numThreads;
168 
170  float sampleRate;
171 
175 
179  AWEFlashFSInstance *pFlashFileSystem;
180 
181 #ifdef AWEINSTANCE_FRAMEWORK
182  AWEINSTANCE_FRAMEWORK
183 #else
184 
185  #ifdef BUILD64
186  UINT32 _Reserved[52];
187  #else
188  UINT32 _Reserved[39];
189  #endif
190 #endif
191 
193 
194 
195 /*------------------------------------------Initialization----------------------------------------------------*/
205 INT32 awe_init(AWEInstance *pAWE);
206 
207 
216 INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name);
217 
218 
224 void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance);
225 
226 typedef INT32 packetProcessFunction(AWEInstance * pAWE);
227 
228 
229 /*------------------------------------------Packet----------------------------------------------------*/
237 
238 
239 /*------------------------------------------Audio----------------------------------------------------*/
240 
251 INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex);
252 
274 INT32 awe_audioImportSamples(const AWEInstance *pAWE, const void *inSamples, INT32 inStride, INT32 channel, SampleType inType);
275 
298 INT32 awe_audioExportSamples(const AWEInstance *pAWE, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);
299 
306 INT32 awe_audioIsStarted(const AWEInstance *pAWE);
307 
326 
327 /*------------------------------------------Deferred Functions----------------------------------------------------*/
335 
336 
337 /*------------------------------------------Loader Functions----------------------------------------------------*/
346 INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos);
347 
348 
349 /*------------------------------------------Layout Functions----------------------------------------------------*/
357 void awe_layoutGetChannelCount(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *inCount, UINT32 *outCount);
358 
367 INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize);
368 
377 INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate);
378 
384 INT32 awe_layoutIsValid(const AWEInstance *pAWE);
385 
386 
387 /*------------------------------------------Control Interface Functions----------------------------------------------------*/
388 
399 INT32 awe_ctrlSetValue(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length);
400 
401 
412 INT32 awe_ctrlGetValue(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
413 
422 INT32 awe_ctrlSetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 status);
423 
432 INT32 awe_ctrlGetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 *status);
433 
446 INT32 awe_ctrlSetValueMask(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
447 
460 INT32 awe_ctrlGetValueMask(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
461 
469 INT32 awe_ctrlGetModuleClass(const AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID);
470 
471 
479 INT32 awe_setProfilingStatus(AWEInstance *pAWE, UINT32 enable);
480 
491 INT32 awe_getAverageLayoutCycles(AWEInstance *pAWE, UINT32 layoutIdx, UINT32 * averageCycles);
492 
493 
494 #ifdef __cplusplus
495 }
496 #endif
497 
498 #endif // _AWECOREINSTANCE_H
_AWEInstance::sampleRate
float sampleRate
Default sample rate of this instance.
Definition: AWEInstance.h:170
_AWEInstance::pFastHeapA
UINT32 * pFastHeapA
Fast heap A.
Definition: AWEInstance.h:54
awe_ctrlGetStatus
INT32 awe_ctrlGetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 *status)
Get the runtime status of a module.
awe_initFlashFS
void awe_initFlashFS(AWEInstance *pAWE, AWEFlashFSInstance *pAWEFlashFSInstance)
Initialize the file system.
_AWEInstance::slowHeapSize
UINT32 slowHeapSize
The slow heap size.
Definition: AWEInstance.h:71
_AWEInstance::cbAudioStop
INT32(* cbAudioStop)(struct _AWEInstance *pAWE)
OPTIONAL.
Definition: AWEInstance.h:85
_AWEInstance::fastHeapBSize
UINT32 fastHeapBSize
The fast heap B size.
Definition: AWEInstance.h:68
_AWEInstance::_Reserved
UINT32 _Reserved[39]
Internal members.
Definition: AWEInstance.h:188
_AWEInstance::pName
const char * pName
Name of this instance as a string
Definition: AWEInstance.h:163
_AWEInstance::numModules
UINT32 numModules
Number of modules in module table.
Definition: AWEInstance.h:110
awe_ctrlSetValueMask
INT32 awe_ctrlSetValueMask(const 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.
_AWEInstance::numThreads
UINT32 numThreads
Number of threads supported for multithreaded systems(1-4).
Definition: AWEInstance.h:167
awe_ctrlGetModuleClass
INT32 awe_ctrlGetModuleClass(const AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID)
Get an object class from its handle.
_AWEInstance::pInputPin
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:94
_AWEInstance::pPacketBuffer
UINT32 * pPacketBuffer
The Packet buffer pointer.
Definition: AWEInstance.h:128
_AWEInstance::pReplyBuffer
UINT32 * pReplyBuffer
Reply buffer pointer.
Definition: AWEInstance.h:137
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.
_AWEInstance::coreSpeed
float coreSpeed
A BSP author will set this to the speed of the CPU they are integrating into.
Definition: AWEInstance.h:152
awe_layoutGetInputSampleRate
INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate)
Returns the sample rate of an input pin.
awe_audioIsStarted
INT32 awe_audioIsStarted(const AWEInstance *pAWE)
Check if this instance is running.
awe_ctrlSetStatus
INT32 awe_ctrlSetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 status)
Set the runtime status of a module.
_AWEInstance::cbAudioStart
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:79
awe_deferredSetCall
INT32 awe_deferredSetCall(AWEInstance *pAWE)
Perform deferred awe set on a module.
awe_packetProcess
INT32 awe_packetProcess(AWEInstance *pAWE)
Process an AWEInstance's newly received tuning packet.
_AWEInstance::pModuleDescriptorTable
const ModClassModule ** pModuleDescriptorTable
Pointer to module table.
Definition: AWEInstance.h:118
_AWEInstance::userVersion
UINT32 userVersion
User Version word.
Definition: AWEInstance.h:149
awe_setProfilingStatus
INT32 awe_setProfilingStatus(AWEInstance *pAWE, UINT32 enable)
Enable or disable the profiling ability of the AWECore.
awe_initPin
INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name)
Initialize an input or output pin.
_AWEInstance::pFlashFileSystem
AWEFlashFSInstance * pFlashFileSystem
DSPC Flash file system instance.
Definition: AWEInstance.h:179
SampleType
enum _SampleType SampleType
Type of data for I/O.
_AWEInstance
The AWE instance.
Definition: AWEInstance.h:45
awe_layoutGetInputBlockSize
INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize)
Returns the block size of a pin.
awe_layoutIsValid
INT32 awe_layoutIsValid(const AWEInstance *pAWE)
Determines if a layout is loaded and valid.
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.
awe_ctrlSetValue
INT32 awe_ctrlSetValue(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length)
Set a scalar or array value of a module variable by handle.
_AWEInstance::profileSpeed
float profileSpeed
Profiling clock speed in Hz.
Definition: AWEInstance.h:155
AWEInstance
struct _AWEInstance AWEInstance
The AWE instance.
_AWEInstance::fundamentalBlockSize
UINT32 fundamentalBlockSize
Base frame size of this instance.
Definition: AWEInstance.h:174
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.
_AWEInstance::instanceId
UINT32 instanceId
The ID of this instance.
Definition: AWEInstance.h:50
awe_loadAWBfromArray
INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos)
Executes packet commands from an in-memory array.
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.
awe_ctrlGetValue
INT32 awe_ctrlGetValue(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length)
Get a scalar or array value of a module variable by handle.
awe_ctrlGetValueMask
INT32 awe_ctrlGetValueMask(const 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.
_AWEInstance::packetBufferSize
UINT32 packetBufferSize
Packet buffer size.
Definition: AWEInstance.h:144
awe_audioGetPumpMask
INT32 awe_audioGetPumpMask(AWEInstance *pAWE)
Test if AWE is ready to run.
awe_init
INT32 awe_init(AWEInstance *pAWE)
Initialize the instance.
_AWEInstance::pOutputPin
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:100
awe_audioPump
INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex)
Audio pump function.
_AWEInstance::fastHeapASize
UINT32 fastHeapASize
The fast heap A size.
Definition: AWEInstance.h:65
_AWEInstance::pSlowHeap
UINT32 * pSlowHeap
The slow heap.
Definition: AWEInstance.h:60
_AWEInstance::pFastHeapB
UINT32 * pFastHeapB
The second fast heap, B .
Definition: AWEInstance.h:57