AWECore 8.C.1 API Document
AWECore.h
Go to the documentation of this file.
1 /*******************************************************************************
2 *
3 * Audio Framework
4 * ---------------
5 *
6 ********************************************************************************
7 * AWECore.h
8 ********************************************************************************
9 *
10 * Description: AudioWeaver Framework main header file
11 *
12 * Copyright: (c) 2020 DSP Concepts, Inc. All rights reserved.
13 * 3235 Kifer Road
14 * Santa Clara, CA 95054
15 *
16 *******************************************************************************/
17 
23 #ifndef _FRAMEWORK_H
24 //Do nothing if Framework.h was previously included.
25 
26 #ifndef _AWECORE_H
27 #define _AWECORE_H
28 
29 #include <stdlib.h>
30 #include <string.h>
31 #include <stddef.h>
32 
33 #include "TargetProcessor.h" //Include the TargetProcessor header that includes another processor specific header file.
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
42 typedef struct IOPinDescriptor
43 {
45  UINT32 _Reserved[82];
46 
48 
49 // Forward reference
50 struct AWEInstance;
51 
56 typedef struct AWEFlashFSInstance
57 {
60 
63 
66 
69 
71  BOOL (*cbInit)(void);
72 
74  BOOL (*cbEraseSector)(UINT32 nStartingAddress, UINT32 nNumberOfSectors);
75 
77  BOOL (*cbFlashWrite)(UINT32 nFlashAddress, UINT32 * pBuffer, UINT32 nDWordsToWrite);
78 
80  BOOL (*cbFlashRead)(UINT32 nFlashAddress, UINT32 * pBuffer, UINT32 nDWordsToRead);
81 
85  INT32 (*cbFlashProcessCmd)(struct AWEInstance *pAWE);
86 
88  UINT32 _Reserved[62];
89 
91 
100 typedef struct AWEInstance
101 {
106  UINT32 instanceId;
107 
108  /*------------------HEAPS------------------*/
110  UINT32 *pFastHeapA;
111 
113  UINT32 *pFastHeapB;
114 
116  UINT32 *pSlowHeap;
117 
122 
125 
127  UINT32 slowHeapSize;
128 
129  /*------------------AUDIO CALLBACKS------------------*/
130 
135  INT32 (*cbAudioStart)(struct AWEInstance *PAWE);
136 
141  INT32 (*cbAudioStop)(struct AWEInstance *pAWE);
142 
143 
144  /*------------------IO PINS------------------*/
145 
151 
157 
158  /*------------------MODULES------------------*/
159 
166  UINT32 numModules;
167 
175 
176  /*------------------PACKET BUFFERS------------------*/
177 
184  UINT32 *pPacketBuffer;
185 
193  UINT32 *pReplyBuffer;
194 
201 
205  UINT32 userVersion;
206 
208  float coreSpeed;
209 
212 
213 /*The name of the AWE Instance that will be displayed in Server. Can be any string of XYZ length?*/
214 #ifdef __ADSP21000__
215 
216  const UINT32 *pName;
217 #else
218 
219  const char *pName;
220 #endif
221 
223  UINT32 numThreads;
224 
226  float sampleRate;
227 
231 
236 
238  UINT32 _Reserved[52];
239 
241 
242 
243 /*------------------------------------------Initialization----------------------------------------------------*/
252 INT32 awe_init(AWEInstance *pAWE);
253 
254 
263 INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name);
264 
265 
271 void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance);
272 
273 typedef INT32 packetProcessFunction(AWEInstance * pAWE);
274 
275 
276 /*------------------------------------------Packet----------------------------------------------------*/
283 
284 
285 /*------------------------------------------Audio----------------------------------------------------*/
286 
297 INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex);
298 
320 INT32 awe_audioImportSamples(const AWEInstance *pAWE, const void *inSamples, INT32 inStride, INT32 channel, SampleType inType);
321 
344 INT32 awe_audioExportSamples(const AWEInstance *pAWE, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);
345 
352 INT32 awe_audioIsStarted(const AWEInstance *pAWE);
353 
370 
371 /*------------------------------------------Deferred Functions----------------------------------------------------*/
379 
380 
381 /*------------------------------------------Loader Functions----------------------------------------------------*/
390 INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos);
391 
392 
393 /*------------------------------------------Layout Functions----------------------------------------------------*/
401 void awe_layoutGetChannelCount(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *inCount, UINT32 *outCount);
402 
411 INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize);
412 
421 INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate);
422 
428 INT32 awe_layoutIsValid(const AWEInstance *pAWE);
429 
430 
431 /*------------------------------------------Control Interface Functions----------------------------------------------------*/
432 
442 INT32 awe_ctrlSetValue(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length);
443 
444 
454 INT32 awe_ctrlGetValue(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
455 
464 INT32 awe_ctrlSetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 status);
465 
474 INT32 awe_ctrlGetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 *status);
475 
487 INT32 awe_ctrlSetValueMask(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
488 
500 INT32 awe_ctrlGetValueMask(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
501 
509 INT32 awe_ctrlGetModuleClass(const AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID);
510 
511 
519 INT32 awe_setProfilingStatus(AWEInstance *pAWE, UINT32 enable);
520 
530 INT32 awe_getAverageLayoutCycles(AWEInstance *pAWE, UINT32 layoutIdx, UINT32 * averageCycles);
531 
532 
533 #ifdef __cplusplus
534 }
535 #endif
536 
537 #endif // _AWECORE_H
538 
539 #endif // _FRAMEWORK_H
AWEFlashFSInstance
struct AWEFlashFSInstance AWEFlashFSInstance
The DSPC Flash File System Instance.
AWEInstance::cbAudioStop
INT32(* cbAudioStop)(struct AWEInstance *pAWE)
OPTIONAL.
Definition: AWECore.h:141
AWEInstance::sampleRate
float sampleRate
Default sample rate of this instance.
Definition: AWECore.h:226
IOPinDescriptor
struct IOPinDescriptor IOPinDescriptor
AWE IO Pin type.
AWEFlashFSInstance::cbFlashWrite
BOOL(* cbFlashWrite)(UINT32 nFlashAddress, UINT32 *pBuffer, UINT32 nDWordsToWrite)
User callback function to write to flash.
Definition: AWECore.h:77
AWEInstance::numThreads
UINT32 numThreads
Number of threads supported for multithreaded systems(1-4).
Definition: AWECore.h:223
awe_ctrlGetModuleClass
INT32 awe_ctrlGetModuleClass(const AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID)
Get an object class from its handle.
AWEInstance::fastHeapBSize
UINT32 fastHeapBSize
The fast heap B size.
Definition: AWECore.h:124
awe_initPin
INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name)
Initialize an input or output pin.
awe_ctrlGetStatus
INT32 awe_ctrlGetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 *status)
Get the runtime status of a module.
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.
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.
awe_layoutGetInputBlockSize
INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize)
Returns the block size of a pin.
AWEInstance::coreSpeed
float coreSpeed
A BSP author will set this to the speed of the CPU they are integrating into.
Definition: AWECore.h:208
awe_layoutIsValid
INT32 awe_layoutIsValid(const AWEInstance *pAWE)
Determines if a layout is loaded and valid.
awe_initFlashFS
void awe_initFlashFS(AWEInstance *pAWE, AWEFlashFSInstance *pAWEFlashFSInstance)
Initialize the file system.
awe_ctrlSetStatus
INT32 awe_ctrlSetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 status)
Set the runtime status of a module.
awe_loadAWBfromArray
INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos)
Executes packet commands from an in-memory array.
awe_audioGetPumpMask
INT32 awe_audioGetPumpMask(const AWEInstance *pAWE)
Test if AWE is ready to run.
AWEInstance::_Reserved
UINT32 _Reserved[52]
Internal members.
Definition: AWECore.h:238
AWEInstance::numModules
UINT32 numModules
Number of modules in module table.
Definition: AWECore.h:166
awe_layoutGetInputSampleRate
INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate)
Returns the sample rate of an input pin.
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.
AWEFlashFSInstance::flashEraseTimeInMs
UINT32 flashEraseTimeInMs
Flash erase time in milliseconds.
Definition: AWECore.h:68
AWEFlashFSInstance::cbFlashRead
BOOL(* cbFlashRead)(UINT32 nFlashAddress, UINT32 *pBuffer, UINT32 nDWordsToRead)
User function to read from flash.
Definition: AWECore.h:80
AWEInstance::pReplyBuffer
UINT32 * pReplyBuffer
Reply buffer pointer.
Definition: AWECore.h:193
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: AWECore.h:150
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: AWECore.h:156
AWEInstance::pFlashFileSystem
AWEFlashFSInstance * pFlashFileSystem
DSPC Flash file system instance.
Definition: AWECore.h:235
AWEFlashFSInstance::flashSizeInBytes
UINT32 flashSizeInBytes
Size of flash memory - if non-zero, next two values must also be non-zero.
Definition: AWECore.h:59
AWEFlashFSInstance::cbEraseSector
BOOL(* cbEraseSector)(UINT32 nStartingAddress, UINT32 nNumberOfSectors)
User callback function to erase one or more sectors.
Definition: AWECore.h:74
AWEInstance::pName
const char * pName
Name of this instance as a string
Definition: AWECore.h:219
awe_init
INT32 awe_init(AWEInstance *pAWE)
Initialize the instance.
AWEFlashFSInstance::flashErasableBlockSizeInBytes
UINT32 flashErasableBlockSizeInBytes
Size of flash erase block.
Definition: AWECore.h:62
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::pPacketBuffer
UINT32 * pPacketBuffer
The Packet buffer pointer.
Definition: AWECore.h:184
AWEInstance::packetBufferSize
UINT32 packetBufferSize
Packet buffer size.
Definition: AWECore.h:200
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.
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.
AWEInstance
The AWE instance.
Definition: AWECore.h:101
awe_audioPump
INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex)
Audio pump function.
AWEInstance::userVersion
UINT32 userVersion
User Version word.
Definition: AWECore.h:205
AWEFlashFSInstance::_Reserved
UINT32 _Reserved[62]
Reserved member.
Definition: AWECore.h:88
AWEInstance::pSlowHeap
UINT32 * pSlowHeap
The slow heap.
Definition: AWECore.h:116
AWEFlashFSInstance::flashStartOffsetInBytes
UINT32 flashStartOffsetInBytes
Offset into start of flash used for file system.
Definition: AWECore.h:65
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: AWECore.h:135
IOPinDescriptor::_Reserved
UINT32 _Reserved[82]
Reserved member.
Definition: AWECore.h:45
awe_setProfilingStatus
INT32 awe_setProfilingStatus(AWEInstance *pAWE, UINT32 enable)
Enable or disable the profiling ability of the AWECore.
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::instanceId
UINT32 instanceId
The ID of this instance.
Definition: AWECore.h:106
AWEFlashFSInstance
The DSPC Flash File System Instance.
Definition: AWECore.h:57
awe_audioIsStarted
INT32 awe_audioIsStarted(const AWEInstance *pAWE)
Check if this instance is running.
AWEInstance::profileSpeed
float profileSpeed
Profiling clock speed in Hz.
Definition: AWECore.h:211
AWEInstance::fastHeapASize
UINT32 fastHeapASize
The fast heap A size.
Definition: AWECore.h:121
AWEFlashFSInstance::cbFlashProcessCmd
INT32(* cbFlashProcessCmd)(struct AWEInstance *pAWE)
Optional user callback function to return the next command from an awb in flash.
Definition: AWECore.h:85
AWEInstance
struct AWEInstance AWEInstance
The AWE instance.
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_packetProcess
INT32 awe_packetProcess(AWEInstance *pAWE)
Process an AWEInstance's newly received tuning packet.
AWEInstance::slowHeapSize
UINT32 slowHeapSize
The slow heap size.
Definition: AWECore.h:127
AWEInstance::pFastHeapA
UINT32 * pFastHeapA
Fast heap A.
Definition: AWECore.h:110
AWEInstance::fundamentalBlockSize
UINT32 fundamentalBlockSize
Base frame size of this instance.
Definition: AWECore.h:230
awe_deferredSetCall
INT32 awe_deferredSetCall(AWEInstance *pAWE)
Perform deferred awe set on a module.
IOPinDescriptor
AWE IO Pin type.
Definition: AWECore.h:43
AWEInstance::pFastHeapB
UINT32 * pFastHeapB
The second fast heap, B .
Definition: AWECore.h:113
AWEFlashFSInstance::cbInit
BOOL(* cbInit)(void)
User function to initialize flash file system.
Definition: AWECore.h:71
AWEInstance::pModuleDescriptorTable
const void * pModuleDescriptorTable
Pointer to module table.
Definition: AWECore.h:174