📄 zdapp.lst
字号:
\ 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 6025 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 12.... LCALL ?Subroutine6 & 0xFFFF
\ ??CrossCallReturnLabel_66:
\ 0000A4 12.... LCALL ?BCALL ; Banked call to: DPTR()
392
393 // Return unprocessed events
394 return (events ^ ZDO_ROUTER_START);
\ 0000A7 7420 MOV A,#0x20
\ 0000A9 808D SJMP ??ZDApp_event_loop_3
395 }
396 #endif // RTR
397
398 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
399 {
400 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()
401
402 // Return unprocessed events
403 return (events ^ ZDO_STATE_CHANGE_EVT);
\ 0000BD 7410 MOV A,#0x10
\ 0000BF 80BE SJMP ??ZDApp_event_loop_10
404 }
405
406 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
407 {
408 // User defined logic
409
410 // Return unprocessed events
411 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
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:
\ 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
449 {
450 ZDApp_SaveNetworkStateEvt();
451
452 // Return unprocessed events
453 return (events ^ ZDO_NWK_UPDATE_NV);
\ 0000D6 7402 MOV A,#0x2
\ 0000D8 8094 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:
\ 0000DA EE MOV A,R6
\ 0000DB 5404 ANL A,#0x4
\ 0000DD 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();
\ 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
472 }
473
474 // Discard or make more handlers
475 return 0;
\ ??ZDApp_event_loop_18:
\ 0000EA 7A00 MOV R2,#0x0
\ 0000EC 7B00 MOV R3,#0x0
\ ??ZDApp_event_loop_5:
\ 0000EE 02.... LJMP ??Subroutine26_1 & 0xFFFF
476 }
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine26:
\ 000000 7402 MOV A,#0x2
\ ??Subroutine26_0:
\ 000002 12.... LCALL ?DEALLOC_XSTACK8
\ ??Subroutine26_1:
\ 000005 7F02 MOV R7,#0x2
\ 000007 02.... LJMP ?BANKED_LEAVE_XDATA
\ In segment BANKED_CODE, align 1, keep-with-next
\ ?Subroutine28:
\ 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
\ ?Subroutine6:
\ 000000 7A10 MOV R2,#0x10
\ 000002 02.... LJMP ?Subroutine28 & 0xFFFF
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.
504 * ZDO_INITDEV_NEW_NETWORK_STATE - The network state was initialized.
505 * This could mean that ZCD_NV_STARTUP_OPTION said to not restore, or
506 * it could mean that there was no network state to restore.
507 * ZDO_INITDEV_LEAVE_NOT_STARTED - Before the reset, a network leave was issued
508 * with the rejoin option set to TRUE. So, the device was not
509 * started in the network (one time only). The next time this
510 * function is called it will start.
511 */
\ In segment BANKED_CODE, align 1, keep-with-next
512 uint8 ZDOInitDevice( uint16 startDelay )
\ ZDOInitDevice:
513 {
\ 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -