comparison chipsetsw/services/etm/etm.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /******************************************************************************
2 * Enhanced TestMode (ETM)
3 * @file etm.h
4 *
5 * Design and coding Mads Meisner-Jensen, (mmj@ti.com)
6 * Kim T. Petersn, (ktp@ti.com)
7 *
8 *
9 ******************************************************************************/
10
11
12 #ifndef _ETM_H_
13 #define _ETM_H_
14
15
16 /******************************************************************************
17 * Prototypes and Globals
18 ******************************************************************************/
19
20 // Max size of downlink packet payload
21 #define ETM_PAYLOAD_MAX 256
22 // End Terminator for Tables
23 #define TABLE_END -1
24
25 struct ioformat_s {
26 const short index; // index for identifier
27 const char *name; // parameter
28 const char *format; // parameter data format
29 };
30
31
32 /******************************************************************************
33 * Global Definitions
34 ******************************************************************************/
35
36 // Enhanced TestMode Module IDentifiers
37 enum {
38 ETM_TM3 = 0x00, // Use of old TM3 protocol
39 ETM_CORE = 0x01,
40 ETM_TMT = 0x02, // Pseudo module
41 ETM_SH = 0x03, // Pseudo module
42 ETM_TM3_MISC = 0x04, // Pseudo module - Target side
43 ETM_RF = 0x05,
44 ETM_IMEI = 0x06,
45 ETM_FFS2 = 0x07,
46 ETM_AUDIO = 0x08,
47 ETM_TPU = 0x09, // Not official part ETM
48 ETM_PWR = 0x0A,
49 ETM_BT = 0x0B,
50 ETM_L23 = 0x0C,
51 ETM_RESERVED10 = 0x0D,
52 ETM_RESERVED11 = 0x0E,
53 ETM_RESERVED12 = 0x0F,
54
55 ETM_CUST = 0xC0, // Customize id
56 ETM_CUST1 = 0xC1, // Customize id
57 ETM_CUST2 = 0xC2, // Customize id
58 ETM_CUST3 = 0xC3, // Customize id
59 ETM_CUST4 = 0xC4, // Customize id
60 ETM_CUST5 = 0xC5, // Customize id
61 ETM_CUST6 = 0xC6, // Customize id
62 ETM_CUST7 = 0xC7, // Customize id
63 ETM_CUST8 = 0xC8, // Customize id
64
65 ETM_TEST = 0xAA, // used for test of dll's
66 ETM_TASK = 0xEE, // ETM TASK in Target
67
68 ETM_FFS1 = 0x70
69 };
70
71 enum {
72 // ETM_ERROR_MUL = 100,
73 ETM_CORE_ERROR = -100 * ETM_CORE,
74 ETM_TMT_ERROR = -100 * ETM_TMT,
75 ETM_SH_ERROR = -100 * ETM_SH,
76 ETM_RF_ERROR = -100 * ETM_RF,
77 ETM_FFS2_ERROR = -100 * ETM_FFS2,
78 ETM_AUDIO_ERROR = -100 * ETM_AUDIO,
79 ETM_TPU_ERROR = -100 * ETM_TPU,
80 ETM_IMEI_ERROR = -100 * ETM_IMEI,
81 ETM_PWR_ERROR = -100 * ETM_PWR,
82 ETM_BT_ERROR = -100 * ETM_BT,
83 ETM_FFS_ERROR = -100 * ETM_FFS2,
84
85 ETM_TEST_ERROR = -100 * ETM_TEST, // used for test of dll's
86
87 ETM_OS_ERROR = -100 * 1000 // OS Error (specially handled!)
88 };
89
90 // Module private (normally target-side) errors are in the range: [ -2..-47]
91 // Common (normally target-side) errors are in the range: [-48..-63]
92 // Common (normally PC-side) errors are in the range: [-64..-89]
93 // Module private (normally PC-side) errors are in the range: [-90..-99]
94
95 enum ETMCommonTargetErrors {
96 ETM_OK = 0, // Ok
97 ETM_FINISHED = -1, // Previously started operation has finished.
98
99 // Errors that are related to the Riv env.
100 ETM_RV_FATAL = -48, // Fatal error in RIV environment eg. memory error
101 ETM_RV_NOT_SUPPORTED = -49, // Funtionality not supported by RIV
102
103 // Error codes related to L1 Test mode
104 ETM_L1TESTMODE = -50, // Layer 1 is not in test mode
105
106 ETM_NOT_USED1 = -51, //
107 ETM_NOT_USED2 = -52, //
108 ETM_NOT_USED3 = -53, //
109 ETM_NOT_USED4 = -54, //
110
111 // ETM Common Target Errors
112 ETM_MESSAGE = -55, // Received unknown message
113 ETM_NOMEM = -56, // Out of memory
114 ETM_AGAIN = -57, // Not ready, try again later
115 ETM_BADOP = -58, // Operation not possible in current context
116 ETM_INVAL = -59, // Invalid parameter/argument
117 ETM_NOSYS = -60, // Module or function not present
118 ETM_FATAL = -61, // System fatal error
119 ETM_PACKET = -62, // Packet error (checksum or other)
120 ETM_OK_MORE = -63 // Ok, more data coming
121 };
122
123
124 // ETM Common PC-side Errors. The error codes from this section are not to
125 // be used directly but should be used like 'ETM_XXX_ERROR + ETM_INVALID',
126 // where XXX is the module's name
127 enum ETMCommonPCErrors {
128 ETM_INTERNAL = -64, // Fatal (internal) unrecoverable error
129 ETM_TOOFEWARGS = -65, // Too few arguments
130
131 ETM_USE = -67, // Failed to load module
132 ETM_USEAGAIN = -68, // Module already loaded
133 ETM_USEVERSION = -69, // Module version incompatible
134
135 ETM_INVALID = -70, // Invalid parameter/argument
136 ETM_MEMORY = -71, // Out of memory
137 ETM_BUFFER = -72, // Buffer too small (maybe internal buffer)
138 ETM_BADDATA = -73, // Bad/unexpected data in uplink packet
139 ETM_NOSUPPORT = -74, // Not supported
140 ETM_BADVALUE = -75, // Bad argument/parameter value
141
142 ETM_FILE_IO = -76, // File I/O error (file not found?)
143 ETM_HOST_FIO = -78 // Host system file I/O error
144 };
145
146 enum ETMTgTraceMask {
147 TgTrTest = 0x00000001,
148 TgTrEtmLow = 0x00000002,
149 TgTrEtmMed = 0x00000004,
150 TgTrEtmHigh = 0x00000008,
151 TgTrCore = 0x00000100,
152 TgTrAudio = 0x00000200,
153 TgTrFfs = 0x00000400,
154 TgTrRf = 0x00000800,
155 TgTrFatal = 0x80000000,
156 TgTrAll = 0xFFFFFFFF
157 };
158
159
160 /******************************************************************************
161 * Macros
162 ******************************************************************************/
163
164 #define if_error_return(myerror) if (myerror < 0) return myerror
165
166 // Keyword to use for exporting a DLL function
167 #define FEXPORT __stdcall
168
169 // Keyword to use for defining a DLL variable as private
170 #define PRIVATE
171
172 // Keyword to use for defining a DLL variable as private
173 #define PUBLIC
174
175
176 /******************************************************************************
177 * Tracing
178 ******************************************************************************/
179
180 // Trace module IDs
181 enum {
182 TrSH = 1 << 24,
183 TrTMT = 2 << 24,
184 TrCore = 3 << 24,
185 TrAUDIO = 4 << 24,
186 TrFFS = 5 << 24,
187 TrPWR = 6 << 24,
188 TrCust = 9 << 24,
189 TrRF = 10 << 24,
190 TrIMEI = 11 << 24,
191 TrBT = 12 << 24,
192 TrETM = 14 << 24,
193 TrTPU = 15 << 24,
194 TrTEST = 19 << 24
195 };
196
197 /******************************************************************************
198 * Supported hardware and software version - read out from Target
199 *****************************************************************************/
200
201 enum HW_SW_revisions_fids
202 {
203 SW_REV_ETM_TASK = 0x01,
204 SW_REV_ETM_API = 0x02,
205 SW_REV_ETM_CORE = 0x10,
206 SW_REV_ETM_AUDIO = 0x11,
207 SW_REV_ETM_RF = 0x12,
208 SW_REV_ETM_FFS = 0x13,
209 SW_REV_ETM_PWR = 0x14,
210 SW_REV_ETM_BT = 0x15,
211 SW_REV_xx1 = 0x16, // Not in use
212 SW_REV_xx2 = 0x18, // Not in use
213 SW_REV_xx3 = 0x19, // Not in use
214 SW_MCU_TCS_PROGRAM_RELEASE = 0xC0,
215 SW_MCU_TCS_OFFICIAL = 0xC1,
216 SW_MCU_TCS_INTERNAL = 0xC2,
217 SW_MCU_TM_VERSION = 0xC3,
218 SW_DSP_CODE_VERSION = 0xD0,
219 SW_DSP_PATCH_VERSION = 0xD1,
220 HW_REV_1,
221 HW_REV_2,
222 HW_REV_3,
223 HW_REV_4,
224 HW_REV_5,
225 HW_REV_6,
226 HW_REV_7,
227 HW_REV_8
228 };
229
230
231 /******************************************************************************
232 * Types
233 ******************************************************************************/
234
235 #ifndef BASIC_TYPES
236 #define BASIC_TYPES
237 typedef signed char int8_t;
238 typedef unsigned char uint8_t;
239 typedef signed short int16_t;
240 typedef unsigned short uint16_t;
241 typedef signed int int32_t;
242 typedef unsigned int uint32_t;
243
244 typedef signed char int8;
245 typedef unsigned char uint8;
246 typedef signed short int16;
247 typedef unsigned short uint16;
248 typedef signed int int32;
249 typedef unsigned int uint32;
250 #endif
251
252
253 /******************************************************************************
254 * Trash/Hacks
255 ******************************************************************************/
256
257 #endif // _ETM_H_