AWE Core OS 8.B.23 Documentation
Loading...
Searching...
No Matches
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) 2007-2021 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
31extern "C" {
32#endif
33
34/*------------------ PACKET ROUTING MACROS - MULTI-INSTANCE ONLY ------------------*/
35
36/* Maximum number of AWECore instances able to be configured on a single target */
37#define MAX_PROCESSING_INSTANCES (256)
38
40#define PACKET_LENGTH_WORDS(x) (x[0]>>16)
41
43#define PACKET_LENGTH_BYTES(x) ((x[0]>>16) * sizeof(x[0]))
44
46#define PACKET_INSTANCEID(x) (x[0] >> 8) & 0xff
47
50#define PACKET_OPCODE(x) ((INT32)x[0] & 0xffU)
51
53#define AWB_DONE 1
54
56#define AWB_NOT_DONE 0
57
59#define AWE_DESTROY_CMD 0x0002000CU
60
65typedef enum
66{
67 /* --- States for receiving a command --- */
68
69 tMS_Rx_CmdSTX, /* Receive Command STX */
70 tMS_Rx_CmdSeq, /* Receive Command Sequence ID */
71 tMS_Rx_CmdData, /* Receive Command Data */
72
73 /* --- States for sending a response --- */
74 tMS_Tx_RspSTX, /* Send Response STX */
75 tMS_Tx_RspSeq, /* Send Response Sequence ID */
76 tMS_Tx_RspData, /* Send Response Data */
77 tMS_Tx_Done
78
79} tMsgState;
80
81/*-----------------------------SPI/UART HELPER FUNCTIONS------------------------------------- */
82/*The following helper functions are currently not working, but they demonstrate how our UART/SPI state machine works*/
83
84/* ----------------------------------------------------------------------------
85 * Types
86 * ------------------------------------------------------------------------- */
87#define INCOMPLETE_PACKET 0
88#define COMPLETE_NEW_PACKET 1
89#define COMPLETE_REPEATED_PACKET 2
90
98void tuningResetByteEncoderUART(void);
99
126INT32 tuningDecodeByteUART(UINT32 *packetBuffer, UINT8 ch);
127
153 INT32 tuningEncodeByteUART(UINT32 *packetBuffer, UINT8 * ch);
154
159//BOOL awe_tuningRxCmdWordSPI(AWEInstance *pAWE, UINT32 word);
160
165//BOOL awe_tuningGetReplyWordSPI(AWEInstance *pAWE, UINT32 * word);
166
167/*-----------------------------END SPI/UART HELPER FUNCTIONS------------------------------------- */
168
173void ComputeCheckSumPublic(UINT32 * pPacketBuffer);
174
181void GenerateInstanceTableReply(UINT32 * pPacketBuffer, UINT32 numInstances, UINT32 * pInstanceTable);
182
188#if !defined(float_to_fract32) && !defined(FLOAT_TO_FRACT32_DEFINED)
189#define FLOAT_TO_FRACT32_DEFINED
190INT32 float_to_fract32(FLOAT32 x);
191#endif
192
198#if !defined(fract32_to_float) && !defined(FRACT32_TO_FLOAT_DEFINED)
199#define FRACT32_TO_FLOAT_DEFINED
200FLOAT32 fract32_to_float(INT32 x);
201#endif
202
213INT32 awe_getNextAWBCmd(const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset, UINT32 *pPacketBuffer);
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif // AWECOREUTILS_H
220
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.
void GenerateInstanceTableReply(UINT32 *pPacketBuffer, UINT32 numInstances, UINT32 *pInstanceTable)
Generate an instance table reply for Server based on the arguments.
A list of all AWE Server Commands.
A list of all possible Audio Weaver errors and their IDs.