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