📄 probe_com.lst
字号:
142 #define PROBE_COM_STATUS_RX_PKT_WRONG_SIZE 0xFE
143 #define PROBE_COM_STATUS_FAIL 0xFF
144
145 /*
146 *********************************************************************************************************
147 * QUERIES
148 *
149 * Note(s): (1) The following queries are currently defined:
150 *
151 * (A) PROBE_COM_QUERY_MAX_RX_SIZE. The target responds with the data size of the largest
152 * packet it can receive.
153 *
154 * (B) PROBE_COM_QUERY_MAX_TX_SIZE. The target responds with the data size of the largest
155 * packet it can send.
156 *
157 * (C) PROBE_COM_ENDIANNESS_TEST. The target responds with a 4-byte data value. On
158 * little-endian CPUs, this will be received as 0x12345678; on big-endian CPUs, this
159 * will be received as 0x87654321.
160 *
161 * (D) PROBE_COM_QUERY_FMT_SUPPORT. The target responds with a list of the formats the
162 * target can respond to.
163 *
164 * (E) PROBE_COM_QUERY_VERSION. The target responds with the communication module version.
165 **********************************************************************************************************
166 */
167
168 /* ------------------- CONFIGURATION ------------------ */
169 #define PROBE_COM_QUERY_MAX_RX_SIZE 0x0101
170 #define PROBE_COM_QUERY_MAX_TX_SIZE 0x0102
171
172 /* ----------------- TARGET PROPERTIES ---------------- */
173 #define PROBE_COM_QUERY_ENDIANNESS_TEST 0x0201
174
175 /* ------------- COMMUNICATION CAPABILITIES ----------- */
176 #define PROBE_COM_QUERY_FMT_SUPPORT 0x1001
177 #define PROBE_COM_QUERY_VERSION 0x1002
178
179 /*
180 *********************************************************************************************************
181 * INFO PACKET TYPES
182 *
183 * Note(s): (1) The following info packet types are currently defined:
184 *
185 * (A) PROBE_COM_INFO_PKT_SIZE. Probe supplies the size of the next packet.
186 **********************************************************************************************************
187 */
188
189 #define PROBE_COM_INFO_PKT_SIZE 0x0001
190
191 /*
192 *********************************************************************************************************
193 * MODIFIERS
194 *
195 * Note(s): (1) The following modifiers are currently defined:
196 *
197 * (A) PROBE_COM_MODIFIER_NONE. This is the generic modifier.
198 *
199 * (B) PROBE_COM_MODIFIER_STR_HAVE. The target indicates that it has a string to transmit.
200 **********************************************************************************************************
201 */
202
203 #define PROBE_COM_MODIFIER_NONE 0x00
204 #define PROBE_COM_MODIFIER_STR_HAVE 0x01
205
206 /*
207 *********************************************************************************************************
208 * HEADER SIZES
209 *
210 * Note(s): (1) Every RX packet has a 2-byte "header".
211 *
212 * (2) Every TX packet has a 4-byte "header".
213 **********************************************************************************************************
214 */
215
216 #define PROBE_COM_SIZE_RX_HDR 2
217 #define PROBE_COM_SIZE_TX_HDR 4
218
219 /*
220 *********************************************************************************************************
221 * LOCAL CONSTANTS
222 *********************************************************************************************************
223 */
224
225
226 /*
227 *********************************************************************************************************
228 * LOCAL DATA TYPES
229 *********************************************************************************************************
230 */
231
232
233 /*
234 *********************************************************************************************************
235 * LOCAL TABLES
236 *********************************************************************************************************
237 */
238
239
240 /*
241 *********************************************************************************************************
242 * LOCAL GLOBAL VARIABLES
243 *********************************************************************************************************
244 */
245
246 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
247 static CPU_INT16U ProbeCom_StrBufWrIx;
248 static CPU_INT16U ProbeCom_StrBufRdIx;
249 static CPU_CHAR ProbeCom_StrBuf[PROBE_COM_STR_BUF_SIZE];
250 static PROBE_COM_STR_HDNLR_FNCT ProbeCom_StrHndlr;
251 #endif
252
253 static CPU_INT32U ProbeCom_EndiannessTest;
254
255 static PROBE_COM_INFO_HDNLR_FNCT ProbeCom_InfoHndlr;
256
257
258 /*
259 *********************************************************************************************************
260 * LOCAL FUNCTION PROTOTYPES
261 *********************************************************************************************************
262 */
263
264 static CPU_INT08U ProbeCom_PktModifier (void);
265
266 static CPU_INT16U ProbeCom_CmdErr (CPU_INT08U *ptx_buf,
267 CPU_INT08U pcomm_err);
268
269 static CPU_INT16U ProbeCom_CmdQuery (CPU_INT08U *prx_buf,
270 CPU_INT08U *ptx_buf,
271 CPU_INT16U rx_pkt_size,
272 CPU_INT16U tx_buf_size);
273
274 static CPU_INT16U ProbeCom_CmdInfo (CPU_INT08U *prx_buf,
275 CPU_INT08U *ptx_buf,
276 CPU_INT16U rx_pkt_size,
277 CPU_INT16U tx_buf_size);
278
279 static CPU_INT16U ProbeCom_CmdSimpleRd (CPU_INT08U *prx_buf,
280 CPU_INT08U *ptx_buf,
281 CPU_INT16U rx_pkt_size,
282 CPU_INT16U tx_buf_size);
283
284 static CPU_INT16U ProbeCom_CmdMultipleRd(CPU_INT08U *prx_buf,
285 CPU_INT08U *ptx_buf,
286 CPU_INT16U rx_pkt_size,
287 CPU_INT16U tx_buf_size);
288
289 #if (PROBE_COM_SUPPORT_WR == DEF_TRUE)
290 static CPU_INT16U ProbeCom_CmdSimpleWr (CPU_INT08U *prx_buf,
291 CPU_INT08U *ptx_buf,
292 CPU_INT16U rx_pkt_size,
293 CPU_INT16U tx_buf_size);
294
295 static CPU_INT16U ProbeCom_CmdMultipleWr(CPU_INT08U *prx_buf,
296 CPU_INT08U *ptx_buf,
297 CPU_INT16U rx_pkt_size,
298 CPU_INT16U tx_buf_size);
299 #endif
300
301 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
302 static CPU_INT16U ProbeCom_CmdStrRd (CPU_INT08U *prx_buf,
303 CPU_INT08U *ptx_buf,
304 CPU_INT16U rx_pkt_size,
305 CPU_INT16U tx_buf_size);
306
307 static CPU_INT16U ProbeCom_CmdStrWr (CPU_INT08U *prx_buf,
308 CPU_INT08U *ptx_buf,
309 CPU_INT16U rx_pkt_size,
310 CPU_INT16U tx_buf_size);
311 #endif
312
313
314 /* ------------------- RD FROM RX PKT ----------------- */
315 static CPU_INT08U ProbeCom_GetINT8U (CPU_INT08U **pbuf);
316
317 static CPU_INT16U ProbeCom_GetINT16U (CPU_INT08U **pbuf);
318
319 static CPU_INT32U ProbeCom_GetINT32U (CPU_INT08U **pbuf);
320
321 /* -------------------- WR TO TX BUF ----------------- */
322 static void ProbeCom_StoINT8U (CPU_INT08U **pbuf,
323 CPU_INT08U data);
324
325 static void ProbeCom_StoINT16U (CPU_INT08U **pbuf,
326 CPU_INT16U data);
327
328 #if 0
329 static void ProbeCom_StoINT32U (CPU_INT08U **pbuf,
330 CPU_INT32U data);
331 #endif
332
333 /* -------------- DETERMINE PKT MODIFIER -------------- */
334 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
335 static CPU_BOOLEAN ProbeCom_StrRdy (void);
336 #endif
337
338
339 /*
340 *********************************************************************************************************
341 * LOCAL CONFIGURATION ERRORS
342 *********************************************************************************************************
343 */
344
345
346 /*
347 *********************************************************************************************************
348 *********************************************************************************************************
349 * GLOBAL FUNCTIONS
350 *********************************************************************************************************
351 *********************************************************************************************************
352 */
353
354 /*
355 *********************************************************************************************************
356 * ProbeCom_Init()
357 *
358 * Description : Initialize the module.
359 *
360 * Argument(s) : none.
361 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -