📄 zdapp.lst
字号:
\ In segment BANKED_CODE, align 1, keep-with-next
277 void ZDApp_Init( byte task_id )
\ ZDApp_Init:
278 {
\ 000000 C082 PUSH DPL
\ 000002 C083 PUSH DPH
\ 000004 ; Saved register size: 2
\ 000004 ; Auto size: 1
\ 000004 74FF MOV A,#-0x1
\ 000006 12.... LCALL ?ALLOC_XSTACK8
279 uint8 capabilities;
280
281 // Save the task ID
282 ZDAppTaskID = task_id;
\ 000009 E9 MOV A,R1
\ 00000A 90.... MOV DPTR,#ZDAppTaskID
\ 00000D F0 MOVX @DPTR,A
283
284 // Initialize the ZDO global device short address storage
285 ZDAppNwkAddr.addrMode = Addr16Bit;
\ 00000E 7402 MOV A,#0x2
\ 000010 90.... MOV DPTR,#(ZDAppNwkAddr + 8)
\ 000013 F0 MOVX @DPTR,A
286 ZDAppNwkAddr.addr.shortAddr = INVALID_NODE_ADDR;
\ 000014 90.... MOV DPTR,#ZDAppNwkAddr
\ 000017 74FE MOV A,#-0x2
\ 000019 F0 MOVX @DPTR,A
\ 00001A A3 INC DPTR
\ 00001B 74FF MOV A,#-0x1
\ 00001D F0 MOVX @DPTR,A
287 (void)NLME_GetExtAddr(); // Load the saveExtAddr pointer.
\ 00001E ; Setup parameters for call to function NLME_GetExtAddr
\ 00001E 90.... MOV DPTR,#(NLME_GetExtAddr & 0xffff)
\ 000021 74.. MOV A,#((NLME_GetExtAddr >> 16) & 0xff)
\ 000023 12.... LCALL ?BCALL ; Banked call to: DPTR()
288
289 // Check for manual "Hold Auto Start"
290 ZDAppCheckForHoldKey();
\ 000026 ; Setup parameters for call to function ZDAppCheckForHoldKey
\ 000026 90.... MOV DPTR,#(ZDAppCheckForHoldKey & 0xffff)
\ 000029 74.. MOV A,#((ZDAppCheckForHoldKey >> 16) & 0xff)
\ 00002B 12.... LCALL ?BCALL ; Banked call to: DPTR()
291
292 // Initialize ZDO items and setup the device - type of device to create.
293 ZDO_Init();
\ 00002E ; Setup parameters for call to function ZDO_Init
\ 00002E 90.... MOV DPTR,#(ZDO_Init & 0xffff)
\ 000031 74.. MOV A,#((ZDO_Init >> 16) & 0xff)
\ 000033 12.... LCALL ?BCALL ; Banked call to: DPTR()
294
295 // Register the endpoint description with the AF
296 // This task doesn't have a Simple description, but we still need
297 // to register the endpoint.
298 afRegister( (endPointDesc_t *)&ZDApp_epDesc );
\ 000036 ; Setup parameters for call to function afRegister
\ 000036 7A.. MOV R2,#(ZDApp_epDesc & 0xff)
\ 000038 7B.. MOV R3,#((ZDApp_epDesc >> 8) & 0xff)
\ 00003A 90.... MOV DPTR,#(afRegister & 0xffff)
\ 00003D 74.. MOV A,#((afRegister >> 16) & 0xff)
\ 00003F 12.... LCALL ?BCALL ; Banked call to: DPTR()
299
300 #if defined( ZDO_USERDESC_RESPONSE )
301 ZDApp_InitUserDesc();
302 #endif // ZDO_USERDESC_RESPONSE
303
304 #if defined( ZDO_CACHE )
305 ZDCacheInit();
306 #endif
307
308 // Setup the Zigbee Network Protocol Version
309 ZDAppSetupProtoVersion();
\ 000042 ; Setup parameters for call to function ZDAppSetupProtoVersion
\ 000042 90.... MOV DPTR,#(ZDAppSetupProtoVersion & 0xffff)
\ 000045 74.. MOV A,#((ZDAppSetupProtoVersion >> 16) & 0xff)
\ 000047 12.... LCALL ?BCALL ; Banked call to: DPTR()
310
311 // set broadcast address mask to support broadcast filtering
312 NLME_GetRequest(nwkCapabilityInfo, 0, &capabilities);
\ 00004A ; Setup parameters for call to function NLME_GetRequest
\ 00004A 85..82 MOV DPL,?XSP + 0
\ 00004D 85..83 MOV DPH,?XSP + 1
\ 000050 AC82 MOV R4,DPL
\ 000052 AD83 MOV R5,DPH
\ 000054 7A00 MOV R2,#0x0
\ 000056 7B00 MOV R3,#0x0
\ 000058 798F MOV R1,#-0x71
\ 00005A 90.... MOV DPTR,#(NLME_GetRequest & 0xffff)
\ 00005D 74.. MOV A,#((NLME_GetRequest >> 16) & 0xff)
\ 00005F 12.... LCALL ?BCALL ; Banked call to: DPTR()
313 NLME_SetBroadcastFilter( capabilities );
\ 000062 ; Setup parameters for call to function NLME_SetBroadcastFilter
\ 000062 85..82 MOV DPL,?XSP + 0
\ 000065 85..83 MOV DPH,?XSP + 1
\ 000068 E0 MOVX A,@DPTR
\ 000069 F9 MOV R1,A
\ 00006A 90.... MOV DPTR,#(NLME_SetBroadcastFilter & 0xffff)
\ 00006D 74.. MOV A,#((NLME_SetBroadcastFilter >> 16) & 0xff)
\ 00006F 12.... LCALL ?BCALL ; Banked call to: DPTR()
314
315 // Start the device?
316 if ( devState != DEV_HOLD )
\ 000072 90.... MOV DPTR,#devState
\ 000075 E0 MOVX A,@DPTR
\ 000076 600B JZ ??ZDApp_Init_0
317 {
318 ZDOInitDevice( 0 );
\ 000078 ; Setup parameters for call to function ZDOInitDevice
\ 000078 7A00 MOV R2,#0x0
\ 00007A 7B00 MOV R3,#0x0
\ 00007C 90.... MOV DPTR,#(ZDOInitDevice & 0xffff)
\ 00007F 74.. MOV A,#((ZDOInitDevice >> 16) & 0xff)
\ 000081 800F SJMP ??ZDApp_Init_1
319 }
320 else
321 {
322 // Blink LED to indicate HOLD_START
323 HalLedBlink ( HAL_LED_4, 0, 50, 500 );
\ ??ZDApp_Init_0:
\ 000083 ; Setup parameters for call to function HalLedBlink
\ 000083 7CF4 MOV R4,#-0xc
\ 000085 7D01 MOV R5,#0x1
\ 000087 7B32 MOV R3,#0x32
\ 000089 7A00 MOV R2,#0x0
\ 00008B 7908 MOV R1,#0x8
\ 00008D 90.... MOV DPTR,#(HalLedBlink & 0xffff)
\ 000090 74.. MOV A,#((HalLedBlink >> 16) & 0xff)
\ ??ZDApp_Init_1:
\ 000092 02.... LJMP ?Subroutine29 & 0xFFFF
324 }
325 } /* ZDO_Init() */
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine29:
\ 000000 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 000003 7401 MOV A,#0x1
\ 000005 12.... LCALL ?DEALLOC_XSTACK8
\ ??Subroutine29_0:
\ 000008 D083 POP DPH
\ 00000A D082 POP DPL
\ 00000C 02.... LJMP ?BRET
326
327 /*********************************************************************
328 * @fn ZDApp_event_loop()
329 *
330 * @brief Main event loop for Zigbee device objects task. This function
331 * should be called at periodic intervals.
332 *
333 * @param task_id - Task ID
334 * @param events - Bitmap of events
335 *
336 * @return none
337 */
\ In segment BANKED_CODE, align 1, keep-with-next
338 UINT16 ZDApp_event_loop( byte task_id, UINT16 events )
\ ZDApp_event_loop:
339 {
\ 000000 74F6 MOV A,#-0xa
\ 000002 12.... LCALL ?BANKED_ENTER_XDATA
\ 000005 ; Saved register size: 10
\ 000005 ; Auto size: 0
\ 000005 EA MOV A,R2
\ 000006 FE MOV R6,A
\ 000007 EB MOV A,R3
\ 000008 FF MOV R7,A
340 uint8 *msg_ptr;
341
342 if ( events & SYS_EVENT_MSG )
\ 000009 7480 MOV A,#-0x80
\ 00000B 5F ANL A,R7
\ 00000C F9 MOV R1,A
\ 00000D E4 CLR A
\ 00000E 7001 JNZ ??ZDApp_event_loop_0
\ 000010 E9 MOV A,R1
\ ??ZDApp_event_loop_0:
\ 000011 7040 JNZ ??ZDApp_event_loop_1
343 {
344 while ( (msg_ptr = osal_msg_receive( ZDAppTaskID )) )
345 {
346 ZDApp_ProcessOSALMsg( (osal_event_hdr_t *)msg_ptr );
347
348 // Release the memory
349 osal_msg_deallocate( msg_ptr );
350 }
351
352 // Return unprocessed events
353 return (events ^ SYS_EVENT_MSG);
354 }
355
356 if ( events & ZDO_NETWORK_INIT )
\ 000013 EE MOV A,R6
\ 000014 A2E0 MOV C,0xE0 /* A */.0
\ 000016 5059 JNC ??ZDApp_event_loop_2
357 {
358 // Initialize apps and start the network
359 devState = DEV_INIT;
\ 000018 7401 MOV A,#0x1
\ 00001A 90.... MOV DPTR,#devState
\ 00001D F0 MOVX @DPTR,A
360 ZDO_StartDevice( (uint8)ZDO_Config_Node_Descriptor.LogicalType, devStartMode,
361 DEFAULT_BEACON_ORDER, DEFAULT_SUPERFRAME_ORDER );
\ 00001E ; Setup parameters for call to function ZDO_StartDevice
\ 00001E 7C0F MOV R4,#0xf
\ 000020 7B0F MOV R3,#0xf
\ 000022 90.... MOV DPTR,#devStartMode
\ 000025 E0 MOVX A,@DPTR
\ 000026 FA MOV R2,A
\ 000027 90.... MOV DPTR,#ZDO_Config_Node_Descriptor
\ 00002A E0 MOVX A,@DPTR
\ 00002B 5407 ANL A,#0x7
\ 00002D F9 MOV R1,A
\ 00002E 90.... MOV DPTR,#(ZDO_StartDevice & 0xffff)
\ 000031 74.. MOV A,#((ZDO_StartDevice >> 16) & 0xff)
\ 000033 12.... LCALL ?BCALL ; Banked call to: DPTR()
362
363 // Return unprocessed events
364 return (events ^ ZDO_NETWORK_INIT);
\ 000036 7401 MOV A,#0x1
\ ??ZDApp_event_loop_3:
\ 000038 6E XRL A,R6
\ 000039 FA MOV R2,A
\ 00003A EF MOV A,R7
\ ??ZDApp_event_loop_4:
\ 00003B FB MOV R3,A
\ 00003C 02.... LJMP ??ZDApp_event_loop_5 & 0xFFFF
365 }
\ ??ZDApp_event_loop_6:
\ 00003F ; Setup parameters for call to function ZDApp_ProcessOSALMsg
\ 00003F 90.... MOV DPTR,#(ZDApp_ProcessOSALMsg & 0xffff)
\ 000042 74.. MOV A,#((ZDApp_ProcessOSALMsg >> 16) & 0xff)
\ 000044 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 000047 ; Setup parameters for call to function osal_msg_deallocate
\ 000047 AA.. MOV R2,?V0 + 0
\ 000049 AB.. MOV R3,?V0 + 1
\ 00004B 90.... MOV DPTR,#(osal_msg_deallocate & 0xffff)
\ 00004E 74.. MOV A,#((osal_msg_deallocate >> 16) & 0xff)
\ 000050 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ ??ZDApp_event_loop_1:
\ 000053 ; Setup parameters for call to function osal_msg_receive
\ 000053 90.... MOV DPTR,#ZDAppTaskID
\ 000056 E0 MOVX A,@DPTR
\ 000057 F9 MOV R1,A
\ 000058 90.... MOV DPTR,#(osal_msg_receive & 0xffff)
\ 00005B 74.. MOV A,#((osal_msg_receive >> 16) & 0xff)
\ 00005D 12.... LCALL ?BCALL ; Banked call to: DPTR()
\ 000060 8A.. MOV ?V0 + 0,R2
\ 000062 8B.. MOV ?V0 + 1,R3
\ 000064 EA MOV A,R2
\ 000065 7001 JNZ ??ZDApp_event_loop_7
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -