AWECore 8.C.1 API Document
AWECoreUtils.h
Go to the documentation of this file.
1 /*******************************************************************************
2 *
3 * AWE Utilities
4 * ---------------
5 *
6 ********************************************************************************
7 * AWECoreUtils.h
8 ********************************************************************************
9 *
10 * Description: AudioWeaver Utilities and Helper Functions
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 AWECOREUTILS_H
24 #define AWECOREUTILS_H
25 
26 #include "ProxyIDs.h"
27 #include "Errors.h"
28 #include "TargetProcessor.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*------------------ PACKET ROUTING MACROS - MULTI-INSTANCE ONLY ------------------*/
35 
37 #define PACKET_LENGTH_WORDS(x) (x[0]>>16)
38 
40 #define PACKET_LENGTH_BYTES(x) ((x[0]>>16) * sizeof(x[0]))
41 
43 #define PACKET_INSTANCEID(x) (x[0] >> 8) & 0xff
44 
47 #define PACKET_OPCODE(x) ((INT32)x[0] & 0xffU)
48 
50 #define AWB_DONE 1
51 
53 #define AWB_NOT_DONE 0
54 
59 typedef enum
60 {
61  /* --- States for receiving a command --- */
62 
63  tMS_Rx_CmdSTX, /* Receive Command STX */
64  tMS_Rx_CmdSeq, /* Receive Command Sequence ID */
65  tMS_Rx_CmdData, /* Receive Command Data */
66 
67  /* --- States for sending a response --- */
68  tMS_Tx_RspSTX, /* Send Response STX */
69  tMS_Tx_RspSeq, /* Send Response Sequence ID */
70  tMS_Tx_RspData, /* Send Response Data */
71  tMS_Tx_Done
72 
73 } tMsgState;
74 
75 /*-----------------------------SPI/UART HELPER FUNCTIONS------------------------------------- */
76 /*The following helper functions are currently not working, but they demonstrate how our UART/SPI state machine works*/
77 
78 /* ----------------------------------------------------------------------------
79  * Types
80  * ------------------------------------------------------------------------- */
81 #define INCOMPLETE_PACKET 0
82 #define COMPLETE_NEW_PACKET 1
83 #define COMPLETE_REPEATED_PACKET 2
84 
92 void tuningResetByteEncoderUART(void);
93 
120 INT32 tuningDecodeByteUART(UINT32 *packetBuffer, UINT8 ch);
121 
147  INT32 tuningEncodeByteUART(UINT32 *packetBuffer, UINT8 * ch);
148 
153 //BOOL awe_tuningRxCmdWordSPI(AWEInstance *pAWE, UINT32 word);
154 
159 //BOOL awe_tuningGetReplyWordSPI(AWEInstance *pAWE, UINT32 * word);
160 
161 /*-----------------------------END SPI/UART HELPER FUNCTIONS------------------------------------- */
162 
167 void ComputeCheckSumPublic(UINT32 * pPacketBuffer);
168 
175 void GenerateInstanceTableReply(UINT32 * pPacketBuffer, UINT32 numInstances, UINT32 * pInstanceTable);
176 
182 INT32 float_to_fract32(FLOAT32 x);
183 
189 FLOAT32 fract32_to_float(INT32 x);
190 
201 INT32 awe_getNextAWBCmd(const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset, UINT32 *pPacketBuffer);
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif // AWECOREUTILS_H
208 
awe_getNextAWBCmd
INT32 awe_getNextAWBCmd(const UINT32 *pArray, UINT32 arraySize, UINT32 *pErrorOffset, UINT32 *pPacketBuffer)
Get the next command from an array of AWB commands and write it into a packetBuffer to be processed.
float_to_fract32
INT32 float_to_fract32(FLOAT32 x)
Convert audio data from floating point to Fract32 sample by sample.
AWEInstance::pPacketBuffer
UINT32 * pPacketBuffer
The Packet buffer pointer.
Definition: AWECore.h:184
Errors.h
A list of all possible Audio Weaver errors and their IDs.
ProxyIDs.h
A list of all AWE Server Commands.
GenerateInstanceTableReply
void GenerateInstanceTableReply(UINT32 *pPacketBuffer, UINT32 numInstances, UINT32 *pInstanceTable)
Generate an instance table reply for Server based on the arguments.
fract32_to_float
FLOAT32 fract32_to_float(INT32 x)
Convert audio data from fract32 to float sample by sample.