📄 probe_com.lst
字号:
136 /*
137 *********************************************************************************************************
138 * QUERIES
139 *
140 * Note(s): (1) The following queries are currently defined:
141 *
142 * (A) PROBE_COM_QUERY_MAX_RX_SIZE. The target responds with the data size of the
143 * largest packet it can receive.
144 *
145 * (B) PROBE_COM_QUERY_MAX_TX_SIZE. The target responds with the data size of the
146 * largest packet it can send.
147 *
148 * (C) PROBE_COM_QUERY_FMT_SUPPORT. The target responds with a list of the formats
149 * the target can respond to.
150 *
151 **********************************************************************************************************
152 */
153
154 #define PROBE_COM_QUERY_MAX_RX_SIZE 0x0101
155 #define PROBE_COM_QUERY_MAX_TX_SIZE 0x0102
156
157 #define PROBE_COM_QUERY_FMT_SUPPORT 0x1001
158
159 /*
160 *********************************************************************************************************
161 * MODIFIERS
162 *
163 * Note(s): (1) The following modifiers are currently defined:
164 *
165 * (A) PROBE_COM_MODIFIER_NONE. This is the generic modifier.
166 *
167 * (B) PROBE_COM_MODIFIER_STR_HAVE. The target indicates that it has a string to
168 * transmit.
169 *
170 **********************************************************************************************************
171 */
172
173 #define PROBE_COM_MODIFIER_NONE 0x00
174 #define PROBE_COM_MODIFIER_STR_HAVE 0x01
175
176 /*
177 *********************************************************************************************************
178 * HEADER SIZES
179 *
180 * Note(s): (1) Every RX packet has a 2-byte "header".
181 *
182 * (2) Every TX packet has a 4-byte "header".
183 **********************************************************************************************************
184 */
185
186 #define PROBE_COM_SIZE_RX_HEADER 2
187 #define PROBE_COM_SIZE_TX_HEADER 4
188
189 /*
190 *********************************************************************************************************
191 * LOCAL CONSTANTS
192 *********************************************************************************************************
193 */
194
195
196 /*
197 *********************************************************************************************************
198 * LOCAL DATA TYPES
199 *********************************************************************************************************
200 */
201
202
203 /*
204 *********************************************************************************************************
205 * LOCAL TABLES
206 *********************************************************************************************************
207 */
208
209
210 /*
211 *********************************************************************************************************
212 * LOCAL GLOBAL VARIABLES
213 *********************************************************************************************************
214 */
215
216 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
217 static CPU_INT32U ProbeComStrBufWrIx;
218 static CPU_INT32U ProbeComStrBufRdIx;
219 static CPU_CHAR ProbeComStrBuf[PROBE_COM_STR_BUF_SIZE];
220 #endif
221
222
223 /*
224 *********************************************************************************************************
225 * LOCAL FUNCTION PROTOTYPES
226 *********************************************************************************************************
227 */
228
229 /* ---------- PROCESS REQUEST & FORM RESPONSE --------- */
230 static CPU_INT08U ProbeCom_PktModifier (void);
231
232 static CPU_INT16U ProbeCom_CmdError (CPU_INT08U *tx_buf,
233 CPU_INT16U com_error);
234
235 static CPU_INT16U ProbeCom_CmdQuery (CPU_INT08U *rx_buf,
236 CPU_INT08U *tx_buf,
237 CPU_INT16U rx_pkt_sz,
238 CPU_INT16U tx_buf_sz);
239
240 static CPU_INT16U ProbeCom_CmdSimpleRd (CPU_INT08U *rx_buf,
241 CPU_INT08U *tx_buf,
242 CPU_INT16U rx_pkt_sz,
243 CPU_INT16U tx_buf_sz);
244
245 #if (PROBE_COM_SUPPORT_WR == DEF_TRUE)
246 static CPU_INT16U ProbeCom_CmdSimpleWr (CPU_INT08U *rx_buf,
247 CPU_INT08U *tx_buf,
248 CPU_INT16U rx_pkt_sz,
249 CPU_INT16U tx_buf_sz);
250 #endif
251 static CPU_INT16U ProbeCom_CmdMultipleRd(CPU_INT08U *rx_buf,
252 CPU_INT08U *tx_buf,
253 CPU_INT16U rx_pkt_sz,
254 CPU_INT16U tx_buf_sz);
255 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
256 static CPU_INT16U ProbeCom_CmdStrGet (CPU_INT08U *rx_buf,
257 CPU_INT08U *tx_buf,
258 CPU_INT16U rx_pkt_sz,
259 CPU_INT16U tx_buf_sz);
260 #endif
261
262 /* ---------------- READ FROM RX PACKET --------------- */
263 static CPU_INT08U ProbeCom_GetINT8U (CPU_INT08U **buf);
264
265 static CPU_INT16U ProbeCom_GetINT16U (CPU_INT08U **buf);
266
267 static CPU_INT32U ProbeCom_GetINT32U (CPU_INT08U **buf);
268
269 /* ----------------- WRITE TO TX BUFFER --------------- */
270 static void ProbeCom_StoINT8U (CPU_INT08U **buf,
271 CPU_INT08U data);
272
273 static void ProbeCom_StoINT16U (CPU_INT08U **buf,
274 CPU_INT16U data);
275
276 static void ProbeCom_StoINT32U (CPU_INT08U **buf,
277 CPU_INT32U data);
278
279 /* ------ DETERMINE IF STRING IS IN STRING BUFFER ----- */
280 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
281 static CPU_BOOLEAN ProbeCom_StrRdy (void);
282 #endif
283
284
285 /*
286 *********************************************************************************************************
287 * LOCAL CONFIGURATION ERRORS
288 *********************************************************************************************************
289 */
290
291
292 /*
293 *********************************************************************************************************
294 *********************************************************************************************************
295 ** Global Functions
296 *********************************************************************************************************
297 *********************************************************************************************************
298 */
299
300 /*
301 *********************************************************************************************************
302 * Initialize uC/Probe Communication Module
303 *
304 * Description: This function initializes the module.
305 *
306 * Argument(s): None
307 *
308 * Returns : None
309 *********************************************************************************************************
310 */
311
\ In segment CODE, align 4, keep-with-next
312 void ProbeCom_Init (void)
313 {
\ ProbeCom_Init:
\ 00000000 30B5 PUSH {R4,R5,LR}
314 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
315 ProbeComStrBufWrIx = 0;
\ 00000002 .... LDR.N R4,??DataTable1 ;; ProbeCom_RxPktCtr
\ 00000004 0025 MOVS R5,#+0
\ 00000006 A561 STR R5,[R4, #+24]
316 ProbeComStrBufRdIx = 0;
\ 00000008 E561 STR R5,[R4, #+28]
317
318 ProbeCom_OS_Init();
\ 0000000A ........ _BLF ProbeCom_OS_Init,??ProbeCom_OS_Init??rT
319 #endif
320
321 #if (PROBE_COM_STAT_EN == DEF_ENABLED)
322 ProbeCom_RxPktCtr = 0;
\ 0000000E 2560 STR R5,[R4, #+0]
323 ProbeCom_TxPktCtr = 0;
\ 00000010 6560 STR R5,[R4, #+4]
324 ProbeCom_TxSymByteCtr = 0;
\ 00000012 E560 STR R5,[R4, #+12]
325 ProbeCom_TxSymCtr = 0;
\ 00000014 A560 STR R5,[R4, #+8]
326 ProbeCom_ErrPktCtr = 0;
\ 00000016 2561 STR R5,[R4, #+16]
327
328 #if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
329 ProbeCom_TxStrCtr = 0;
\ 00000018 6561 STR R5,[R4, #+20]
330 #endif
331 #endif
332 }
\ 0000001A 30BD POP {R4,R5,PC} ;; return
333
334
335 /*
336 *********************************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -