📄 spimgr.lst
字号:
\ 000183 E0 MOVX A,@DPTR
\ 000184 F9 MOV R1,A
\ 000185 90.... MOV DPTR,#(osal_msg_send & 0xffff)
\ 000188 74.. MOV A,#((osal_msg_send >> 16) & 0xff)
\ 00018A 800A SJMP ??SPIMgr_ProcessZToolData_16
267 }
268 else
269 {
270 /* deallocate the msg */
271 osal_msg_deallocate ( (uint8 *)SPI_Msg);
\ ??SPIMgr_ProcessZToolData_15:
\ 00018C ; Setup parameters for call to function osal_msg_deallocate
\ 00018C E0 MOVX A,@DPTR
\ 00018D FA MOV R2,A
\ 00018E A3 INC DPTR
\ 00018F E0 MOVX A,@DPTR
\ 000190 FB MOV R3,A
\ 000191 90.... MOV DPTR,#(osal_msg_deallocate & 0xffff)
\ 000194 74.. MOV A,#((osal_msg_deallocate >> 16) & 0xff)
\ ??SPIMgr_ProcessZToolData_16:
\ 000196 12.... LCALL ?BCALL ; Banked call to: DPTR()
272 }
273
274 /* Reset the state, send or discard the buffers at this point */
275 state = SOP_STATE;
\ 000199 E4 CLR A
\ 00019A 02.... LJMP ??SPIMgr_ProcessZToolData_3 & 0xFFFF
276
277 break;
278
279 default:
280 break;
281 }
282
283
284 }
285 }
286 }
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine2:
\ 000000 90.... MOV DPTR,#SPI_Msg
\ 000003 E0 MOVX A,@DPTR
\ 000004 FA MOV R2,A
\ 000005 A3 INC DPTR
\ 000006 E0 MOVX A,@DPTR
\ 000007 F583 MOV DPH,A
\ 000009 8A82 MOV DPL,R2
\ 00000B A3 INC DPTR
\ 00000C A3 INC DPTR
\ 00000D 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine1:
\ 000000 12.... LCALL ?Subroutine3 & 0xFFFF
\ ??CrossCallReturnLabel_7:
\ 000003 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine3:
\ 000000 12.... LCALL ?Subroutine4 & 0xFFFF
\ ??CrossCallReturnLabel_11:
\ 000003 A3 INC DPTR
\ 000004 A3 INC DPTR
\ 000005 E0 MOVX A,@DPTR
\ 000006 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine0:
\ 000000 12.... LCALL ?Subroutine3 & 0xFFFF
\ ??CrossCallReturnLabel_6:
\ 000003 12.... LCALL ??Subroutine4_0 & 0xFFFF
\ ??CrossCallReturnLabel_10:
\ 000006 A3 INC DPTR
\ 000007 22 RET
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine4:
\ 000000 90.... MOV DPTR,#SPI_Msg
\ 000003 E0 MOVX A,@DPTR
\ ??Subroutine4_0:
\ 000004 F8 MOV R0,A
\ 000005 A3 INC DPTR
\ 000006 E0 MOVX A,@DPTR
\ 000007 F583 MOV DPH,A
\ 000009 8882 MOV DPL,R0
\ 00000B 22 RET
287 #endif //ZTOOL
288
289 #if defined (ZAPP_P1) || defined (ZAPP_P2)
290 /***************************************************************************************************
291 * @fn SPIMgr_ProcessZAppRxData
292 *
293 * @brief | SOP | CMD | Data Length | FSC |
294 * | 1 | 2 | 1 | 1 |
295 *
296 * Parses the data and determine either is SPI or just simply serial data
297 * then send the data to correct place (MT or APP)
298 *
299 * @param pBuffer - pointer to the buffer that contains the data
300 * length - length of the buffer
301 *
302 *
303 * @return None
304 ***************************************************************************************************/
305 void SPIMgr_ProcessZAppData ( uint8 port, uint8 event )
306 {
307
308 osal_event_hdr_t *msg_ptr;
309 uint16 length = 0;
310 uint16 rxBufLen = Hal_UART_RxBufLen(SPI_MGR_DEFAULT_PORT);
311
312 /*
313 If maxZAppBufferLength is 0 or larger than current length
314 the entire length of the current buffer is returned.
315 */
316 if ((SPIMgr_MaxZAppBufLen != 0) && (SPIMgr_MaxZAppBufLen <= rxBufLen))
317 {
318 length = SPIMgr_MaxZAppBufLen;
319 }
320 else
321 {
322 length = rxBufLen;
323 }
324
325 /* Verify events */
326 if (event == HAL_UART_TX_FULL)
327 {
328 // Do something when TX if full
329 return;
330 }
331
332 if (event & ( HAL_UART_RX_FULL | HAL_UART_RX_ABOUT_FULL | HAL_UART_RX_TIMEOUT))
333 {
334 if ( App_TaskID )
335 {
336 /*
337 If Application is ready to receive and there is something
338 in the Rx buffer then send it up
339 */
340 if ((SPIMgr_ZAppRxStatus == SPI_MGR_ZAPP_RX_READY ) && (length != 0))
341 {
342 /* Disable App flow control until it processes the current data */
343 SPIMgr_AppFlowControl ( SPI_MGR_ZAPP_RX_NOT_READY );
344
345 /* 2 more bytes are added, 1 for CMD type, other for length */
346 msg_ptr = (osal_event_hdr_t *)osal_msg_allocate( length + sizeof(osal_event_hdr_t) );
347 if ( msg_ptr )
348 {
349 msg_ptr->event = SPI_INCOMING_ZAPP_DATA;
350 msg_ptr->status = length;
351
352 /* Read the data of Rx buffer */
353 HalUARTRead( SPI_MGR_DEFAULT_PORT, (uint8 *)(msg_ptr + 1), length );
354
355 /* Send the raw data to application...or where ever */
356 osal_msg_send( App_TaskID, (uint8 *)msg_ptr );
357 }
358 }
359 }
360 }
361 }
362
363 /***************************************************************************************************
364 * @fn SPIMgr_ZAppBufferLengthRegister
365 *
366 * @brief
367 *
368 * @param maxLen - Max Length that the application wants at a time
369 *
370 * @return None
371 *
372 ***************************************************************************************************/
373 void SPIMgr_ZAppBufferLengthRegister ( uint16 maxLen )
374 {
375 /* If the maxLen is larger than the RX buff, something is not right */
376 if (maxLen <= SPI_MGR_DEFAULT_MAX_RX_BUFF)
377 SPIMgr_MaxZAppBufLen = maxLen;
378 else
379 SPIMgr_MaxZAppBufLen = 1; /* default is 1 byte */
380 }
381
382 /***************************************************************************************************
383 * @fn SPIMgr_AppFlowControl
384 *
385 * @brief
386 *
387 * @param status - ready to send or not
388 *
389 * @return None
390 *
391 ***************************************************************************************************/
392 void SPIMgr_AppFlowControl ( bool status )
393 {
394
395 /* Make sure only update if needed */
396 if (status != SPIMgr_ZAppRxStatus )
397 {
398 SPIMgr_ZAppRxStatus = status;
399 }
400
401 /* App is ready to read again, ProcessZAppData have to be triggered too */
402 if (status == SPI_MGR_ZAPP_RX_READY)
403 {
404 SPIMgr_ProcessZAppData ( SPI_MGR_DEFAULT_PORT, HAL_UART_RX_TIMEOUT );
405 }
406
407 }
408
409 #endif //ZAPP
410
411 /***************************************************************************************************
412 ***************************************************************************************************/
Maximum stack usage in bytes:
Function ISTACK PSTACK XSTACK
-------- ------ ------ ------
SPIMgr_CalcFCS 0 0 24
SPIMgr_Init 3 0 30
-> HalUARTOpen 4 0 60
SPIMgr_ProcessZToolData 1 0 15
-> Hal_UART_RxBufLen 0 0 30
-> HalUARTRead 0 0 30
-> SendData 0 0 30
-> osal_msg_allocate 0 0 30
-> SPIMgr_CalcFCS 0 0 30
-> osal_msg_send 0 0 30
-> osal_msg_deallocate 0 0 30
SPIMgr_RegisterTaskID 2 0 0
Segment part sizes:
Function/Label Bytes
-------------- -----
App_TaskID 1
state 1
CMD_Token 2
LEN_Token 1
FSC_Token 1
SPI_Msg 2
tempDataLen 1
SPIMgr_Init 126
?Subroutine5 7
SPIMgr_RegisterTaskID 11
SPIMgr_CalcFCS 37
SPIMgr_ProcessZToolData 413
?Subroutine2 14
?Subroutine1 4
?Subroutine3 7
?Subroutine0 8
?Subroutine4 12
639 bytes in segment BANKED_CODE
9 bytes in segment XDATA_Z
639 bytes of CODE memory
9 bytes of XDATA memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -