AWECore 8.B.0 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) 2019 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 
49 #define AWB_DONE 1
50 #define AWB_NOT_DONE 0
51 
56 typedef enum
57 {
58  /* --- States for receiving a command --- */
59 
60  tMS_Rx_CmdSTX, /* Receive Command STX */
61  tMS_Rx_CmdSeq, /* Receive Command Sequence ID */
62  tMS_Rx_CmdData, /* Receive Command Data */
63 
64  /* --- States for sending a response --- */
65  tMS_Tx_RspSTX, /* Send Response STX */
66  tMS_Tx_RspSeq, /* Send Response Sequence ID */
67  tMS_Tx_RspData, /* Send Response Data */
68  tMS_Tx_Done
69 
70 } tMsgState;
71 
72 /*-----------------------------SPI/UART HELPER FUNCTIONS------------------------------------- */
73 /*The following helper functions are currently not working, but they demonstrate how our UART/SPI state machine works*/
74 
75 /* ----------------------------------------------------------------------------
76  * Types
77  * ------------------------------------------------------------------------- */
78 #define INCOMPLETE_PACKET 0
79 #define COMPLETE_NEW_PACKET 1
80 #define COMPLETE_REPEATED_PACKET 2
81 
89 void tuningResetByteEncoderUART(void);
90 
117 INT32 tuningDecodeByteUART(UINT32 *packetBuffer, UINT8 ch);
118 
144  INT32 tuningEncodeByteUART(UINT32 *packetBuffer, UINT8 * ch);
145 
150 //BOOL awe_tuningRxCmdWordSPI(AWEInstance *pAWE, UINT32 word);
151 
156 //BOOL awe_tuningGetReplyWordSPI(AWEInstance *pAWE, UINT32 * word);
157 
158 /*-----------------------------END SPI/UART HELPER FUNCTIONS------------------------------------- */
159 
164 void ComputeCheckSumPublic(UINT32 * pPacketBuffer);
165 
172 void GenerateInstanceTableReply(UINT32 * pPacketBuffer, UINT32 numInstances, UINT32 * pInstanceTable);
173 
179 INT32 float_to_fract32(FLOAT32 x);
180 
186 FLOAT32 fract32_to_float(INT32 x);
187 
198 INT32 awe_getNextAWBCmd(const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset, UINT32 *pPacketBuffer);
199 
200 #ifdef __cplusplus
201 }
202 #endif
203 
204 #endif // AWECOREUTILS_H
205 
A list of all possible Audio Weaver errors and their IDs.
void GenerateInstanceTableReply(UINT32 *pPacketBuffer, UINT32 numInstances, UINT32 *pInstanceTable)
Generate an instance table reply for Server based on the arguments.
UINT32 * pPacketBuffer
The Packet buffer pointer.
Definition: AWECore.h:183
INT32 float_to_fract32(FLOAT32 x)
Convert audio data from floating point to Fract32 sample by sample.
FLOAT32 fract32_to_float(INT32 x)
Convert audio data from fract32 to float sample by sample.
A list of all AWE Server Commands.
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...