📄 zdapp.lst
字号:
\ 000067 EB MOV A,R3
\ ??ZDApp_event_loop_7:
\ 000068 70D5 JNZ ??ZDApp_event_loop_6
\ 00006A EE MOV A,R6
\ 00006B FA MOV R2,A
\ 00006C 7480 MOV A,#-0x80
\ ??ZDApp_event_loop_8:
\ 00006E 6F XRL A,R7
\ 00006F 80CA SJMP ??ZDApp_event_loop_4
366
367 #if defined (RTR_NWK)
368 if ( events & ZDO_NETWORK_START )
\ ??ZDApp_event_loop_2:
\ 000071 5402 ANL A,#0x2
\ 000073 600C JZ ??ZDApp_event_loop_9
369 {
370 ZDApp_NetworkStartEvt();
\ 000075 ; Setup parameters for call to function ZDApp_NetworkStartEvt
\ 000075 90.... MOV DPTR,#(ZDApp_NetworkStartEvt & 0xffff)
\ 000078 74.. MOV A,#((ZDApp_NetworkStartEvt >> 16) & 0xff)
\ 00007A 12.... LCALL ?BCALL ; Banked call to: DPTR()
371
372 // Return unprocessed events
373 return (events ^ ZDO_NETWORK_START);
\ 00007D 7402 MOV A,#0x2
\ ??ZDApp_event_loop_10:
\ 00007F 80B7 SJMP ??ZDApp_event_loop_3
374 }
375 #endif //RTR_NWK
376
377 #if defined ( RTR_NWK )
378 if ( events & ZDO_ROUTER_START )
\ ??ZDApp_event_loop_9:
\ 000081 EE MOV A,R6
\ 000082 5420 ANL A,#0x20
\ 000084 6027 JZ ??ZDApp_event_loop_11
379 {
380 if ( nwkStatus == ZSuccess )
\ 000086 90.... MOV DPTR,#nwkStatus
\ 000089 E0 MOVX A,@DPTR
\ 00008A 7015 JNZ ??ZDApp_event_loop_12
381 {
382 if ( devState == DEV_END_DEVICE )
\ 00008C 90.... MOV DPTR,#devState
\ 00008F E0 MOVX A,@DPTR
\ 000090 6406 XRL A,#0x6
\ 000092 7003 JNZ ??ZDApp_event_loop_13
383 devState = DEV_ROUTER;
\ 000094 7407 MOV A,#0x7
\ 000096 F0 MOVX @DPTR,A
384
385 osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
\ ??ZDApp_event_loop_13:
\ 000097 ; Setup parameters for call to function osal_pwrmgr_device
\ 000097 7900 MOV R1,#0x0
\ 000099 90.... MOV DPTR,#(osal_pwrmgr_device & 0xffff)
\ 00009C 74.. MOV A,#((osal_pwrmgr_device >> 16) & 0xff)
\ 00009E 12.... LCALL ?BCALL ; Banked call to: DPTR()
386 }
387 else
388 {
389 // remain as end device!!
390 }
391 osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
\ ??ZDApp_event_loop_12:
\ 0000A1 ; Setup parameters for call to function osal_set_event
\ 0000A1 7A10 MOV R2,#0x10
\ 0000A3 12.... LCALL ?Subroutine9 & 0xFFFF
\ ??CrossCallReturnLabel_82:
\ 0000A6 12.... LCALL ?BCALL ; Banked call to: DPTR()
392
393 // Return unprocessed events
394 return (events ^ ZDO_ROUTER_START);
\ 0000A9 7420 MOV A,#0x20
\ 0000AB 808B SJMP ??ZDApp_event_loop_3
395 }
396 #endif // RTR
397
398 if ( events & ZDO_STATE_CHANGE_EVT )
\ ??ZDApp_event_loop_11:
\ 0000AD EE MOV A,R6
\ 0000AE 5410 ANL A,#0x10
\ 0000B0 6011 JZ ??ZDApp_event_loop_14
399 {
400 ZDO_UpdateNwkStatus( devState );
\ 0000B2 ; Setup parameters for call to function ZDO_UpdateNwkStatus
\ 0000B2 90.... MOV DPTR,#devState
\ 0000B5 E0 MOVX A,@DPTR
\ 0000B6 F9 MOV R1,A
\ 0000B7 90.... MOV DPTR,#(ZDO_UpdateNwkStatus & 0xffff)
\ 0000BA 74.. MOV A,#((ZDO_UpdateNwkStatus >> 16) & 0xff)
\ 0000BC 12.... LCALL ?BCALL ; Banked call to: DPTR()
401
402 // Return unprocessed events
403 return (events ^ ZDO_STATE_CHANGE_EVT);
\ 0000BF 7410 MOV A,#0x10
\ 0000C1 80BC SJMP ??ZDApp_event_loop_10
404 }
405
406 if ( events & ZDO_COMMAND_CNF )
\ ??ZDApp_event_loop_14:
\ 0000C3 EE MOV A,R6
\ 0000C4 5408 ANL A,#0x8
\ 0000C6 6006 JZ ??ZDApp_event_loop_15
407 {
408 // User defined logic
409
410 // Return unprocessed events
411 return (events ^ ZDO_COMMAND_CNF);
\ 0000C8 7408 MOV A,#0x8
\ 0000CA 6E XRL A,R6
\ 0000CB FA MOV R2,A
\ 0000CC 8022 SJMP ??ZDApp_event_loop_5
412 }
413
414 #if defined( ZDSECMGR_SECURE ) && defined( RTR_NWK )
415 if ( events & ZDO_NEW_DEVICE )
416 {
417 // process the new device event
418 if ( ZDSecMgrNewDeviceEvent() == TRUE )
419 {
420 osal_start_timerEx( ZDAppTaskID, ZDO_NEW_DEVICE, 1000 );
421 }
422
423 // Return unprocessed events
424 return (events ^ ZDO_NEW_DEVICE);
425 }
426 #endif // ZDSECMGR_SECURE && RTR
427
428 #if defined ( ZDSECMGR_COMMERCIAL )
429 if ( events & ZDO_SECMGR_EVENT )
430 {
431 ZDSecMgrEvent();
432
433 // Return unprocessed events
434 return (events ^ ZDO_SECMGR_EVENT);
435 }
436 #endif // defined( ZDSECMGR_COMMERCIAL )
437
438 #if ( SECURE != 0 )
439 if ( events & ZDO_DEVICE_AUTH )
440 {
441 ZDApp_DeviceAuthEvt();
442
443 // Return unprocessed events
444 return (events ^ ZDO_DEVICE_AUTH);
445 }
446 #endif // SECURE
447
448 if ( events & ZDO_NWK_UPDATE_NV )
\ ??ZDApp_event_loop_15:
\ 0000CE 7402 MOV A,#0x2
\ 0000D0 5F ANL A,R7
\ 0000D1 F9 MOV R1,A
\ 0000D2 E4 CLR A
\ 0000D3 7001 JNZ ??ZDApp_event_loop_16
\ 0000D5 E9 MOV A,R1
\ ??ZDApp_event_loop_16:
\ 0000D6 6004 JZ ??ZDApp_event_loop_17
449 {
450 ZDApp_SaveNetworkStateEvt();
451
452 // Return unprocessed events
453 return (events ^ ZDO_NWK_UPDATE_NV);
\ 0000D8 7402 MOV A,#0x2
\ 0000DA 8092 SJMP ??ZDApp_event_loop_8
454 }
455
456 #if ( SECURE != 0 )
457 if ( events & ZDO_FRAMECOUNTER_CHANGE )
458 {
459 if ( nwkFrameCounterChanges++ > MAX_NWK_FRAMECOUNTER_CHANGES )
460 ZDApp_SaveNwkKey();
461
462 // Return unprocessed events
463 return (events ^ ZDO_FRAMECOUNTER_CHANGE);
464 }
465 #endif
466
467 if ( events & ZDO_DEVICE_RESET )
\ ??ZDApp_event_loop_17:
\ 0000DC EE MOV A,R6
\ 0000DD 5404 ANL A,#0x4
\ 0000DF 600B JZ ??ZDApp_event_loop_18
468 {
469 // The device has been in the UNAUTH state, so reset
470 // Note: there will be no return from this call
471 SystemReset();
\ 0000E1 C2AF CLR 0xa8.7
\ 0000E3 75C9AB MOV 0xc9,#-0x55
\ 0000E6 75C95B MOV 0xc9,#0x5b
\ ??ZDApp_event_loop_19:
\ 0000E9 00 NOP
\ 0000EA 80FD SJMP ??ZDApp_event_loop_19
472 }
473
474 // Discard or make more handlers
475 return 0;
\ ??ZDApp_event_loop_18:
\ 0000EC 7A00 MOV R2,#0x0
\ 0000EE 7B00 MOV R3,#0x0
\ ??ZDApp_event_loop_5:
\ 0000F0 80.. SJMP ??Subroutine31_1
476 }
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine31:
\ 000000 7402 MOV A,#0x2
\ ??Subroutine31_0:
\ 000002 12.... LCALL ?DEALLOC_XSTACK8
\ ??Subroutine31_1:
\ 000005 7F02 MOV R7,#0x2
\ 000007 02.... LJMP ?BANKED_LEAVE_XDATA
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine9:
\ 000000 7B00 MOV R3,#0x0
\ 000002 90.... MOV DPTR,#ZDAppTaskID
\ 000005 E0 MOVX A,@DPTR
\ 000006 F9 MOV R1,A
\ 000007 90.... MOV DPTR,#(osal_set_event & 0xffff)
\ 00000A 74.. MOV A,#((osal_set_event >> 16) & 0xff)
\ 00000C 22 RET
477
478 /*********************************************************************
479 * Application Functions
480 */
481
482 /*********************************************************************
483 * @fn ZDOInitDevice
484 *
485 * @brief Start the device in the network. This function will read
486 * ZCD_NV_STARTUP_OPTION (NV item) to determine whether or not to
487 * restore the network state of the device.
488 *
489 * @param startDelay - timeDelay to start device (in milliseconds).
490 * There is a jitter added to this delay:
491 * ((NWK_START_DELAY + startDelay)
492 * + (osal_rand() & EXTENDED_JOINING_RANDOM_MASK))
493 *
494 * NOTE: If the application would like to force a "new" join, the
495 * application should set the ZCD_STARTOPT_DEFAULT_NETWORK_STATE
496 * bit in the ZCD_NV_STARTUP_OPTION NV item before calling
497 * this function. "new" join means to not restore the network
498 * state of the device. Use zgWriteStartupOptions() to set these
499 * options.
500 *
501 * @return
502 * ZDO_INITDEV_RESTORED_NETWORK_STATE - The device's network state was
503 * restored.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -