📄 zdapp.lst
字号:
384 {
385 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
386 devState = DEV_ROUTER;
\ 000094 7407 MOV A,#0x7
\ 000096 F0 MOVX @DPTR,A
387
388 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()
389 }
390 else
391 {
392 // remain as end device!!
393 }
394 osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
\ ??ZDApp_event_loop_12:
\ 0000A1 ; Setup parameters for call to function osal_set_event
\ 0000A1 12.... LCALL ?Subroutine7 & 0xFFFF
\ ??CrossCallReturnLabel_70:
\ 0000A4 12.... LCALL ?BCALL ; Banked call to: DPTR()
395
396 // Return unprocessed events
397 return (events ^ ZDO_ROUTER_START);
\ 0000A7 7420 MOV A,#0x20
\ 0000A9 808D SJMP ??ZDApp_event_loop_3
398 }
399 #endif // RTR
400
401 if ( events & ZDO_STATE_CHANGE_EVT )
\ ??ZDApp_event_loop_11:
\ 0000AB EE MOV A,R6
\ 0000AC 5410 ANL A,#0x10
\ 0000AE 6011 JZ ??ZDApp_event_loop_14
402 {
403 ZDO_UpdateNwkStatus( devState );
\ 0000B0 ; Setup parameters for call to function ZDO_UpdateNwkStatus
\ 0000B0 90.... MOV DPTR,#devState
\ 0000B3 E0 MOVX A,@DPTR
\ 0000B4 F9 MOV R1,A
\ 0000B5 90.... MOV DPTR,#(ZDO_UpdateNwkStatus & 0xffff)
\ 0000B8 74.. MOV A,#((ZDO_UpdateNwkStatus >> 16) & 0xff)
\ 0000BA 12.... LCALL ?BCALL ; Banked call to: DPTR()
404
405 // Return unprocessed events
406 return (events ^ ZDO_STATE_CHANGE_EVT);
\ 0000BD 7410 MOV A,#0x10
\ 0000BF 80BE SJMP ??ZDApp_event_loop_10
407 }
408
409 if ( events & ZDO_COMMAND_CNF )
\ ??ZDApp_event_loop_14:
\ 0000C1 EE MOV A,R6
\ 0000C2 5408 ANL A,#0x8
\ 0000C4 6006 JZ ??ZDApp_event_loop_15
410 {
411 // User defined logic
412
413 // Return unprocessed events
414 return (events ^ ZDO_COMMAND_CNF);
\ 0000C6 7408 MOV A,#0x8
\ 0000C8 6E XRL A,R6
\ 0000C9 FA MOV R2,A
\ 0000CA 8022 SJMP ??ZDApp_event_loop_5
415 }
416
417 #if defined( ZDSECMGR_SECURE ) && defined( RTR_NWK )
418 if ( events & ZDO_NEW_DEVICE )
419 {
420 // process the new device event
421 if ( ZDSecMgrNewDeviceEvent() == TRUE )
422 {
423 osal_start_timerEx( ZDAppTaskID, ZDO_NEW_DEVICE, 1000 );
424 }
425
426 // Return unprocessed events
427 return (events ^ ZDO_NEW_DEVICE);
428 }
429 #endif // ZDSECMGR_SECURE && RTR
430
431 #if defined ( ZDSECMGR_COMMERCIAL )
432 if ( events & ZDO_SECMGR_EVENT )
433 {
434 ZDSecMgrEvent();
435
436 // Return unprocessed events
437 return (events ^ ZDO_SECMGR_EVENT);
438 }
439 #endif // defined( ZDSECMGR_COMMERCIAL )
440
441 #if ( SECURE != 0 )
442 if ( events & ZDO_DEVICE_AUTH )
443 {
444 ZDApp_DeviceAuthEvt();
445
446 // Return unprocessed events
447 return (events ^ ZDO_DEVICE_AUTH);
448 }
449 #endif // SECURE
450
451 if ( events & ZDO_NWK_UPDATE_NV )
\ ??ZDApp_event_loop_15:
\ 0000CC 7402 MOV A,#0x2
\ 0000CE 5F ANL A,R7
\ 0000CF F9 MOV R1,A
\ 0000D0 E4 CLR A
\ 0000D1 7001 JNZ ??ZDApp_event_loop_16
\ 0000D3 E9 MOV A,R1
\ ??ZDApp_event_loop_16:
\ 0000D4 6004 JZ ??ZDApp_event_loop_17
452 {
453 ZDApp_SaveNetworkStateEvt();
454
455 // Return unprocessed events
456 return (events ^ ZDO_NWK_UPDATE_NV);
\ 0000D6 7402 MOV A,#0x2
\ 0000D8 8094 SJMP ??ZDApp_event_loop_8
457 }
458
459 #if ( SECURE != 0 )
460 if ( events & ZDO_FRAMECOUNTER_CHANGE )
461 {
462 if ( nwkFrameCounterChanges++ > MAX_NWK_FRAMECOUNTER_CHANGES )
463 ZDApp_SaveNwkKey();
464
465 // Return unprocessed events
466 return (events ^ ZDO_FRAMECOUNTER_CHANGE);
467 }
468 #endif
469
470 if ( events & ZDO_DEVICE_RESET )
\ ??ZDApp_event_loop_17:
\ 0000DA EE MOV A,R6
\ 0000DB 5404 ANL A,#0x4
\ 0000DD 600B JZ ??ZDApp_event_loop_18
471 {
472 // The device has been in the UNAUTH state, so reset
473 // Note: there will be no return from this call
474 SystemReset();
\ 0000DF C2AF CLR 0xa8.7
\ 0000E1 75C9AB MOV 0xc9,#-0x55
\ 0000E4 75C95B MOV 0xc9,#0x5b
\ ??ZDApp_event_loop_19:
\ 0000E7 00 NOP
\ 0000E8 80FD SJMP ??ZDApp_event_loop_19
475 }
476
477 // Discard or make more handlers
478 return 0;
\ ??ZDApp_event_loop_18:
\ 0000EA 7A00 MOV R2,#0x0
\ 0000EC 7B00 MOV R3,#0x0
\ ??ZDApp_event_loop_5:
\ 0000EE 02.... LJMP ??Subroutine28_1 & 0xFFFF
479 }
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine28:
\ 000000 7402 MOV A,#0x2
\ ??Subroutine28_0:
\ 000002 12.... LCALL ?DEALLOC_XSTACK8
\ ??Subroutine28_1:
\ 000005 7F02 MOV R7,#0x2
\ 000007 02.... LJMP ?BANKED_LEAVE_XDATA
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine30:
\ 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
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine7:
\ 000000 7A10 MOV R2,#0x10
\ 000002 02.... LJMP ?Subroutine30 & 0xFFFF
480
481 /*********************************************************************
482 * Application Functions
483 */
484
485 /*********************************************************************
486 * @fn ZDOInitDevice
487 *
488 * @brief Start the device in the network. This function will read
489 * ZCD_NV_STARTUP_OPTION (NV item) to determine whether or not to
490 * restore the network state of the device.
491 *
492 * @param startDelay - timeDelay to start device (in milliseconds).
493 * There is a jitter added to this delay:
494 * ((NWK_START_DELAY + startDelay)
495 * + (osal_rand() & EXTENDED_JOINING_RANDOM_MASK))
496 *
497 * NOTE: If the application would like to force a "new" join, the
498 * application should set the ZCD_STARTOPT_DEFAULT_NETWORK_STATE
499 * bit in the ZCD_NV_STARTUP_OPTION NV item before calling
500 * this function. "new" join means to not restore the network
501 * state of the device. Use zgWriteStartupOptions() to set these
502 * options.
503 *
504 * @return
505 * ZDO_INITDEV_RESTORED_NETWORK_STATE - The device's network state was
506 * restored.
507 * ZDO_INITDEV_NEW_NETWORK_STATE - The network state was initialized.
508 * This could mean that ZCD_NV_STARTUP_OPTION said to not restore, or
509 * it could mean that there was no network state to restore.
510 * ZDO_INITDEV_LEAVE_NOT_STARTED - Before the reset, a network leave was issued
511 * with the rejoin option set to TRUE. So, the device was not
512 * started in the network (one time only). The next time this
513 * function is called it will start.
514 */
\ In segment BANKED_CODE, align 1, keep-with-next
515 uint8 ZDOInitDevice( uint16 startDelay )
\ ZDOInitDevice:
516 {
\ 000000 74F6 MOV A,#-0xa
\ 000002 12.... LCALL ?BANKED_ENTER_XDATA
\ 000005 ; Saved register size: 10
\ 000005 ; Auto size: 2
\ 000005 74FE MOV A,#-0x2
\ 000007 12.... LCALL ?ALLOC_XSTACK8
\ 00000A 85..82 MOV DPL,?XSP + 0
\ 00000D 85..83 MOV DPH,?XSP + 1
\ 000010 EA MOV A,R2
\ 000011 F0 MOVX @DPTR,A
\ 000012 A3 INC DPTR
\ 000013 EB MOV A,R3
\ 000014 F0 MOVX @DPTR,A
517 uint8 networkStateNV = ZDO_INITDEV_NEW_NETWORK_STATE;
518 uint16 extendedDelay = 0;
519
520 devState = DEV_INIT; // Remove the Hold state
\ 000015 7401 MOV A,#0x1
\ 000017 90.... MOV DPTR,#devState
\ 00001A F0 MOVX @DPTR,A
521
522 // Initialize leave control logic
523 ZDApp_LeaveCtrlInit();
\ 00001B ; Setup parameters for call to function ZDApp_LeaveCtrlInit
\ 00001B 90.... MOV DPTR,#(ZDApp_LeaveCtrlInit & 0xffff)
\ 00001E 74.. MOV A,#((ZDApp_LeaveCtrlInit >> 16) & 0xff)
\ 000020 12.... LCALL ?BCALL ; Banked call to: DPTR()
524
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -