AWECore 8.B.0 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) 2019 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 
39 #define WORDSOF(x) (sizeof(x) / sizeof(INT32))
40 
41 #ifndef NUMOF
42 #define NUMOF(x) (sizeof(x) / sizeof(*x))
43 #endif
44 
45 #define AWE_UNUSED_VARIABLE(x) ((void)(x))
46 
50 typedef struct IOPinDescriptor
51 {
53  UINT32 _Reserved[82];
54 
56 
61 typedef struct AWEFlashFSInstance
62 {
65 
68 
71 
74 
76  BOOL (*cbInit)(void);
77 
79  BOOL (*cbEraseSector)(UINT32 nStartingAddress, UINT32 nNumberOfSectors);
80 
82  BOOL (*cbFlashWrite)(UINT32 nFlashAddress, UINT32 * pBuffer, UINT32 nDWordsToWrite);
83 
85  BOOL (*cbFlashRead)(UINT32 nFlashAddress, UINT32 * pBuffer, UINT32 nDWordsToRead);
86 
87  UINT32 _Reserved[62];
88 
90 
99 typedef struct AWEInstance
100 {
105  UINT32 instanceId;
106 
107  /*------------------HEAPS------------------*/
109  UINT32 *pFastHeapA;
110 
112  UINT32 *pFastHeapB;
113 
115  UINT32 *pSlowHeap;
116 
121 
124 
126  UINT32 slowHeapSize;
127 
128  /*------------------AUDIO CALLBACKS------------------*/
129 
134  INT32 (*cbAudioStart)(struct AWEInstance *PAWE);
135 
140  INT32 (*cbAudioStop)(struct AWEInstance *pAWE);
141 
142 
143  /*------------------IO PINS------------------*/
144 
150 
156 
157  /*------------------MODULES------------------*/
158 
165  UINT32 numModules;
166 
174 
175  /*------------------PACKET BUFFERS------------------*/
176 
183  UINT32 *pPacketBuffer;
184 
192  UINT32 *pReplyBuffer;
193 
200 
204  UINT32 userVersion;
205 
207  float coreSpeed;
208 
211 
212 /*The name of the AWE Instance that will be displayed in Server. Can be any string of XYZ length?*/
213 #ifdef __ADSP21000__
214 
215  const UINT32 *pName;
216 #else
217 
218  const char *pName;
219 #endif
220 
222  UINT32 numThreads;
223 
225  float sampleRate;
226 
230 
235 
237  UINT32 _Reserved[48];
238 
239 } AWEInstance;
240 
241 
243 typedef enum _SampleType
244 {
247 
250 
253 
256 } SampleType;
257 
258 
259 /*------------------------------------------Initialization----------------------------------------------------*/
268 INT32 awe_init(AWEInstance *pAWE);
269 
270 
279 INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name);
280 
286 void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance);
287 
288 
289 /*------------------------------------------Packet----------------------------------------------------*/
295 INT32 awe_packetProcess(AWEInstance * pAWE);
296 
297 
298 /*------------------------------------------Audio----------------------------------------------------*/
299 
310 INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex);
311 
324 INT32 awe_audioImportSamples(const AWEInstance *pAWE, const void *inSamples, INT32 inStride, INT32 channel, SampleType inType);
325 
339 INT32 awe_audioExportSamples(const AWEInstance *pAWE, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);
340 
347 INT32 awe_audioIsStarted(const AWEInstance *pAWE);
348 
364 INT32 awe_audioGetPumpMask(const AWEInstance *pAWE);
365 
366 
367 /*------------------------------------------Deferred Functions----------------------------------------------------*/
374 INT32 awe_deferredSetCall(AWEInstance * pAWE);
375 
376 
377 /*------------------------------------------Loader Functions----------------------------------------------------*/
386 INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos);
387 
388 
389 /*------------------------------------------Layout Functions----------------------------------------------------*/
397 void awe_layoutGetChannelCount(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *inCount, UINT32 *outCount);
398 
407 INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize);
408 
417 INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate);
418 
424 INT32 awe_layoutIsValid(const AWEInstance *pAWE);
425 
426 
427 /*------------------------------------------Control Interface Functions----------------------------------------------------*/
437 INT32 awe_ctrlGetValue(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length);
438 
448 INT32 awe_ctrlSetValue(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
449 
457 INT32 awe_ctrlSetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 status);
458 
466 INT32 awe_ctrlGetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 *status);
467 
478 INT32 awe_ctrlSetValueMask(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
479 
490 INT32 awe_ctrlGetValueMask(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
491 
499 INT32 awe_ctrlGetModuleClass(const AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID);
500 
501 
502 
503 #ifdef __cplusplus
504 }
505 #endif
506 
507 #endif // _AWECORE_H
508 
509 #endif // _FRAMEWORK_H
UINT32 * pFastHeapB
The second fast heap, B .
Definition: AWECore.h:112
enum _SampleType SampleType
Type of data for I/O.
void awe_layoutGetChannelCount(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *inCount, UINT32 *outCount)
Returns the number of channels in the Layout&#39;s input and output pins.
UINT32 * pSlowHeap
The slow heap.
Definition: AWECore.h:115
INT32 awe_ctrlSetValue(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length)
Get a scalar or array value by handle.
Data is 24 bit PCM aligned to the high bit in 32 bit buffers.
Definition: AWECore.h:252
AWEFlashFSInstance * pFlashFileSystem
DSPC Flash file system instance.
Definition: AWECore.h:234
UINT32 fundamentalBlockSize
Base frame size of this instance.
Definition: AWECore.h:229
Data is 24 bit PCM aligned to the low bit in 32 bit buffers.
Definition: AWECore.h:249
UINT32 numModules
Number of modules in module table.
Definition: AWECore.h:165
INT32 awe_ctrlSetValueMask(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length, UINT32 mask)
Set a scalar or array value by handle with mask.
const char * pName
Name of this instance as a string.
Definition: AWECore.h:218
INT32 awe_audioIsStarted(const AWEInstance *pAWE)
Check if this instance is running.
UINT32 * pPacketBuffer
The Packet buffer pointer.
Definition: AWECore.h:183
float profileSpeed
Profiling clock speed in Hz.
Definition: AWECore.h:210
Data is 16 bit PCM.
Definition: AWECore.h:246
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_packetProcess(AWEInstance *pAWE)
Process an AWEInstance&#39;s newly received tuning packet.
UINT32 flashSizeInBytes
Size of flash memory - if non-zero, next two values must also be non-zero.
Definition: AWECore.h:64
UINT32 * pReplyBuffer
Reply buffer pointer.
Definition: AWECore.h:192
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:149
const void * pModuleDescriptorTable
Pointer to module table.
Definition: AWECore.h:173
INT32 awe_initPin(IOPinDescriptor *pPin, UINT32 channels, const char *name)
Initialize an input or output pin.
INT32 awe_deferredSetCall(AWEInstance *pAWE)
Perform deferred awe set on a module.
INT32 awe_layoutGetInputBlockSize(const AWEInstance *pAWE, UINT32 pinIdx, UINT32 *blockSize)
Returns the block size of a pin.
AWE IO Pin type.
Definition: AWECore.h:50
INT32 awe_layoutIsValid(const AWEInstance *pAWE)
Determines if a layout is loaded and valid.
UINT32 instanceId
The ID of this instance.
Definition: AWECore.h:105
INT32(* cbAudioStop)(struct AWEInstance *pAWE)
OPTIONAL.
Definition: AWECore.h:140
UINT32 flashStartOffsetInBytes
Offset into start of flash used for file system.
Definition: AWECore.h:70
void awe_initFlashFS(AWEInstance *pAWE, AWEFlashFSInstance *pAWEFlashFSInstance)
Initialize the file system.
INT32 awe_ctrlSetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 status)
Set the status of a module.
INT32 awe_audioGetPumpMask(const AWEInstance *pAWE)
Test if AWE is ready to run.
Data is 32 bit PCM .
Definition: AWECore.h:255
UINT32 fastHeapBSize
The fast heap B size.
Definition: AWECore.h:123
INT32 awe_ctrlGetModuleClass(const AWEInstance *pAWE, UINT32 handle, UINT32 *pClassID)
Get an object class from its handle.
UINT32 userVersion
User Version word.
Definition: AWECore.h:204
INT32 awe_ctrlGetValue(const AWEInstance *pAWE, UINT32 handle, const void *value, INT32 arrayOffset, UINT32 length)
Set a scalar or array value by handle.
INT32 awe_ctrlGetStatus(const AWEInstance *pAWE, UINT32 handle, UINT32 *status)
Get the status of a module.
The AWE instance.
Definition: AWECore.h:99
UINT32 flashEraseTimeInMs
Flash erase time in milliseconds.
Definition: AWECore.h:73
UINT32 fastHeapASize
The fast heap A size.
Definition: AWECore.h:120
UINT32 * pFastHeapA
Fast heap A.
Definition: AWECore.h:109
UINT32 flashErasableBlockSizeInBytes
Size of flash erase block.
Definition: AWECore.h:67
INT32 awe_loadAWBfromArray(AWEInstance *pAWE, const UINT32 *pCommands, UINT32 arraySize, UINT32 *pPos)
Executes packet commands from an in-memory array.
_SampleType
Type of data for I/O.
Definition: AWECore.h:243
INT32 awe_ctrlGetValueMask(const AWEInstance *pAWE, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask)
Get a scalar or array value by handle with mask.
float sampleRate
Default sample rate of this instance.
Definition: AWECore.h:225
INT32 awe_layoutGetInputSampleRate(const AWEInstance *pAWE, UINT32 pinIdx, FLOAT32 *sampleRate)
Returns the sample rate of an input pin.
struct AWEFlashFSInstance AWEFlashFSInstance
The DSPC Flash File System Instance Optional – SINGLE INSTANCE ONLY.
UINT32 numThreads
Number of threads supported for multithreaded systems(1-4).
Definition: AWECore.h:222
struct IOPinDescriptor IOPinDescriptor
AWE IO Pin type.
INT32 awe_audioExportSamples(const AWEInstance *pAWE, void *outSamples, INT32 outStride, INT32 channel, SampleType outType)
Export samples to a user buffer from a channel.
struct AWEInstance AWEInstance
The AWE instance.
UINT32 packetBufferSize
Packet buffer size.
Definition: AWECore.h:199
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:155
INT32 awe_audioPump(AWEInstance *pAWE, UINT32 layoutIndex)
Audio pump function.
float coreSpeed
A BSP author will set this to the speed of the CPU they are integrating into.
Definition: AWECore.h:207
UINT32 _Reserved[82]
Reserved member.
Definition: AWECore.h:53
UINT32 slowHeapSize
The slow heap size.
Definition: AWECore.h:126
The DSPC Flash File System Instance Optional – SINGLE INSTANCE ONLY.
Definition: AWECore.h:61
INT32 awe_init(AWEInstance *pAWE)
Initialize the instance.