⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zdapp.lst

📁 CC2431无线定位程序非常有参考价值
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   000067   70D5         JNZ     ??ZDApp_event_loop_6
   \   000069   EE           MOV     A,R6
   \   00006A   FA           MOV     R2,A
   \   00006B   7480         MOV     A,#-0x80
   \                     ??ZDApp_event_loop_8:
   \   00006D   6F           XRL     A,R7
   \   00006E   80CB         SJMP    ??ZDApp_event_loop_4
    366          
    367          #if defined (RTR_NWK)
    368            if ( events & ZDO_NETWORK_START )
    369            {
    370              ZDApp_NetworkStartEvt();
    371          
    372              // Return unprocessed events
    373              return (events ^ ZDO_NETWORK_START);
    374            }
    375          #endif  //RTR_NWK
    376          
    377          #if defined ( RTR_NWK )
    378            if ( events & ZDO_ROUTER_START )
    379            {
    380              if ( nwkStatus == ZSuccess )
    381              {
    382                if ( devState == DEV_END_DEVICE )
    383                  devState = DEV_ROUTER;
    384          
    385                osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
    386              }
    387              else
    388              {
    389                // remain as end device!!
    390              }
    391              osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
    392          
    393              // Return unprocessed events
    394              return (events ^ ZDO_ROUTER_START);
    395            }
    396          #endif  // RTR
    397          
    398            if ( events & ZDO_STATE_CHANGE_EVT )
   \                     ??ZDApp_event_loop_2:
   \   000070   5410         ANL     A,#0x10
   \   000072   6011         JZ      ??ZDApp_event_loop_9
    399            {
    400              ZDO_UpdateNwkStatus( devState );
   \   000074                ; Setup parameters for call to function ZDO_UpdateNwkStatus
   \   000074   90....       MOV     DPTR,#devState
   \   000077   E0           MOVX    A,@DPTR
   \   000078   F9           MOV     R1,A
   \   000079   90....       MOV     DPTR,#(ZDO_UpdateNwkStatus & 0xffff)
   \   00007C   74..         MOV     A,#((ZDO_UpdateNwkStatus >> 16) & 0xff)
   \   00007E   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    401          
    402              // Return unprocessed events
    403              return (events ^ ZDO_STATE_CHANGE_EVT);
   \   000081   7410         MOV     A,#0x10
   \   000083   80B3         SJMP    ??ZDApp_event_loop_3
    404            }
    405          
    406            if ( events & ZDO_COMMAND_CNF )
   \                     ??ZDApp_event_loop_9:
   \   000085   EE           MOV     A,R6
   \   000086   5408         ANL     A,#0x8
   \   000088   6006         JZ      ??ZDApp_event_loop_10
    407            {
    408              // User defined logic
    409          
    410              // Return unprocessed events
    411              return (events ^ ZDO_COMMAND_CNF);
   \   00008A   7408         MOV     A,#0x8
   \   00008C   6E           XRL     A,R6
   \   00008D   FA           MOV     R2,A
   \   00008E   802C         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_10:
   \   000090   7402         MOV     A,#0x2
   \   000092   5F           ANL     A,R7
   \   000093   F9           MOV     R1,A
   \   000094   E4           CLR     A
   \   000095   7001         JNZ     ??ZDApp_event_loop_11
   \   000097   E9           MOV     A,R1
   \                     ??ZDApp_event_loop_11:
   \   000098   600E         JZ      ??ZDApp_event_loop_12
    449            {
    450              ZDApp_SaveNetworkStateEvt();
   \   00009A                ; Setup parameters for call to function ZDApp_SaveNetworkStateEvt
   \   00009A   90....       MOV     DPTR,#(ZDApp_SaveNetworkStateEvt & 0xffff)
   \   00009D   74..         MOV     A,#((ZDApp_SaveNetworkStateEvt >> 16) & 0xff)
   \   00009F   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    451          
    452              // Return unprocessed events
    453              return (events ^ ZDO_NWK_UPDATE_NV);
   \   0000A2   EE           MOV     A,R6
   \   0000A3   FA           MOV     R2,A
   \   0000A4   7402         MOV     A,#0x2
   \   0000A6   80C5         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_12:
   \   0000A8   EE           MOV     A,R6
   \   0000A9   5404         ANL     A,#0x4
   \   0000AB   600B         JZ      ??ZDApp_event_loop_13
    468            {
    469              // The device has been in the UNAUTH state, so reset
    470              // Note: there will be no return from this call
    471              SystemReset();
   \   0000AD   C2AF         CLR     0xa8.7
   \   0000AF   75C9AB       MOV     0xc9,#-0x55
   \   0000B2   75C95B       MOV     0xc9,#0x5b
   \                     ??ZDApp_event_loop_14:
   \   0000B5   00           NOP
   \   0000B6   80FD         SJMP    ??ZDApp_event_loop_14
    472            }
    473          
    474            // Discard or make more handlers
    475            return 0;
   \                     ??ZDApp_event_loop_13:
   \   0000B8   7A00         MOV     R2,#0x0
   \   0000BA   7B00         MOV     R3,#0x0
   \                     ??ZDApp_event_loop_5:
   \   0000BC   02....       LJMP    ??Subroutine24_0 & 0xFFFF
    476          }

   \                                 In segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine24:
   \   000000   12....       LCALL   ?DEALLOC_XSTACK8
   \                     ??Subroutine24_0:
   \   000003   7F02         MOV     R7,#0x2
   \   000005   02....       LJMP    ?BANKED_LEAVE_XDATA
    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   74F4         MOV     A,#-0xc
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 12
   \   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
    514            uint8 networkStateNV = ZDO_INITDEV_NEW_NETWORK_STATE;
    515            uint16 extendedDelay = 0;
   \   000015   7E00         MOV     R6,#0x0
   \   000017   7F00         MOV     R7,#0x0
    516          
    517            devState = DEV_INIT;    // Remove the Hold state
   \   000019   7401         MOV     A,#0x1
   \   00001B   90....       MOV     DPTR,#devState
   \   00001E   F0           MOVX    @DPTR,A
    518          
    519            // Initialize leave control logic
    520            ZDApp_LeaveCtrlInit();
   \   00001F                ; Setup parameters for call to function ZDApp_LeaveCtrlInit
   \   00001F   90....       MOV     DPTR,#(ZDApp_LeaveCtrlInit & 0xffff)
   \   000022   74..         MOV     A,#((ZDApp_LeaveCtrlInit >> 16) & 0xff)
   \   000024   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    521          
    522            // Check leave control reset settings

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -