AWE Core 8.D.9 Documentation
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
62typedef enum
63{
64 /* --- States for receiving a command --- */
65
66 tMS_Rx_CmdSTX, /* Receive Command STX */
67 tMS_Rx_CmdSeq, /* Receive Command Sequence ID */
68 tMS_Rx_CmdData, /* Receive Command Data */
69
70 /* --- States for sending a response --- */
71 tMS_Tx_RspSTX, /* Send Response STX */
72 tMS_Tx_RspSeq, /* Send Response Sequence ID */
73 tMS_Tx_RspData, /* Send Response Data */
74 tMS_Tx_Done
75
76} tMsgState;
77
78/*-----------------------------SPI/UART HELPER FUNCTIONS------------------------------------- */
79/*The following helper functions are currently not working, but they demonstrate how our UART/SPI state machine works*/
80
81/* ----------------------------------------------------------------------------
82 * Types
83 * ------------------------------------------------------------------------- */
84#define INCOMPLETE_PACKET 0
85#define COMPLETE_NEW_PACKET 1
86#define COMPLETE_REPEATED_PACKET 2
87
95void tuningResetByteEncoderUART(void);
96
123INT32 tuningDecodeByteUART(UINT32 *packetBuffer, UINT8 ch);
124
150 INT32 tuningEncodeByteUART(UINT32 *packetBuffer, UINT8 * ch);
151
156//BOOL awe_tuningRxCmdWordSPI(AWEInstance *pAWE, UINT32 word);
157
162//BOOL awe_tuningGetReplyWordSPI(AWEInstance *pAWE, UINT32 * word);
163
164/*-----------------------------END SPI/UART HELPER FUNCTIONS------------------------------------- */
165
170void ComputeCheckSumPublic(UINT32 * pPacketBuffer);
171
178void GenerateInstanceTableReply(UINT32 * pPacketBuffer, UINT32 numInstances, UINT32 * pInstanceTable);
179
185INT32 float_to_fract32(FLOAT32 x);
186
192FLOAT32 fract32_to_float(INT32 x);
193
204INT32 awe_getNextAWBCmd(const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset, UINT32 *pPacketBuffer);
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif // AWECOREUTILS_H
211
INT32 float_to_fract32(FLOAT32 x)
Convert audio data from floating point to Fract32 sample by sample.
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.
FLOAT32 fract32_to_float(INT32 x)
Convert audio data from fract32 to float sample by sample.
void GenerateInstanceTableReply(UINT32 *pPacketBuffer, UINT32 numInstances, UINT32 *pInstanceTable)
Generate an instance table reply for Server based on the arguments.
A list of all possible Audio Weaver errors and their IDs.
A list of all AWE Server Commands.