📄 mtel.s51
字号:
ADD A,#0x2
MOV R0,A
MOV A,R3
ADDC A,#0x0
MOV R1,A
MOV A,R2
ADD A,#0x4
MOV R2,A
MOV A,R3
ADDC A,#0x0
MOV R3,A
MOV DPL,R0
MOV DPH,R1
MOV A,R2
MOVX @DPTR,A
INC DPTR
MOV A,R3
MOVX @DPTR,A
// 369 msg = msgPtr->msg;
// 370
// 371 //First byte is used as the event type for MT
// 372 *msg++ = SOP_VALUE;
MOV A,#0x2
MOV DPL,R2
MOV DPH,R3
MOVX @DPTR,A
INC DPTR
// 373 *msg++ = HI_UINT16( callbackID );
MOV A,R7
MOVX @DPTR,A
INC DPTR
// 374 *msg++ = LO_UINT16( callbackID );
MOV A,R6
MOVX @DPTR,A
INC DPTR
MOV R2,DPL
MOV R3,DPH
// 375 *msg++ = len;
MOV A,?V0 + 0
MOVX @DPTR,A
// 376
// 377 //Fill up the data bytes
// 378 osal_memcpy( msg, pData, len );
; Setup parameters for call to function osal_memcpy
MOV ?V0 + 4,?V0 + 6
MOV ?V0 + 5,?V0 + 7
MOV ?V0 + 6,#0x0
MOV R0,#?V0 + 4
LCALL ?PUSH_XSTACK_I_THREE
CFI CFA_XSP16 add(XSP16, 19)
MOV R4,?V0 + 0
MOV R5,#0x0
MOV DPL,R2
MOV DPH,R3
INC DPTR
INC R2
MOV R3,DPH
MOV DPTR,#(osal_memcpy & 0xffff)
MOV A,#((osal_memcpy >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
MOV A,#0x3
LCALL ?DEALLOC_XSTACK8
CFI CFA_XSP16 add(XSP16, 16)
// 379
// 380 osal_msg_send( MT_TaskID, (uint8 *)msgPtr );
; Setup parameters for call to function osal_msg_send
MOV R2,?V0 + 2
MOV R3,?V0 + 3
MOV DPTR,#MT_TaskID
MOVX A,@DPTR
MOV R1,A
MOV DPTR,#(osal_msg_send & 0xffff)
MOV A,#((osal_msg_send >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
// 381 }
// 382 }
??MT_BuildAndSendZToolCB_1:
LJMP ??Subroutine18_0 & 0xFFFF
CFI EndBlock cfiBlock7
// 383 #endif
// 384
// 385 /*********************************************************************
// 386 * @fn MT_ProcessCommand
// 387 *
// 388 * @brief
// 389 *
// 390 * Process Event Messages.
// 391 *
// 392 * @param byte *msg - pointer to event message
// 393 *
// 394 * @return
// 395 */
RSEG BANKED_CODE:CODE:NOROOT(0)
// 396 void MT_ProcessCommand( mtOSALSerialData_t *msg )
MT_ProcessCommand:
CFI Block cfiBlock8 Using cfiCommon0
CFI Function MT_ProcessCommand
// 397 {
FUNCALL MT_ProcessCommand, MT_ProcessSerialCommand
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL MT_ProcessCommand, MT_ProcessDebugMsg
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL MT_ProcessCommand, MT_ProcessDebugStr
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL MT_ProcessCommand, SPIMgr_CalcFCS
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL MT_ProcessCommand, HalUARTWrite
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL MT_ProcessCommand, MTProcessAppRspMsg
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
FUNCALL MT_ProcessCommand, osal_msg_deallocate
LOCFRAME XSTACK, 14, STACK
ARGFRAME XSTACK, 14, STACK
MOV A,#-0xe
LCALL ?BANKED_ENTER_XDATA
CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-7)))
CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-8)))
CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-9)))
CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-10)))
CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-11)))
CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-12)))
CFI VB load(1, XDATA, add(CFA_XSP16, literal(-13)))
CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-14)))
CFI CFA_SP SP+0
CFI CFA_XSP16 add(XSP16, 14)
; Saved register size: 14
; Auto size: 0
MOV ?V0 + 0,R2
MOV ?V0 + 1,R3
// 398 byte deallocate;
// 399 #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
// 400 byte *msg_ptr;
// 401 byte len;
// 402
// 403 // A little setup for AF, CB_FUNC and MT_SYS_APP_RSP_MSG
// 404 msg_ptr = msg->msg;
MOV DPL,R2
MOV DPH,R3
INC DPTR
INC DPTR
MOVX A,@DPTR
MOV R6,A
INC DPTR
MOVX A,@DPTR
MOV R7,A
// 405 #endif // ZTOOL
// 406
// 407 deallocate = true;
// 408
// 409 // Use the first byte of the message as the command ID
// 410 switch ( msg->hdr.event )
MOV DPL,R2
MOV DPH,R3
MOVX A,@DPTR
LCALL ?UC_SWITCH_SPARSE
`?<Jumptable for MT_ProcessCommand>_0`:
DB 0
DB 5
DB 1
DW ??MT_ProcessCommand_0
DB 2
DW ??MT_ProcessCommand_1
DB 4
DW ??MT_ProcessCommand_2
DB 6
DW ??MT_ProcessCommand_3
DB 36
DW ??MT_ProcessCommand_4
DW ??MT_ProcessCommand_5
// 411 {
// 412 #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
// 413 case CMD_SERIAL_MSG:
// 414 MT_ProcessSerialCommand( msg->msg );
??MT_ProcessCommand_0:
; Setup parameters for call to function MT_ProcessSerialCommand
MOV DPL,R2
MOV DPH,R3
INC DPTR
INC DPTR
LCALL ??Subroutine7_0 & 0xFFFF
??CrossCallReturnLabel_23:
MOV DPTR,#(MT_ProcessSerialCommand & 0xffff)
MOV A,#((MT_ProcessSerialCommand >> 16) & 0xff)
SJMP ??MT_ProcessCommand_6
// 415 break;
// 416
// 417 case CMD_DEBUG_MSG:
// 418 MT_ProcessDebugMsg( (mtDebugMsg_t *)msg );
??MT_ProcessCommand_1:
; Setup parameters for call to function MT_ProcessDebugMsg
MOV DPTR,#(MT_ProcessDebugMsg & 0xffff)
MOV A,#((MT_ProcessDebugMsg >> 16) & 0xff)
SJMP ??MT_ProcessCommand_6
// 419 break;
// 420
// 421 case CMD_DEBUG_STR:
// 422 MT_ProcessDebugStr( (mtDebugStr_t *)msg );
??MT_ProcessCommand_3:
; Setup parameters for call to function MT_ProcessDebugStr
MOV DPTR,#(MT_ProcessDebugStr & 0xffff)
MOV A,#((MT_ProcessDebugStr >> 16) & 0xff)
SJMP ??MT_ProcessCommand_6
// 423 break;
// 424
// 425 case CB_FUNC:
// 426 /*
// 427 Build SPI message here instead of redundantly calling MT_BuildSPIMsg
// 428 because we have copied data already in the allocated message
// 429 */
// 430
// 431 /* msg_ptr is the beginning of the intended SPI message */
// 432 len = SPI_0DATA_MSG_LEN + msg_ptr[DATALEN_FIELD];
??MT_ProcessCommand_2:
MOV DPL,R6
MOV DPH,R7
INC DPTR
INC DPTR
INC DPTR
MOVX A,@DPTR
ADD A,#0x5
MOV ?V0 + 2,A
// 433
// 434 /*
// 435 FCS goes to the last byte in the message and is calculated over all
// 436 the bytes except FCS and SOP
// 437 */
// 438 msg_ptr[len-1] = SPIMgr_CalcFCS( msg_ptr + 1 , (byte)(len-2) );
; Setup parameters for call to function SPIMgr_CalcFCS
MOV A,#-0x2
ADD A,?V0 + 2
MOV R1,A
MOV DPL,R6
MOV DPH,R7
INC DPTR
MOV R2,DPL
MOV R3,DPH
MOV DPTR,#(SPIMgr_CalcFCS & 0xffff)
MOV A,#((SPIMgr_CalcFCS >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
MOV A,R1
PUSH A
CFI CFA_SP SP+-1
MOV ?V0 + 4,?V0 + 2
MOV A,R6
ADD A,?V0 + 4
MOV R0,A
MOV A,R7
ADDC A,#0x0
MOV R1,A
MOV A,#-0x1
ADD A,R0
MOV DPL,A
MOV A,#-0x1
ADDC A,R1
MOV DPH,A
POP A
CFI CFA_SP SP+0
MOVX @DPTR,A
// 439
// 440 #ifdef SPI_MGR_DEFAULT_PORT
// 441 HalUARTWrite ( SPI_MGR_DEFAULT_PORT, msg_ptr, len );
; Setup parameters for call to function HalUARTWrite
MOV R4,?V0 + 2
MOV R5,#0x0
MOV A,R6
MOV R2,A
MOV A,R7
MOV R3,A
MOV R1,#0x0
MOV DPTR,#(HalUARTWrite & 0xffff)
MOV A,#((HalUARTWrite >> 16) & 0xff)
SJMP ??MT_ProcessCommand_6
// 442 #endif
// 443 break;
// 444
// 445 #if !defined ( NONWK )
// 446 case MT_SYS_APP_RSP_MSG:
// 447 len = SPI_0DATA_MSG_LEN + msg_ptr[DATALEN_FIELD];
// 448 MTProcessAppRspMsg( msg_ptr, len );
??MT_ProcessCommand_4:
; Setup parameters for call to function MTProcessAppRspMsg
MOV DPL,R6
MOV DPH,R7
INC DPTR
INC DPTR
INC DPTR
MOVX A,@DPTR
ADD A,#0x5
MOV R1,A
MOV A,R6
MOV R2,A
MOV A,R7
MOV R3,A
MOV DPTR,#(MTProcessAppRspMsg & 0xffff)
MOV A,#((MTProcessAppRspMsg >> 16) & 0xff)
??MT_ProcessCommand_6:
LCALL ?BCALL ; Banked call to: DPTR()
// 449 break;
// 450 #endif // NONWK
// 451 #endif // ZTOOL
// 452
// 453 default:
// 454 break;
// 455 }
// 456
// 457 if ( deallocate )
// 458 {
// 459 osal_msg_deallocate( (uint8 *)msg );
??MT_ProcessCommand_5:
; Setup parameters for call to function osal_msg_deallocate
MOV R2,?V0 + 0
MOV R3,?V0 + 1
MOV DPTR,#(osal_msg_deallocate & 0xffff)
MOV A,#((osal_msg_deallocate >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
// 460 }
// 461 }
LJMP ??Subroutine17_0 & 0xFFFF
CFI EndBlock cfiBlock8
// 462
// 463 #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
// 464 /*********************************************************************
// 465 * @fn MT_ProcessDebugMsg
// 466 *
// 467 * @brief
// 468 *
// 469 * Build and send a debug message.
// 470 *
// 471 * @param byte *data - pointer to the data portion of the debug message
// 472 *
// 473 * @return void
// 474 */
RSEG BANKED_CODE:CODE:NOROOT(0)
// 475 void MT_ProcessDebugMsg( mtDebugMsg_t *msg )
MT_ProcessDebugMsg:
CFI Block cfiBlock9 Using cfiCommon0
CFI Function MT_ProcessDebugMsg
// 476 {
FUNCALL MT_ProcessDebugMsg, osal_msg_allocate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -