///////////////////////////////////////////////////////////////////////////////
//                                                                            /
// IAR 8051 C/C++ Compiler V7.30B/W32                   12/Sep/2010  21:57:33 /
// Copyright 2004-2007 IAR Systems. All rights reserved.                      /
//                                                                            /
//    Core               =  plain                                             /
//    Code model         =  banked                                            /
//    Data model         =  large                                             /
//    Calling convention =  xdata reentrant                                   /
//    Constant location  =  data                                              /
//    Dptr setup         =  1,16                                              /
//    Source file        =  C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Compon /
//                          ents\stack\zdo\ZDApp.c                            /
//    Command line       =  -f "C:\Texas Instruments                          /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\Tools\CC2430DB\f8wRouter. /
//                          cfg" (-DCPU32MHZ -DFORCE_MAC_NEAR                 /
//                          -DROOT=__near_func -DMAC_CFG_APP_PENDING_QUEUE=TR /
//                          UE -DRTR_NWK -DBLINK_LEDS "-DCONST=const __code"  /
//                          -DGENERIC=__generic) -f "C:\Texas Instruments     /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\Tools\CC2430DB\f8wConfig. /
//                          cfg" (-DSECURE=1 -DDEFAULT_CHANLIST=0x04000000    /
//                          -DZDAPP_CONFIG_PAN_ID=0x00FF                      /
//                          -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_M /
//                          ASK=0x007F -DBEACON_REQUEST_DELAY=100             /
//                          -DBEACON_REQ_DELAY_MASK=0x00FF                    /
//                          -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_P /
//                          OLLED=3000 -DNWK_INDIRECT_MSG_TIMEOUT=7           /
//                          -DMAX_RREQ_ENTRIES=10 -DAPSC_MAX_FRAME_RETRIES=3  /
//                          -DNWK_MAX_DATA_RETRIES=2                          /
//                          -DMAX_POLL_FAILURE_RETRIES=2 -DMAX_BCAST=9        /
//                          -DAPS_MAX_GROUPS=16 -DMAX_RTG_ENTRIES=20          /
//                          -DNWK_MAX_BINDING_ENTRIES=10                      /
//                          -DMAX_BINDING_CLUSTER_IDS=5                       /
//                          "-DDEFAULT_KEY={0x02, 0x03, 0x05, 0x07, 0x09,     /
//                          0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08,   /
//                          0x0A, 0x0C, 0x0D}" -DRFD_RCVC_ALWAYS_ON=FALSE     /
//                          -DPOLL_RATE=1000 -DQUEUED_POLL_RATE=100           /
//                          -DRESPONSE_POLL_RATE=100) -DREJOIN_POLL_RATE=440  /
//                          "C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Compo /
//                          nents\stack\zdo\ZDApp.c" -D CC2430EB -D           /
//                          LOCATION_REFNODE -D xNV_RESTORE -D ZTOOL_P1 -D    /
//                          MT_TASK -D POWER_SAVING -D HAL_UART_BIG_TX_BUF=1  /
//                          -D SPI_MGR_DEFAULT_MAX_TX_BUFF=1024 -D            /
//                          SPI_MGR_DEFAULT_OVERFLOW=1 -lC "C:\Texas          /
//                          Instruments 33\ZStack-1.4.3-1.2.1\Projects\zstack /
//                          \Project\Location\CC2430DB\RefNode\List\" -lA     /
//                          "C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Proje /
//                          cts\zstack\Project\Location\CC2430DB\RefNode\List /
//                          \" --diag_suppress Pe001,Pa010 --diag_remark      /
//                          pe550 -o "C:\Texas Instruments                    /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\RefNode\Obj\" -e                   /
//                          --require_prototypes -z9 --no_code_motion         /
//                          --debug --core=plain --dptr=16,1                  /
//                          --data_model=large --code_model=banked            /
//                          --calling_convention=xdata_reentrant              /
//                          --place_constants=data --nr_virtual_regs 8 -I     /
//                          "C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Proje /
//                          cts\zstack\Project\Location\CC2430DB\" -I         /
//                          "C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Proje /
//                          cts\zstack\Project\Location\CC2430DB\..\SOURCE\"  /
//                          -I "C:\Texas Instruments                          /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\ZMAIN\TI2430DB\" -I       /
//                          "C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Proje /
//                          cts\zstack\Project\Location\CC2430DB\..\..\..\..\ /
//                          ..\COMPONENTS\MT\" -I "C:\Texas Instruments       /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\HAL\INCL /
//                          UDE\" -I "C:\Texas Instruments                    /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\HAL\TARG /
//                          ET\CC2430BB\" -I "C:\Texas Instruments            /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\OSAL\MCU /
//                          \CCSOC\" -I "C:\Texas Instruments                 /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\OSAL\INC /
//                          LUDE\" -I "C:\Texas Instruments                   /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\STACK\AF /
//                          \" -I "C:\Texas Instruments                       /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\STACK\NW /
//                          K\" -I "C:\Texas Instruments                      /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\STACK\SE /
//                          C\" -I "C:\Texas Instruments                      /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\STACK\SY /
//                          S\" -I "C:\Texas Instruments                      /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\STACK\ZD /
//                          O\" -I "C:\Texas Instruments                      /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\ZMAC\F8W /
//                          \" -I "C:\Texas Instruments                       /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\ZMAC\"   /
//                          -I "C:\Texas Instruments                          /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\SERVICES /
//                          \SADDR\" -I "C:\Texas Instruments                 /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\SERVICES /
//                          \SDATA\" -I "C:\Texas Instruments                 /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\MAC\INCL /
//                          UDE\" -I "C:\Texas Instruments                    /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\MAC\HIGH /
//                          _LEVEL\" -I "C:\Texas Instruments                 /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\MAC\LOW_ /
//                          LEVEL\SRF03\" -I "C:\Texas Instruments            /
//                          33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Loc /
//                          ation\CC2430DB\..\..\..\..\..\COMPONENTS\MAC\LOW_ /
//                          LEVEL\SRF03\SINGLE_CHIP\" -I "C:\Program          /
//                          Files\IAR Systems\Embedded Workbench 4.0          /
//                          Evaluation version\8051\INC\" -I "C:\Program      /
//                          Files\IAR Systems\Embedded Workbench 4.0          /
//                          Evaluation version\8051\INC\CLIB\"                /
//    List file          =  C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Projec /
//                          ts\zstack\Project\Location\CC2430DB\RefNode\List\ /
//                          ZDApp.s51                                         /
//                                                                            /
//                                                                            /
///////////////////////////////////////////////////////////////////////////////

        NAME ZDApp

        RTMODEL "__calling_convention", "xdata_reentrant"
        RTMODEL "__code_model", "banked"
        RTMODEL "__core", "plain"
        RTMODEL "__data_model", "large"
        RTMODEL "__dptr_size", "16"
        RTMODEL "__extended_stack", "disabled"
        RTMODEL "__location_for_constants", "data"
        RTMODEL "__number_of_dptrs", "1"
        RTMODEL "__rt_version", "1"

        RSEG DOVERLAY:DATA:NOROOT(0)
        RSEG IOVERLAY:IDATA:NOROOT(0)
        RSEG ISTACK:IDATA:NOROOT(0)
        RSEG PSTACK:XDATA:NOROOT(0)
        RSEG XSTACK:XDATA:NOROOT(0)

        EXTERN ??ZDAppCheckForHoldKey?relay
        EXTERN ??ZDApp_DeviceAuthEvt?relay
        EXTERN ??ZDApp_LeaveCtrlInit?relay
        EXTERN ??ZDApp_LeaveCtrlSet?relay
        EXTERN ??ZDApp_LeaveCtrlStartup?relay
        EXTERN ??ZDApp_LeaveReset?relay
        EXTERN ??ZDApp_NVUpdate?relay
        EXTERN ??ZDApp_NetworkInit?relay
        EXTERN ??ZDApp_NetworkStartEvt?relay
        EXTERN ??ZDApp_NodeProfileSync?relay
        EXTERN ??ZDApp_ProcessNetworkJoin?relay
        EXTERN ??ZDApp_ProcessOSALMsg?relay
        EXTERN ??ZDApp_ResetTimerCancel?relay
        EXTERN ??ZDApp_ResetTimerStart?relay
        EXTERN ??ZDApp_RestoreNwkKey?relay
        EXTERN ??ZDApp_SaveNwkKey?relay
        EXTERN ??ZDApp_SecInit?relay
        EXTERN ??ZDApp_SendMsg?relay
        EXTERN ??ZDOInitDevice?relay
        EXTERN ?ALLOC_XSTACK8
        EXTERN ?BANKED_ENTER_XDATA
        EXTERN ?BANKED_LEAVE_XDATA
        EXTERN ?BDISPATCH
        EXTERN ?BRET
        EXTERN ?DEALLOC_XSTACK8
        EXTERN ?L_ADD_TO_X
        EXTERN ?L_ADD_X
        EXTERN ?L_EQ_X
        EXTERN ?L_MOV_TO_X
        EXTERN ?L_MOV_X
        EXTERN ?PUSH_XSTACK_I_ONE
        EXTERN ?PUSH_XSTACK_I_THREE
        EXTERN ?PUSH_XSTACK_I_TWO
        EXTERN ?UC_SWITCH_SPARSE
        EXTERN ?V0
        EXTERN ?XSP
        EXTERN ?XSTACK_DISP0_8
        EXTERN __INIT_XDATA_I
        EXTERN __INIT_XDATA_Z

        PUBLIC ??AddrMgrWriteNVRequest?relay
        FUNCTION ??AddrMgrWriteNVRequest?relay,0203H
        PUBLIC ??ZDAppCheckForHoldKey?relay
        FUNCTION ??ZDAppCheckForHoldKey?relay,0203H
        PUBLIC ??ZDAppDetermineDeviceType?relay
        FUNCTION ??ZDAppDetermineDeviceType?relay,0203H
        PUBLIC ??ZDApp_ChangeMatchDescRespPermission?relay
        FUNCTION ??ZDApp_ChangeMatchDescRespPermission?relay,0203H
        PUBLIC ??ZDApp_CoordStartPANIDConflictCB?relay
        FUNCTION ??ZDApp_CoordStartPANIDConflictCB?relay,0203H
        PUBLIC ??ZDApp_DeviceAuthEvt?relay
        FUNCTION ??ZDApp_DeviceAuthEvt?relay,0203H
        PUBLIC ??ZDApp_InMsgCB?relay
        FUNCTION ??ZDApp_InMsgCB?relay,0203H
        PUBLIC ??ZDApp_Init?relay
        FUNCTION ??ZDApp_Init?relay,0203H
        PUBLIC ??ZDApp_InitUserDesc?relay
        FUNCTION ??ZDApp_InitUserDesc?relay,0203H
        PUBLIC ??ZDApp_LeaveCtrlBypass?relay
        FUNCTION ??ZDApp_LeaveCtrlBypass?relay,0203H
        PUBLIC ??ZDApp_LeaveCtrlInit?relay
        FUNCTION ??ZDApp_LeaveCtrlInit?relay,0203H
        PUBLIC ??ZDApp_LeaveCtrlSet?relay
        FUNCTION ??ZDApp_LeaveCtrlSet?relay,0203H
        PUBLIC ??ZDApp_LeaveCtrlStartup?relay
        FUNCTION ??ZDApp_LeaveCtrlStartup?relay,0203H
        PUBLIC ??ZDApp_LeaveReset?relay
        FUNCTION ??ZDApp_LeaveReset?relay,0203H
        PUBLIC ??ZDApp_LeaveUpdate?relay
        FUNCTION ??ZDApp_LeaveUpdate?relay,0203H
        PUBLIC ??ZDApp_NVUpdate?relay
        FUNCTION ??ZDApp_NVUpdate?relay,0203H
        PUBLIC ??ZDApp_NetworkInit?relay
        FUNCTION ??ZDApp_NetworkInit?relay,0203H
        PUBLIC ??ZDApp_NetworkStartEvt?relay
        FUNCTION ??ZDApp_NetworkStartEvt?relay,0203H
        PUBLIC ??ZDApp_NodeProfileSync?relay
        FUNCTION ??ZDApp_NodeProfileSync?relay,0203H
        PUBLIC ??ZDApp_ProcessMsgCBs?relay
        FUNCTION ??ZDApp_ProcessMsgCBs?relay,0203H
        PUBLIC ??ZDApp_ProcessNetworkJoin?relay
        FUNCTION ??ZDApp_ProcessNetworkJoin?relay,0203H
        PUBLIC ??ZDApp_ProcessOSALMsg?relay
        FUNCTION ??ZDApp_ProcessOSALMsg?relay,0203H
        PUBLIC ??ZDApp_ReadNetworkRestoreState?relay
        FUNCTION ??ZDApp_ReadNetworkRestoreState?relay,0203H
        PUBLIC ??ZDApp_RegisterCBs?relay
        FUNCTION ??ZDApp_RegisterCBs?relay,0203H
        PUBLIC ??ZDApp_ResetNwkKey?relay
        FUNCTION ??ZDApp_ResetNwkKey?relay,0203H
        PUBLIC ??ZDApp_ResetTimerCancel?relay
        FUNCTION ??ZDApp_ResetTimerCancel?relay,0203H
        PUBLIC ??ZDApp_ResetTimerStart?relay
        FUNCTION ??ZDApp_ResetTimerStart?relay,0203H
        PUBLIC ??ZDApp_RestoreNetworkState?relay
        FUNCTION ??ZDApp_RestoreNetworkState?relay,0203H
        PUBLIC ??ZDApp_RestoreNwkKey?relay
        FUNCTION ??ZDApp_RestoreNwkKey?relay,0203H
        PUBLIC ??ZDApp_SaveNetworkStateEvt?relay
        FUNCTION ??ZDApp_SaveNetworkStateEvt?relay,0203H
        PUBLIC ??ZDApp_SaveNwkKey?relay
        FUNCTION ??ZDApp_SaveNwkKey?relay,0203H
        PUBLIC ??ZDApp_SecInit?relay
        FUNCTION ??ZDApp_SecInit?relay,0203H
        PUBLIC ??ZDApp_SendEventMsg?relay
        FUNCTION ??ZDApp_SendEventMsg?relay,0203H
        PUBLIC ??ZDApp_SendMsg?relay
        FUNCTION ??ZDApp_SendMsg?relay,0203H
        PUBLIC ??ZDApp_StartJoiningCycle?relay
        FUNCTION ??ZDApp_StartJoiningCycle?relay,0203H
        PUBLIC ??ZDApp_StartUpFromApp?relay
        FUNCTION ??ZDApp_StartUpFromApp?relay,0203H
        PUBLIC ??ZDApp_StopJoiningCycle?relay
        FUNCTION ??ZDApp_StopJoiningCycle?relay,0203H
        PUBLIC ??ZDApp_StopStartUp?relay
        FUNCTION ??ZDApp_StopStartUp?relay,0203H
        PUBLIC ??ZDApp_event_loop?relay
        FUNCTION ??ZDApp_event_loop?relay,0203H
        PUBLIC ??ZDOInitDevice?relay
        FUNCTION ??ZDOInitDevice?relay,0203H
        PUBLIC ??ZDO_JoinConfirmCB?relay
        FUNCTION ??ZDO_JoinConfirmCB?relay,0203H
        PUBLIC ??ZDO_JoinIndicationCB?relay
        FUNCTION ??ZDO_JoinIndicationCB?relay,0203H
        PUBLIC ??ZDO_LeaveCnf?relay
        FUNCTION ??ZDO_LeaveCnf?relay,0203H
        PUBLIC ??ZDO_LeaveInd?relay
        FUNCTION ??ZDO_LeaveInd?relay,0203H
        PUBLIC ??ZDO_NetworkDiscoveryConfirmCB?relay
        FUNCTION ??ZDO_NetworkDiscoveryConfirmCB?relay,0203H
        PUBLIC ??ZDO_NetworkFormationConfirmCB?relay
        FUNCTION ??ZDO_NetworkFormationConfirmCB?relay,0203H
        PUBLIC ??ZDO_PollConfirmCB?relay
        FUNCTION ??ZDO_PollConfirmCB?relay,0203H
        PUBLIC ??ZDO_StartRouterConfirmCB?relay
        FUNCTION ??ZDO_StartRouterConfirmCB?relay,0203H
        PUBLIC ??ZDO_SyncIndicationCB?relay
        FUNCTION ??ZDO_SyncIndicationCB?relay,0203H
        PUBLIC AddrMgrWriteNVRequest
        FUNCTION AddrMgrWriteNVRequest,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        PUBWEAK WDCTL
        PUBLIC ZDAppCheckForHoldKey
        FUNCTION ZDAppCheckForHoldKey,021203H
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDAppDetermineDeviceType
        FUNCTION ZDAppDetermineDeviceType,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDAppNwkAddr
        PUBLIC ZDAppTaskID
        PUBLIC ZDApp_AutoFindMode_epDesc
        PUBLIC ZDApp_ChangeMatchDescRespPermission
        FUNCTION ZDApp_ChangeMatchDescRespPermission,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_CoordStartPANIDConflictCB
        FUNCTION ZDApp_CoordStartPANIDConflictCB,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDApp_DeviceAuthEvt
        FUNCTION ZDApp_DeviceAuthEvt,021203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_InMsgCB
        FUNCTION ZDApp_InMsgCB,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        PUBLIC ZDApp_Init
        FUNCTION ZDApp_Init,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME XSTACK, 1, STACK
        PUBLIC ZDApp_InitUserDesc
        FUNCTION ZDApp_InitUserDesc,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        PUBLIC ZDApp_LeaveCtrl
        PUBLIC ZDApp_LeaveCtrlBypass
        FUNCTION ZDApp_LeaveCtrlBypass,0203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_LeaveCtrlInit
        FUNCTION ZDApp_LeaveCtrlInit,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 14, STACK
        PUBLIC ZDApp_LeaveCtrlSet
        FUNCTION ZDApp_LeaveCtrlSet,021203H
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 14, STACK
        PUBLIC ZDApp_LeaveCtrlStartup
        FUNCTION ZDApp_LeaveCtrlStartup,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 1, STACK
        LOCFRAME XSTACK, 14, STACK
        PUBLIC ZDApp_LeaveReset
        FUNCTION ZDApp_LeaveReset,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_LeaveUpdate
        FUNCTION ZDApp_LeaveUpdate,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_NVUpdate
        FUNCTION ZDApp_NVUpdate,021203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_NetworkInit
        FUNCTION ZDApp_NetworkInit,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_NetworkStartEvt
        FUNCTION ZDApp_NetworkStartEvt,021203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_NodeProfileSync
        FUNCTION ZDApp_NodeProfileSync,021203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 10, STACK
        PUBLIC ZDApp_ProcessMsgCBs
        FUNCTION ZDApp_ProcessMsgCBs,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDApp_ProcessNetworkJoin
        FUNCTION ZDApp_ProcessNetworkJoin,021203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 12, STACK
        PUBLIC ZDApp_ProcessOSALMsg
        FUNCTION ZDApp_ProcessOSALMsg,0a1203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 11, STACK
        PUBLIC ZDApp_ReadNetworkRestoreState
        FUNCTION ZDApp_ReadNetworkRestoreState,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        PUBLIC ZDApp_RegisterCBs
        FUNCTION ZDApp_RegisterCBs,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDApp_ResetNwkKey
        FUNCTION ZDApp_ResetNwkKey,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 35, STACK
        PUBLIC ZDApp_ResetTimerCancel
        FUNCTION ZDApp_ResetTimerCancel,021203H
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_ResetTimerStart
        FUNCTION ZDApp_ResetTimerStart,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_RestoreNetworkState
        FUNCTION ZDApp_RestoreNetworkState,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 33, STACK
        PUBLIC ZDApp_RestoreNwkKey
        FUNCTION ZDApp_RestoreNwkKey,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME XSTACK, 37, STACK
        PUBLIC ZDApp_SaveNetworkStateEvt
        FUNCTION ZDApp_SaveNetworkStateEvt,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDApp_SaveNwkKey
        FUNCTION ZDApp_SaveNwkKey,021203H
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 37, STACK
        PUBLIC ZDApp_SecInit
        FUNCTION ZDApp_SecInit,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 12, STACK
        PUBLIC ZDApp_SendEventMsg
        FUNCTION ZDApp_SendEventMsg,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_SendMsg
        FUNCTION ZDApp_SendMsg,021203H
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 1, STACK
        LOCFRAME XSTACK, 19, STACK
        PUBLIC ZDApp_StartJoiningCycle
        FUNCTION ZDApp_StartJoiningCycle,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_StartUpFromApp
        FUNCTION ZDApp_StartUpFromApp,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_StopJoiningCycle
        FUNCTION ZDApp_StopJoiningCycle,0203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDApp_StopStartUp
        FUNCTION ZDApp_StopStartUp,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDApp_epDesc
        PUBLIC ZDApp_event_loop
        FUNCTION ZDApp_event_loop,0a1203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        PUBLIC ZDOInitDevice
        FUNCTION ZDOInitDevice,021203H
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME XSTACK, 12, STACK
        PUBLIC ZDO_JoinConfirmCB
        FUNCTION ZDO_JoinConfirmCB,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDO_JoinIndicationCB
        FUNCTION ZDO_JoinIndicationCB,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDO_LeaveCnf
        FUNCTION ZDO_LeaveCnf,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        PUBLIC ZDO_LeaveInd
        FUNCTION ZDO_LeaveInd,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 1, STACK
        LOCFRAME XSTACK, 12, STACK
        PUBLIC ZDO_NetworkDiscoveryConfirmCB
        FUNCTION ZDO_NetworkDiscoveryConfirmCB,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME XSTACK, 24, STACK
        PUBLIC ZDO_NetworkFormationConfirmCB
        FUNCTION ZDO_NetworkFormationConfirmCB,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDO_PollConfirmCB
        FUNCTION ZDO_PollConfirmCB,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC ZDO_StartRouterConfirmCB
        FUNCTION ZDO_StartRouterConfirmCB,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC ZDO_SyncIndicationCB
        FUNCTION ZDO_SyncIndicationCB,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBWEAK _A_IEN0
        PUBWEAK __Constant_0
        PUBWEAK __Constant_1
        PUBWEAK __Constant_3e8
        PUBLIC _tmpRejoinState
        PUBLIC continueJoining
        PUBLIC devStartMode
        PUBLIC devState
        PUBLIC nwkFrameCounterChanges
        PUBLIC nwkStatus
        PUBLIC zdoDiscCounter
        
        CFI Names cfiNames0
        CFI StackFrame CFA_SP SP DATA
        CFI StackFrame CFA_PSP16 PSP16 XDATA
        CFI StackFrame CFA_XSP16 XSP16 XDATA
        CFI StaticOverlayFrame CFA_IOVERLAY IOVERLAY
        CFI StaticOverlayFrame CFA_DOVERLAY DOVERLAY
        CFI Resource `PSW.CY`:1, `B.BR0`:1, `B.BR1`:1, `B.BR2`:1, `B.BR3`:1
        CFI Resource `B.BR4`:1, `B.BR5`:1, `B.BR6`:1, `B.BR7`:1, `VB.BR8`:1
        CFI Resource `VB.BR9`:1, `VB.BR10`:1, `VB.BR11`:1, `VB.BR12`:1
        CFI Resource `VB.BR13`:1, `VB.BR14`:1, `VB.BR15`:1, VB:8, B:8, A:8
        CFI Resource PSW:8, DPL0:8, DPH0:8, R0:8, R1:8, R2:8, R3:8, R4:8, R5:8
        CFI Resource R6:8, R7:8, V0:8, V1:8, V2:8, V3:8, V4:8, V5:8, V6:8, V7:8
        CFI Resource SP:8, PSPH:8, PSPL:8, PSP16:16, XSPH:8, XSPL:8, XSP16:16
        CFI VirtualResource ?RET:24
        CFI Resource ?BRET_EXT:8
        CFI VirtualResource ?RET_HIGH:8, ?RET_LOW:8
        CFI ResourceParts PSP16 PSPH, PSPL
        CFI ResourceParts XSP16 XSPH, XSPL
        CFI ResourceParts ?RET ?BRET_EXT, ?RET_HIGH, ?RET_LOW
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 1
        CFI DataAlign -1
        CFI ReturnAddress ?RET CODE
        CFI CFA_DOVERLAY Used
        CFI CFA_IOVERLAY Used
        CFI CFA_SP SP+-3
        CFI CFA_PSP16 PSP16+0
        CFI CFA_XSP16 XSP16+0
        CFI `PSW.CY` SameValue
        CFI `B.BR0` SameValue
        CFI `B.BR1` SameValue
        CFI `B.BR2` SameValue
        CFI `B.BR3` SameValue
        CFI `B.BR4` SameValue
        CFI `B.BR5` SameValue
        CFI `B.BR6` SameValue
        CFI `B.BR7` SameValue
        CFI `VB.BR8` SameValue
        CFI `VB.BR9` SameValue
        CFI `VB.BR10` SameValue
        CFI `VB.BR11` SameValue
        CFI `VB.BR12` SameValue
        CFI `VB.BR13` SameValue
        CFI `VB.BR14` SameValue
        CFI `VB.BR15` SameValue
        CFI VB SameValue
        CFI B Undefined
        CFI A Undefined
        CFI PSW SameValue
        CFI DPL0 SameValue
        CFI DPH0 SameValue
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 Undefined
        CFI R5 Undefined
        CFI R6 SameValue
        CFI R7 SameValue
        CFI V0 SameValue
        CFI V1 SameValue
        CFI V2 SameValue
        CFI V3 SameValue
        CFI V4 SameValue
        CFI V5 SameValue
        CFI V6 SameValue
        CFI V7 SameValue
        CFI PSPH Undefined
        CFI PSPL Undefined
        CFI XSPH Undefined
        CFI XSPL Undefined
        CFI ?RET Concat
        CFI ?BRET_EXT Frame(CFA_SP, 3)
        CFI ?RET_HIGH Frame(CFA_SP, 2)
        CFI ?RET_LOW Frame(CFA_SP, 1)
        CFI EndCommon cfiCommon0
        
        
        CFI Common cfiCommon1 Using cfiNames0
        CFI CodeAlign 1
        CFI DataAlign -1
        CFI ReturnAddress ?RET CODE
        CFI CFA_DOVERLAY Used
        CFI CFA_IOVERLAY Used
        CFI CFA_SP SP+-2
        CFI CFA_PSP16 PSP16+0
        CFI CFA_XSP16 XSP16+0
        CFI `PSW.CY` SameValue
        CFI `B.BR0` SameValue
        CFI `B.BR1` SameValue
        CFI `B.BR2` SameValue
        CFI `B.BR3` SameValue
        CFI `B.BR4` SameValue
        CFI `B.BR5` SameValue
        CFI `B.BR6` SameValue
        CFI `B.BR7` SameValue
        CFI `VB.BR8` SameValue
        CFI `VB.BR9` SameValue
        CFI `VB.BR10` SameValue
        CFI `VB.BR11` SameValue
        CFI `VB.BR12` SameValue
        CFI `VB.BR13` SameValue
        CFI `VB.BR14` SameValue
        CFI `VB.BR15` SameValue
        CFI VB SameValue
        CFI B SameValue
        CFI A SameValue
        CFI PSW SameValue
        CFI DPL0 SameValue
        CFI DPH0 SameValue
        CFI R0 SameValue
        CFI R1 SameValue
        CFI R2 SameValue
        CFI R3 SameValue
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI V0 SameValue
        CFI V1 SameValue
        CFI V2 SameValue
        CFI V3 SameValue
        CFI V4 SameValue
        CFI V5 SameValue
        CFI V6 SameValue
        CFI V7 SameValue
        CFI PSPH Undefined
        CFI PSPL Undefined
        CFI XSPH Undefined
        CFI XSPL Undefined
        CFI ?RET Concat
        CFI ?BRET_EXT SameValue
        CFI ?RET_HIGH Frame(CFA_SP, 2)
        CFI ?RET_LOW Frame(CFA_SP, 1)
        CFI EndCommon cfiCommon1
        
NLME_GetExtAddr     SYMBOL "NLME_GetExtAddr"
ZDO_Init            SYMBOL "ZDO_Init"
afRegister          SYMBOL "afRegister"
NLME_GetRequest     SYMBOL "NLME_GetRequest"
NLME_SetBroadcastFilter SYMBOL "NLME_SetBroadcastFilter"
HalLedBlink         SYMBOL "HalLedBlink"
ZDSecMgrInit        SYMBOL "ZDSecMgrInit"
SSP_UpdateNwkKey    SYMBOL "SSP_UpdateNwkKey"
SSP_SwitchNwkKey    SYMBOL "SSP_SwitchNwkKey"
ZDO_UpdateNwkStatus SYMBOL "ZDO_UpdateNwkStatus"
osal_msg_deallocate SYMBOL "osal_msg_deallocate"
osal_msg_receive    SYMBOL "osal_msg_receive"
ZDO_StartDevice     SYMBOL "ZDO_StartDevice"
osal_pwrmgr_device  SYMBOL "osal_pwrmgr_device"
osal_set_event      SYMBOL "osal_set_event"
ZDSecMgrNewDeviceEvent SYMBOL "ZDSecMgrNewDeviceEvent"
osal_start_timerEx  SYMBOL "osal_start_timerEx"
osal_rand           SYMBOL "osal_rand"
zgReadStartupOptions SYMBOL "zgReadStartupOptions"
NLME_GetEnergyThreshold SYMBOL "NLME_GetEnergyThreshold"
NLME_SetEnergyThreshold SYMBOL "NLME_SetEnergyThreshold"
NLME_StartRouterRequest SYMBOL "NLME_StartRouterRequest"
NLME_InitNV         SYMBOL "NLME_InitNV"
NLME_RestoreFromNV  SYMBOL "NLME_RestoreFromNV"
NLME_GetShortAddr   SYMBOL "NLME_GetShortAddr"
osal_memset         SYMBOL "osal_memset"
osal_nv_item_init   SYMBOL "osal_nv_item_init"
osal_nv_read        SYMBOL "osal_nv_read"
HalKeyRead          SYMBOL "HalKeyRead"
ZDP_IncomingData    SYMBOL "ZDP_IncomingData"
NLME_JoinRequest    SYMBOL "NLME_JoinRequest"
NLME_ReJoinRequest  SYMBOL "NLME_ReJoinRequest"
NLME_SetPollRate    SYMBOL "NLME_SetPollRate"
NLME_SetQueuedPollRate SYMBOL "NLME_SetQueuedPollRate"
NLME_SetResponseRate SYMBOL "NLME_SetResponseRate"
ZDSecMgrTransportKeyInd SYMBOL "ZDSecMgrTransportKeyInd"
ZDSecMgrRemoveDeviceInd SYMBOL "ZDSecMgrRemoveDeviceInd"
ZDSecMgrSwitchKeyInd SYMBOL "ZDSecMgrSwitchKeyInd"
SSP_ReadNwkActiveKey SYMBOL "SSP_ReadNwkActiveKey"
osal_nv_write       SYMBOL "osal_nv_write"
osal_stop_timerEx   SYMBOL "osal_stop_timerEx"
NLME_RemoveChild    SYMBOL "NLME_RemoveChild"
osal_msg_allocate   SYMBOL "osal_msg_allocate"
osal_memcpy         SYMBOL "osal_memcpy"
osal_msg_send       SYMBOL "osal_msg_send"
osal_cpyExtAddr     SYMBOL "osal_cpyExtAddr"
HalLedSet           SYMBOL "HalLedSet"
osal_ExtAddrEqual   SYMBOL "osal_ExtAddrEqual"
NLME_LeaveRsp       SYMBOL "NLME_LeaveRsp"
NLME_GetCoordShortAddr SYMBOL "NLME_GetCoordShortAddr"
osal_get_timeoutEx  SYMBOL "osal_get_timeoutEx"
ZDP_GenericRsp      SYMBOL "ZDP_GenericRsp"
afSetMatch          SYMBOL "afSetMatch"
nwk_getNetworkDesc  SYMBOL "nwk_getNetworkDesc"
??HalKeyRead?relay  SYMBOL "?relay", HalKeyRead
??HalLedBlink?relay SYMBOL "?relay", HalLedBlink
??HalLedSet?relay   SYMBOL "?relay", HalLedSet
??NLME_GetCoordShortAddr?relay SYMBOL "?relay", NLME_GetCoordShortAddr
??NLME_GetEnergyThreshold?relay SYMBOL "?relay", NLME_GetEnergyThreshold
??NLME_GetExtAddr?relay SYMBOL "?relay", NLME_GetExtAddr
??NLME_GetRequest?relay SYMBOL "?relay", NLME_GetRequest
??NLME_GetShortAddr?relay SYMBOL "?relay", NLME_GetShortAddr
??NLME_InitNV?relay SYMBOL "?relay", NLME_InitNV
??NLME_JoinRequest?relay SYMBOL "?relay", NLME_JoinRequest
??NLME_LeaveRsp?relay SYMBOL "?relay", NLME_LeaveRsp
??NLME_ReJoinRequest?relay SYMBOL "?relay", NLME_ReJoinRequest
??NLME_RemoveChild?relay SYMBOL "?relay", NLME_RemoveChild
??NLME_RestoreFromNV?relay SYMBOL "?relay", NLME_RestoreFromNV
??NLME_SetBroadcastFilter?relay SYMBOL "?relay", NLME_SetBroadcastFilter
??NLME_SetEnergyThreshold?relay SYMBOL "?relay", NLME_SetEnergyThreshold
??NLME_SetPollRate?relay SYMBOL "?relay", NLME_SetPollRate
??NLME_SetQueuedPollRate?relay SYMBOL "?relay", NLME_SetQueuedPollRate
??NLME_SetResponseRate?relay SYMBOL "?relay", NLME_SetResponseRate
??NLME_StartRouterRequest?relay SYMBOL "?relay", NLME_StartRouterRequest
??SSP_ReadNwkActiveKey?relay SYMBOL "?relay", SSP_ReadNwkActiveKey
??SSP_SwitchNwkKey?relay SYMBOL "?relay", SSP_SwitchNwkKey
??SSP_UpdateNwkKey?relay SYMBOL "?relay", SSP_UpdateNwkKey
??ZDO_Init?relay    SYMBOL "?relay", ZDO_Init
??ZDO_StartDevice?relay SYMBOL "?relay", ZDO_StartDevice
??ZDO_UpdateNwkStatus?relay SYMBOL "?relay", ZDO_UpdateNwkStatus
??ZDP_GenericRsp?relay SYMBOL "?relay", ZDP_GenericRsp
??ZDP_IncomingData?relay SYMBOL "?relay", ZDP_IncomingData
??ZDSecMgrInit?relay SYMBOL "?relay", ZDSecMgrInit
??ZDSecMgrNewDeviceEvent?relay SYMBOL "?relay", ZDSecMgrNewDeviceEvent
??ZDSecMgrRemoveDeviceInd?relay SYMBOL "?relay", ZDSecMgrRemoveDeviceInd
??ZDSecMgrSwitchKeyInd?relay SYMBOL "?relay", ZDSecMgrSwitchKeyInd
??ZDSecMgrTransportKeyInd?relay SYMBOL "?relay", ZDSecMgrTransportKeyInd
??afRegister?relay  SYMBOL "?relay", afRegister
??afSetMatch?relay  SYMBOL "?relay", afSetMatch
??nwk_getNetworkDesc?relay SYMBOL "?relay", nwk_getNetworkDesc
??osal_ExtAddrEqual?relay SYMBOL "?relay", osal_ExtAddrEqual
??osal_cpyExtAddr?relay SYMBOL "?relay", osal_cpyExtAddr
??osal_get_timeoutEx?relay SYMBOL "?relay", osal_get_timeoutEx
??osal_memcpy?relay SYMBOL "?relay", osal_memcpy
??osal_memset?relay SYMBOL "?relay", osal_memset
??osal_msg_allocate?relay SYMBOL "?relay", osal_msg_allocate
??osal_msg_deallocate?relay SYMBOL "?relay", osal_msg_deallocate
??osal_msg_receive?relay SYMBOL "?relay", osal_msg_receive
??osal_msg_send?relay SYMBOL "?relay", osal_msg_send
??osal_nv_item_init?relay SYMBOL "?relay", osal_nv_item_init
??osal_nv_read?relay SYMBOL "?relay", osal_nv_read
??osal_nv_write?relay SYMBOL "?relay", osal_nv_write
??osal_pwrmgr_device?relay SYMBOL "?relay", osal_pwrmgr_device
??osal_rand?relay   SYMBOL "?relay", osal_rand
??osal_set_event?relay SYMBOL "?relay", osal_set_event
??osal_start_timerEx?relay SYMBOL "?relay", osal_start_timerEx
??osal_stop_timerEx?relay SYMBOL "?relay", osal_stop_timerEx
??zgReadStartupOptions?relay SYMBOL "?relay", zgReadStartupOptions
AddrMgrWriteNVRequest SYMBOL "AddrMgrWriteNVRequest"
??AddrMgrWriteNVRequest?relay SYMBOL "?relay", AddrMgrWriteNVRequest
ZDAppCheckForHoldKey SYMBOL "ZDAppCheckForHoldKey"
??ZDAppCheckForHoldKey?relay SYMBOL "?relay", ZDAppCheckForHoldKey
ZDAppDetermineDeviceType SYMBOL "ZDAppDetermineDeviceType"
??ZDAppDetermineDeviceType?relay SYMBOL "?relay", ZDAppDetermineDeviceType
ZDApp_ChangeMatchDescRespPermission SYMBOL "ZDApp_ChangeMatchDescRespPermission"
??ZDApp_ChangeMatchDescRespPermission?relay SYMBOL "?relay", ZDApp_ChangeMatchDescRespPermission
ZDApp_CoordStartPANIDConflictCB SYMBOL "ZDApp_CoordStartPANIDConflictCB"
??ZDApp_CoordStartPANIDConflictCB?relay SYMBOL "?relay", ZDApp_CoordStartPANIDConflictCB
ZDApp_DeviceAuthEvt SYMBOL "ZDApp_DeviceAuthEvt"
??ZDApp_DeviceAuthEvt?relay SYMBOL "?relay", ZDApp_DeviceAuthEvt
ZDApp_InMsgCB       SYMBOL "ZDApp_InMsgCB"
??ZDApp_InMsgCB?relay SYMBOL "?relay", ZDApp_InMsgCB
ZDApp_Init          SYMBOL "ZDApp_Init"
??ZDApp_Init?relay  SYMBOL "?relay", ZDApp_Init
ZDApp_InitUserDesc  SYMBOL "ZDApp_InitUserDesc"
??ZDApp_InitUserDesc?relay SYMBOL "?relay", ZDApp_InitUserDesc
ZDApp_LeaveCtrlBypass SYMBOL "ZDApp_LeaveCtrlBypass"
??ZDApp_LeaveCtrlBypass?relay SYMBOL "?relay", ZDApp_LeaveCtrlBypass
ZDApp_LeaveCtrlInit SYMBOL "ZDApp_LeaveCtrlInit"
??ZDApp_LeaveCtrlInit?relay SYMBOL "?relay", ZDApp_LeaveCtrlInit
ZDApp_LeaveCtrlSet  SYMBOL "ZDApp_LeaveCtrlSet"
??ZDApp_LeaveCtrlSet?relay SYMBOL "?relay", ZDApp_LeaveCtrlSet
ZDApp_LeaveCtrlStartup SYMBOL "ZDApp_LeaveCtrlStartup"
??ZDApp_LeaveCtrlStartup?relay SYMBOL "?relay", ZDApp_LeaveCtrlStartup
ZDApp_LeaveReset    SYMBOL "ZDApp_LeaveReset"
??ZDApp_LeaveReset?relay SYMBOL "?relay", ZDApp_LeaveReset
ZDApp_LeaveUpdate   SYMBOL "ZDApp_LeaveUpdate"
??ZDApp_LeaveUpdate?relay SYMBOL "?relay", ZDApp_LeaveUpdate
ZDApp_NVUpdate      SYMBOL "ZDApp_NVUpdate"
??ZDApp_NVUpdate?relay SYMBOL "?relay", ZDApp_NVUpdate
ZDApp_NetworkInit   SYMBOL "ZDApp_NetworkInit"
??ZDApp_NetworkInit?relay SYMBOL "?relay", ZDApp_NetworkInit
ZDApp_NetworkStartEvt SYMBOL "ZDApp_NetworkStartEvt"
??ZDApp_NetworkStartEvt?relay SYMBOL "?relay", ZDApp_NetworkStartEvt
ZDApp_NodeProfileSync SYMBOL "ZDApp_NodeProfileSync"
??ZDApp_NodeProfileSync?relay SYMBOL "?relay", ZDApp_NodeProfileSync
ZDApp_ProcessMsgCBs SYMBOL "ZDApp_ProcessMsgCBs"
??ZDApp_ProcessMsgCBs?relay SYMBOL "?relay", ZDApp_ProcessMsgCBs
ZDApp_ProcessNetworkJoin SYMBOL "ZDApp_ProcessNetworkJoin"
??ZDApp_ProcessNetworkJoin?relay SYMBOL "?relay", ZDApp_ProcessNetworkJoin
ZDApp_ProcessOSALMsg SYMBOL "ZDApp_ProcessOSALMsg"
??ZDApp_ProcessOSALMsg?relay SYMBOL "?relay", ZDApp_ProcessOSALMsg
ZDApp_ReadNetworkRestoreState SYMBOL "ZDApp_ReadNetworkRestoreState"
??ZDApp_ReadNetworkRestoreState?relay SYMBOL "?relay", ZDApp_ReadNetworkRestoreState
ZDApp_RegisterCBs   SYMBOL "ZDApp_RegisterCBs"
??ZDApp_RegisterCBs?relay SYMBOL "?relay", ZDApp_RegisterCBs
ZDApp_ResetNwkKey   SYMBOL "ZDApp_ResetNwkKey"
??ZDApp_ResetNwkKey?relay SYMBOL "?relay", ZDApp_ResetNwkKey
ZDApp_ResetTimerCancel SYMBOL "ZDApp_ResetTimerCancel"
??ZDApp_ResetTimerCancel?relay SYMBOL "?relay", ZDApp_ResetTimerCancel
ZDApp_ResetTimerStart SYMBOL "ZDApp_ResetTimerStart"
??ZDApp_ResetTimerStart?relay SYMBOL "?relay", ZDApp_ResetTimerStart
ZDApp_RestoreNetworkState SYMBOL "ZDApp_RestoreNetworkState"
??ZDApp_RestoreNetworkState?relay SYMBOL "?relay", ZDApp_RestoreNetworkState
ZDApp_RestoreNwkKey SYMBOL "ZDApp_RestoreNwkKey"
??ZDApp_RestoreNwkKey?relay SYMBOL "?relay", ZDApp_RestoreNwkKey
ZDApp_SaveNetworkStateEvt SYMBOL "ZDApp_SaveNetworkStateEvt"
??ZDApp_SaveNetworkStateEvt?relay SYMBOL "?relay", ZDApp_SaveNetworkStateEvt
ZDApp_SaveNwkKey    SYMBOL "ZDApp_SaveNwkKey"
??ZDApp_SaveNwkKey?relay SYMBOL "?relay", ZDApp_SaveNwkKey
ZDApp_SecInit       SYMBOL "ZDApp_SecInit"
??ZDApp_SecInit?relay SYMBOL "?relay", ZDApp_SecInit
ZDApp_SendEventMsg  SYMBOL "ZDApp_SendEventMsg"
??ZDApp_SendEventMsg?relay SYMBOL "?relay", ZDApp_SendEventMsg
ZDApp_SendMsg       SYMBOL "ZDApp_SendMsg"
??ZDApp_SendMsg?relay SYMBOL "?relay", ZDApp_SendMsg
ZDApp_StartJoiningCycle SYMBOL "ZDApp_StartJoiningCycle"
??ZDApp_StartJoiningCycle?relay SYMBOL "?relay", ZDApp_StartJoiningCycle
ZDApp_StartUpFromApp SYMBOL "ZDApp_StartUpFromApp"
??ZDApp_StartUpFromApp?relay SYMBOL "?relay", ZDApp_StartUpFromApp
ZDApp_StopJoiningCycle SYMBOL "ZDApp_StopJoiningCycle"
??ZDApp_StopJoiningCycle?relay SYMBOL "?relay", ZDApp_StopJoiningCycle
ZDApp_StopStartUp   SYMBOL "ZDApp_StopStartUp"
??ZDApp_StopStartUp?relay SYMBOL "?relay", ZDApp_StopStartUp
ZDApp_event_loop    SYMBOL "ZDApp_event_loop"
??ZDApp_event_loop?relay SYMBOL "?relay", ZDApp_event_loop
ZDOInitDevice       SYMBOL "ZDOInitDevice"
??ZDOInitDevice?relay SYMBOL "?relay", ZDOInitDevice
ZDO_JoinConfirmCB   SYMBOL "ZDO_JoinConfirmCB"
??ZDO_JoinConfirmCB?relay SYMBOL "?relay", ZDO_JoinConfirmCB
ZDO_JoinIndicationCB SYMBOL "ZDO_JoinIndicationCB"
??ZDO_JoinIndicationCB?relay SYMBOL "?relay", ZDO_JoinIndicationCB
ZDO_LeaveCnf        SYMBOL "ZDO_LeaveCnf"
??ZDO_LeaveCnf?relay SYMBOL "?relay", ZDO_LeaveCnf
ZDO_LeaveInd        SYMBOL "ZDO_LeaveInd"
??ZDO_LeaveInd?relay SYMBOL "?relay", ZDO_LeaveInd
ZDO_NetworkDiscoveryConfirmCB SYMBOL "ZDO_NetworkDiscoveryConfirmCB"
??ZDO_NetworkDiscoveryConfirmCB?relay SYMBOL "?relay", ZDO_NetworkDiscoveryConfirmCB
ZDO_NetworkFormationConfirmCB SYMBOL "ZDO_NetworkFormationConfirmCB"
??ZDO_NetworkFormationConfirmCB?relay SYMBOL "?relay", ZDO_NetworkFormationConfirmCB
ZDO_PollConfirmCB   SYMBOL "ZDO_PollConfirmCB"
??ZDO_PollConfirmCB?relay SYMBOL "?relay", ZDO_PollConfirmCB
ZDO_StartRouterConfirmCB SYMBOL "ZDO_StartRouterConfirmCB"
??ZDO_StartRouterConfirmCB?relay SYMBOL "?relay", ZDO_StartRouterConfirmCB
ZDO_SyncIndicationCB SYMBOL "ZDO_SyncIndicationCB"
??ZDO_SyncIndicationCB?relay SYMBOL "?relay", ZDO_SyncIndicationCB

        EXTERN NLME_GetExtAddr
        FUNCTION NLME_GetExtAddr,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDO_Init
        FUNCTION ZDO_Init,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN afRegister
        FUNCTION afRegister,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_GetRequest
        FUNCTION NLME_GetRequest,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_SetBroadcastFilter
        FUNCTION NLME_SetBroadcastFilter,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN HalLedBlink
        FUNCTION HalLedBlink,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDSecMgrInit
        FUNCTION ZDSecMgrInit,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN SSP_UpdateNwkKey
        FUNCTION SSP_UpdateNwkKey,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN SSP_SwitchNwkKey
        FUNCTION SSP_SwitchNwkKey,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDO_UpdateNwkStatus
        FUNCTION ZDO_UpdateNwkStatus,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_msg_deallocate
        FUNCTION osal_msg_deallocate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_msg_receive
        FUNCTION osal_msg_receive,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDO_StartDevice
        FUNCTION ZDO_StartDevice,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_pwrmgr_device
        FUNCTION osal_pwrmgr_device,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_set_event
        FUNCTION osal_set_event,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDSecMgrNewDeviceEvent
        FUNCTION ZDSecMgrNewDeviceEvent,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_start_timerEx
        FUNCTION osal_start_timerEx,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_rand
        FUNCTION osal_rand,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN zgReadStartupOptions
        FUNCTION zgReadStartupOptions,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_GetEnergyThreshold
        FUNCTION NLME_GetEnergyThreshold,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_SetEnergyThreshold
        FUNCTION NLME_SetEnergyThreshold,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_StartRouterRequest
        FUNCTION NLME_StartRouterRequest,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_InitNV
        FUNCTION NLME_InitNV,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_RestoreFromNV
        FUNCTION NLME_RestoreFromNV,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_GetShortAddr
        FUNCTION NLME_GetShortAddr,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_memset
        FUNCTION osal_memset,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_nv_item_init
        FUNCTION osal_nv_item_init,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 33, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_nv_read
        FUNCTION osal_nv_read,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 37, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN HalKeyRead
        FUNCTION HalKeyRead,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDP_IncomingData
        FUNCTION ZDP_IncomingData,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_JoinRequest
        FUNCTION NLME_JoinRequest,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 11, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_ReJoinRequest
        FUNCTION NLME_ReJoinRequest,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_SetPollRate
        FUNCTION NLME_SetPollRate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_SetQueuedPollRate
        FUNCTION NLME_SetQueuedPollRate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_SetResponseRate
        FUNCTION NLME_SetResponseRate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDSecMgrTransportKeyInd
        FUNCTION ZDSecMgrTransportKeyInd,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDSecMgrRemoveDeviceInd
        FUNCTION ZDSecMgrRemoveDeviceInd,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDSecMgrSwitchKeyInd
        FUNCTION ZDSecMgrSwitchKeyInd,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZMacSetReq
        FUNCTION ZMacSetReq,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN SSP_ReadNwkActiveKey
        FUNCTION SSP_ReadNwkActiveKey,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 33, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_nv_write
        FUNCTION osal_nv_write,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 37, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_stop_timerEx
        FUNCTION osal_stop_timerEx,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_RemoveChild
        FUNCTION NLME_RemoveChild,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_msg_allocate
        FUNCTION osal_msg_allocate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 16, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_memcpy
        FUNCTION osal_memcpy,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 19, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_msg_send
        FUNCTION osal_msg_send,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 16, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_cpyExtAddr
        FUNCTION osal_cpyExtAddr,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN HalLedSet
        FUNCTION HalLedSet,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_ExtAddrEqual
        FUNCTION osal_ExtAddrEqual,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_LeaveRsp
        FUNCTION NLME_LeaveRsp,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_GetCoordShortAddr
        FUNCTION NLME_GetCoordShortAddr,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_get_timeoutEx
        FUNCTION osal_get_timeoutEx,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDP_GenericRsp
        FUNCTION ZDP_GenericRsp,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN afSetMatch
        FUNCTION afSetMatch,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN nwk_getNetworkDesc
        FUNCTION nwk_getNetworkDesc,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ??HalKeyRead?relay
        FUNCTION ??HalKeyRead?relay,00H
        EXTERN ??HalLedBlink?relay
        FUNCTION ??HalLedBlink?relay,00H
        EXTERN ??HalLedSet?relay
        FUNCTION ??HalLedSet?relay,00H
        EXTERN ??NLME_GetCoordShortAddr?relay
        FUNCTION ??NLME_GetCoordShortAddr?relay,00H
        EXTERN ??NLME_GetEnergyThreshold?relay
        FUNCTION ??NLME_GetEnergyThreshold?relay,00H
        EXTERN ??NLME_GetExtAddr?relay
        FUNCTION ??NLME_GetExtAddr?relay,00H
        EXTERN ??NLME_GetRequest?relay
        FUNCTION ??NLME_GetRequest?relay,00H
        EXTERN ??NLME_GetShortAddr?relay
        FUNCTION ??NLME_GetShortAddr?relay,00H
        EXTERN ??NLME_InitNV?relay
        FUNCTION ??NLME_InitNV?relay,00H
        EXTERN ??NLME_JoinRequest?relay
        FUNCTION ??NLME_JoinRequest?relay,00H
        EXTERN ??NLME_LeaveRsp?relay
        FUNCTION ??NLME_LeaveRsp?relay,00H
        EXTERN ??NLME_ReJoinRequest?relay
        FUNCTION ??NLME_ReJoinRequest?relay,00H
        EXTERN ??NLME_RemoveChild?relay
        FUNCTION ??NLME_RemoveChild?relay,00H
        EXTERN ??NLME_RestoreFromNV?relay
        FUNCTION ??NLME_RestoreFromNV?relay,00H
        EXTERN ??NLME_SetBroadcastFilter?relay
        FUNCTION ??NLME_SetBroadcastFilter?relay,00H
        EXTERN ??NLME_SetEnergyThreshold?relay
        FUNCTION ??NLME_SetEnergyThreshold?relay,00H
        EXTERN ??NLME_SetPollRate?relay
        FUNCTION ??NLME_SetPollRate?relay,00H
        EXTERN ??NLME_SetQueuedPollRate?relay
        FUNCTION ??NLME_SetQueuedPollRate?relay,00H
        EXTERN ??NLME_SetResponseRate?relay
        FUNCTION ??NLME_SetResponseRate?relay,00H
        EXTERN ??NLME_StartRouterRequest?relay
        FUNCTION ??NLME_StartRouterRequest?relay,00H
        EXTERN ??SSP_ReadNwkActiveKey?relay
        FUNCTION ??SSP_ReadNwkActiveKey?relay,00H
        EXTERN ??SSP_SwitchNwkKey?relay
        FUNCTION ??SSP_SwitchNwkKey?relay,00H
        EXTERN ??SSP_UpdateNwkKey?relay
        FUNCTION ??SSP_UpdateNwkKey?relay,00H
        EXTERN ??ZDO_Init?relay
        FUNCTION ??ZDO_Init?relay,00H
        EXTERN ??ZDO_StartDevice?relay
        FUNCTION ??ZDO_StartDevice?relay,00H
        EXTERN ??ZDO_UpdateNwkStatus?relay
        FUNCTION ??ZDO_UpdateNwkStatus?relay,00H
        EXTERN ??ZDP_GenericRsp?relay
        FUNCTION ??ZDP_GenericRsp?relay,00H
        EXTERN ??ZDP_IncomingData?relay
        FUNCTION ??ZDP_IncomingData?relay,00H
        EXTERN ??ZDSecMgrInit?relay
        FUNCTION ??ZDSecMgrInit?relay,00H
        EXTERN ??ZDSecMgrNewDeviceEvent?relay
        FUNCTION ??ZDSecMgrNewDeviceEvent?relay,00H
        EXTERN ??ZDSecMgrRemoveDeviceInd?relay
        FUNCTION ??ZDSecMgrRemoveDeviceInd?relay,00H
        EXTERN ??ZDSecMgrSwitchKeyInd?relay
        FUNCTION ??ZDSecMgrSwitchKeyInd?relay,00H
        EXTERN ??ZDSecMgrTransportKeyInd?relay
        FUNCTION ??ZDSecMgrTransportKeyInd?relay,00H
        EXTERN ??afRegister?relay
        FUNCTION ??afRegister?relay,00H
        EXTERN ??afSetMatch?relay
        FUNCTION ??afSetMatch?relay,00H
        EXTERN ??nwk_getNetworkDesc?relay
        FUNCTION ??nwk_getNetworkDesc?relay,00H
        EXTERN ??osal_ExtAddrEqual?relay
        FUNCTION ??osal_ExtAddrEqual?relay,00H
        EXTERN ??osal_cpyExtAddr?relay
        FUNCTION ??osal_cpyExtAddr?relay,00H
        EXTERN ??osal_get_timeoutEx?relay
        FUNCTION ??osal_get_timeoutEx?relay,00H
        EXTERN ??osal_memcpy?relay
        FUNCTION ??osal_memcpy?relay,00H
        EXTERN ??osal_memset?relay
        FUNCTION ??osal_memset?relay,00H
        EXTERN ??osal_msg_allocate?relay
        FUNCTION ??osal_msg_allocate?relay,00H
        EXTERN ??osal_msg_deallocate?relay
        FUNCTION ??osal_msg_deallocate?relay,00H
        EXTERN ??osal_msg_receive?relay
        FUNCTION ??osal_msg_receive?relay,00H
        EXTERN ??osal_msg_send?relay
        FUNCTION ??osal_msg_send?relay,00H
        EXTERN ??osal_nv_item_init?relay
        FUNCTION ??osal_nv_item_init?relay,00H
        EXTERN ??osal_nv_read?relay
        FUNCTION ??osal_nv_read?relay,00H
        EXTERN ??osal_nv_write?relay
        FUNCTION ??osal_nv_write?relay,00H
        EXTERN ??osal_pwrmgr_device?relay
        FUNCTION ??osal_pwrmgr_device?relay,00H
        EXTERN ??osal_rand?relay
        FUNCTION ??osal_rand?relay,00H
        EXTERN ??osal_set_event?relay
        FUNCTION ??osal_set_event?relay,00H
        EXTERN ??osal_start_timerEx?relay
        FUNCTION ??osal_start_timerEx?relay,00H
        EXTERN ??osal_stop_timerEx?relay
        FUNCTION ??osal_stop_timerEx?relay,00H
        EXTERN ??zgReadStartupOptions?relay
        FUNCTION ??zgReadStartupOptions?relay,00H
        EXTERN ZDO_Config_Node_Descriptor
        EXTERN _NIB
        EXTERN nwkFrameCounter
        EXTERN zgConfigPANID
        EXTERN zgDefaultStartingScanDuration
        EXTERN zgPreConfigKey
        EXTERN zgPreConfigKeys
        EXTERN zgStackProfile

// C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Components\stack\zdo\ZDApp.c
//    1 /**************************************************************************************************
//    2   Filename:       ZDApp.c
//    3   Revised:        $Date: 2007-11-28 15:44:45 -0800 (Wed, 28 Nov 2007) $
//    4   Revision:       $Revision: 15983 $
//    5 
//    6   Description:    This file contains the interface to the Zigbee Device Application. This is the
//    7                   Application part that the use can change. This also contains the Task functions.
//    8 
//    9 
//   10   Copyright 2004-2007 Texas Instruments Incorporated. All rights reserved.
//   11 
//   12   IMPORTANT: Your use of this Software is limited to those specific rights
//   13   granted under the terms of a software license agreement between the user
//   14   who downloaded the software, his/her employer (which must be your employer)
//   15   and Texas Instruments Incorporated (the "License").  You may not use this
//   16   Software unless you agree to abide by the terms of the License. The License
//   17   limits your use, and you acknowledge, that the Software may not be modified,
//   18   copied or distributed unless embedded on a Texas Instruments microcontroller
//   19   or used solely and exclusively in conjunction with a Texas Instruments radio
//   20   frequency transceiver, which is integrated into your product.  Other than for
//   21   the foregoing purpose, you may not use, reproduce, copy, prepare derivative
//   22   works of, modify, distribute, perform, display or sell this Software and/or
//   23   its documentation for any purpose.
//   24 
//   25   YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
//   26   PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
//   27   INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
//   28   NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
//   29   TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
//   30   NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
//   31   LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
//   32   INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
//   33   OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
//   34   OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
//   35   (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
//   36 
//   37   Should you have any questions regarding your right to use this Software,
//   38   contact Texas Instruments Incorporated at www.TI.com.
//   39 **************************************************************************************************/
//   40 
//   41 /*********************************************************************
//   42  * INCLUDES
//   43  */
//   44 #include "ZComDef.h"
//   45 #include "ZMac.h"
//   46 #include "OSAL.h"
//   47 #include "OSAL_Tasks.h"
//   48 #include "OSAL_PwrMgr.h"
//   49 #include "OSAL_Nv.h"
//   50 #include "AF.h"
//   51 #include "APSMEDE.h"
//   52 #include "NLMEDE.h"
//   53 #include "AddrMgr.h"
//   54 #include "ZDProfile.h"
//   55 #include "ZDObject.h"
//   56 #include "ZDConfig.h"
//   57 #include "ZDSecMgr.h"
//   58 #include "ZDApp.h"
//   59 #include "DebugTrace.h"
//   60 #include "nwk_util.h"
//   61 #include "OnBoard.h"

        ASEGN SFR_AN:DATA:NOROOT,0a8H
// union <unnamed> volatile __sfr _A_IEN0
_A_IEN0:
        DS 1

        ASEGN SFR_AN:DATA:NOROOT,0c9H
// unsigned char volatile __sfr WDCTL
WDCTL:
        DS 1
//   62 #include "ZGlobals.h"
//   63 
//   64 #if   ( SECURE != 0  )
//   65   #include "ssp.h"
//   66 #endif
//   67 
//   68 #if defined( MT_ZDO_FUNC )
//   69   #include "MT_ZDO.h"
//   70 #endif
//   71 
//   72 /* HAL */
//   73 #include "hal_led.h"
//   74 //#include "hal_lcd.h"
//   75 #if defined( LCD_SUPPORTED )
//   76   #include "lcd128_64.h"
//   77 #endif
//   78 #include "hal_key.h"
//   79 
//   80 #if defined( MT_MAC_FUNC ) || defined( MT_MAC_CB_FUNC )
//   81   #error "ERROR! MT_MAC functionalities should be disabled on ZDO devices"
//   82 #endif
//   83 /*********************************************************************
//   84  * MACROS
//   85  */
//   86 
//   87 /*********************************************************************
//   88  * CONSTANTS
//   89  */
//   90 #if !defined( NWK_START_DELAY )
//   91   #define NWK_START_DELAY             100   // in milliseconds
//   92 #endif
//   93 
//   94 #if !defined( EXTENDED_JOINING_RANDOM_MASK )
//   95   #define EXTENDED_JOINING_RANDOM_MASK 0x007F
//   96 #endif
//   97 
//   98 #if !defined( BEACON_REQUEST_DELAY )
//   99   #define BEACON_REQUEST_DELAY        100   // in milliseconds
//  100 #endif
//  101 
//  102 #if !defined( BEACON_REQ_DELAY_MASK )
//  103   #define BEACON_REQ_DELAY_MASK       0x007F
//  104 #endif
//  105 
//  106 #if defined (AUTO_SOFT_START)
//  107   #define MAX_RESUME_RETRY            3
//  108   #define NUM_DISC_ATTEMPTS           3
//  109 #else
//  110   #define MAX_RESUME_RETRY            1
//  111 #endif
//  112 
//  113 #define MAX_DEVICE_UNAUTH_TIMEOUT   5000  // 5 seconds
//  114 
//  115 // Beacon Order Settings (see NLMEDE.h)
//  116 #define DEFAULT_BEACON_ORDER        BEACON_ORDER_NO_BEACONS
//  117 #define DEFAULT_SUPERFRAME_ORDER    DEFAULT_BEACON_ORDER
//  118 
//  119 #if ( SECURE != 0 )
//  120   #if !defined( MAX_NWK_FRAMECOUNTER_CHANGES )
//  121     // The number of times the frame counter can change before
//  122     // saving to NV
//  123     #define MAX_NWK_FRAMECOUNTER_CHANGES    1000
//  124   #endif
//  125 #endif
//  126 
//  127 // Leave control bits
//  128 #define ZDAPP_LEAVE_CTRL_INIT 0
//  129 #define ZDAPP_LEAVE_CTRL_SET  1
//  130 #define ZDAPP_LEAVE_CTRL_RA   2
//  131 
//  132 // Standard time to update NWK NV data
//  133 #define ZDAPP_UPDATE_NWK_NV_TIME 700
//  134 
//  135 // Address Manager Stub Implementation
//  136 #define ZDApp_NwkWriteNVRequest AddrMgrWriteNVRequest
//  137 
//  138 /*********************************************************************
//  139  * TYPEDEFS
//  140  */
//  141 
//  142 /*********************************************************************
//  143  * GLOBAL VARIABLES
//  144  */
//  145 
//  146 #if defined( LCD_SUPPORTED )
//  147   byte MatchRsps = 0;
//  148 #endif
//  149 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  150 byte zdoDiscCounter = 1;
zdoDiscCounter:
        DS 1
        REQUIRE `?<Initializer for zdoDiscCounter>`
        REQUIRE __INIT_XDATA_I
//  151 

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  152 zAddrType_t ZDAppNwkAddr;
ZDAppNwkAddr:
        DS 9
        REQUIRE __INIT_XDATA_Z
//  153 
//  154 #if defined ( ZDO_MGMT_NWKDISC_RESPONSE )
//  155   byte zdappMgmtNwkDiscRspTransSeq;
//  156   byte zdappMgmtNwkDiscReqInProgress = FALSE;
//  157   zAddrType_t zdappMgmtNwkDiscRspAddr;
//  158   byte zdappMgmtNwkDiscStartIndex;
//  159   byte zdappMgmtSavedNwkState;
//  160 #endif
//  161 
//  162 #if ( SECURE != 0 )

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  163   uint16 nwkFrameCounterChanges = 0;
nwkFrameCounterChanges:
        DS 2
        REQUIRE __INIT_XDATA_Z
//  164 #endif
//  165 
//  166 #if defined ( SOFT_START )
//  167   static uint8 softStartAllowCoord = TRUE;
//  168 #endif
//  169 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  170 uint8 continueJoining = TRUE;
continueJoining:
        DS 1
        REQUIRE `?<Initializer for continueJoining>`
        REQUIRE __INIT_XDATA_I
//  171 

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  172 byte  _tmpRejoinState;
_tmpRejoinState:
        DS 1
        REQUIRE __INIT_XDATA_Z
//  173 
//  174 /*********************************************************************
//  175  * EXTERNAL VARIABLES
//  176  */
//  177 
//  178 /*********************************************************************
//  179  * EXTERNAL FUNCTIONS
//  180  */
//  181 
//  182 /*********************************************************************
//  183  * LOCAL FUNCTIONS
//  184  */
//  185 
//  186 void ZDApp_NetworkStartEvt( void );
//  187 void ZDApp_DeviceAuthEvt( void );
//  188 void ZDApp_SaveNetworkStateEvt( void );
//  189 
//  190 uint8 ZDApp_ReadNetworkRestoreState( void );
//  191 uint8 ZDApp_RestoreNetworkState( void );
//  192 void ZDAppDetermineDeviceType( void );
//  193 void ZDApp_InitUserDesc( void );
//  194 void ZDAppCheckForHoldKey( void );
//  195 void ZDApp_ProcessOSALMsg( osal_event_hdr_t *msgPtr );
//  196 void ZDApp_ProcessNetworkJoin( void );
//  197 void ZDApp_SetCoordAddress( byte endPoint, byte dstEP );
//  198 
//  199 #if ( SECURE != 0 )
//  200   void ZDApp_SaveNwkKey( void );
//  201   byte ZDApp_RestoreNwkKey( void );
//  202 #endif
//  203 
//  204 void ZDApp_SendMsg( byte taskID, byte cmd, byte len, byte *buf );
//  205 
//  206 void ZDApp_ResetTimerStart( uint16 delay );
//  207 void ZDApp_ResetTimerCancel( void );
//  208 void ZDApp_LeaveCtrlInit( void );
//  209 void ZDApp_LeaveCtrlSet( uint8 ra );
//  210 uint8 ZDApp_LeaveCtrlBypass( void );
//  211 void ZDApp_LeaveCtrlStartup( devStates_t* state, uint16* startDelay );
//  212 void ZDApp_LeaveReset( uint8 ra );
//  213 void ZDApp_LeaveUpdate( uint16 nwkAddr, uint8* extAddr,
//  214                         uint8 removeChildren );
//  215 void ZDApp_NodeProfileSync( ZDO_NetworkDiscoveryCfm_t* cfm );
//  216 void ZDApp_ProcessMsgCBs( zdoIncomingMsg_t *inMsg );
//  217 void ZDApp_RegisterCBs( void );
//  218 void ZDApp_SecInit( uint8 state );
//  219 
//  220 /*********************************************************************
//  221  * LOCAL VARIABLES
//  222  */
//  223 

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  224 byte ZDAppTaskID;
ZDAppTaskID:
        DS 1
        REQUIRE __INIT_XDATA_Z

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  225 byte nwkStatus;
nwkStatus:
        DS 1
        REQUIRE __INIT_XDATA_Z

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  226 endPointDesc_t *ZDApp_AutoFindMode_epDesc = (endPointDesc_t *)NULL;
ZDApp_AutoFindMode_epDesc:
        DS 2
        REQUIRE __INIT_XDATA_Z

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  227 uint8 ZDApp_LeaveCtrl;
ZDApp_LeaveCtrl:
        DS 1
        REQUIRE __INIT_XDATA_Z
//  228 
//  229 #if defined( HOLD_AUTO_START )
//  230   devStates_t devState = DEV_HOLD;
//  231 #else

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  232   devStates_t devState = DEV_INIT;
devState:
        DS 1
        REQUIRE `?<Initializer for devState>`
        REQUIRE __INIT_XDATA_I
//  233 #endif
//  234 
//  235 #if defined( ZDO_COORDINATOR ) && !defined( SOFT_START )
//  236   // Set the default to coodinator
//  237   devStartModes_t devStartMode = MODE_HARD;
//  238 #else

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  239   devStartModes_t devStartMode = MODE_JOIN;     // Assume joining
devStartMode:
        DS 1
        REQUIRE __INIT_XDATA_Z
//  240   //devStartModes_t devStartMode = MODE_RESUME; // if already "directly joined"
//  241                         // to parent. Set to make the device do an Orphan scan.
//  242 #endif
//  243 
//  244 #if !defined( ZDO_COORDINATOR ) || defined( SOFT_START )

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  245   static uint8 retryCnt;
retryCnt:
        DS 1
        REQUIRE __INIT_XDATA_Z
//  246 #endif
//  247 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  248 endPointDesc_t ZDApp_epDesc =
ZDApp_epDesc:
        DS 6
        REQUIRE `?<Initializer for ZDApp_epDesc>`
        REQUIRE __INIT_XDATA_I

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
__Constant_0:
        DS 4
        REQUIRE `?<Initializer for __Constant_0>`
        REQUIRE __INIT_XDATA_I

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
__Constant_1:
        DS 4
        REQUIRE `?<Initializer for __Constant_1>`
        REQUIRE __INIT_XDATA_I

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
__Constant_3e8:
        DS 4
        REQUIRE `?<Initializer for __Constant_3e8>`
        REQUIRE __INIT_XDATA_I
//  249 {
//  250   ZDO_EP,
//  251   &ZDAppTaskID,
//  252   (SimpleDescriptionFormat_t *)NULL,  // No Simple description for ZDO
//  253   (afNetworkLatencyReq_t)0            // No Network Latency req
//  254 };
//  255 
//  256 /*********************************************************************
//  257  * @fn      ZDApp_Init
//  258  *
//  259  * @brief   ZDApp Initialization function.
//  260  *
//  261  * @param   task_id - ZDApp Task ID
//  262  *
//  263  * @return  None
//  264  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  265 void ZDApp_Init( byte task_id )
ZDApp_Init:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function ZDApp_Init
//  266 {
        FUNCALL ZDApp_Init, NLME_GetExtAddr
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, ZDAppCheckForHoldKey
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, ZDO_Init
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, afRegister
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, NLME_GetRequest
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, NLME_SetBroadcastFilter
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, ZDOInitDevice
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_Init, HalLedBlink
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 1, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 1, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 1
        MOV     A,#-0x1
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 1)
//  267   uint8 capabilities;
//  268 
//  269   // Save the task ID
//  270   ZDAppTaskID = task_id;
        MOV     A,R1
        MOV     DPTR,#ZDAppTaskID
        MOVX    @DPTR,A
//  271 
//  272   // Initialize the ZDO global device short address storage
//  273   ZDAppNwkAddr.addrMode = Addr16Bit;
        MOV     A,#0x2
        MOV     DPTR,#(ZDAppNwkAddr + 8)
        MOVX    @DPTR,A
//  274   ZDAppNwkAddr.addr.shortAddr = INVALID_NODE_ADDR;
        MOV     DPTR,#ZDAppNwkAddr
        MOV     A,#-0x2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,#-0x1
        MOVX    @DPTR,A
//  275   (void)NLME_GetExtAddr();  // Load the saveExtAddr pointer.
        ; Setup parameters for call to function NLME_GetExtAddr
        LCALL   ??NLME_GetExtAddr?relay
//  276 
//  277   // Check for manual "Hold Auto Start"
//  278   ZDAppCheckForHoldKey();
        ; Setup parameters for call to function ZDAppCheckForHoldKey
        LCALL   ??ZDAppCheckForHoldKey?relay
//  279 
//  280   // Initialize ZDO items and setup the device - type of device to create.
//  281   ZDO_Init();
        ; Setup parameters for call to function ZDO_Init
        LCALL   ??ZDO_Init?relay
//  282 
//  283   // Register the endpoint description with the AF
//  284   // This task doesn't have a Simple description, but we still need
//  285   // to register the endpoint.
//  286   afRegister( (endPointDesc_t *)&ZDApp_epDesc );
        ; Setup parameters for call to function afRegister
        MOV     R2,#(ZDApp_epDesc & 0xff)
        MOV     R3,#((ZDApp_epDesc >> 8) & 0xff)
        LCALL   ??afRegister?relay
//  287 
//  288 #if defined( ZDO_USERDESC_RESPONSE )
//  289   ZDApp_InitUserDesc();
//  290 #endif // ZDO_USERDESC_RESPONSE
//  291 
//  292   // set broadcast address mask to support broadcast filtering
//  293   NLME_GetRequest(nwkCapabilityInfo, 0, &capabilities);
        ; Setup parameters for call to function NLME_GetRequest
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R4,DPL
        MOV     R5,DPH
        MOV     R2,#0x0
        MOV     R3,#0x0
        MOV     R1,#-0x71
        LCALL   ??NLME_GetRequest?relay
//  294   NLME_SetBroadcastFilter( capabilities );
        ; Setup parameters for call to function NLME_SetBroadcastFilter
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??NLME_SetBroadcastFilter?relay
//  295 
//  296   // Start the device?
//  297   if ( devState != DEV_HOLD )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        JZ      ??ZDApp_Init_0
//  298   {
//  299     ZDOInitDevice( 0 );
        ; Setup parameters for call to function ZDOInitDevice
        MOV     R2,#0x0
        MOV     R3,#0x0
        LCALL   ??ZDOInitDevice?relay
        SJMP    ??ZDApp_Init_1
//  300   }
//  301   else
//  302   {
//  303     // Blink LED to indicate HOLD_START
//  304     HalLedBlink ( HAL_LED_4, 0, 50, 500 );
??ZDApp_Init_0:
        ; Setup parameters for call to function HalLedBlink
        MOV     R4,#-0xc
        MOV     R5,#0x1
        MOV     R3,#0x32
        MOV     R2,#0x0
        MOV     R1,#0x8
        LCALL   ??HalLedBlink?relay
//  305   }
//  306 
//  307   ZDApp_RegisterCBs();
//  308 } /* ZDO_Init() */
??ZDApp_Init_1:
        MOV     A,#0x1
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 XSP16+0
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock0
//  309 
//  310 /*********************************************************************
//  311  * @fn          ZDApp_SecInit
//  312  *
//  313  * @brief       ZDApp initialize security.
//  314  *
//  315  * @param       state - device initialization state
//  316  *
//  317  * @return      none
//  318  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  319 void ZDApp_SecInit( uint8 state )
ZDApp_SecInit:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function ZDApp_SecInit
//  320 {
        FUNCALL ZDApp_SecInit, ZDSecMgrInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_SecInit, SSP_UpdateNwkKey
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_SecInit, SSP_SwitchNwkKey
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xc
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 12)
        ; Saved register size: 12
        ; Auto size: 0
//  321   // Initialize ZigBee Device Security Manager
//  322   ZDSecMgrInit();
        ; Setup parameters for call to function ZDSecMgrInit
        LCALL   ??ZDSecMgrInit?relay
//  323 
//  324   // -----------------------------------------------------------------
//  325   #if ( SECURE != 0 )
//  326   // -----------------------------------------------------------------
//  327   nwkFrameCounter = 0;
        MOV     DPTR,#__Constant_0
        MOV     R0,#?V0 + 0
        LCALL   ?L_MOV_X
        MOV     DPTR,#nwkFrameCounter
        MOV     R0,#?V0 + 0
        LCALL   ?L_MOV_TO_X
//  328 
//  329   if( _NIB.nwkKeyLoaded == FALSE )
        MOV     DPTR,#(_NIB + 61)
        MOVX    A,@DPTR
        JNZ     ??ZDApp_SecInit_0
//  330   {
//  331     // ---------------------------------------------------------------
//  332     #if ( SECURITY_MODE == SECURITY_RESIDENTIAL )
//  333     // ---------------------------------------------------------------
//  334     #if !defined (ZDO_COORDINATOR)
//  335     if ( zgPreConfigKeys )
        MOV     DPTR,#zgPreConfigKeys
        MOVX    A,@DPTR
        JZ      ??ZDApp_SecInit_0
//  336     #endif
//  337     {
//  338       SSP_UpdateNwkKey( (byte*)zgPreConfigKey, 0);
        ; Setup parameters for call to function SSP_UpdateNwkKey
        MOV     R1,#0x0
        MOV     R2,#(zgPreConfigKey & 0xff)
        MOV     R3,#((zgPreConfigKey >> 8) & 0xff)
        LCALL   ??SSP_UpdateNwkKey?relay
//  339       SSP_SwitchNwkKey( 0 );
        ; Setup parameters for call to function SSP_SwitchNwkKey
        MOV     R1,#0x0
        LCALL   ??SSP_SwitchNwkKey?relay
//  340     }
//  341     // ---------------------------------------------------------------
//  342     #endif // ( SECURITY_MODE == SECURITY_RESIDENTIAL )
//  343     // ---------------------------------------------------------------
//  344   }
//  345 
//  346   if ( state == ZDO_INITDEV_RESTORED_NETWORK_STATE )
//  347   {
//  348     //Restore NWK frame counter
//  349   }
//  350   // -----------------------------------------------------------------
//  351   #endif
//  352   // -----------------------------------------------------------------
//  353 }
??ZDApp_SecInit_0:
        LJMP    ??Subroutine17_0 & 0xFFFF
        CFI EndBlock cfiBlock1
//  354 
//  355 /*********************************************************************
//  356  * @fn      ZDApp_event_loop()
//  357  *
//  358  * @brief   Main event loop for Zigbee device objects task. This function
//  359  *          should be called at periodic intervals.
//  360  *
//  361  * @param   task_id - Task ID
//  362  * @param   events  - Bitmap of events
//  363  *
//  364  * @return  none
//  365  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  366 UINT16 ZDApp_event_loop( byte task_id, UINT16 events )
ZDApp_event_loop:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function ZDApp_event_loop
//  367 {
        FUNCALL ZDApp_event_loop, ZDO_UpdateNwkStatus
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, ZDApp_ProcessOSALMsg
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, osal_msg_deallocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, osal_msg_receive
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, ZDO_StartDevice
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, ZDApp_NetworkStartEvt
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, osal_pwrmgr_device
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, osal_set_event
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, ZDSecMgrNewDeviceEvent
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, osal_start_timerEx
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, ZDApp_DeviceAuthEvt
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_event_loop, ZDApp_SaveNwkKey
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
        MOV     A,R2
        MOV     R6,A
        MOV     A,R3
        MOV     R7,A
//  368   uint8 *msg_ptr;
//  369 
//  370   if ( events & SYS_EVENT_MSG )
        MOV     A,#-0x80
        ANL     A,R7
        MOV     R1,A
        CLR     A
        JNZ     ??ZDApp_event_loop_0
        MOV     A,R1
??ZDApp_event_loop_0:
        JNZ     ??ZDApp_event_loop_1
//  371   {
//  372     while ( (msg_ptr = osal_msg_receive( ZDAppTaskID )) )
//  373     {
//  374       ZDApp_ProcessOSALMsg( (osal_event_hdr_t *)msg_ptr );
//  375 
//  376       // Release the memory
//  377       osal_msg_deallocate( msg_ptr );
//  378     }
//  379 
//  380     // Return unprocessed events
//  381     return (events ^ SYS_EVENT_MSG);
//  382   }
//  383 
//  384   if ( events & ZDO_STATE_CHANGE_EVT )
        MOV     A,R6
        ANL     A,#0x10
        JZ      ??ZDApp_event_loop_2
//  385   {
//  386     ZDO_UpdateNwkStatus( devState );
        ; Setup parameters for call to function ZDO_UpdateNwkStatus
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??ZDO_UpdateNwkStatus?relay
//  387 
//  388     // Return unprocessed events
//  389     return (events ^ ZDO_STATE_CHANGE_EVT);
        MOV     A,#0x10
??ZDApp_event_loop_3:
        XRL     A,R6
        MOV     R2,A
        MOV     A,R7
??ZDApp_event_loop_4:
        MOV     R3,A
        LJMP    ??ZDApp_event_loop_5 & 0xFFFF
//  390   }
??ZDApp_event_loop_6:
        ; Setup parameters for call to function ZDApp_ProcessOSALMsg
        LCALL   ??ZDApp_ProcessOSALMsg?relay
        ; Setup parameters for call to function osal_msg_deallocate
        MOV     R2,?V0 + 0
        MOV     R3,?V0 + 1
        LCALL   ??osal_msg_deallocate?relay
??ZDApp_event_loop_1:
        ; Setup parameters for call to function osal_msg_receive
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_msg_receive?relay
        MOV     ?V0 + 0,R2
        MOV     ?V0 + 1,R3
        MOV     A,R2
        JNZ     ??ZDApp_event_loop_7
        MOV     A,R3
??ZDApp_event_loop_7:
        JNZ     ??ZDApp_event_loop_6
        MOV     A,R6
        MOV     R2,A
        MOV     A,#-0x80
??ZDApp_event_loop_8:
        XRL     A,R7
        SJMP    ??ZDApp_event_loop_4
//  391 
//  392 
//  393   if ( events & ZDO_NETWORK_INIT )
??ZDApp_event_loop_2:
        MOV     A,R6
        MOV     C,0xE0 /* A   */.0
        JNC     ??ZDApp_event_loop_9
//  394   {
//  395     // Initialize apps and start the network
//  396     devState = DEV_INIT;
        MOV     A,#0x1
        MOV     DPTR,#devState
        MOVX    @DPTR,A
//  397     ZDO_StartDevice( (uint8)ZDO_Config_Node_Descriptor.LogicalType, devStartMode,
//  398                      DEFAULT_BEACON_ORDER, DEFAULT_SUPERFRAME_ORDER );
        ; Setup parameters for call to function ZDO_StartDevice
        MOV     R4,#0xf
        MOV     R3,#0xf
        MOV     DPTR,#devStartMode
        MOVX    A,@DPTR
        MOV     R2,A
        MOV     DPTR,#ZDO_Config_Node_Descriptor
        MOVX    A,@DPTR
        ANL     A,#0x7
        MOV     R1,A
        LCALL   ??ZDO_StartDevice?relay
//  399 
//  400     // Return unprocessed events
//  401     return (events ^ ZDO_NETWORK_INIT);
        MOV     A,#0x1
??ZDApp_event_loop_10:
        SJMP    ??ZDApp_event_loop_3
//  402   }
//  403 
//  404 #if defined (RTR_NWK)
//  405   if ( events & ZDO_NETWORK_START )
??ZDApp_event_loop_9:
        ANL     A,#0x2
        JZ      ??ZDApp_event_loop_11
//  406   {
//  407     ZDApp_NetworkStartEvt();
        ; Setup parameters for call to function ZDApp_NetworkStartEvt
        LCALL   ??ZDApp_NetworkStartEvt?relay
//  408 
//  409     // Return unprocessed events
//  410     return (events ^ ZDO_NETWORK_START);
        MOV     A,#0x2
        SJMP    ??ZDApp_event_loop_3
//  411   }
//  412 #endif  //RTR_NWK
//  413 
//  414 #if defined ( RTR_NWK )
//  415   if ( events & ZDO_ROUTER_START )
??ZDApp_event_loop_11:
        MOV     A,R6
        ANL     A,#0x20
        JZ      ??ZDApp_event_loop_12
//  416   {
//  417     if ( nwkStatus == ZSuccess )
        MOV     DPTR,#nwkStatus
        MOVX    A,@DPTR
        JNZ     ??ZDApp_event_loop_13
//  418     {
//  419       if ( devState == DEV_END_DEVICE )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x6
        JNZ     ??ZDApp_event_loop_14
//  420         devState = DEV_ROUTER;
        MOV     A,#0x7
        MOVX    @DPTR,A
//  421 
//  422       osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
??ZDApp_event_loop_14:
        ; Setup parameters for call to function osal_pwrmgr_device
        MOV     R1,#0x0
        LCALL   ??osal_pwrmgr_device?relay
//  423     }
//  424     else
//  425     {
//  426       // remain as end device!!
//  427     }
//  428     osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
??ZDApp_event_loop_13:
        ; Setup parameters for call to function osal_set_event
        LCALL   ?Subroutine4 & 0xFFFF
//  429 
//  430     // Return unprocessed events
//  431     return (events ^ ZDO_ROUTER_START);
??CrossCallReturnLabel_46:
        MOV     A,#0x20
        SJMP    ??ZDApp_event_loop_3
//  432   }
//  433 #endif  // RTR
//  434 
//  435 
//  436   if ( events & ZDO_COMMAND_CNF )
??ZDApp_event_loop_12:
        MOV     A,R6
        ANL     A,#0x8
        JZ      ??ZDApp_event_loop_15
//  437   {
//  438     // User defined logic
//  439 
//  440     // Return unprocessed events
//  441     return (events ^ ZDO_COMMAND_CNF);
        MOV     A,#0x8
        XRL     A,R6
        MOV     R2,A
        SJMP    ??ZDApp_event_loop_5
//  442   }
//  443 
//  444 #if defined( ZDSECMGR_SECURE ) && defined( RTR_NWK )
//  445   if ( events & ZDO_NEW_DEVICE )
??ZDApp_event_loop_15:
        MOV     A,R6
        ANL     A,#0x40
        JZ      ??ZDApp_event_loop_16
//  446   {
//  447     // process the new device event
//  448     if ( ZDSecMgrNewDeviceEvent() == TRUE )
        ; Setup parameters for call to function ZDSecMgrNewDeviceEvent
        LCALL   ??ZDSecMgrNewDeviceEvent?relay
        MOV     A,R1
        XRL     A,#0x1
        JNZ     ??CrossCallReturnLabel_9
//  449     {
//  450       osal_start_timerEx( ZDAppTaskID, ZDO_NEW_DEVICE, 1000 );
        ; Setup parameters for call to function osal_start_timerEx
        MOV     R4,#-0x18
        MOV     R5,#0x3
        LCALL   ?Subroutine6 & 0xFFFF
//  451     }
//  452 
//  453     // Return unprocessed events
//  454     return (events ^ ZDO_NEW_DEVICE);
??CrossCallReturnLabel_9:
        MOV     A,#0x40
        LJMP    ??ZDApp_event_loop_3 & 0xFFFF
//  455   }
//  456 #endif  // ZDSECMGR_SECURE && RTR
//  457 
//  458 #if defined ( ZDSECMGR_COMMERCIAL )
//  459   if ( events & ZDO_SECMGR_EVENT )
//  460   {
//  461     ZDSecMgrEvent();
//  462 
//  463     // Return unprocessed events
//  464     return (events ^ ZDO_SECMGR_EVENT);
//  465   }
//  466 #endif // defined( ZDSECMGR_COMMERCIAL )
//  467 
//  468 #if   ( SECURE != 0  )
//  469   if ( events & ZDO_DEVICE_AUTH )
??ZDApp_event_loop_16:
        MOV     A,R6
        ANL     A,#0x80
        JZ      ??ZDApp_event_loop_17
//  470   {
//  471     ZDApp_DeviceAuthEvt();
        ; Setup parameters for call to function ZDApp_DeviceAuthEvt
        LCALL   ??ZDApp_DeviceAuthEvt?relay
//  472 
//  473     // Return unprocessed events
//  474     return (events ^ ZDO_DEVICE_AUTH);
        MOV     A,#-0x80
        SJMP    ??ZDApp_event_loop_10
//  475   }
//  476 #endif  // SECURE
//  477 
//  478   if ( events & ZDO_NWK_UPDATE_NV )
??ZDApp_event_loop_17:
        MOV     A,#0x2
        ANL     A,R7
        MOV     R1,A
        CLR     A
        JNZ     ??ZDApp_event_loop_18
        MOV     A,R1
??ZDApp_event_loop_18:
        JZ      ??ZDApp_event_loop_19
//  479   {
//  480     ZDApp_SaveNetworkStateEvt();
//  481 
//  482     // Return unprocessed events
//  483     return (events ^ ZDO_NWK_UPDATE_NV);
        MOV     A,#0x2
        LJMP    ??ZDApp_event_loop_8 & 0xFFFF
//  484   }
//  485 
//  486 #if ( SECURE != 0  )
//  487   if ( events & ZDO_FRAMECOUNTER_CHANGE )
??ZDApp_event_loop_19:
        MOV     A,#0x4
        ANL     A,R7
        MOV     R1,A
        CLR     A
        JNZ     ??ZDApp_event_loop_20
        MOV     A,R1
??ZDApp_event_loop_20:
        JZ      ??ZDApp_event_loop_21
//  488   {
//  489     if ( nwkFrameCounterChanges++ > MAX_NWK_FRAMECOUNTER_CHANGES )
        MOV     DPTR,#nwkFrameCounterChanges
        MOVX    A,@DPTR
        MOV     R0,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R1,A
        MOV     A,#0x1
        ADD     A,R0
        MOV     R2,A
        CLR     A
        ADDC    A,R1
        MOV     R3,A
        MOV     DPTR,#nwkFrameCounterChanges
        MOV     A,R2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R3
        MOVX    @DPTR,A
        CLR     C
        MOV     A,R0
        SUBB    A,#-0x17
        MOV     A,R1
        SUBB    A,#0x3
        JC      ??ZDApp_event_loop_22
//  490       ZDApp_SaveNwkKey();
        ; Setup parameters for call to function ZDApp_SaveNwkKey
        LCALL   ??ZDApp_SaveNwkKey?relay
//  491 
//  492     // Return unprocessed events
//  493     return (events ^ ZDO_FRAMECOUNTER_CHANGE);
??ZDApp_event_loop_22:
        MOV     A,R6
        MOV     R2,A
        MOV     A,#0x4
        LJMP    ??ZDApp_event_loop_8 & 0xFFFF
//  494   }
//  495 #endif
//  496 
//  497   if ( events & ZDO_DEVICE_RESET )
??ZDApp_event_loop_21:
        MOV     A,R6
        ANL     A,#0x4
        JZ      ??ZDApp_event_loop_23
//  498   {
//  499     // The device has been in the UNAUTH state, so reset
//  500     // Note: there will be no return from this call
//  501     SystemReset();
        CLR     0xa8.7
        MOV     0xc9,#-0x55
        MOV     0xc9,#0x5b
??ZDApp_event_loop_24:
        NOP
        SJMP    ??ZDApp_event_loop_24
//  502   }
//  503 
//  504   // Discard or make more handlers
//  505   return 0;
??ZDApp_event_loop_23:
        MOV     R2,#0x0
        MOV     R3,#0x0
??ZDApp_event_loop_5:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock2
        REQUIRE _A_IEN0
        REQUIRE WDCTL
//  506 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine4:
        CFI Block cfiCond3 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_46
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond4 Using cfiCommon0
        CFI (cfiCond4) NoFunction
        CFI (cfiCond4) Conditional ??CrossCallReturnLabel_47
        CFI (cfiCond4) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond4) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond4) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond4) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond4) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond4) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond4) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond4) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond4) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond4) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond4) CFA_SP SP+0
        CFI (cfiCond4) CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond5 Using cfiCommon0
        CFI (cfiCond5) NoFunction
        CFI (cfiCond5) Conditional ??CrossCallReturnLabel_48
        CFI (cfiCond5) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond5) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond5) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond5) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond5) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond5) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond5) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond5) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond5) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond5) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond5) CFA_SP SP+0
        CFI (cfiCond5) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker6 Using cfiCommon1
        CFI (cfiPicker6) NoFunction
        CFI (cfiPicker6) Picker
        MOV     R2,#0x10
        CFI Block cfiCond7 Using cfiCommon0
        CFI (cfiCond7) NoFunction
        CFI (cfiCond7) Conditional ??Subroutine16_0
        CFI (cfiCond7) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond7) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond7) CFA_SP SP+-5
        CFI Block cfiCond8 Using cfiCommon0
        CFI (cfiCond8) NoFunction
        CFI (cfiCond8) Conditional ??Subroutine16_0
        CFI (cfiCond8) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond8) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond8) CFA_SP SP+-5
        CFI Block cfiCond9 Using cfiCommon0
        CFI (cfiCond9) NoFunction
        CFI (cfiCond9) Conditional ??CrossCallReturnLabel_49
        CFI (cfiCond9) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond9) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond9) CFA_SP SP+-5
??Subroutine4_0:
        MOV     R3,#0x0
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_set_event?relay
        RET
        CFI EndBlock cfiCond3
        CFI EndBlock cfiCond4
        CFI EndBlock cfiCond5
        CFI EndBlock cfiPicker6
        CFI EndBlock cfiCond7
        CFI EndBlock cfiCond8
        CFI EndBlock cfiCond9
//  507 
//  508 /*********************************************************************
//  509  * Application Functions
//  510  */
//  511 
//  512 /*********************************************************************
//  513  * @fn      ZDOInitDevice
//  514  *
//  515  * @brief   Start the device in the network.  This function will read
//  516  *   ZCD_NV_STARTUP_OPTION (NV item) to determine whether or not to
//  517  *   restore the network state of the device.
//  518  *
//  519  * @param   startDelay - timeDelay to start device (in milliseconds).
//  520  *      There is a jitter added to this delay:
//  521  *              ((NWK_START_DELAY + startDelay)
//  522  *              + (osal_rand() & EXTENDED_JOINING_RANDOM_MASK))
//  523  *
//  524  * NOTE:    If the application would like to force a "new" join, the
//  525  *          application should set the ZCD_STARTOPT_DEFAULT_NETWORK_STATE
//  526  *          bit in the ZCD_NV_STARTUP_OPTION NV item before calling
//  527  *          this function. "new" join means to not restore the network
//  528  *          state of the device. Use zgWriteStartupOptions() to set these
//  529  *          options.
//  530  *
//  531  * @return
//  532  *    ZDO_INITDEV_RESTORED_NETWORK_STATE  - The device's network state was
//  533  *          restored.
//  534  *    ZDO_INITDEV_NEW_NETWORK_STATE - The network state was initialized.
//  535  *          This could mean that ZCD_NV_STARTUP_OPTION said to not restore, or
//  536  *          it could mean that there was no network state to restore.
//  537  *    ZDO_INITDEV_LEAVE_NOT_STARTED - Before the reset, a network leave was issued
//  538  *          with the rejoin option set to TRUE.  So, the device was not
//  539  *          started in the network (one time only).  The next time this
//  540  *          function is called it will start.
//  541  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  542 uint8 ZDOInitDevice( uint16 startDelay )
ZDOInitDevice:
        CFI Block cfiBlock10 Using cfiCommon0
        CFI Function ZDOInitDevice
//  543 {
        FUNCALL ZDOInitDevice, ZDApp_LeaveCtrlInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDOInitDevice, ZDApp_LeaveCtrlStartup
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDOInitDevice, osal_rand
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDOInitDevice, ZDApp_SecInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDOInitDevice, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 2
        MOV     A,#-0x2
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     A,R2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R3
        MOVX    @DPTR,A
//  544   uint8 networkStateNV = ZDO_INITDEV_NEW_NETWORK_STATE;
//  545   uint16 extendedDelay = 0;
//  546 
//  547   devState = DEV_INIT;    // Remove the Hold state
        MOV     A,#0x1
        MOV     DPTR,#devState
        MOVX    @DPTR,A
//  548 
//  549   // Initialize leave control logic
//  550   ZDApp_LeaveCtrlInit();
        ; Setup parameters for call to function ZDApp_LeaveCtrlInit
        LCALL   ??ZDApp_LeaveCtrlInit?relay
//  551 
//  552   // Check leave control reset settings
//  553   ZDApp_LeaveCtrlStartup( &devState, &startDelay );
        ; Setup parameters for call to function ZDApp_LeaveCtrlStartup
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R4,DPL
        MOV     R5,DPH
        MOV     R2,#(devState & 0xff)
        MOV     R3,#((devState >> 8) & 0xff)
        LCALL   ??ZDApp_LeaveCtrlStartup?relay
//  554 
//  555   // Leave may make the hold state come back
//  556   if ( devState == DEV_HOLD )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        JNZ     ??ZDOInitDevice_0
//  557     return ( ZDO_INITDEV_LEAVE_NOT_STARTED );   // Don't join - (one time).
        MOV     R1,#0x2
        SJMP    ??ZDOInitDevice_1
//  558 
//  559 #if defined ( NV_RESTORE )
//  560   // Get Keypad directly to see if a reset nv is needed.
//  561   // Hold down the SW_BYPASS_NV key (defined in OnBoard.h)
//  562   // while booting to skip past NV Restore.
//  563   if ( HalKeyRead() == SW_BYPASS_NV )
//  564     networkStateNV = ZDO_INITDEV_NEW_NETWORK_STATE;
//  565   else
//  566   {
//  567     // Determine if NV should be restored
//  568     networkStateNV = ZDApp_ReadNetworkRestoreState();
//  569   }
//  570 
//  571   if ( networkStateNV == ZDO_INITDEV_RESTORED_NETWORK_STATE )
//  572   {
//  573     networkStateNV = ZDApp_RestoreNetworkState();
//  574   }
//  575   else
//  576   {
//  577     // Wipe out the network state in NV
//  578     NLME_InitNV();
//  579     NLME_SetDefaultNV();
//  580   }
//  581 #endif
//  582 
//  583   if ( networkStateNV == ZDO_INITDEV_NEW_NETWORK_STATE )
//  584   {
//  585     ZDAppDetermineDeviceType();
//  586 
//  587     // Only delay if joining network - not restoring network state
//  588     extendedDelay = (uint16)((NWK_START_DELAY + startDelay)
//  589               + (osal_rand() & EXTENDED_JOINING_RANDOM_MASK));
??ZDOInitDevice_0:
        ; Setup parameters for call to function osal_rand
        LCALL   ??osal_rand?relay
        MOV     ?V0 + 0,R2
        MOV     R0,?V0 + 0
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     A,#0x7f
        ANL     A,R0
        MOV     R0,A
        MOVX    A,@DPTR
        ADD     A,R0
        MOV     R0,A
        INC     DPTR
        MOVX    A,@DPTR
        ADDC    A,#0x0
        MOV     R1,A
        MOV     A,#0x64
        ADD     A,R0
        MOV     R6,A
        CLR     A
        ADDC    A,R1
        MOV     R7,A
//  590   }
//  591 
//  592   // Initialize device security
//  593   ZDApp_SecInit( networkStateNV );
        ; Setup parameters for call to function ZDApp_SecInit
        MOV     R1,#0x1
        LCALL   ??ZDApp_SecInit?relay
//  594 
//  595   // Trigger the network start
//  596   ZDApp_NetworkInit( extendedDelay );
        ; Setup parameters for call to function ZDApp_NetworkInit
        MOV     A,R6
        MOV     R2,A
        MOV     A,R7
        MOV     R3,A
        LCALL   ??ZDApp_NetworkInit?relay
//  597 
//  598   return ( networkStateNV );
        MOV     R1,#0x1
??ZDOInitDevice_1:
        LJMP    ?Subroutine18 & 0xFFFF
        CFI EndBlock cfiBlock10
//  599 }
//  600 
//  601 /*********************************************************************
//  602  * @fn      ZDApp_ReadNetworkRestoreState
//  603  *
//  604  * @brief   Read the ZCD_NV_STARTUP_OPTION NV Item to state whether
//  605  *          or not to restore the network state.
//  606  *          If the read value has the ZCD_STARTOPT_DEFAULT_NETWORK_STATE
//  607  *          bit set return the ZDO_INITDEV_NEW_NETWORK_STATE.
//  608  *
//  609  * @param   none
//  610  *
//  611  * @return  ZDO_INITDEV_NEW_NETWORK_STATE
//  612  *          or ZDO_INITDEV_RESTORED_NETWORK_STATE based on whether or
//  613  *          not ZCD_STARTOPT_DEFAULT_NETWORK_STATE bit is set in
//  614  *          ZCD_NV_STARTUP_OPTION
//  615  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  616 uint8 ZDApp_ReadNetworkRestoreState( void )
ZDApp_ReadNetworkRestoreState:
        CFI Block cfiBlock11 Using cfiCommon0
        CFI Function ZDApp_ReadNetworkRestoreState
//  617 {
        FUNCALL ZDApp_ReadNetworkRestoreState, zgReadStartupOptions
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0x9
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        ; Saved register size: 9
        ; Auto size: 0
//  618   uint8 networkStateNV = ZDO_INITDEV_RESTORED_NETWORK_STATE;
        MOV     R6,#0x0
//  619 
//  620   // Look for the New Network State option.
//  621   if ( zgReadStartupOptions() & ZCD_STARTOPT_DEFAULT_NETWORK_STATE )
        ; Setup parameters for call to function zgReadStartupOptions
        LCALL   ??zgReadStartupOptions?relay
        MOV     A,R1
        MOV     C,0xE0 /* A   */.1
        JNC     ??ZDApp_ReadNetworkRestoreState_0
//  622   {
//  623     networkStateNV = ZDO_INITDEV_NEW_NETWORK_STATE;
        INC     R6
//  624   }
//  625 
//  626   return ( networkStateNV );
??ZDApp_ReadNetworkRestoreState_0:
        MOV     A,R6
        MOV     R1,A
        CFI EndBlock cfiBlock11
        REQUIRE ?Subroutine20
        ; // Fall through to label ?Subroutine20
//  627 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine20:
        CFI Block cfiBlock12 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        MOV     R7,#0x1
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock12
//  628 
//  629 /*********************************************************************
//  630  * @fn      ZDAppDetermineDeviceType()
//  631  *
//  632  * @brief   Determines the type of device to start.  Right now
//  633  *          this only works with the SOFT_START feature.  So it doesn't
//  634  *          support the end device type.
//  635  *
//  636  *          Looks at zgDeviceLogicalType and determines what type of
//  637  *          device to start.  The types are:
//  638  *            ZG_DEVICETYPE_COORDINATOR
//  639  *            ZG_DEVICETYPE_ROUTER
//  640  *            ZG_DEVICETYPE_ENDDEVICE - not supported yet.
//  641  *            ZG_DEVICETYPE_SOFT - looks for coordinator, if one doesn't
//  642  *               exist, becomes one.  This option is should only be used
//  643  *               if the system is manually configured and you are insured
//  644  *               that the first device is started before all the other
//  645  *               devices are started.
//  646  *
//  647  * @param   none
//  648  *
//  649  * @return  none
//  650  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  651 void ZDAppDetermineDeviceType( void )
ZDAppDetermineDeviceType:
        CFI Block cfiBlock13 Using cfiCommon0
        CFI Function ZDAppDetermineDeviceType
//  652 {
        ; Saved register size: 0
        ; Auto size: 0
//  653   if ( zgDeviceLogicalType == ZG_DEVICETYPE_ENDDEVICE )
        LJMP    ?BRET
        CFI EndBlock cfiBlock13
//  654     return;
//  655 
//  656 #if defined ( SOFT_START )
//  657   if ( zgDeviceLogicalType == ZG_DEVICETYPE_COORDINATOR )
//  658   {
//  659     devStartMode = MODE_HARD;     // Start as a coordinator
//  660     ZDO_Config_Node_Descriptor.LogicalType = NODETYPE_COORDINATOR;
//  661   }
//  662   else
//  663   {
//  664     if ( zgDeviceLogicalType == ZG_DEVICETYPE_ROUTER )
//  665     {
//  666       softStartAllowCoord = FALSE;  // Don't allow coord to start
//  667       continueJoining = TRUE;
//  668     }
//  669     devStartMode = MODE_JOIN;     // Assume joining
//  670   }
//  671 #endif // SOFT_START
//  672 }
//  673 
//  674 /*********************************************************************
//  675  * @fn      ZDApp_NetworkStartEvt()
//  676  *
//  677  * @brief   Process the Network Start Event
//  678  *
//  679  * @param   none
//  680  *
//  681  * @return  none
//  682  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  683 void ZDApp_NetworkStartEvt( void )
ZDApp_NetworkStartEvt:
        CFI Block cfiBlock14 Using cfiCommon0
        CFI Function ZDApp_NetworkStartEvt
//  684 {
        FUNCALL ZDApp_NetworkStartEvt, osal_pwrmgr_device
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkStartEvt, osal_set_event
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkStartEvt, NLME_GetEnergyThreshold
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkStartEvt, NLME_GetEnergyThreshold
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkStartEvt, NLME_SetEnergyThreshold
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkStartEvt, osal_set_event
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkStartEvt, osal_set_event
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  685   if ( nwkStatus == ZSuccess )
        MOV     DPTR,#nwkStatus
        MOVX    A,@DPTR
        JNZ     ??ZDApp_NetworkStartEvt_0
//  686   {
//  687     // Successfully started a ZigBee network
//  688     if ( devState == DEV_COORD_STARTING )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x8
        JNZ     ??ZDApp_NetworkStartEvt_1
//  689     {
//  690       devState = DEV_ZB_COORD;
        MOV     A,#0x9
        MOVX    @DPTR,A
//  691     }
//  692 
//  693     osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
??ZDApp_NetworkStartEvt_1:
        ; Setup parameters for call to function osal_pwrmgr_device
        MOV     R1,#0x0
        LCALL   ??osal_pwrmgr_device?relay
//  694     osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
        ; Setup parameters for call to function osal_set_event
        SJMP    ??ZDApp_NetworkStartEvt_2
//  695   }
//  696   else
//  697   {
//  698     // Try again with a higher energy threshold !!
//  699     if ( ( NLME_GetEnergyThreshold() + ENERGY_SCAN_INCREMENT ) < 0xff )
??ZDApp_NetworkStartEvt_0:
        ; Setup parameters for call to function NLME_GetEnergyThreshold
        LCALL   ??NLME_GetEnergyThreshold?relay
        MOV     A,R1
        MOV     R0,A
        MOV     A,#0x10
        ADD     A,R0
        MOV     R0,A
        CLR     A
        ADDC    A,#0x0
        MOV     R1,A
        MOV     A,R0
        SUBB    A,#-0x1
        MOV     A,R1
        SUBB    A,#0x0
        CLR     C
        XRL     A,PSW
        RLC     A
        JNC     ??ZDApp_NetworkStartEvt_3
//  700     {
//  701       NLME_SetEnergyThreshold( (uint8)(NLME_GetEnergyThreshold() + ENERGY_SCAN_INCREMENT) );
        ; Setup parameters for call to function NLME_SetEnergyThreshold
        ; Setup parameters for call to function NLME_GetEnergyThreshold
        LCALL   ??NLME_GetEnergyThreshold?relay
        MOV     A,R1
        ADD     A,#0x10
        MOV     R1,A
        LCALL   ??NLME_SetEnergyThreshold?relay
//  702       osal_set_event( ZDAppTaskID, ZDO_NETWORK_INIT );
        ; Setup parameters for call to function osal_set_event
        MOV     R2,#0x1
        SJMP    ??ZDApp_NetworkStartEvt_4
//  703     }
//  704     else
//  705     {
//  706       // Failed to start network. Enter a dormant state (until user intervenes)
//  707       devState = DEV_INIT;
??ZDApp_NetworkStartEvt_3:
        MOV     A,#0x1
        MOV     DPTR,#devState
        MOVX    @DPTR,A
//  708       osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
        ; Setup parameters for call to function osal_set_event
??ZDApp_NetworkStartEvt_2:
        MOV     R2,#0x10
??ZDApp_NetworkStartEvt_4:
        LJMP    ?Subroutine16 & 0xFFFF
        CFI EndBlock cfiBlock14
//  709     }
//  710   }
//  711 }
//  712 
//  713 #if ( SECURE != 0 )
//  714 /*********************************************************************
//  715  * @fn      ZDApp_DeviceAuthEvt()
//  716  *
//  717  * @brief   Process the Device Authentic Event
//  718  *
//  719  * @param   none
//  720  *
//  721  * @return  none
//  722  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  723 void ZDApp_DeviceAuthEvt( void )
ZDApp_DeviceAuthEvt:
        CFI Block cfiBlock15 Using cfiCommon0
        CFI Function ZDApp_DeviceAuthEvt
//  724 {
        FUNCALL ZDApp_DeviceAuthEvt, ZDApp_ResetTimerCancel
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_DeviceAuthEvt, osal_set_event
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_DeviceAuthEvt, osal_pwrmgr_device
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_DeviceAuthEvt, NLME_StartRouterRequest
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_DeviceAuthEvt, ZDApp_NVUpdate
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_DeviceAuthEvt, ZDApp_SaveNwkKey
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_DeviceAuthEvt, ZDApp_NVUpdate
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  725   // received authentication from trust center
//  726   if ( devState == DEV_END_DEVICE_UNAUTH )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x5
        JNZ     ??ZDApp_DeviceAuthEvt_0
//  727   {
//  728     // Stop the reset timer so it doesn't reset
//  729     ZDApp_ResetTimerCancel();
        ; Setup parameters for call to function ZDApp_ResetTimerCancel
        LCALL   ??ZDApp_ResetTimerCancel?relay
//  730 
//  731     devState = DEV_END_DEVICE;
        LCALL   ?Subroutine0 & 0xFFFF
//  732     osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
//  733 
//  734     // Set the Power Manager Device
//  735 #if defined ( POWER_SAVING )
//  736     osal_pwrmgr_device( PWRMGR_BATTERY );
//  737 #endif
//  738 
//  739 #if defined ( RTR_NWK )
//  740     if ( ZDO_Config_Node_Descriptor.LogicalType != NODETYPE_DEVICE )
??CrossCallReturnLabel_0:
        LCALL   ?Subroutine7 & 0xFFFF
??CrossCallReturnLabel_14:
        JZ      ??ZDApp_DeviceAuthEvt_1
//  741     {
//  742       // NOTE: first two parameters are not used, see NLMEDE.h for details
//  743       NLME_StartRouterRequest( 0, 0, false );
        ; Setup parameters for call to function NLME_StartRouterRequest
        MOV     R3,#0x0
        MOV     R2,#0x0
        MOV     R1,#0x0
        LCALL   ??NLME_StartRouterRequest?relay
//  744     }
//  745 #endif  // RTR
//  746 
//  747     // Notify to save info into NV
//  748     ZDApp_NVUpdate();
??ZDApp_DeviceAuthEvt_1:
        ; Setup parameters for call to function ZDApp_NVUpdate
        LCALL   ??ZDApp_NVUpdate?relay
//  749 
//  750     // Save off the security
//  751     ZDApp_SaveNwkKey();
        ; Setup parameters for call to function ZDApp_SaveNwkKey
        LCALL   ??ZDApp_SaveNwkKey?relay
        SJMP    ??ZDApp_DeviceAuthEvt_2
//  752 
//  753 #if defined ( ZDO_ENDDEVICE_ANNCE_GENERATE )
//  754     ZDP_EndDeviceAnnce( ZDAppNwkAddr.addr.shortAddr, saveExtAddr,
//  755                        ZDO_Config_Node_Descriptor.CapabilityFlags, 0 );
//  756 #endif
//  757   }
//  758   else
//  759   {
//  760     ZDApp_NVUpdate();
??ZDApp_DeviceAuthEvt_0:
        ; Setup parameters for call to function ZDApp_NVUpdate
        LCALL   ??ZDApp_NVUpdate?relay
//  761   }
//  762 }
??ZDApp_DeviceAuthEvt_2:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock15
//  763 #endif
//  764 
//  765 /*********************************************************************
//  766  * @fn      ZDApp_SaveNetworkStateEvt()
//  767  *
//  768  * @brief   Process the Save the Network State Event
//  769  *
//  770  * @param   none
//  771  *
//  772  * @return  none
//  773  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  774 void ZDApp_SaveNetworkStateEvt( void )
ZDApp_SaveNetworkStateEvt:
        CFI Block cfiBlock16 Using cfiCommon0
        CFI Function ZDApp_SaveNetworkStateEvt
//  775 {
        ; Saved register size: 0
        ; Auto size: 0
//  776 #if defined ( NV_RESTORE )
//  777  #if defined ( NV_TURN_OFF_RADIO )
//  778   // Turn off the radio's receiver during an NV update
//  779   byte RxOnIdle;
//  780   byte x = false;
//  781   ZMacGetReq( ZMacRxOnIdle, &RxOnIdle );
//  782   ZMacSetReq( ZMacRxOnIdle, &x );
//  783  #endif
//  784 
//  785   // Update the Network State in NV
//  786   NLME_UpdateNV( NWK_NV_NIB_ENABLE        |
//  787                  NWK_NV_DEVICELIST_ENABLE |
//  788                  NWK_NV_BINDING_ENABLE    |
//  789                  NWK_NV_ADDRMGR_ENABLE );
//  790 
//  791   // Reset the NV startup option to resume from NV by
//  792   // clearing the "New" join option.
//  793   zgWriteStartupOptions( FALSE, ZCD_STARTOPT_DEFAULT_NETWORK_STATE );
//  794 
//  795  #if defined ( NV_TURN_OFF_RADIO )
//  796   ZMacSetReq( ZMacRxOnIdle, &RxOnIdle );
//  797  #endif
//  798 #endif  // NV_RESTORE
//  799 }
        LJMP    ?BRET
        CFI EndBlock cfiBlock16
//  800 
//  801 /*********************************************************************
//  802  * @fn      ZDApp_RestoreNetworkState()
//  803  *
//  804  * @brief   This function will restore the network state of the
//  805  *          device if the network state is stored in NV.
//  806  *
//  807  * @param   none
//  808  *
//  809  * @return
//  810  *    ZDO_INITDEV_RESTORED_NETWORK_STATE  - The device's network state was
//  811  *          restored.
//  812  *    ZDO_INITDEV_NEW_NETWORK_STATE - The network state was not used.
//  813  *          This could mean that zgStartupOption said to not restore, or
//  814  *          it could mean that there was no network state to restore.
//  815  *
//  816  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  817 uint8 ZDApp_RestoreNetworkState( void )
ZDApp_RestoreNetworkState:
        CFI Block cfiBlock17 Using cfiCommon0
        CFI Function ZDApp_RestoreNetworkState
//  818 {
        FUNCALL ZDApp_RestoreNetworkState, NLME_InitNV
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_RestoreNetworkState, NLME_RestoreFromNV
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_RestoreNetworkState, NLME_GetShortAddr
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_RestoreNetworkState, osal_memset
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_RestoreNetworkState, osal_nv_item_init
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 33, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 33, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 21
        MOV     A,#-0x15
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 31)
//  819   byte nvStat;
//  820 #if ( SECURE != 0 )
//  821   nwkActiveKeyItems keyItems;
//  822 #endif
//  823 
//  824   // Initialize NWK NV items
//  825   nvStat = NLME_InitNV();
        ; Setup parameters for call to function NLME_InitNV
        LCALL   ??NLME_InitNV?relay
        MOV     A,R1
        MOV     R6,A
//  826 
//  827   if ( nvStat != NV_OPER_FAILED )
        MOV     A,#0x10
        XRL     A,R6
        JZ      ??ZDApp_RestoreNetworkState_0
//  828   {
//  829     if ( NLME_RestoreFromNV() )
        ; Setup parameters for call to function NLME_RestoreFromNV
        LCALL   ??NLME_RestoreFromNV?relay
        MOV     A,R1
        JZ      ??ZDApp_RestoreNetworkState_1
//  830     {
//  831       // Are we a coordinator
//  832       ZDAppNwkAddr.addr.shortAddr = NLME_GetShortAddr();
        ; Setup parameters for call to function NLME_GetShortAddr
        LCALL   ??NLME_GetShortAddr?relay
        MOV     DPTR,#ZDAppNwkAddr
        MOV     A,R2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R3
        MOVX    @DPTR,A
//  833       if ( ZDAppNwkAddr.addr.shortAddr == 0 )
        MOV     DPTR,#ZDAppNwkAddr
        MOVX    A,@DPTR
        JNZ     ??ZDApp_RestoreNetworkState_2
        INC     DPTR
        MOVX    A,@DPTR
??ZDApp_RestoreNetworkState_2:
        JNZ     ??ZDApp_RestoreNetworkState_3
//  834       {
//  835         ZDO_Config_Node_Descriptor.LogicalType = NODETYPE_COORDINATOR;
        MOV     DPTR,#ZDO_Config_Node_Descriptor
        MOVX    A,@DPTR
        ANL     A,#0xf8
        MOVX    @DPTR,A
//  836       }
//  837       devStartMode = MODE_RESUME;
??ZDApp_RestoreNetworkState_3:
        MOV     A,#0x1
        MOV     DPTR,#devStartMode
        MOVX    @DPTR,A
        SJMP    ??ZDApp_RestoreNetworkState_4
//  838     }
//  839     else
//  840       nvStat = NV_ITEM_UNINIT;
??ZDApp_RestoreNetworkState_1:
        MOV     R6,#0xf
//  841 
//  842 #if   ( SECURE != 0  )
//  843     nwkFrameCounterChanges = 0;
??ZDApp_RestoreNetworkState_4:
        MOV     DPTR,#nwkFrameCounterChanges
        CLR     A
        MOVX    @DPTR,A
        INC     DPTR
        MOVX    @DPTR,A
//  844     osal_memset( &keyItems, 0, sizeof( nwkActiveKeyItems ) );
        ; Setup parameters for call to function osal_memset
        MOV     R4,#0x15
        MOV     R5,A
        MOV     R1,A
        LCALL   ??Subroutine12_0 & 0xFFFF
//  845     osal_nv_item_init( ZCD_NV_NWKKEY, sizeof(nwkActiveKeyItems), (void *)&keyItems );
??CrossCallReturnLabel_31:
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 33)
        MOV     R4,#0x15
        MOV     R5,#0x0
        MOV     R2,#-0x7e
        MOV     R3,#0x0
        LCALL   ??osal_nv_item_init?relay
        MOV     A,#0x2
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 31)
//  846 
//  847   #if defined ( ZDO_COORDINATOR )
//  848     ZDApp_RestoreNwkKey();
//  849   #endif // ZDO_COORDINATOR
//  850 #endif // SECURE
//  851 
//  852     // The default for RxOnWhenIdle is true for RTR_NWK and false for end devices
//  853     // [setup in the NLME_RestoreFromNV()].  Change it here if you want something
//  854     // other than default.
//  855   }
//  856 
//  857   if ( nvStat == ZSUCCESS )
??ZDApp_RestoreNetworkState_0:
        MOV     A,R6
        JNZ     ??ZDApp_RestoreNetworkState_5
//  858     return ( ZDO_INITDEV_RESTORED_NETWORK_STATE );
        MOV     R1,#0x0
        SJMP    ??ZDApp_RestoreNetworkState_6
//  859   else
//  860     return ( ZDO_INITDEV_NEW_NETWORK_STATE );
??ZDApp_RestoreNetworkState_5:
        MOV     R1,#0x1
        CFI EndBlock cfiBlock17
??ZDApp_RestoreNetworkState_6:
        REQUIRE ?Subroutine22
        ; // Fall through to label ?Subroutine22
//  861 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine22:
        CFI Block cfiBlock18 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 31)
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        MOV     A,#0x15
        LJMP    ??Subroutine18_0 & 0xFFFF
        CFI EndBlock cfiBlock18
//  862 
//  863 /*********************************************************************
//  864  * @fn      ZDApp_InitUserDesc()
//  865  *
//  866  * @brief   Initialize the User Descriptor, the descriptor is read from NV
//  867  *          when needed.  If you want to initialize the User descriptor to
//  868  *          something other than all zero, do it here.
//  869  *
//  870  * @param   none
//  871  *
//  872  * @return  none
//  873  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  874 void ZDApp_InitUserDesc( void )
ZDApp_InitUserDesc:
        CFI Block cfiBlock19 Using cfiCommon0
        CFI Function ZDApp_InitUserDesc
//  875 {
        FUNCALL ZDApp_InitUserDesc, osal_memset
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 27, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 27, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_InitUserDesc, osal_nv_item_init
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 29, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 29, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_InitUserDesc, osal_nv_read
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 17
        MOV     A,#-0x11
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 27)
//  876   UserDescriptorFormat_t ZDO_DefaultUserDescriptor;
//  877 
//  878   // Initialize the User Descriptor, the descriptor is read from NV
//  879   // when needed.  If you want to initialize the User descriptor to something
//  880   // other than all zero, do it here.
//  881   osal_memset( &ZDO_DefaultUserDescriptor, 0, sizeof( UserDescriptorFormat_t ) );
        ; Setup parameters for call to function osal_memset
        MOV     R4,#0x11
        LCALL   ?Subroutine12 & 0xFFFF
//  882   if ( ZSUCCESS == osal_nv_item_init( ZCD_NV_USERDESC,
//  883          sizeof(UserDescriptorFormat_t), (void*)&ZDO_DefaultUserDescriptor ) )
??CrossCallReturnLabel_29:
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 29)
        MOV     R4,#0x11
        MOV     R5,#0x0
        MOV     R2,#-0x7f
        MOV     R3,#0x0
        LCALL   ??osal_nv_item_init?relay
        MOV     A,#0x2
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 27)
        MOV     A,R1
        JNZ     ??ZDApp_InitUserDesc_0
//  884   {
//  885     if ( ZSUCCESS == osal_nv_read( ZCD_NV_USERDESC, 0,
//  886          sizeof(UserDescriptorFormat_t), (void*)&ZDO_DefaultUserDescriptor ) )
        ; Setup parameters for call to function osal_nv_read
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 29)
        MOV     ?V0 + 0,#0x11
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 31)
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#-0x7f
        MOV     R3,#0x0
        LCALL   ??osal_nv_read?relay
        MOV     A,#0x4
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 27)
        MOV     A,R1
        JNZ     ??ZDApp_InitUserDesc_0
//  887     {
//  888       if ( ZDO_DefaultUserDescriptor.len != 0 )
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOVX    A,@DPTR
        JZ      ??ZDApp_InitUserDesc_0
//  889       {
//  890         ZDO_Config_Node_Descriptor.UserDescAvail = TRUE;
        MOV     DPTR,#ZDO_Config_Node_Descriptor
        MOVX    A,@DPTR
        SETB    0xE0 /* A   */.4
        MOVX    @DPTR,A
//  891       }
//  892     }
//  893   }
//  894 }
??ZDApp_InitUserDesc_0:
        MOV     A,#0x11
        LJMP    ??Subroutine18_0 & 0xFFFF
        CFI EndBlock cfiBlock19

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine12:
        CFI Block cfiCond20 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_29
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 27)
        CFI Block cfiCond21 Using cfiCommon0
        CFI (cfiCond21) NoFunction
        CFI (cfiCond21) Conditional ??CrossCallReturnLabel_30
        CFI (cfiCond21) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond21) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond21) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond21) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond21) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond21) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond21) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond21) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond21) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond21) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond21) CFA_SP SP+0
        CFI (cfiCond21) CFA_XSP16 add(XSP16, 31)
        CFI Block cfiPicker22 Using cfiCommon1
        CFI (cfiPicker22) NoFunction
        CFI (cfiPicker22) Picker
        MOV     R5,#0x0
        MOV     R1,#0x0
        CFI Block cfiCond23 Using cfiCommon0
        CFI (cfiCond23) NoFunction
        CFI (cfiCond23) Conditional ??CrossCallReturnLabel_31
        CFI (cfiCond23) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond23) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond23) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond23) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond23) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond23) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond23) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond23) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond23) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond23) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond23) CFA_SP SP+0
        CFI (cfiCond23) CFA_XSP16 add(XSP16, 31)
??Subroutine12_0:
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R2,DPL
        MOV     R3,DPH
        LCALL   ??osal_memset?relay
        ; Setup parameters for call to function osal_nv_item_init
        ; Setup parameters for call to function osal_nv_write
        ; Setup parameters for call to function osal_nv_item_init
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     ?V0 + 0,DPL
        MOV     ?V0 + 1,DPH
        MOV     R0,#?V0 + 0
        RET
        CFI EndBlock cfiCond20
        CFI EndBlock cfiCond21
        CFI EndBlock cfiPicker22
        CFI EndBlock cfiCond23
//  895 
//  896 /*********************************************************************
//  897  * @fn      ZDAppCheckForHoldKey()
//  898  *
//  899  * @brief   Check for key to set the device into Hold Auto Start
//  900  *
//  901  * @param   none
//  902  *
//  903  * @return  none
//  904  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  905 void ZDAppCheckForHoldKey( void )
ZDAppCheckForHoldKey:
        CFI Block cfiBlock24 Using cfiCommon0
        CFI Function ZDAppCheckForHoldKey
//  906 {
        FUNCALL ZDAppCheckForHoldKey, HalKeyRead
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  907 #if (defined HAL_KEY) && (HAL_KEY == TRUE)
//  908   // Get Keypad directly to see if a HOLD_START is needed.
//  909   // Hold down the SW_BYPASS_START key (see OnBoard.h)
//  910   // while booting to avoid starting up the device.
//  911   if ( HalKeyRead () == SW_BYPASS_START)
        ; Setup parameters for call to function HalKeyRead
        LCALL   ??HalKeyRead?relay
        MOV     A,R1
        XRL     A,#0x1
        JNZ     ??ZDAppCheckForHoldKey_0
//  912   {
//  913     // Change the device state to HOLD on start up
//  914     devState = DEV_HOLD;
        CLR     A
        MOV     DPTR,#devState
        MOVX    @DPTR,A
//  915   }
//  916 #endif // HAL_KEY
//  917 }
??ZDAppCheckForHoldKey_0:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock24
//  918 
//  919 /*********************************************************************
//  920  * @fn      ZDApp_ProcessOSALMsg()
//  921  *
//  922  * @brief   Process the incoming task message.
//  923  *
//  924  * @param   msgPtr - message to process
//  925  *
//  926  * @return  none
//  927  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  928 void ZDApp_ProcessOSALMsg( osal_event_hdr_t *msgPtr )
ZDApp_ProcessOSALMsg:
        CFI Block cfiBlock25 Using cfiCommon0
        CFI Function ZDApp_ProcessOSALMsg
//  929 {
        FUNCALL ZDApp_ProcessOSALMsg, ZDP_IncomingData
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDApp_NodeProfileSync
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, NLME_JoinRequest
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 11, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 11, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, osal_rand
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, NLME_ReJoinRequest
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, osal_rand
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, NLME_SetPollRate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, NLME_SetQueuedPollRate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, NLME_SetResponseRate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, osal_rand
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDApp_ProcessNetworkJoin
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, osal_set_event
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDSecMgrTransportKeyInd
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDSecMgrRemoveDeviceInd
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessOSALMsg, ZDSecMgrSwitchKeyInd
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
        MOV     A,R2
        MOV     R6,A
        MOV     A,R3
        MOV     R7,A
//  930   // Data Confirmation message fields
//  931   byte sentEP;       // This should always be 0
//  932   byte sentStatus;
//  933   afDataConfirm_t *afDataConfirm;
//  934 
//  935   switch ( msgPtr->event )
        MOV     DPL,R6
        MOV     DPH,R7
        MOVX    A,@DPTR
        LCALL   ?UC_SWITCH_SPARSE
`?<Jumptable for ZDApp_ProcessOSALMsg>_0`:
        DATA
        DB        0
        DB        7
        DB        1
        DW        ??ZDApp_ProcessOSALMsg_0
        DB        2
        DW        ??ZDApp_ProcessOSALMsg_1
        DB        3
        DW        ??ZDApp_ProcessOSALMsg_2
        DB        6
        DW        ??ZDApp_ProcessOSALMsg_3
        DB        8
        DW        ??ZDApp_ProcessOSALMsg_4
        DB        10
        DW        ??ZDApp_ProcessOSALMsg_5
        DB        26
        DW        ??ZDApp_ProcessOSALMsg_6
        DW        ??ZDApp_ProcessOSALMsg_7
        CODE
//  936   {
//  937     // Incoming ZDO Message
//  938     case AF_INCOMING_MSG_CMD:
//  939       ZDP_IncomingData( (afIncomingMSGPacket_t *)msgPtr );
??ZDApp_ProcessOSALMsg_6:
        ; Setup parameters for call to function ZDP_IncomingData
        LCALL   ??ZDP_IncomingData?relay
        LJMP    ??ZDApp_ProcessOSALMsg_7 & 0xFFFF
//  940       break;
//  941 
//  942     case ZDO_CB_MSG:
//  943       ZDApp_ProcessMsgCBs( (zdoIncomingMsg_t *)msgPtr );
//  944       break;
//  945 
//  946     case AF_DATA_CONFIRM_CMD:
//  947       // This message is received as a confirmation of a data packet sent.
//  948       // The status is of ZStatus_t type [defined in NLMEDE.h]
//  949       // The message fields are defined in AF.h
//  950       afDataConfirm = (afDataConfirm_t *)msgPtr;
//  951       sentEP = afDataConfirm->endpoint;
//  952       sentStatus = afDataConfirm->hdr.status;
//  953 
//  954       // Action taken when confirmation is received.
//  955       /* Put code here */
//  956 #if !defined ( RTR_NWK )
//  957       if ( sentStatus == ZMacNoACK )
//  958       {
//  959         //ZDApp_SendMsg( ZDAppTaskID, ZDO_NWK_JOIN_REQ, sizeof(osal_event_hdr_t), NULL );
//  960       }
//  961 #else
//  962      (void)sentStatus;
//  963 #endif
//  964       break;
//  965 
//  966     case ZDO_NWK_DISC_CNF:
//  967       if (devState != DEV_NWK_DISC)
??ZDApp_ProcessOSALMsg_0:
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x2
        JZ      $+5
        LJMP    ??ZDApp_ProcessOSALMsg_7 & 0xFFFF
//  968       {
//  969       }
//  970 #if !defined ( ZDO_COORDINATOR ) || defined ( SOFT_START )
//  971   #if defined ( MANAGED_SCAN )
//  972       else if ( (((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->hdr.status == ZDO_SUCCESS) && (zdoDiscCounter > NUM_DISC_ATTEMPTS) )
//  973   #else
//  974       else if ( (((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->hdr.status == ZDO_SUCCESS) && (zdoDiscCounter++ > NUM_DISC_ATTEMPTS) )
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        MOVX    A,@DPTR
        JNZ     ??ZDApp_ProcessOSALMsg_8
        MOV     DPTR,#zdoDiscCounter
        MOVX    A,@DPTR
        MOV     R2,A
        MOV     A,#0x1
        ADD     A,R2
        MOVX    @DPTR,A
        MOV     A,R2
        CLR     C
        SUBB    A,#0x3
        JC      ??ZDApp_ProcessOSALMsg_8
//  975   #endif
//  976       {
//  977         if ( devStartMode == MODE_JOIN )
        MOV     DPTR,#devStartMode
        MOVX    A,@DPTR
        JNZ     ??ZDApp_ProcessOSALMsg_9
//  978         {
//  979           devState = DEV_NWK_JOINING;
        MOV     A,#0x3
        MOV     DPTR,#devState
        MOVX    @DPTR,A
//  980 
//  981           ZDApp_NodeProfileSync((ZDO_NetworkDiscoveryCfm_t *)msgPtr);
        ; Setup parameters for call to function ZDApp_NodeProfileSync
        MOV     A,R6
        MOV     R2,A
        LCALL   ??ZDApp_NodeProfileSync?relay
//  982 
//  983           if ( NLME_JoinRequest( ((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->extendedPANID,
//  984                BUILD_UINT16( ((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->panIdLSB, ((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->panIdMSB ),
//  985                ((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->logicalChannel,
//  986                ZDO_Config_Node_Descriptor.CapabilityFlags ) != ZSuccess )
        ; Setup parameters for call to function NLME_JoinRequest
        MOV     DPTR,#(ZDO_Config_Node_Descriptor + 2)
        MOVX    A,@DPTR
        MOV     ?V0 + 0,A
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_ONE
        CFI CFA_XSP16 add(XSP16, 11)
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R1,A
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R4,A
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R5,A
        MOV     A,R6
        ADD     A,#0x6
        MOV     R2,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     R3,A
        LCALL   ??NLME_JoinRequest?relay
        MOV     A,#0x1
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 10)
        SJMP    ??ZDApp_ProcessOSALMsg_10
//  987           {
//  988             ZDApp_NetworkInit( (uint16)(NWK_START_DELAY
//  989                 + ((uint16)(osal_rand()& EXTENDED_JOINING_RANDOM_MASK))) );
//  990           }
//  991         }
//  992         else if ( devStartMode == MODE_REJOIN )
??ZDApp_ProcessOSALMsg_9:
        XRL     A,#0x3
        JNZ     ??CrossCallReturnLabel_42
//  993         {
//  994           devState = DEV_NWK_REJOIN;
        MOV     A,#0x4
        MOV     DPTR,#devState
        MOVX    @DPTR,A
//  995           if ( NLME_ReJoinRequest() != ZSuccess )
        ; Setup parameters for call to function NLME_ReJoinRequest
        LCALL   ??NLME_ReJoinRequest?relay
??ZDApp_ProcessOSALMsg_10:
        MOV     A,R1
        JZ      ??CrossCallReturnLabel_42
//  996           {
//  997             ZDApp_NetworkInit( (uint16)(NWK_START_DELAY
//  998                 + ((uint16)(osal_rand()& EXTENDED_JOINING_RANDOM_MASK))) );
        ; Setup parameters for call to function ZDApp_NetworkInit
        ; Setup parameters for call to function osal_rand
        LCALL   ?Subroutine9 & 0xFFFF
//  999           }
// 1000         }
// 1001 
// 1002         if ( ZDO_Config_Node_Descriptor.CapabilityFlags & CAPINFO_RCVR_ON_IDLE )
??CrossCallReturnLabel_42:
        MOV     DPTR,#(ZDO_Config_Node_Descriptor + 2)
        MOVX    A,@DPTR
        MOV     C,0xE0 /* A   */.3
        JNC     ??ZDApp_ProcessOSALMsg_7
// 1003         {
// 1004           // The receiver is on, turn network layer polling off.
// 1005           NLME_SetPollRate( 0 );
        ; Setup parameters for call to function NLME_SetPollRate
        LCALL   ?Subroutine13 & 0xFFFF
// 1006           NLME_SetQueuedPollRate( 0 );
// 1007           NLME_SetResponseRate( 0 );
??CrossCallReturnLabel_32:
        SJMP    ??ZDApp_ProcessOSALMsg_7
// 1008         }
// 1009       }
// 1010       else
// 1011       {
// 1012 #if defined ( SOFT_START ) && !defined ( VIRTKEY_SOFT_START )
// 1013   #if defined ( MANAGED_SCAN )
// 1014         if ( (softStartAllowCoord)
// 1015             && (((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->hdr.status != ZDO_SUCCESS )
// 1016               && (zdoDiscCounter > NUM_DISC_ATTEMPTS) )
// 1017   #else
// 1018         if ( (softStartAllowCoord)
// 1019             && (((ZDO_NetworkDiscoveryCfm_t *)msgPtr)->hdr.status != ZDO_SUCCESS )
// 1020               && (zdoDiscCounter++ > NUM_DISC_ATTEMPTS) )
// 1021   #endif
// 1022         {
// 1023           ZDO_Config_Node_Descriptor.LogicalType = NODETYPE_COORDINATOR;
// 1024           devStartMode = MODE_HARD;
// 1025         }
// 1026         else if ( continueJoining == FALSE )
// 1027         {
// 1028           devState = DEV_HOLD;
// 1029           osal_stop_timerEx( ZDAppTaskID, ZDO_NETWORK_INIT );
// 1030           break;    // Don't init
// 1031         }
// 1032 #endif
// 1033   #if defined ( MANAGED_SCAN )
// 1034         ZDApp_NetworkInit( MANAGEDSCAN_DELAY_BETWEEN_SCANS );
// 1035   #else
// 1036         if ( continueJoining )
??ZDApp_ProcessOSALMsg_8:
        MOV     DPTR,#continueJoining
        MOVX    A,@DPTR
        JZ      ??ZDApp_ProcessOSALMsg_7
// 1037         {
// 1038           ZDApp_NetworkInit( (uint16)(BEACON_REQUEST_DELAY
// 1039               + ((uint16)(osal_rand()& BEACON_REQ_DELAY_MASK))) );
        ; Setup parameters for call to function ZDApp_NetworkInit
        ; Setup parameters for call to function osal_rand
        LCALL   ??osal_rand?relay
        MOV     ?V0 + 0,R2
        MOV     A,#-0x1
        ANL     A,?V0 + 0
        MOV     R0,A
        MOV     A,#0x64
        ADD     A,R0
        MOV     R2,A
        CLR     A
        ADDC    A,#0x0
        MOV     R3,A
        LCALL   ??ZDApp_NetworkInit?relay
        SJMP    ??ZDApp_ProcessOSALMsg_7
// 1040         }
// 1041   #endif
// 1042       }
// 1043 #endif  // !ZDO_COORDINATOR
// 1044       break;
// 1045 
// 1046 #if !defined( ZDO_COORDINATOR ) || defined( SOFT_START )
// 1047     case ZDO_NWK_JOIN_IND:
// 1048       ZDApp_ProcessNetworkJoin();
??ZDApp_ProcessOSALMsg_1:
        ; Setup parameters for call to function ZDApp_ProcessNetworkJoin
        LCALL   ??ZDApp_ProcessNetworkJoin?relay
        SJMP    ??ZDApp_ProcessOSALMsg_7
// 1049       break;
// 1050 
// 1051     case ZDO_NWK_JOIN_REQ:
// 1052       retryCnt = 0;
??ZDApp_ProcessOSALMsg_2:
        CLR     A
        MOV     DPTR,#retryCnt
        MOVX    @DPTR,A
// 1053       devStartMode = MODE_RESUME;
        MOV     A,#0x1
        MOV     DPTR,#devStartMode
        MOVX    @DPTR,A
// 1054       _tmpRejoinState = true;
        MOV     DPTR,#_tmpRejoinState
        MOVX    @DPTR,A
// 1055       zgDefaultStartingScanDuration = BEACON_ORDER_60_MSEC;
        MOV     A,#0x2
        MOV     DPTR,#zgDefaultStartingScanDuration
        LCALL   ?Subroutine1 & 0xFFFF
// 1056       ZDApp_NetworkInit( 0 );
// 1057 
// 1058       // indicate state change to apps
// 1059       devState = DEV_INIT;
??CrossCallReturnLabel_40:
        MOV     A,#0x1
        MOV     DPTR,#devState
        MOVX    @DPTR,A
// 1060       osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
        ; Setup parameters for call to function osal_set_event
        LCALL   ?Subroutine4 & 0xFFFF
??CrossCallReturnLabel_47:
        SJMP    ??ZDApp_ProcessOSALMsg_7
// 1061       break;
// 1062 #endif  // !ZDO_COORDINATOR
// 1063 
// 1064 #if defined ( ZDSECMGR_SECURE )
// 1065   #if defined ( ZDSECMGR_COMMERCIAL )
// 1066         case ZDO_ESTABLISH_KEY_CFM:
// 1067           ZDSecMgrEstablishKeyCfm
// 1068             ( (ZDO_EstablishKeyCfm_t*)msgPtr );
// 1069           break;
// 1070   #endif
// 1071 
// 1072   #if defined ( ZDSECMGR_COMMERCIAL )
// 1073     #if !defined ( ZDO_COORDINATOR ) || defined ( SOFT_START )
// 1074         case ZDO_ESTABLISH_KEY_IND:
// 1075           ZDSecMgrEstablishKeyInd
// 1076             ( (ZDO_EstablishKeyInd_t*)msgPtr );
// 1077           break;
// 1078     #endif
// 1079   #endif
// 1080 
// 1081   #if !defined ( ZDO_COORDINATOR ) || defined( SOFT_START )
// 1082         case ZDO_TRANSPORT_KEY_IND:
// 1083           ZDSecMgrTransportKeyInd
// 1084             ( (ZDO_TransportKeyInd_t*)msgPtr );
??ZDApp_ProcessOSALMsg_3:
        ; Setup parameters for call to function ZDSecMgrTransportKeyInd
        LCALL   ??ZDSecMgrTransportKeyInd?relay
        SJMP    ??ZDApp_ProcessOSALMsg_7
// 1085           break;
// 1086   #endif
// 1087 
// 1088   #if defined ( ZDO_COORDINATOR )
// 1089         case ZDO_UPDATE_DEVICE_IND:
// 1090           ZDSecMgrUpdateDeviceInd
// 1091             ( (ZDO_UpdateDeviceInd_t*)msgPtr );
// 1092           break;
// 1093   #endif
// 1094 
// 1095   #if defined ( RTR_NWK )
// 1096     #if !defined ( ZDO_COORDINATOR ) || defined( SOFT_START )
// 1097         case ZDO_REMOVE_DEVICE_IND:
// 1098           ZDSecMgrRemoveDeviceInd
// 1099             ( (ZDO_RemoveDeviceInd_t*)msgPtr );
??ZDApp_ProcessOSALMsg_4:
        ; Setup parameters for call to function ZDSecMgrRemoveDeviceInd
        LCALL   ??ZDSecMgrRemoveDeviceInd?relay
        SJMP    ??ZDApp_ProcessOSALMsg_7
// 1100           break;
// 1101     #endif
// 1102   #endif
// 1103 
// 1104   #if defined ( ZDSECMGR_COMMERCIAL )
// 1105     #if defined ( ZDO_COORDINATOR )
// 1106         case ZDO_REQUEST_KEY_IND:
// 1107           ZDSecMgrRequestKeyInd
// 1108             ( (ZDO_RequestKeyInd_t*)msgPtr );
// 1109           break;
// 1110     #endif
// 1111   #endif
// 1112 
// 1113   #if !defined ( ZDO_COORDINATOR ) || defined( SOFT_START )
// 1114         case ZDO_SWITCH_KEY_IND:
// 1115           ZDSecMgrSwitchKeyInd
// 1116             ( (ZDO_SwitchKeyInd_t*)msgPtr );
??ZDApp_ProcessOSALMsg_5:
        ; Setup parameters for call to function ZDSecMgrSwitchKeyInd
        LCALL   ??ZDSecMgrSwitchKeyInd?relay
// 1117           break;
// 1118   #endif
// 1119 
// 1120 #endif // defined ( ZDSECMGR_SECURE )
// 1121 
// 1122     default:
// 1123       break;
// 1124   }
// 1125 
// 1126   (void)sentEP;
// 1127 }
??ZDApp_ProcessOSALMsg_7:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock25
// 1128 
// 1129 /*********************************************************************
// 1130  * @fn      ZDApp_ProcessMsgCBs()
// 1131  *
// 1132  * @brief   Process response messages
// 1133  *
// 1134  * @param   none
// 1135  *
// 1136  * @return  none
// 1137  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1138 void ZDApp_ProcessMsgCBs( zdoIncomingMsg_t *inMsg )
ZDApp_ProcessMsgCBs:
        CFI Block cfiBlock26 Using cfiCommon0
        CFI Function ZDApp_ProcessMsgCBs
// 1139 {
        ; Saved register size: 0
        ; Auto size: 0
// 1140   switch ( inMsg->clusterID )
// 1141   {
// 1142 #if defined ( ZDO_NWKADDR_REQUEST ) || defined ( ZDO_IEEEADDR_REQUEST ) || defined ( REFLECTOR )
// 1143     case NWK_addr_rsp:
// 1144     case IEEE_addr_rsp:
// 1145       {
// 1146         ZDO_NwkIEEEAddrResp_t *pAddrRsp;
// 1147         pAddrRsp = ZDO_ParseAddrRsp( inMsg );
// 1148         if ( pAddrRsp )
// 1149         {
// 1150           if ( pAddrRsp->status == ZSuccess )
// 1151           {
// 1152             ZDO_UpdateAddrManager( pAddrRsp->nwkAddr, pAddrRsp->extAddr );
// 1153           }
// 1154           osal_mem_free( pAddrRsp );
// 1155         }
// 1156       }
// 1157       break;
// 1158 #endif
// 1159 
// 1160 #if defined ( REFLECTOR )
// 1161     case Bind_req:
// 1162     case Unbind_req:
// 1163       {
// 1164         ZDO_BindUnbindReq_t bindReq;
// 1165         ZDO_ParseBindUnbindReq( inMsg, &bindReq );
// 1166         ZDO_ProcessBindUnbindReq( inMsg, &bindReq );
// 1167       }
// 1168       break;
// 1169 #endif
// 1170 
// 1171 #if defined ( ZDO_COORDINATOR )
// 1172     case Bind_rsp:
// 1173     case Unbind_rsp:
// 1174       if ( matchED )
// 1175       {
// 1176         ZDMatchSendState(
// 1177              (uint8)((inMsg->clusterID == Bind_rsp) ? ZDMATCH_REASON_BIND_RSP : ZDMATCH_REASON_UNBIND_RSP),
// 1178              ZDO_ParseBindRsp(inMsg), inMsg->TransSeq );
// 1179       }
// 1180       break;
// 1181 
// 1182     case End_Device_Bind_req:
// 1183       {
// 1184         ZDEndDeviceBind_t bindReq;
// 1185         ZDO_ParseEndDeviceBindReq( inMsg, &bindReq );
// 1186         ZDO_MatchEndDeviceBind( &bindReq );
// 1187 
// 1188         // Freeing the cluster lists - if allocated.
// 1189         if ( bindReq.numInClusters )
// 1190           osal_mem_free( bindReq.inClusters );
// 1191         if ( bindReq.numOutClusters )
// 1192           osal_mem_free( bindReq.outClusters );
// 1193       }
// 1194       break;
// 1195 #endif
// 1196   }
// 1197 }
        LJMP    ?BRET
        CFI EndBlock cfiBlock26
// 1198 
// 1199 /*********************************************************************
// 1200  * @fn      ZDApp_RegisterCBs()
// 1201  *
// 1202  * @brief   Process response messages
// 1203  *
// 1204  * @param   none
// 1205  *
// 1206  * @return  none
// 1207  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1208 void ZDApp_RegisterCBs( void )
ZDApp_RegisterCBs:
        CFI Block cfiBlock27 Using cfiCommon0
        CFI Function ZDApp_RegisterCBs
// 1209 {
        ; Saved register size: 0
        ; Auto size: 0
// 1210 #if defined ( ZDO_IEEEADDR_REQUEST ) || defined ( REFLECTOR )
// 1211   ZDO_RegisterForZDOMsg( ZDAppTaskID, IEEE_addr_rsp );
// 1212 #endif
// 1213 #if defined ( ZDO_NWKADDR_REQUEST ) || defined ( REFLECTOR )
// 1214   ZDO_RegisterForZDOMsg( ZDAppTaskID, NWK_addr_rsp );
// 1215 #endif
// 1216 #if defined ( ZDO_COORDINATOR )
// 1217   ZDO_RegisterForZDOMsg( ZDAppTaskID, Bind_rsp );
// 1218   ZDO_RegisterForZDOMsg( ZDAppTaskID, Unbind_rsp );
// 1219   ZDO_RegisterForZDOMsg( ZDAppTaskID, End_Device_Bind_req );
// 1220 #endif
// 1221 #if defined ( REFLECTOR )
// 1222   ZDO_RegisterForZDOMsg( ZDAppTaskID, Bind_req );
// 1223   ZDO_RegisterForZDOMsg( ZDAppTaskID, Unbind_req );
// 1224 #endif
// 1225 }
        LJMP    ?BRET
        CFI EndBlock cfiBlock27
// 1226 
// 1227 #if !defined( ZDO_COORDINATOR ) || defined( SOFT_START )
// 1228 /*********************************************************************
// 1229  * @fn      ZDApp_ProcessNetworkJoin()
// 1230  *
// 1231  * @brief
// 1232  *
// 1233  *   Save off the Network key information.
// 1234  *
// 1235  * @param   none
// 1236  *
// 1237  * @return  none
// 1238  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1239 void ZDApp_ProcessNetworkJoin( void )
ZDApp_ProcessNetworkJoin:
        CFI Block cfiBlock28 Using cfiCommon0
        CFI Function ZDApp_ProcessNetworkJoin
// 1240 {
        FUNCALL ZDApp_ProcessNetworkJoin, osal_set_event
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, osal_pwrmgr_device
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, ZDApp_RestoreNwkKey
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, ZDApp_ResetTimerStart
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, NLME_StartRouterRequest
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, NLME_GetShortAddr
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, ZMacSetReq
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, osal_rand
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, ZDApp_RestoreNwkKey
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, osal_set_event
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, osal_pwrmgr_device
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, NLME_SetPollRate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, NLME_SetQueuedPollRate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, NLME_SetResponseRate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, osal_rand
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ProcessNetworkJoin, ZDApp_NetworkInit
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 2
        MOV     A,#-0x2
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 12)
// 1241   if ( (devState == DEV_NWK_JOINING) ||
// 1242       ((devState == DEV_NWK_ORPHAN)  &&
// 1243        (ZDO_Config_Node_Descriptor.LogicalType == NODETYPE_ROUTER)) )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x3
        JZ      ??ZDApp_ProcessNetworkJoin_0
        MOVX    A,@DPTR
        XRL     A,#0xa
        JZ      $+5
        LJMP    ??ZDApp_ProcessNetworkJoin_1 & 0xFFFF
        MOV     DPTR,#ZDO_Config_Node_Descriptor
        MOVX    A,@DPTR
        ANL     A,#0x7
        XRL     A,#0x1
        JZ      $+5
        LJMP    ??ZDApp_ProcessNetworkJoin_2 & 0xFFFF
// 1244   {
// 1245     // Result of a Join attempt by this device.
// 1246     if ( nwkStatus == ZSuccess )
??ZDApp_ProcessNetworkJoin_0:
        MOV     DPTR,#nwkStatus
        MOVX    A,@DPTR
        JNZ     ??ZDApp_ProcessNetworkJoin_3
// 1247     {
// 1248       osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
        ; Setup parameters for call to function osal_set_event
        LCALL   ?Subroutine4 & 0xFFFF
// 1249 
// 1250 #if defined ( POWER_SAVING )
// 1251       osal_pwrmgr_device( PWRMGR_BATTERY );
??CrossCallReturnLabel_48:
        ; Setup parameters for call to function osal_pwrmgr_device
        MOV     R1,#0x1
        LCALL   ??osal_pwrmgr_device?relay
// 1252 #endif
// 1253 
// 1254 #if   ( SECURE != 0  )
// 1255       if ( _NIB.SecurityLevel && (ZDApp_RestoreNwkKey() == false ) )
        MOV     DPTR,#(_NIB + 12)
        MOVX    A,@DPTR
        JZ      ??ZDApp_ProcessNetworkJoin_4
        ; Setup parameters for call to function ZDApp_RestoreNwkKey
        LCALL   ??ZDApp_RestoreNwkKey?relay
        MOV     A,R1
        JNZ     ??ZDApp_ProcessNetworkJoin_4
// 1256       {
// 1257         // wait for auth from trust center!!
// 1258         devState = DEV_END_DEVICE_UNAUTH;
        MOV     A,#0x5
        MOV     DPTR,#devState
        MOVX    @DPTR,A
// 1259 
// 1260         // Start the reset timer for MAX UNAUTH time
// 1261         ZDApp_ResetTimerStart( MAX_DEVICE_UNAUTH_TIMEOUT );
        ; Setup parameters for call to function ZDApp_ResetTimerStart
        MOV     R2,#-0x78
        MOV     R3,#0x13
        LCALL   ??ZDApp_ResetTimerStart?relay
        LJMP    ??CrossCallReturnLabel_43 & 0xFFFF
// 1262       }
// 1263       else
// 1264 #endif  // SECURE
// 1265       {
// 1266 #if defined ( RTR_NWK )
// 1267         if ( devState == DEV_NWK_ORPHAN
// 1268             && ZDO_Config_Node_Descriptor.LogicalType != NODETYPE_DEVICE )
??ZDApp_ProcessNetworkJoin_4:
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0xa
        JNZ     ??ZDApp_ProcessNetworkJoin_5
        LCALL   ?Subroutine7 & 0xFFFF
??CrossCallReturnLabel_15:
        JZ      ??ZDApp_ProcessNetworkJoin_5
// 1269         {
// 1270           // Change NIB state to router for restore
// 1271           _NIB.nwkState = NWK_ROUTER;
        MOV     A,#0x8
        MOV     DPTR,#(_NIB + 35)
        MOVX    @DPTR,A
// 1272         }
// 1273 #endif
// 1274         devState = DEV_END_DEVICE;
??ZDApp_ProcessNetworkJoin_5:
        MOV     A,#0x6
        MOV     DPTR,#devState
        MOVX    @DPTR,A
// 1275 #if defined ( RTR_NWK )
// 1276         // NOTE: first two parameters are not used, see NLMEDE.h for details
// 1277   #if !defined (AUTO_SOFT_START)
// 1278         if ( ZDO_Config_Node_Descriptor.LogicalType != NODETYPE_DEVICE )
        LCALL   ?Subroutine7 & 0xFFFF
??CrossCallReturnLabel_16:
        JNZ     $+5
        LJMP    ??CrossCallReturnLabel_43 & 0xFFFF
// 1279         {
// 1280           NLME_StartRouterRequest( 0, 0, false );
        ; Setup parameters for call to function NLME_StartRouterRequest
        MOV     R3,#0x0
        MOV     R2,#0x0
        MOV     R1,#0x0
        LCALL   ??NLME_StartRouterRequest?relay
        LJMP    ??CrossCallReturnLabel_43 & 0xFFFF
// 1281         }
// 1282   #endif // AUTO_SOFT_START
// 1283 #endif  // RTR
// 1284 
// 1285 #if defined ( ZDO_ENDDEVICE_ANNCE_GENERATE )
// 1286         ZDP_EndDeviceAnnce( ZDAppNwkAddr.addr.shortAddr, saveExtAddr,
// 1287                            ZDO_Config_Node_Descriptor.CapabilityFlags, 0 );
// 1288 #endif
// 1289       }
// 1290     }
// 1291     else
// 1292     {
// 1293       if ( (devStartMode == MODE_RESUME) && (++retryCnt >= MAX_RESUME_RETRY) )
??ZDApp_ProcessNetworkJoin_3:
        MOV     DPTR,#devStartMode
        MOVX    A,@DPTR
        XRL     A,#0x1
        JNZ     ??ZDApp_ProcessNetworkJoin_6
        MOV     DPTR,#retryCnt
        MOVX    A,@DPTR
        INC     A
        MOVX    @DPTR,A
        JZ      ??ZDApp_ProcessNetworkJoin_6
// 1294       {
// 1295         if ( _NIB.nwkPanId == 0xFFFF || _NIB.nwkPanId == INVALID_PAN_ID )
        MOV     DPTR,#(_NIB + 33)
        MOVX    A,@DPTR
        XRL     A,#0xff
        JNZ     ??ZDApp_ProcessNetworkJoin_7
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??ZDApp_ProcessNetworkJoin_7:
        JZ      ??ZDApp_ProcessNetworkJoin_8
        MOV     DPTR,#(_NIB + 33)
        MOVX    A,@DPTR
        XRL     A,#0xfe
        JNZ     ??ZDApp_ProcessNetworkJoin_9
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??ZDApp_ProcessNetworkJoin_9:
        JNZ     ??ZDApp_ProcessNetworkJoin_10
// 1296           devStartMode = MODE_JOIN;
??ZDApp_ProcessNetworkJoin_8:
        CLR     A
        MOV     DPTR,#devStartMode
        SJMP    ??ZDApp_ProcessNetworkJoin_11
// 1297         else
// 1298         {
// 1299           devStartMode = MODE_REJOIN;
??ZDApp_ProcessNetworkJoin_10:
        MOV     A,#0x3
        MOV     DPTR,#devStartMode
        MOVX    @DPTR,A
// 1300           _tmpRejoinState = true;
        MOV     A,#0x1
        MOV     DPTR,#_tmpRejoinState
??ZDApp_ProcessNetworkJoin_11:
        MOVX    @DPTR,A
// 1301         }
// 1302       }
// 1303 
// 1304       if ( (NLME_GetShortAddr() != INVALID_NODE_ADDR) ||
// 1305            (_NIB.nwkDevAddress != INVALID_NODE_ADDR) )
??ZDApp_ProcessNetworkJoin_6:
        ; Setup parameters for call to function NLME_GetShortAddr
        LCALL   ??NLME_GetShortAddr?relay
        MOV     ?V0 + 0,R2
        MOV     ?V0 + 1,R3
        MOV     A,#-0x2
        XRL     A,?V0 + 0
        JNZ     ??ZDApp_ProcessNetworkJoin_12
        MOV     A,#-0x1
        XRL     A,?V0 + 1
??ZDApp_ProcessNetworkJoin_12:
        JNZ     ??ZDApp_ProcessNetworkJoin_13
        MOV     DPTR,#(_NIB + 20)
        MOVX    A,@DPTR
        XRL     A,#0xfe
        JNZ     ??ZDApp_ProcessNetworkJoin_14
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??ZDApp_ProcessNetworkJoin_14:
        JZ      ??ZDApp_ProcessNetworkJoin_15
// 1306       {
// 1307         uint16 addr = INVALID_NODE_ADDR;
??ZDApp_ProcessNetworkJoin_13:
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     A,#-0x2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,#-0x1
        MOVX    @DPTR,A
// 1308         // Invalidate nwk addr so end device does not use in its data reqs.
// 1309         _NIB.nwkDevAddress = INVALID_NODE_ADDR;
        MOV     DPTR,#(_NIB + 20)
        MOV     A,#-0x2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,#-0x1
        MOVX    @DPTR,A
// 1310         ZMacSetReq( ZMacShortAddress, (byte *)&addr );
        ; Setup parameters for call to function ZMacSetReq
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R2,DPL
        MOV     R3,DPH
        MOV     R1,#0x53
        LCALL   ZMacSetReq & 0xFFFF
// 1311       }
// 1312 
// 1313       zdoDiscCounter = 1;
??ZDApp_ProcessNetworkJoin_15:
        MOV     A,#0x1
        MOV     DPTR,#zdoDiscCounter
        SJMP    ??ZDApp_ProcessNetworkJoin_16
        ; Setup parameters for call to function ZDApp_NetworkInit
        ; Setup parameters for call to function osal_rand
// 1314 
// 1315 //      ZDApp_NetworkInit( (uint16)
// 1316 //                         ((NWK_START_DELAY * (osal_rand() & 0x0F)) +
// 1317 //                          (NWK_START_DELAY * 5)) );
// 1318       ZDApp_NetworkInit( (uint16)(NWK_START_DELAY
// 1319            + ((uint16)(osal_rand()& EXTENDED_JOINING_RANDOM_MASK))) );
// 1320     }
// 1321   }
// 1322   else if ( devState == DEV_NWK_ORPHAN || devState == DEV_NWK_REJOIN )
??ZDApp_ProcessNetworkJoin_1:
        MOVX    A,@DPTR
        XRL     A,#0x4
        JNZ     ??CrossCallReturnLabel_43
// 1323   {
// 1324     // results of an orphaning attempt by this device
// 1325     if (nwkStatus == ZSuccess)
??ZDApp_ProcessNetworkJoin_2:
        MOV     DPTR,#nwkStatus
        MOVX    A,@DPTR
        JNZ     ??ZDApp_ProcessNetworkJoin_17
// 1326     {
// 1327 #if ( SECURE != 0 )
// 1328       ZDApp_RestoreNwkKey();
        ; Setup parameters for call to function ZDApp_RestoreNwkKey
        LCALL   ??ZDApp_RestoreNwkKey?relay
// 1329 #endif
// 1330       devState = DEV_END_DEVICE;
        LCALL   ?Subroutine0 & 0xFFFF
// 1331       osal_set_event( ZDAppTaskID, ZDO_STATE_CHANGE_EVT );
// 1332       // setup Power Manager Device
// 1333 #if defined ( POWER_SAVING )
// 1334       osal_pwrmgr_device( PWRMGR_BATTERY );
// 1335 #endif
// 1336 
// 1337       if ( ZDO_Config_Node_Descriptor.CapabilityFlags & CAPINFO_RCVR_ON_IDLE )
??CrossCallReturnLabel_1:
        MOV     DPTR,#(ZDO_Config_Node_Descriptor + 2)
        MOVX    A,@DPTR
        MOV     C,0xE0 /* A   */.3
        JNC     ??CrossCallReturnLabel_43
// 1338       {
// 1339         // The receiver is on, turn network layer polling off.
// 1340         NLME_SetPollRate( 0 );
        ; Setup parameters for call to function NLME_SetPollRate
        LCALL   ?Subroutine13 & 0xFFFF
// 1341         NLME_SetQueuedPollRate( 0 );
// 1342         NLME_SetResponseRate( 0 );
??CrossCallReturnLabel_33:
        SJMP    ??CrossCallReturnLabel_43
// 1343       }
// 1344 
// 1345 #if defined ( ZDO_ENDDEVICE_ANNCE_GENERATE )
// 1346       ZDP_EndDeviceAnnce( ZDAppNwkAddr.addr.shortAddr, saveExtAddr,
// 1347                          ZDO_Config_Node_Descriptor.CapabilityFlags, 0 );
// 1348 #endif
// 1349 
// 1350     }
// 1351     else
// 1352     {
// 1353       if ( (devStartMode == MODE_RESUME) && (++retryCnt >= MAX_RESUME_RETRY) )
??ZDApp_ProcessNetworkJoin_17:
        MOV     DPTR,#devStartMode
        MOVX    A,@DPTR
        XRL     A,#0x1
        JNZ     ??ZDApp_ProcessNetworkJoin_18
        MOV     DPTR,#retryCnt
        MOVX    A,@DPTR
        INC     A
        MOVX    @DPTR,A
        JZ      ??ZDApp_ProcessNetworkJoin_18
// 1354       {
// 1355         if ( _NIB.nwkPanId == 0xFFFF || _NIB.nwkPanId == INVALID_PAN_ID )
        MOV     DPTR,#(_NIB + 33)
        MOVX    A,@DPTR
        XRL     A,#0xff
        JNZ     ??ZDApp_ProcessNetworkJoin_19
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??ZDApp_ProcessNetworkJoin_19:
        JZ      ??ZDApp_ProcessNetworkJoin_20
        MOV     DPTR,#(_NIB + 33)
        MOVX    A,@DPTR
        XRL     A,#0xfe
        JNZ     ??ZDApp_ProcessNetworkJoin_21
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??ZDApp_ProcessNetworkJoin_21:
        JNZ     ??ZDApp_ProcessNetworkJoin_22
// 1356           devStartMode = MODE_JOIN;
??ZDApp_ProcessNetworkJoin_20:
        CLR     A
        MOV     DPTR,#devStartMode
        SJMP    ??ZDApp_ProcessNetworkJoin_16
// 1357         else
// 1358         {
// 1359           devStartMode = MODE_REJOIN;
??ZDApp_ProcessNetworkJoin_22:
        MOV     A,#0x3
        MOV     DPTR,#devStartMode
        MOVX    @DPTR,A
// 1360           _tmpRejoinState = true;
        MOV     A,#0x1
        MOV     DPTR,#_tmpRejoinState
??ZDApp_ProcessNetworkJoin_16:
        MOVX    @DPTR,A
// 1361         }
// 1362       }
// 1363 
// 1364       // setup a retry for later...
// 1365       ZDApp_NetworkInit( (uint16)(NWK_START_DELAY
// 1366            + (osal_rand()& EXTENDED_JOINING_RANDOM_MASK)) );
??ZDApp_ProcessNetworkJoin_18:
        ; Setup parameters for call to function ZDApp_NetworkInit
        ; Setup parameters for call to function osal_rand
        LCALL   ?Subroutine9 & 0xFFFF
// 1367     }
// 1368   }
// 1369   else
// 1370   {
// 1371     // this is an error case!!
// 1372   }
// 1373 }
??CrossCallReturnLabel_43:
        LJMP    ?Subroutine18 & 0xFFFF
        CFI EndBlock cfiBlock28

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine13:
        CFI Block cfiCond29 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_32
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond30 Using cfiCommon0
        CFI (cfiCond30) NoFunction
        CFI (cfiCond30) Conditional ??CrossCallReturnLabel_33
        CFI (cfiCond30) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond30) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond30) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond30) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond30) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond30) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond30) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond30) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond30) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond30) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond30) CFA_SP SP+0
        CFI (cfiCond30) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker31 Using cfiCommon1
        CFI (cfiPicker31) NoFunction
        CFI (cfiPicker31) Picker
        MOV     R2,#0x0
        MOV     R3,#0x0
        LCALL   ??NLME_SetPollRate?relay
        ; Setup parameters for call to function NLME_SetQueuedPollRate
        ; Setup parameters for call to function NLME_SetQueuedPollRate
        MOV     R2,#0x0
        MOV     R3,#0x0
        LCALL   ??NLME_SetQueuedPollRate?relay
        ; Setup parameters for call to function NLME_SetResponseRate
        ; Setup parameters for call to function NLME_SetResponseRate
        MOV     R2,#0x0
        MOV     R3,#0x0
        LCALL   ??NLME_SetResponseRate?relay
        RET
        CFI EndBlock cfiCond29
        CFI EndBlock cfiCond30
        CFI EndBlock cfiPicker31

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine9:
        CFI Block cfiCond32 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_42
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond33 Using cfiCommon0
        CFI (cfiCond33) NoFunction
        CFI (cfiCond33) Conditional ??CrossCallReturnLabel_43
        CFI (cfiCond33) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond33) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond33) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond33) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond33) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond33) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond33) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond33) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond33) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond33) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond33) CFA_SP SP+0
        CFI (cfiCond33) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker34 Using cfiCommon1
        CFI (cfiPicker34) NoFunction
        CFI (cfiPicker34) Picker
        LCALL   ??osal_rand?relay
        MOV     ?V0 + 0,R2
        MOV     A,#0x7f
        ANL     A,?V0 + 0
        MOV     R0,A
        MOV     A,#0x64
        ADD     A,R0
        MOV     R2,A
        CFI EndBlock cfiCond32
        CFI EndBlock cfiCond33
        CFI EndBlock cfiPicker34
        REQUIRE ?Subroutine19
        ; // Fall through to label ?Subroutine19

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine19:
        CFI Block cfiCond35 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_42
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond36 Using cfiCommon0
        CFI (cfiCond36) NoFunction
        CFI (cfiCond36) Conditional ??CrossCallReturnLabel_43
        CFI (cfiCond36) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond36) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond36) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond36) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond36) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond36) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond36) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond36) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond36) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond36) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond36) CFA_SP SP+0
        CFI (cfiCond36) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiCond37 Using cfiCommon0
        CFI (cfiCond37) NoFunction
        CFI (cfiCond37) Conditional ??CrossCallReturnLabel_40
        CFI (cfiCond37) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond37) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond37) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond37) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond37) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond37) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond37) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond37) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond37) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond37) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond37) CFA_SP SP+0
        CFI (cfiCond37) CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond38 Using cfiCommon0
        CFI (cfiCond38) NoFunction
        CFI (cfiCond38) Conditional ??CrossCallReturnLabel_41
        CFI (cfiCond38) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond38) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond38) CFA_SP SP+-5
        CFI Block cfiPicker39 Using cfiCommon1
        CFI (cfiPicker39) NoFunction
        CFI (cfiPicker39) Picker
        MOV     R3,#0x0
        LCALL   ??ZDApp_NetworkInit?relay
        RET
        CFI EndBlock cfiCond35
        CFI EndBlock cfiCond36
        CFI EndBlock cfiCond37
        CFI EndBlock cfiCond38
        CFI EndBlock cfiPicker39

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine7:
        CFI Block cfiCond40 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_14
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        CFI Block cfiCond41 Using cfiCommon0
        CFI (cfiCond41) NoFunction
        CFI (cfiCond41) Conditional ??CrossCallReturnLabel_15
        CFI (cfiCond41) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond41) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond41) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond41) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond41) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond41) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond41) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond41) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond41) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond41) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond41) CFA_SP SP+0
        CFI (cfiCond41) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiCond42 Using cfiCommon0
        CFI (cfiCond42) NoFunction
        CFI (cfiCond42) Conditional ??CrossCallReturnLabel_16
        CFI (cfiCond42) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond42) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond42) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond42) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond42) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond42) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond42) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond42) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond42) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond42) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond42) CFA_SP SP+0
        CFI (cfiCond42) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiCond43 Using cfiCommon0
        CFI (cfiCond43) NoFunction
        CFI (cfiCond43) Conditional ??CrossCallReturnLabel_17
        CFI (cfiCond43) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond43) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond43) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond43) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond43) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond43) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond43) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond43) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond43) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond43) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond43) CFA_SP SP+0
        CFI (cfiCond43) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker44 Using cfiCommon1
        CFI (cfiPicker44) NoFunction
        CFI (cfiPicker44) Picker
        MOV     DPTR,#ZDO_Config_Node_Descriptor
        MOVX    A,@DPTR
        ANL     A,#0x7
        XRL     A,#0x2
        RET
        CFI EndBlock cfiCond40
        CFI EndBlock cfiCond41
        CFI EndBlock cfiCond42
        CFI EndBlock cfiCond43
        CFI EndBlock cfiPicker44

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine0:
        CFI Block cfiCond45 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_0
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        CFI Block cfiCond46 Using cfiCommon0
        CFI (cfiCond46) NoFunction
        CFI (cfiCond46) Conditional ??CrossCallReturnLabel_1
        CFI (cfiCond46) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond46) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond46) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond46) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond46) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond46) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond46) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond46) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond46) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond46) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond46) CFA_SP SP+0
        CFI (cfiCond46) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker47 Using cfiCommon1
        CFI (cfiPicker47) NoFunction
        CFI (cfiPicker47) Picker
        MOV     A,#0x6
        MOV     DPTR,#devState
        MOVX    @DPTR,A
        ; Setup parameters for call to function osal_set_event
        ; Setup parameters for call to function osal_set_event
        MOV     R2,#0x10
        MOV     R3,#0x0
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_set_event?relay
        ; Setup parameters for call to function osal_pwrmgr_device
        ; Setup parameters for call to function osal_pwrmgr_device
        MOV     R1,#0x1
        LCALL   ??osal_pwrmgr_device?relay
        RET
        CFI EndBlock cfiCond45
        CFI EndBlock cfiCond46
        CFI EndBlock cfiPicker47
// 1374 #endif // !ZDO_COORDINATOR
// 1375 
// 1376 #if ( SECURE != 0 )
// 1377 /*********************************************************************
// 1378  * @fn      ZDApp_SaveNwkKey()
// 1379  *
// 1380  * @brief   Save off the Network key information.
// 1381  *
// 1382  * @param   none
// 1383  *
// 1384  * @return  none
// 1385  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1386 void ZDApp_SaveNwkKey( void )
ZDApp_SaveNwkKey:
        CFI Block cfiBlock48 Using cfiCommon0
        CFI Function ZDApp_SaveNwkKey
// 1387 {
        FUNCALL ZDApp_SaveNwkKey, SSP_ReadNwkActiveKey
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 33, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 33, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_SaveNwkKey, osal_nv_write
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 37, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 37, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xc
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 12)
        ; Saved register size: 12
        ; Auto size: 21
        MOV     A,#-0x15
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 33)
// 1388   nwkActiveKeyItems keyItems;
// 1389 
// 1390   SSP_ReadNwkActiveKey( &keyItems );
        ; Setup parameters for call to function SSP_ReadNwkActiveKey
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R2,DPL
        MOV     R3,DPH
        LCALL   ??SSP_ReadNwkActiveKey?relay
// 1391   keyItems.frameCounter++;
        MOV     DPTR,#__Constant_1
        MOV     R0,#?V0 + 0
        LCALL   ?L_MOV_X
        MOV     A,#0x11
        LCALL   ?XSTACK_DISP0_8
        MOV     R0,#?V0 + 0
        LCALL   ?L_ADD_TO_X
// 1392 
// 1393   osal_nv_write( ZCD_NV_NWKKEY, 0, sizeof( nwkActiveKeyItems ),
// 1394                 (void *)&keyItems );
        ; Setup parameters for call to function osal_nv_write
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     ?V0 + 0,DPL
        MOV     ?V0 + 1,DPH
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 35)
        MOV     ?V0 + 0,#0x15
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 37)
        LCALL   ?Subroutine15 & 0xFFFF
??CrossCallReturnLabel_36:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 33)
// 1395 
// 1396   nwkFrameCounterChanges = 0;
        MOV     DPTR,#nwkFrameCounterChanges
        CLR     A
        MOVX    @DPTR,A
        INC     DPTR
        MOVX    @DPTR,A
        CFI EndBlock cfiBlock48
// 1397 }
        REQUIRE ?Subroutine17
        ; // Fall through to label ?Subroutine17

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine17:
        CFI Block cfiBlock49 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 33)
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        MOV     A,#0x15
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 12)
??Subroutine17_0:
        MOV     R7,#0x4
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock49

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine15:
        CFI Block cfiCond50 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_36
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 37)
        CFI Block cfiCond51 Using cfiCommon0
        CFI (cfiCond51) NoFunction
        CFI (cfiCond51) Conditional ??CrossCallReturnLabel_37
        CFI (cfiCond51) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond51) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond51) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond51) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond51) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond51) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond51) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond51) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond51) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond51) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond51) CFA_SP SP+0
        CFI (cfiCond51) CFA_XSP16 add(XSP16, 35)
        CFI Block cfiPicker52 Using cfiCommon1
        CFI (cfiPicker52) NoFunction
        CFI (cfiPicker52) Picker
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#-0x7e
        CFI Block cfiCond53 Using cfiCommon0
        CFI (cfiCond53) NoFunction
        CFI (cfiCond53) Conditional ??CrossCallReturnLabel_38
        CFI (cfiCond53) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond53) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond53) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond53) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond53) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond53) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond53) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond53) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond53) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond53) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond53) CFA_SP SP+0
        CFI (cfiCond53) CFA_XSP16 add(XSP16, 14)
        CFI Block cfiCond54 Using cfiCommon0
        CFI (cfiCond54) NoFunction
        CFI (cfiCond54) Conditional ??CrossCallReturnLabel_39
        CFI (cfiCond54) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond54) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond54) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond54) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond54) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond54) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond54) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond54) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond54) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond54) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond54) CFA_SP SP+0
        CFI (cfiCond54) CFA_XSP16 add(XSP16, 14)
??Subroutine15_0:
        MOV     R3,#0x0
        LCALL   ??osal_nv_write?relay
        MOV     A,#0x4
        RET
        CFI EndBlock cfiCond50
        CFI EndBlock cfiCond51
        CFI EndBlock cfiPicker52
        CFI EndBlock cfiCond53
        CFI EndBlock cfiCond54
// 1398 
// 1399 /*********************************************************************
// 1400  * @fn      ZDApp_ResetNwkKey()
// 1401  *
// 1402  * @brief   Reset the Network key information in NV.
// 1403  *
// 1404  * @param   none
// 1405  *
// 1406  * @return  none
// 1407  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1408 void ZDApp_ResetNwkKey( void )
ZDApp_ResetNwkKey:
        CFI Block cfiBlock55 Using cfiCommon0
        CFI Function ZDApp_ResetNwkKey
// 1409 {
        FUNCALL ZDApp_ResetNwkKey, osal_memset
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 31, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 31, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_ResetNwkKey, osal_nv_write
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 35, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 35, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 21
        MOV     A,#-0x15
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 31)
// 1410   nwkActiveKeyItems keyItems;
// 1411 
// 1412   osal_memset( &keyItems, 0, sizeof( nwkActiveKeyItems ) );
        ; Setup parameters for call to function osal_memset
        MOV     R4,#0x15
        LCALL   ?Subroutine12 & 0xFFFF
// 1413   osal_nv_write( ZCD_NV_NWKKEY, 0, sizeof( nwkActiveKeyItems ),
// 1414                 (void *)&keyItems );
??CrossCallReturnLabel_30:
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 33)
        MOV     ?V0 + 0,#0x15
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 35)
        LCALL   ?Subroutine15 & 0xFFFF
??CrossCallReturnLabel_37:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 31)
// 1415 }
        LJMP    ?Subroutine22 & 0xFFFF
        CFI EndBlock cfiBlock55
// 1416 #endif
// 1417 
// 1418 #if ( SECURE != 0 )
// 1419 /*********************************************************************
// 1420  * @fn      ZDApp_RestoreNwkKey()
// 1421  *
// 1422  * @brief
// 1423  *
// 1424  *   Save off the Network key information.
// 1425  *
// 1426  * @param   none
// 1427  *
// 1428  * @return  true if restored from NV, false if not
// 1429  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1430 byte ZDApp_RestoreNwkKey( void )
ZDApp_RestoreNwkKey:
        CFI Block cfiBlock56 Using cfiCommon0
        CFI Function ZDApp_RestoreNwkKey
// 1431 {
        FUNCALL ZDApp_RestoreNwkKey, osal_nv_read
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 37, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 37, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xc
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 12)
        ; Saved register size: 12
        ; Auto size: 21
        MOV     A,#-0x15
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 33)
// 1432   nwkActiveKeyItems keyItems;
// 1433   byte ret = false;
        MOV     R6,#0x0
// 1434 
// 1435   if ( osal_nv_read( ZCD_NV_NWKKEY, 0, sizeof(nwkActiveKeyItems), (void*)&keyItems )
// 1436       == ZSUCCESS )
        ; Setup parameters for call to function osal_nv_read
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     ?V0 + 0,DPL
        MOV     ?V0 + 1,DPH
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 35)
        MOV     ?V0 + 0,#0x15
        MOV     ?V0 + 1,R6
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 37)
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#-0x7e
        MOV     R3,#0x0
        LCALL   ??osal_nv_read?relay
        MOV     A,#0x4
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 33)
        MOV     A,R1
        JNZ     ??ZDApp_RestoreNwkKey_0
// 1437   {
// 1438     if ( keyItems.frameCounter > 0 )
        MOV     A,#0x11
        LCALL   ?XSTACK_DISP0_8
        PUSH    DPL
        CFI CFA_SP SP+-1
        PUSH    DPH
        CFI CFA_SP SP+-2
        MOV     DPTR,#__Constant_0
        MOV     R0,#?V0 + 0
        LCALL   ?L_MOV_X
        POP     DPH
        CFI CFA_SP SP+-1
        POP     DPL
        CFI CFA_SP SP+0
        MOV     R0,#?V0 + 0
        LCALL   ?L_EQ_X
        JZ      ??ZDApp_RestoreNwkKey_1
// 1439     {
// 1440       // Restore the key information
// 1441       keyItems.frameCounter += MAX_NWK_FRAMECOUNTER_CHANGES;
// 1442       nwkFrameCounter = keyItems.frameCounter;
        MOV     A,#0x11
        LCALL   ?XSTACK_DISP0_8
        PUSH    DPL
        CFI CFA_SP SP+-1
        PUSH    DPH
        CFI CFA_SP SP+-2
        MOV     DPTR,#__Constant_3e8
        MOV     R0,#?V0 + 0
        LCALL   ?L_MOV_X
        POP     DPH
        CFI CFA_SP SP+-1
        POP     DPL
        CFI CFA_SP SP+0
        MOV     R0,#?V0 + 0
        LCALL   ?L_ADD_X
        MOV     DPTR,#nwkFrameCounter
        MOV     R0,#?V0 + 0
        LCALL   ?L_MOV_TO_X
// 1443       ret = true;
        INC     R6
// 1444     }
// 1445 
// 1446     // Force a save for the first frame counter increment
// 1447     nwkFrameCounterChanges = MAX_NWK_FRAMECOUNTER_CHANGES + 1;
??ZDApp_RestoreNwkKey_1:
        MOV     DPTR,#nwkFrameCounterChanges
        MOV     A,#-0x17
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,#0x3
        MOVX    @DPTR,A
// 1448   }
// 1449   return ( ret );
??ZDApp_RestoreNwkKey_0:
        MOV     A,R6
        MOV     R1,A
        LJMP    ?Subroutine17 & 0xFFFF
        CFI EndBlock cfiBlock56
// 1450 }
// 1451 #endif
// 1452 
// 1453 /*********************************************************************
// 1454  * @fn      ZDApp_ResetTimerStart
// 1455  *
// 1456  * @brief   Start the reset timer.
// 1457  *
// 1458  * @param   delay - delay time(ms) before reset
// 1459  *
// 1460  * @return  none
// 1461  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1462 void ZDApp_ResetTimerStart( uint16 delay )
ZDApp_ResetTimerStart:
        CFI Block cfiBlock57 Using cfiCommon0
        CFI Function ZDApp_ResetTimerStart
// 1463 {
        FUNCALL ZDApp_ResetTimerStart, osal_start_timerEx
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1464   // Start the rest timer
// 1465   osal_start_timerEx( ZDAppTaskID, ZDO_DEVICE_RESET, delay );
        ; Setup parameters for call to function osal_start_timerEx
        MOV     A,R2
        MOV     R4,A
        MOV     A,R3
        MOV     R5,A
        MOV     R2,#0x4
        LCALL   ??Subroutine6_0 & 0xFFFF
// 1466 }
??CrossCallReturnLabel_11:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock57
// 1467 
// 1468 /*********************************************************************
// 1469  * @fn      ZDApp_ResetTimerCancel
// 1470  *
// 1471  * @brief   Cancel the reset timer.
// 1472  *
// 1473  * @param   none
// 1474  *
// 1475  * @return  none
// 1476  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1477 void ZDApp_ResetTimerCancel( void )
ZDApp_ResetTimerCancel:
        CFI Block cfiBlock58 Using cfiCommon0
        CFI Function ZDApp_ResetTimerCancel
// 1478 {
        FUNCALL ZDApp_ResetTimerCancel, osal_stop_timerEx
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1479   // Cancel the reset timer
// 1480   osal_stop_timerEx( ZDAppTaskID, ZDO_DEVICE_RESET );
        ; Setup parameters for call to function osal_stop_timerEx
        MOV     R2,#0x4
        MOV     R3,#0x0
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_stop_timerEx?relay
// 1481 }
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock58
// 1482 
// 1483 /*********************************************************************
// 1484  * @fn      ZDApp_LeaveCtrlInit
// 1485  *
// 1486  * @brief   Initialize the leave control logic.
// 1487  *
// 1488  * @param   none
// 1489  *
// 1490  * @return  none
// 1491  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1492 void ZDApp_LeaveCtrlInit( void )
ZDApp_LeaveCtrlInit:
        CFI Block cfiBlock59 Using cfiCommon0
        CFI Function ZDApp_LeaveCtrlInit
// 1493 {
        FUNCALL ZDApp_LeaveCtrlInit, osal_nv_item_init
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_LeaveCtrlInit, osal_nv_read
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
// 1494   uint8 status;
// 1495 
// 1496 
// 1497   // Initialize control state
// 1498   ZDApp_LeaveCtrl = ZDAPP_LEAVE_CTRL_INIT;
        LCALL   ?Subroutine2 & 0xFFFF
// 1499 
// 1500   status = osal_nv_item_init( ZCD_NV_LEAVE_CTRL,
// 1501                               sizeof(ZDApp_LeaveCtrl),
// 1502                               &ZDApp_LeaveCtrl );
// 1503 
// 1504   if ( status == ZSUCCESS )
??CrossCallReturnLabel_2:
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     R4,#0x1
        MOV     R5,#0x0
        MOV     R2,#-0x7b
        MOV     R3,#0x0
        LCALL   ??osal_nv_item_init?relay
        MOV     A,#0x2
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 10)
        MOV     A,R1
        JNZ     ??ZDApp_LeaveCtrlInit_0
// 1505   {
// 1506     // Read saved control
// 1507     osal_nv_read( ZCD_NV_LEAVE_CTRL,
// 1508                   0,
// 1509                   sizeof( uint8 ),
// 1510                   &ZDApp_LeaveCtrl);
        ; Setup parameters for call to function osal_nv_read
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     ?V0 + 0,#0x1
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 14)
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#-0x7b
        MOV     R3,#0x0
        LCALL   ??osal_nv_read?relay
        MOV     A,#0x4
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 10)
// 1511   }
// 1512 }
??ZDApp_LeaveCtrlInit_0:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock59
// 1513 
// 1514 /*********************************************************************
// 1515  * @fn      ZDApp_LeaveCtrlSet
// 1516  *
// 1517  * @brief   Set the leave control logic.
// 1518  *
// 1519  * @param   ra - reassociate flag
// 1520  *
// 1521  * @return  none
// 1522  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1523 void ZDApp_LeaveCtrlSet( uint8 ra )
ZDApp_LeaveCtrlSet:
        CFI Block cfiBlock60 Using cfiCommon0
        CFI Function ZDApp_LeaveCtrlSet
// 1524 {
        FUNCALL ZDApp_LeaveCtrlSet, osal_nv_write
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
// 1525   ZDApp_LeaveCtrl = ZDAPP_LEAVE_CTRL_SET;
        MOV     A,#0x1
        MOV     DPTR,#ZDApp_LeaveCtrl
        MOVX    @DPTR,A
// 1526 
// 1527   if ( ra == TRUE )
        XRL     A,R1
        JNZ     ??ZDApp_LeaveCtrlSet_0
// 1528   {
// 1529     ZDApp_LeaveCtrl |= ZDAPP_LEAVE_CTRL_RA;
        MOV     A,#0x3
        MOVX    @DPTR,A
// 1530   }
// 1531 
// 1532   // Write the leave control
// 1533   osal_nv_write( ZCD_NV_LEAVE_CTRL,
// 1534                  0,
// 1535                  sizeof( uint8 ),
// 1536                  &ZDApp_LeaveCtrl);
??ZDApp_LeaveCtrlSet_0:
        ; Setup parameters for call to function osal_nv_write
        MOV     ?V0 + 0,#(ZDApp_LeaveCtrl & 0xff)
        MOV     ?V0 + 1,#((ZDApp_LeaveCtrl >> 8) & 0xff)
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     ?V0 + 0,#0x1
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 14)
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#-0x7b
        LCALL   ??Subroutine15_0 & 0xFFFF
??CrossCallReturnLabel_38:
        LJMP    ??Subroutine18_0 & 0xFFFF
        CFI EndBlock cfiBlock60
// 1537 }
// 1538 
// 1539 /*********************************************************************
// 1540  * @fn      ZDApp_LeaveCtrlBypass
// 1541  *
// 1542  * @brief   Check if NV restore should be skipped during a leave reset.
// 1543  *
// 1544  * @param   none
// 1545  *
// 1546  * @return  uint8 - (TRUE bypass:FALSE do not bypass)
// 1547  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1548 uint8 ZDApp_LeaveCtrlBypass( void )
ZDApp_LeaveCtrlBypass:
        CFI Block cfiBlock61 Using cfiCommon0
        CFI Function ZDApp_LeaveCtrlBypass
// 1549 {
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1550   uint8 bypass;
// 1551 
// 1552   if ( ZDApp_LeaveCtrl & ZDAPP_LEAVE_CTRL_SET )
// 1553   {
// 1554     bypass = TRUE;
// 1555   }
// 1556   else
// 1557   {
// 1558     bypass = FALSE;
// 1559   }
// 1560 
// 1561   return bypass;
        MOV     DPTR,#ZDApp_LeaveCtrl
        MOVX    A,@DPTR
        MOV     C,0xE0 /* A   */.0
        CLR     A
        MOV     0xE0 /* A   */.0,C
        MOV     R1,A
        SJMP    ??Subroutine16_0
        CFI EndBlock cfiBlock61
// 1562 }
// 1563 
// 1564 /*********************************************************************
// 1565  * @fn      ZDApp_LeaveCtrlStartup
// 1566  *
// 1567  * @brief   Check for startup conditions during a leave reset.
// 1568  *
// 1569  * @param   state      - devState_t determined by leave control logic
// 1570  * @param   startDelay - startup delay
// 1571  *
// 1572  * @return  none
// 1573  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1574 void ZDApp_LeaveCtrlStartup( devStates_t* state, uint16* startDelay )
ZDApp_LeaveCtrlStartup:
        CFI Block cfiBlock62 Using cfiCommon0
        CFI Function ZDApp_LeaveCtrlStartup
// 1575 {
        FUNCALL ZDApp_LeaveCtrlStartup, osal_nv_write
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
// 1576   *startDelay = 0;
        MOV     DPL,R4
        MOV     DPH,R5
        CLR     A
        MOVX    @DPTR,A
        INC     DPTR
        MOVX    @DPTR,A
// 1577 
// 1578   if ( ZDApp_LeaveCtrl & ZDAPP_LEAVE_CTRL_SET )
        MOV     DPTR,#ZDApp_LeaveCtrl
        MOVX    A,@DPTR
        MOV     C,0xE0 /* A   */.0
        JNC     ??ZDApp_LeaveCtrlStartup_0
// 1579   {
// 1580     if ( ZDApp_LeaveCtrl & ZDAPP_LEAVE_CTRL_RA )
        MOV     C,0xE0 /* A   */.1
        JNC     ??ZDApp_LeaveCtrlStartup_1
// 1581     {
// 1582       *startDelay = 5000;
        MOV     DPL,R4
        MOV     DPH,R5
        MOV     A,#-0x78
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,#0x13
        SJMP    ??ZDApp_LeaveCtrlStartup_2
// 1583     }
// 1584     else
// 1585     {
// 1586       *state = DEV_HOLD;
??ZDApp_LeaveCtrlStartup_1:
        CLR     A
        MOV     DPL,R2
        MOV     DPH,R3
??ZDApp_LeaveCtrlStartup_2:
        MOVX    @DPTR,A
// 1587     }
// 1588 
// 1589     // Set leave control to initialized state
// 1590     ZDApp_LeaveCtrl = ZDAPP_LEAVE_CTRL_INIT;
        LCALL   ?Subroutine2 & 0xFFFF
// 1591 
// 1592     // Write initialized control
// 1593     osal_nv_write( ZCD_NV_LEAVE_CTRL,
// 1594                   0,
// 1595                   sizeof( uint8 ),
// 1596                   &ZDApp_LeaveCtrl);
??CrossCallReturnLabel_3:
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     ?V0 + 0,#0x1
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 14)
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#-0x7b
        LCALL   ??Subroutine15_0 & 0xFFFF
??CrossCallReturnLabel_39:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 10)
// 1597   }
// 1598 }
??ZDApp_LeaveCtrlStartup_0:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock62

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine2:
        CFI Block cfiCond63 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_2
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond64 Using cfiCommon0
        CFI (cfiCond64) NoFunction
        CFI (cfiCond64) Conditional ??CrossCallReturnLabel_3
        CFI (cfiCond64) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond64) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond64) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond64) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond64) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond64) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond64) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond64) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond64) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond64) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond64) CFA_SP SP+0
        CFI (cfiCond64) CFA_XSP16 add(XSP16, 10)
        CFI Block cfiPicker65 Using cfiCommon1
        CFI (cfiPicker65) NoFunction
        CFI (cfiPicker65) Picker
        CLR     A
        MOV     DPTR,#ZDApp_LeaveCtrl
        MOVX    @DPTR,A
        ; Setup parameters for call to function osal_nv_item_init
        ; Setup parameters for call to function osal_nv_write
        MOV     ?V0 + 0,#(ZDApp_LeaveCtrl & 0xff)
        MOV     ?V0 + 1,#((ZDApp_LeaveCtrl >> 8) & 0xff)
        MOV     R0,#?V0 + 0
        RET
        CFI EndBlock cfiCond63
        CFI EndBlock cfiCond64
        CFI EndBlock cfiPicker65
// 1599 
// 1600 /*********************************************************************
// 1601  * @fn      ZDApp_LeaveReset
// 1602  *
// 1603  * @brief   Setup a device reset due to a leave indication/confirm.
// 1604  *
// 1605  * @param   ra - reassociate flag
// 1606  *
// 1607  * @return  none
// 1608  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1609 void ZDApp_LeaveReset( uint8 ra )
ZDApp_LeaveReset:
        CFI Block cfiBlock66 Using cfiCommon0
        CFI Function ZDApp_LeaveReset
// 1610 {
        FUNCALL ZDApp_LeaveReset, ZDApp_LeaveCtrlSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_LeaveReset, ZDApp_ResetTimerStart
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1611   ZDApp_LeaveCtrlSet( ra );
        ; Setup parameters for call to function ZDApp_LeaveCtrlSet
        LCALL   ??ZDApp_LeaveCtrlSet?relay
// 1612 
// 1613   ZDApp_ResetTimerStart( 5000 );
        ; Setup parameters for call to function ZDApp_ResetTimerStart
        MOV     R2,#-0x78
        MOV     R3,#0x13
        LCALL   ??ZDApp_ResetTimerStart?relay
// 1614 }
        SJMP    ??Subroutine16_0
        CFI EndBlock cfiBlock66
// 1615 
// 1616 /*********************************************************************
// 1617  * @fn      ZDApp_LeaveUpdate
// 1618  *
// 1619  * @brief   Update local device data related to leaving device.
// 1620  *
// 1621  * @param   nwkAddr        - NWK address of leaving device
// 1622  * @param   extAddr        - EXT address of leaving device
// 1623  * @param   removeChildren - remove children of leaving device
// 1624  *
// 1625  * @return  none
// 1626  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1627 void ZDApp_LeaveUpdate( uint16 nwkAddr, uint8* extAddr,
ZDApp_LeaveUpdate:
        CFI Block cfiBlock67 Using cfiCommon0
        CFI Function ZDApp_LeaveUpdate
// 1628                         uint8 removeChildren )
// 1629 {
        FUNCALL ZDApp_LeaveUpdate, NLME_RemoveChild
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
        MOV     A,R4
        MOV     R2,A
        MOV     A,R5
        MOV     R3,A
// 1630   /*
// 1631   AddrMgrEntry_t entry;
// 1632   */
// 1633 
// 1634 
// 1635   // Remove if child
// 1636   NLME_RemoveChild( extAddr, removeChildren );
        ; Setup parameters for call to function NLME_RemoveChild
        LCALL   ??NLME_RemoveChild?relay
// 1637 
// 1638   /*
// 1639   // Set NWK address to invalid
// 1640   entry.user    = ADDRMGR_USER_DEFAULT;
// 1641   entry.nwkAddr = INVALID_NODE_ADDR;
// 1642   AddrMgrExtAddrSet( entry.extAddr, extAddr );
// 1643   AddrMgrEntryUpdate( &entry );
// 1644 
// 1645   // Check
// 1646   if ( removeChildren == TRUE )
// 1647   {
// 1648     // Set index to INVALID_NODE_ADDR to start search
// 1649     entry.index = INVALID_NODE_ADDR;
// 1650 
// 1651     // Get first entry
// 1652     AddrMgrEntryGetNext( &entry );
// 1653 
// 1654     // Remove all descendents
// 1655     while ( entry.index != INVALID_NODE_ADDR )
// 1656     {
// 1657       // Check NWK address allocation algorithm
// 1658       if ( RTG_ANCESTOR( entry.nwkAddr, thisAddr ) != 0 )
// 1659       {
// 1660         // Set NWK address to invalid
// 1661         entry.nwkAddr = INVALID_NODE_ADDR;
// 1662         AddrMgrEntryUpdate( &entry );
// 1663       }
// 1664 
// 1665       // Get next entry
// 1666       AddrMgrEntryGetNext( &entry );
// 1667     }
// 1668   }
// 1669   */
// 1670 }
        SJMP    ??Subroutine16_0
        CFI EndBlock cfiBlock67

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine16:
        CFI Block cfiBlock68 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+-5
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        LCALL   ??Subroutine4_0 & 0xFFFF
??Subroutine16_0:
        POP     DPH
        CFI CFA_SP SP+-4
        CFI DPH0 SameValue
        POP     DPL
        CFI CFA_SP SP+-3
        CFI DPL0 SameValue
        LJMP    ?BRET
        CFI EndBlock cfiBlock68
// 1671 
// 1672 /*********************************************************************
// 1673  * CALLBACK FUNCTIONS
// 1674  */
// 1675 
// 1676 /*********************************************************************
// 1677  * @fn      ZDApp_SendEventMsg()
// 1678  *
// 1679  * @brief
// 1680  *
// 1681  *   Sends a Network Join message
// 1682  *
// 1683  * @param  cmd - command ID
// 1684  * @param  len - length (in bytes) of the buf field
// 1685  * @param  buf - buffer for the rest of the message.
// 1686  *
// 1687  * @return  none
// 1688  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1689 void ZDApp_SendEventMsg( byte cmd, byte len, byte *buf )
ZDApp_SendEventMsg:
        CFI Block cfiBlock69 Using cfiCommon0
        CFI Function ZDApp_SendEventMsg
// 1690 {
        FUNCALL ZDApp_SendEventMsg, ZDApp_SendMsg
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1691   ZDApp_SendMsg( ZDAppTaskID, cmd, len, buf );
        ; Setup parameters for call to function ZDApp_SendMsg
        MOV     A,R2
        MOV     R3,A
        MOV     A,R1
        MOV     R2,A
        CFI EndBlock cfiBlock69
        REQUIRE ?Subroutine21
        ; // Fall through to label ?Subroutine21
// 1692 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine21:
        CFI Block cfiBlock70 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+-5
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        LCALL   ?Subroutine8 & 0xFFFF
??CrossCallReturnLabel_44:
        SJMP    ??Subroutine16_0
        CFI EndBlock cfiBlock70
// 1693 
// 1694 /*********************************************************************
// 1695  * @fn      ZDApp_SendMsg()
// 1696  *
// 1697  * @brief   Sends a OSAL message
// 1698  *
// 1699  * @param  taskID - Where to send the message
// 1700  * @param  cmd - command ID
// 1701  * @param  len - length (in bytes) of the buf field
// 1702  * @param  buf - buffer for the rest of the message.
// 1703  *
// 1704  * @return  none
// 1705  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1706 void ZDApp_SendMsg( byte taskID, byte cmd, byte len, byte *buf )
ZDApp_SendMsg:
        CFI Block cfiBlock71 Using cfiCommon0
        CFI Function ZDApp_SendMsg
// 1707 {
        FUNCALL ZDApp_SendMsg, osal_msg_allocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 16, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 16, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_SendMsg, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 19, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 19, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_SendMsg, osal_msg_send
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 16, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 16, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0x10
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 16)
        ; Saved register size: 16
        ; Auto size: 0
        MOV     A,R1
        MOV     R6,A
        MOV     ?V0 + 3,R2
        MOV     A,R3
        MOV     R7,A
        MOV     ?V0 + 6,R4
        MOV     ?V0 + 7,R5
// 1708   osal_event_hdr_t *msgPtr;
// 1709 
// 1710   // Send the address to the task
// 1711   msgPtr = (osal_event_hdr_t *)osal_msg_allocate( len );
        ; Setup parameters for call to function osal_msg_allocate
        MOV     R2,A
        MOV     R3,#0x0
        LCALL   ??osal_msg_allocate?relay
        MOV     ?V0 + 4,R2
        MOV     ?V0 + 5,R3
// 1712   if ( msgPtr )
        MOV     A,R2
        JNZ     ??ZDApp_SendMsg_0
        MOV     A,R3
??ZDApp_SendMsg_0:
        JZ      ??ZDApp_SendMsg_1
// 1713   {
// 1714     if ( (len > 0) && (buf != NULL) )
        MOV     A,R7
        JZ      ??ZDApp_SendMsg_2
        MOV     A,?V0 + 6
        JNZ     ??ZDApp_SendMsg_3
        MOV     A,?V0 + 7
??ZDApp_SendMsg_3:
        JZ      ??ZDApp_SendMsg_2
// 1715       osal_memcpy( msgPtr, buf, len );
        ; Setup parameters for call to function osal_memcpy
        MOV     ?V0 + 0,?V0 + 6
        MOV     ?V0 + 1,?V0 + 7
        MOV     ?V0 + 2,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 19)
        MOV     A,R7
        MOV     R4,A
        MOV     R5,#0x0
        LCALL   ??osal_memcpy?relay
        MOV     A,#0x3
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 16)
// 1716 
// 1717     msgPtr->event = cmd;
??ZDApp_SendMsg_2:
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        MOV     A,?V0 + 3
        MOVX    @DPTR,A
// 1718     osal_msg_send( taskID, (byte *)msgPtr );
        ; Setup parameters for call to function osal_msg_send
        MOV     R2,?V0 + 4
        MOV     R3,?V0 + 5
        MOV     A,R6
        MOV     R1,A
        LCALL   ??osal_msg_send?relay
// 1719   }
// 1720 }
??ZDApp_SendMsg_1:
        MOV     R7,#0x8
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock71
// 1721 
// 1722 /*********************************************************************
// 1723  * Call Back Functions from NWK  - API
// 1724  */
// 1725 
// 1726 /*********************************************************************
// 1727  * @fn          ZDO_NetworkDiscoveryConfirmCB
// 1728  *
// 1729  * @brief       This function returns a choice of PAN to join.
// 1730  *
// 1731  * @param       ResultCount - Number of routers discovered
// 1732  * @param               NetworkList - Pointer to list of network descriptors
// 1733  *
// 1734  * @return      ZStatus_t
// 1735  */
// 1736 #define STACK_PROFILE_MAX 2

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1737 ZStatus_t ZDO_NetworkDiscoveryConfirmCB( byte ResultCount,
ZDO_NetworkDiscoveryConfirmCB:
        CFI Block cfiBlock72 Using cfiCommon0
        CFI Function ZDO_NetworkDiscoveryConfirmCB
// 1738                                          networkDesc_t *NetworkList )
// 1739 {
        FUNCALL ZDO_NetworkDiscoveryConfirmCB, osal_cpyExtAddr
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_NetworkDiscoveryConfirmCB, ZDApp_SendMsg
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 14
        MOV     A,#-0xe
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 24)
        MOV     A,R1
        MOV     R6,A
        MOV     A,R2
        MOV     R0,A
        MOV     A,R3
        MOV     R1,A
// 1740   networkDesc_t *pNwkDesc;
// 1741   ZDO_NetworkDiscoveryCfm_t msg;
// 1742   byte  i;
// 1743   uint8 stackProfile;
// 1744   uint8 stackProfilePro;
// 1745   uint8 selected;
// 1746 
// 1747 #if defined ( ZDO_MGMT_NWKDISC_RESPONSE )
// 1748   if ( zdappMgmtNwkDiscReqInProgress )
// 1749   {
// 1750     zdappMgmtNwkDiscReqInProgress = false;
// 1751     ZDO_FinishProcessingMgmtNwkDiscReq( ResultCount, NetworkList );
// 1752     return ( ZSuccess );
// 1753   }
// 1754 #endif
// 1755 
// 1756   // process discovery results
// 1757   stackProfilePro = FALSE;
        MOV     ?V0 + 1,#0x0
// 1758   selected = FALSE;
// 1759 
// 1760   for ( stackProfile = 0; stackProfile < STACK_PROFILE_MAX; stackProfile++ )
        MOV     R7,#0x0
// 1761   {
// 1762     pNwkDesc = NetworkList;
??ZDO_NetworkDiscoveryConfirmCB_0:
        MOV     A,R0
        MOV     R2,A
        MOV     A,R1
        MOV     R3,A
// 1763     for ( i = 0; i < ResultCount; i++, pNwkDesc = pNwkDesc->nextDesc )
        MOV     ?V0 + 0,#0x0
        SJMP    ??ZDO_NetworkDiscoveryConfirmCB_1
// 1764     {
// 1765       if ( zgConfigPANID != 0xFFFF )
// 1766       {
// 1767         // PAN Id is preconfigured. check if it matches
// 1768         // only 14 bits of pan id is used
// 1769         if ( pNwkDesc->panId != ( zgConfigPANID & 0x3FFF ) )
// 1770           continue;
// 1771       }
// 1772 
// 1773       // check that network is allowing joining
// 1774       //------------------------------------------------------------
// 1775       #if defined( RTR_NWK )
// 1776       //------------------------------------------------------------
// 1777       if ( stackProfilePro == FALSE )
// 1778       {
// 1779         if ( !pNwkDesc->routerCapacity )
// 1780         {
// 1781           continue;
// 1782         }
// 1783       }
// 1784       else
// 1785       {
// 1786         if ( !pNwkDesc->deviceCapacity )
??ZDO_NetworkDiscoveryConfirmCB_2:
        INC     DPTR
        MOVX    A,@DPTR
        JZ      ??ZDO_NetworkDiscoveryConfirmCB_3
// 1787         {
// 1788           continue;
// 1789         }
// 1790       }
// 1791       //------------------------------------------------------------
// 1792       #else
// 1793       //------------------------------------------------------------
// 1794       if ( !pNwkDesc->deviceCapacity )
// 1795       {
// 1796         continue;
// 1797       }
// 1798       //------------------------------------------------------------
// 1799       #endif
// 1800       //------------------------------------------------------------
// 1801       // check version of zigbee protocol
// 1802       if ( pNwkDesc->version != _NIB.nwkProtocolVersion )
??ZDO_NetworkDiscoveryConfirmCB_4:
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R4,A
        MOV     DPTR,#(_NIB + 17)
        MOVX    A,@DPTR
        XRL     A,R4
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_3
// 1803         continue;
// 1804 
// 1805       // check version of stack profile
// 1806       if ( pNwkDesc->stackProfile != zgStackProfile  )
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R4,A
        MOV     DPTR,#zgStackProfile
        MOVX    A,@DPTR
        XRL     A,R4
        JNZ     $+5
        LJMP    ??ZDO_NetworkDiscoveryConfirmCB_5 & 0xFFFF
// 1807       {
// 1808         if ( pNwkDesc->stackProfile == ZIGBEEPRO_PROFILE )
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0x2
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_6
// 1809           stackProfilePro = TRUE;
        MOV     ?V0 + 1,#0x1
// 1810 
// 1811         if ( stackProfile == 0 )
??ZDO_NetworkDiscoveryConfirmCB_6:
        MOV     A,R7
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_5
// 1812         {
// 1813           continue;
// 1814         }
// 1815       }
??ZDO_NetworkDiscoveryConfirmCB_3:
        INC     ?V0 + 0
        MOV     A,R2
        ADD     A,#0x15
        MOV     DPL,A
        MOV     A,R3
        LCALL   ??Subroutine11_1 & 0xFFFF
??CrossCallReturnLabel_20:
        MOV     R2,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R3,A
??ZDO_NetworkDiscoveryConfirmCB_1:
        MOV     A,?V0 + 0
        CLR     C
        SUBB    A,R6
        JNC     ??ZDO_NetworkDiscoveryConfirmCB_7
        MOV     DPTR,#zgConfigPANID
        MOVX    A,@DPTR
        XRL     A,#0xff
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_8
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??ZDO_NetworkDiscoveryConfirmCB_8:
        JZ      ??ZDO_NetworkDiscoveryConfirmCB_9
        MOV     DPTR,#zgConfigPANID
        MOVX    A,@DPTR
        MOV     R4,A
        INC     DPTR
        MOVX    A,@DPTR
        ANL     A,#0x3f
        MOV     R5,A
        MOV     DPH,R3
        MOV     DPL,R2
        MOVX    A,@DPTR
        XRL     A,R4
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_10
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,R5
??ZDO_NetworkDiscoveryConfirmCB_10:
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_3
??ZDO_NetworkDiscoveryConfirmCB_9:
        MOV     A,?V0 + 1
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        JZ      $+5
        LJMP    ??ZDO_NetworkDiscoveryConfirmCB_2 & 0xFFFF
        MOVX    A,@DPTR
        JZ      $+5
        LJMP    ??ZDO_NetworkDiscoveryConfirmCB_4 & 0xFFFF
        SJMP    ??ZDO_NetworkDiscoveryConfirmCB_3
// 1816 
// 1817       // check if beacon order is the right value..
// 1818       //  if ( pNwkDesc->beaconOrder < ZDO_CONFIG_MAX_BO )
// 1819       //    continue;
// 1820 
// 1821       // choose this pan for joining
// 1822       break;
// 1823     }
// 1824 
// 1825     if (i < ResultCount)
// 1826     {
// 1827      selected = TRUE;
// 1828       break;
// 1829     }
// 1830 
// 1831     // break if selected or stack profile pro wasn't found
// 1832     if ( (selected == TRUE) || (stackProfilePro == FALSE) )
??ZDO_NetworkDiscoveryConfirmCB_7:
        MOV     A,?V0 + 1
        JZ      ??ZDO_NetworkDiscoveryConfirmCB_11
// 1833     {
// 1834       break;
// 1835     }
// 1836   }
        INC     R7
        MOV     A,R7
        CLR     C
        SUBB    A,#0x2
        JNC     $+5
        LJMP    ??ZDO_NetworkDiscoveryConfirmCB_0 & 0xFFFF
// 1837 
// 1838   if ( i == ResultCount )
??ZDO_NetworkDiscoveryConfirmCB_11:
        MOV     A,R6
        XRL     A,?V0 + 0
        JNZ     ??ZDO_NetworkDiscoveryConfirmCB_5
// 1839   {
// 1840     msg.hdr.status = ZDO_FAIL;   // couldn't find appropriate PAN to join !
        MOV     A,#0x1
        LCALL   ?XSTACK_DISP0_8
        MOV     A,#0x1
        MOVX    @DPTR,A
        SJMP    ??ZDO_NetworkDiscoveryConfirmCB_12
// 1841   }
// 1842   else
// 1843   {
// 1844     msg.hdr.status = ZDO_SUCCESS;
??ZDO_NetworkDiscoveryConfirmCB_5:
        MOV     A,#0x1
        LCALL   ?XSTACK_DISP0_8
        CLR     A
        MOVX    @DPTR,A
// 1845     msg.panIdLSB = LO_UINT16( pNwkDesc->panId );
        MOV     DPL,R2
        MOV     DPH,R3
        MOVX    A,@DPTR
        PUSH    A
        CFI CFA_SP SP+-1
        MOV     A,#0x2
        LCALL   ?XSTACK_DISP0_8
        POP     A
        CFI CFA_SP SP+0
        LCALL   ?Subroutine3 & 0xFFFF
// 1846     msg.panIdMSB = HI_UINT16( pNwkDesc->panId );
??CrossCallReturnLabel_4:
        MOVX    A,@DPTR
        PUSH    A
        CFI CFA_SP SP+-1
        MOV     A,#0x3
        LCALL   ?XSTACK_DISP0_8
        POP     A
        CFI CFA_SP SP+0
        LCALL   ?Subroutine3 & 0xFFFF
// 1847     msg.logicalChannel = pNwkDesc->logicalChannel;
??CrossCallReturnLabel_5:
        INC     DPTR
        MOVX    A,@DPTR
        PUSH    A
        CFI CFA_SP SP+-1
        MOV     A,#0x4
        LCALL   ?XSTACK_DISP0_8
        POP     A
        CFI CFA_SP SP+0
        LCALL   ?Subroutine3 & 0xFFFF
// 1848     msg.version = pNwkDesc->version;
??CrossCallReturnLabel_6:
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        PUSH    A
        CFI CFA_SP SP+-1
        MOV     A,#0x5
        LCALL   ?XSTACK_DISP0_8
        POP     A
        CFI CFA_SP SP+0
        MOVX    @DPTR,A
// 1849     osal_cpyExtAddr( msg.extendedPANID, pNwkDesc->extendedPANID );
        ; Setup parameters for call to function osal_cpyExtAddr
        MOV     A,R2
        ADD     A,#0xd
        MOV     R4,A
        MOV     A,R3
        ADDC    A,#0x0
        MOV     R5,A
        MOV     A,#0x6
        LCALL   ?XSTACK_DISP0_8
        MOV     R2,DPL
        MOV     R3,DPH
        LCALL   ??osal_cpyExtAddr?relay
// 1850   }
// 1851 
// 1852   ZDApp_SendMsg( ZDAppTaskID, ZDO_NWK_DISC_CNF, sizeof(ZDO_NetworkDiscoveryCfm_t), (byte *)&msg );
??ZDO_NetworkDiscoveryConfirmCB_12:
        ; Setup parameters for call to function ZDApp_SendMsg
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R4,DPL
        MOV     R5,DPH
        MOV     R3,#0xe
        MOV     R2,#0x1
        LCALL   ?Subroutine8 & 0xFFFF
// 1853 
// 1854   return (ZSuccess);
??CrossCallReturnLabel_45:
        MOV     R1,#0x0
        MOV     A,#0xe
        SJMP    ??Subroutine18_0
        CFI EndBlock cfiBlock72
// 1855 }  // ZDO_NetworkDiscoveryConfirmCB

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine18:
        CFI Block cfiBlock73 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 12)
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        MOV     A,#0x2
??Subroutine18_0:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 10)
??Subroutine18_1:
        MOV     R7,#0x2
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock73

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine8:
        CFI Block cfiCond74 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_44
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        CFI Block cfiCond75 Using cfiCommon0
        CFI (cfiCond75) NoFunction
        CFI (cfiCond75) Conditional ??CrossCallReturnLabel_45
        CFI (cfiCond75) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond75) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond75) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond75) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond75) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond75) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond75) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond75) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond75) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond75) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond75) CFA_SP SP+0
        CFI (cfiCond75) CFA_XSP16 add(XSP16, 24)
        CFI Block cfiCond76 Using cfiCommon0
        CFI (cfiCond76) NoFunction
        CFI (cfiCond76) Conditional ??CrossCallReturnLabel_44
        CFI (cfiCond76) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond76) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond76) CFA_SP SP+-5
        CFI Block cfiPicker77 Using cfiCommon1
        CFI (cfiPicker77) NoFunction
        CFI (cfiPicker77) Picker
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??ZDApp_SendMsg?relay
        RET
        CFI EndBlock cfiCond74
        CFI EndBlock cfiCond75
        CFI EndBlock cfiCond76
        CFI EndBlock cfiPicker77

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine3:
        CFI Block cfiCond78 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_4
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 24)
        CFI Block cfiCond79 Using cfiCommon0
        CFI (cfiCond79) NoFunction
        CFI (cfiCond79) Conditional ??CrossCallReturnLabel_5
        CFI (cfiCond79) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond79) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond79) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond79) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond79) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond79) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond79) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond79) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond79) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond79) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond79) CFA_SP SP+0
        CFI (cfiCond79) CFA_XSP16 add(XSP16, 24)
        CFI Block cfiCond80 Using cfiCommon0
        CFI (cfiCond80) NoFunction
        CFI (cfiCond80) Conditional ??CrossCallReturnLabel_6
        CFI (cfiCond80) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond80) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond80) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond80) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond80) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond80) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond80) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond80) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond80) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond80) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond80) CFA_SP SP+0
        CFI (cfiCond80) CFA_XSP16 add(XSP16, 24)
        CFI Block cfiPicker81 Using cfiCommon1
        CFI (cfiPicker81) NoFunction
        CFI (cfiPicker81) Picker
        MOVX    @DPTR,A
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        RET
        CFI EndBlock cfiCond78
        CFI EndBlock cfiCond79
        CFI EndBlock cfiCond80
        CFI EndBlock cfiPicker81
// 1856 
// 1857 /*********************************************************************
// 1858  * @fn          ZDO_NetworkFormationConfirmCB
// 1859  *
// 1860  * @brief       This function reports the results of the request to
// 1861  *              initialize a coordinator in a network.
// 1862  *
// 1863  * @param       Status - Result of NLME_NetworkFormationRequest()
// 1864  *
// 1865  * @return      none
// 1866  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1867 void ZDO_NetworkFormationConfirmCB( ZStatus_t Status )
ZDO_NetworkFormationConfirmCB:
        CFI Block cfiBlock82 Using cfiCommon0
        CFI Function ZDO_NetworkFormationConfirmCB
// 1868 {
        ; Saved register size: 0
        ; Auto size: 0
// 1869 #if defined(ZDO_COORDINATOR)
// 1870   nwkStatus = (byte)Status;
// 1871 
// 1872   if ( Status == ZSUCCESS )
// 1873   {
// 1874     // LED on shows Coordinator started
// 1875     HalLedSet ( HAL_LED_3, HAL_LED_MODE_ON );
// 1876 
// 1877     // LED off forgets HOLD_AUTO_START
// 1878     HalLedSet (HAL_LED_4, HAL_LED_MODE_OFF);
// 1879 
// 1880 #if defined ( ZBIT )
// 1881     SIM_SetColor(0xd0ffd0);
// 1882 #endif
// 1883 
// 1884     if ( devState == DEV_HOLD )
// 1885     {
// 1886       // Began with HOLD_AUTO_START
// 1887       devState = DEV_COORD_STARTING;
// 1888     }
// 1889   }
// 1890 #if defined(BLINK_LEDS)
// 1891   else
// 1892     HalLedSet ( HAL_LED_3, HAL_LED_MODE_FLASH );  // Flash LED to show failure
// 1893 #endif
// 1894 
// 1895   osal_set_event( ZDAppTaskID, ZDO_NETWORK_START );
// 1896 #endif  //ZDO_COORDINATOR
// 1897 }
        LJMP    ?BRET
        CFI EndBlock cfiBlock82
// 1898 
// 1899 #if defined(RTR_NWK)
// 1900 /*********************************************************************
// 1901  * @fn          ZDO_StartRouterConfirmCB
// 1902  *
// 1903  * @brief       This function reports the results of the request to
// 1904  *              start functioning as a router in a network.
// 1905  *
// 1906  * @param       Status - Result of NLME_StartRouterRequest()
// 1907  *
// 1908  * @return      none
// 1909  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1910 void ZDO_StartRouterConfirmCB( ZStatus_t Status )
ZDO_StartRouterConfirmCB:
        CFI Block cfiBlock83 Using cfiCommon0
        CFI Function ZDO_StartRouterConfirmCB
// 1911 {
        FUNCALL ZDO_StartRouterConfirmCB, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_StartRouterConfirmCB, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_StartRouterConfirmCB, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_StartRouterConfirmCB, osal_set_event
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1912   nwkStatus = (byte)Status;
        MOV     A,R1
        MOV     DPTR,#nwkStatus
        MOVX    @DPTR,A
// 1913 
// 1914   if ( Status == ZSUCCESS )
        JNZ     ??ZDO_StartRouterConfirmCB_0
// 1915   {
// 1916     // LED on shows Router started
// 1917     HalLedSet ( HAL_LED_3, HAL_LED_MODE_ON );
        ; Setup parameters for call to function HalLedSet
        LCALL   ?Subroutine14 & 0xFFFF
// 1918     // LED off forgets HOLD_AUTO_START
// 1919     HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF);
// 1920     if ( devState == DEV_HOLD )
??CrossCallReturnLabel_34:
        JNZ     ??ZDO_StartRouterConfirmCB_1
// 1921     {
// 1922       // Began with HOLD_AUTO_START
// 1923       devState = DEV_END_DEVICE;
        MOV     A,#0x6
        MOVX    @DPTR,A
        SJMP    ??ZDO_StartRouterConfirmCB_1
// 1924     }
// 1925   }
// 1926 #if defined(BLINK_LEDS)
// 1927   else
// 1928     HalLedSet( HAL_LED_3, HAL_LED_MODE_FLASH );  // Flash LED to show failure
??ZDO_StartRouterConfirmCB_0:
        ; Setup parameters for call to function HalLedSet
        MOV     R2,#0x4
        MOV     R1,#0x4
        LCALL   ??HalLedSet?relay
// 1929 #endif
// 1930 
// 1931   osal_set_event( ZDAppTaskID, ZDO_ROUTER_START );
??ZDO_StartRouterConfirmCB_1:
        ; Setup parameters for call to function osal_set_event
        MOV     R2,#0x20
        LJMP    ?Subroutine16 & 0xFFFF
        CFI EndBlock cfiBlock83
// 1932 }
// 1933 #endif  //RTR_NWK
// 1934 
// 1935 /*********************************************************************
// 1936  * @fn          ZDO_JoinConfirmCB
// 1937  *
// 1938  * @brief       This function allows the next hight layer to be notified
// 1939  *              of the results of its request to join itself or another
// 1940  *              device to a network.
// 1941  *
// 1942  * @param       Status - Result of NLME_JoinRequest()
// 1943  *
// 1944  * @return      none
// 1945  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1946 void ZDO_JoinConfirmCB( uint16 PanId, ZStatus_t Status )
ZDO_JoinConfirmCB:
        CFI Block cfiBlock84 Using cfiCommon0
        CFI Function ZDO_JoinConfirmCB
// 1947 {
        FUNCALL ZDO_JoinConfirmCB, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_JoinConfirmCB, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_JoinConfirmCB, HalLedSet
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_JoinConfirmCB, ZDApp_SendMsg
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1948   nwkStatus = (byte)Status;
        MOV     A,R1
        MOV     DPTR,#nwkStatus
        MOVX    @DPTR,A
// 1949 
// 1950   if ( Status == ZSUCCESS )
        JNZ     ??ZDO_JoinConfirmCB_0
// 1951   {
// 1952     // LED on shows device joined
// 1953     HalLedSet ( HAL_LED_3, HAL_LED_MODE_ON );
        ; Setup parameters for call to function HalLedSet
        LCALL   ?Subroutine14 & 0xFFFF
// 1954     // LED off forgets HOLD_AUTO_START
// 1955     HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF);
// 1956     if ( (devState == DEV_HOLD) )
??CrossCallReturnLabel_35:
        JNZ     ??ZDO_JoinConfirmCB_1
// 1957     {
// 1958       // Began with HOLD_AUTO_START
// 1959       devState = DEV_NWK_JOINING;
        MOV     A,#0x3
        MOVX    @DPTR,A
        SJMP    ??ZDO_JoinConfirmCB_1
// 1960     }
// 1961 #if !  ( SECURE != 0  )
// 1962     // Notify to save info into NV
// 1963     ZDApp_NVUpdate();
// 1964 #endif
// 1965   }
// 1966 #if defined(BLINK_LEDS)
// 1967   else
// 1968     HalLedSet ( HAL_LED_3, HAL_LED_MODE_FLASH );  // Flash LED to show failure
??ZDO_JoinConfirmCB_0:
        ; Setup parameters for call to function HalLedSet
        MOV     R2,#0x4
        MOV     R1,#0x4
        LCALL   ??HalLedSet?relay
// 1969 #endif
// 1970 
// 1971   // Notify ZDApp
// 1972   ZDApp_SendMsg( ZDAppTaskID, ZDO_NWK_JOIN_IND, sizeof(osal_event_hdr_t), (byte*)NULL );
??ZDO_JoinConfirmCB_1:
        ; Setup parameters for call to function ZDApp_SendMsg
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R3,#0x2
        MOV     R2,#0x2
        LJMP    ?Subroutine21 & 0xFFFF
        CFI EndBlock cfiBlock84
// 1973 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine14:
        CFI Block cfiCond85 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_34
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        CFI Block cfiCond86 Using cfiCommon0
        CFI (cfiCond86) NoFunction
        CFI (cfiCond86) Conditional ??CrossCallReturnLabel_35
        CFI (cfiCond86) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond86) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond86) CFA_SP SP+-5
        CFI Block cfiPicker87 Using cfiCommon1
        CFI (cfiPicker87) NoFunction
        CFI (cfiPicker87) Picker
        MOV     R2,#0x1
        MOV     R1,#0x4
        LCALL   ??HalLedSet?relay
        ; Setup parameters for call to function HalLedSet
        ; Setup parameters for call to function HalLedSet
        MOV     R2,#0x0
        MOV     R1,#0x8
        LCALL   ??HalLedSet?relay
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        RET
        CFI EndBlock cfiCond85
        CFI EndBlock cfiCond86
        CFI EndBlock cfiPicker87
// 1974 
// 1975 /*********************************************************************
// 1976  * @fn          ZDO_JoinIndicationCB
// 1977  *
// 1978  * @brief       This function allows the next higher layer of a
// 1979  *              coordinator to be notified of a remote join request.
// 1980  *
// 1981  * @param       ShortAddress - 16-bit address
// 1982  * @param       ExtendedAddress - IEEE (64-bit) address
// 1983  * @param       CapabilityInformation - Association Capability Information
// 1984  *
// 1985  * @return      ZStatus_t
// 1986  */
// 1987 #if defined(RTR_NWK)

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 1988 ZStatus_t ZDO_JoinIndicationCB( uint16 ShortAddress, byte *ExtendedAddress,
ZDO_JoinIndicationCB:
        CFI Block cfiBlock88 Using cfiCommon0
        CFI Function ZDO_JoinIndicationCB
// 1989                                          byte CapabilityInformation )
// 1990 {
        FUNCALL ZDO_JoinIndicationCB, ZDApp_NVUpdate
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_JoinIndicationCB, osal_start_timerEx
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 1991 #if defined (AUTO_SOFT_START)
// 1992     ZDX_PostCoordinatorIEEE(ShortAddress);
// 1993 #endif
// 1994 
// 1995   // Notify to save info into NV
// 1996   ZDApp_NVUpdate();
        ; Setup parameters for call to function ZDApp_NVUpdate
        LCALL   ??ZDApp_NVUpdate?relay
// 1997 
// 1998 #if   ( SECURE != 0  )
// 1999   // send notification to TC of new device..
// 2000   if ( _NIB.SecurityLevel )
        MOV     DPTR,#(_NIB + 12)
        MOVX    A,@DPTR
        JZ      ??CrossCallReturnLabel_10
// 2001     osal_start_timerEx( ZDAppTaskID, ZDO_NEW_DEVICE, 600 );
        ; Setup parameters for call to function osal_start_timerEx
        MOV     R4,#0x58
        MOV     R5,#0x2
        LCALL   ?Subroutine6 & 0xFFFF
// 2002 #endif  // SECURE
// 2003 
// 2004   return ( ZSuccess );
??CrossCallReturnLabel_10:
        MOV     R1,#0x0
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock88
// 2005 }
// 2006 #endif  //RTR_NWK
// 2007 
// 2008 /*********************************************************************
// 2009  * @fn          ZDO_LeaveCnf
// 2010  *
// 2011  * @brief       This function allows the next higher layer to be
// 2012  *              notified of the results of its request for this or
// 2013  *              a child device to leave the network.
// 2014  *
// 2015  * @param       cnf - NLME_LeaveCnf_t
// 2016  *
// 2017  * @return      none
// 2018  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2019 void ZDO_LeaveCnf( NLME_LeaveCnf_t* cnf )
ZDO_LeaveCnf:
        CFI Block cfiBlock89 Using cfiCommon0
        CFI Function ZDO_LeaveCnf
// 2020 {
        FUNCALL ZDO_LeaveCnf, NLME_GetExtAddr
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_LeaveCnf, osal_ExtAddrEqual
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_LeaveCnf, ZDApp_LeaveReset
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_LeaveCnf, NLME_RemoveChild
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 9, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 9, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0x9
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        ; Saved register size: 9
        ; Auto size: 0
        MOV     A,R2
        MOV     R6,A
        MOV     A,R3
        MOV     R7,A
// 2021   // Check for this device
// 2022   if ( osal_ExtAddrEqual( cnf->extAddr,
// 2023                           NLME_GetExtAddr() ) == TRUE )
        ; Setup parameters for call to function osal_ExtAddrEqual
        ; Setup parameters for call to function NLME_GetExtAddr
        LCALL   ??NLME_GetExtAddr?relay
        MOV     A,R2
        MOV     R4,A
        MOV     A,R3
        MOV     R5,A
        MOV     A,R6
        ADD     A,#0x2
        MOV     R2,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     R3,A
        LCALL   ??osal_ExtAddrEqual?relay
        MOV     A,R1
        XRL     A,#0x1
        JNZ     ??ZDO_LeaveCnf_0
// 2024   {
// 2025     // Prepare to leave with reset
// 2026     ZDApp_LeaveReset( cnf->rejoin );
        ; Setup parameters for call to function ZDApp_LeaveReset
        MOV     A,R6
        ADD     A,#0xb
        LCALL   ?Subroutine10 & 0xFFFF
??CrossCallReturnLabel_18:
        SJMP    ??CrossCallReturnLabel_7
// 2027   }
// 2028   //------------------------------------------------------------------
// 2029   #if defined( RTR_NWK )
// 2030   //------------------------------------------------------------------
// 2031   else
// 2032   {
// 2033     // Remove device address(optionally descendents) from data
// 2034     ZDApp_LeaveUpdate( cnf->dstAddr,
// 2035                        cnf->extAddr,
// 2036                        cnf->removeChildren );
??ZDO_LeaveCnf_0:
        ; Setup parameters for call to function NLME_RemoveChild
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        LCALL   ?Subroutine5 & 0xFFFF
// 2037   }
// 2038   //------------------------------------------------------------------
// 2039   #endif
// 2040   //------------------------------------------------------------------
// 2041 }
??CrossCallReturnLabel_7:
        LJMP    ?Subroutine20 & 0xFFFF
        CFI EndBlock cfiBlock89
// 2042 
// 2043 /*********************************************************************
// 2044  * @fn          ZDO_LeaveInd
// 2045  *
// 2046  * @brief       This function allows the next higher layer of a
// 2047  *              device to be notified of a remote leave request or
// 2048  *              indication.
// 2049  *
// 2050  * @param       ind - NLME_LeaveInd_t
// 2051  *
// 2052  * @return      none
// 2053  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2054 void ZDO_LeaveInd( NLME_LeaveInd_t* ind )
ZDO_LeaveInd:
        CFI Block cfiBlock90 Using cfiCommon0
        CFI Function ZDO_LeaveInd
// 2055 {
        FUNCALL ZDO_LeaveInd, NLME_LeaveRsp
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_LeaveInd, NLME_GetCoordShortAddr
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_LeaveInd, ZDApp_LeaveReset
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDO_LeaveInd, NLME_RemoveChild
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 2
        MOV     A,#-0x2
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     A,R2
        MOV     R6,A
        MOV     A,R3
        MOV     R7,A
// 2056   uint8 leave;
// 2057 
// 2058 
// 2059   // Parent is requesting the leave - NWK layer filters out illegal
// 2060   // requests
// 2061   if ( ind->request == TRUE )
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0x1
        JNZ     ??ZDO_LeaveInd_0
// 2062   {
// 2063     // Notify network of leave
// 2064     //----------------------------------------------------------------
// 2065     #if defined( RTR_NWK )
// 2066     //----------------------------------------------------------------
// 2067     NLME_LeaveRsp_t rsp;
// 2068     rsp.rejoin         = ind->rejoin;
        LCALL   ?Subroutine11 & 0xFFFF
??CrossCallReturnLabel_21:
        PUSH    A
        CFI CFA_SP SP+-1
        MOV     A,#0x1
        LCALL   ?XSTACK_DISP0_8
        POP     A
        CFI CFA_SP SP+0
        MOVX    @DPTR,A
// 2069     rsp.removeChildren = ind->removeChildren;
        MOV     A,R6
        ADD     A,#0xb
        LCALL   ??Subroutine11_0 & 0xFFFF
??CrossCallReturnLabel_22:
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOVX    @DPTR,A
// 2070     NLME_LeaveRsp( &rsp );
        ; Setup parameters for call to function NLME_LeaveRsp
        MOV     R2,DPL
        MOV     R3,DPH
        LCALL   ??NLME_LeaveRsp?relay
        SJMP    ??ZDO_LeaveInd_1
// 2071     //----------------------------------------------------------------
// 2072     #endif
// 2073     //----------------------------------------------------------------
// 2074 
// 2075     // Prepare to leave with reset
// 2076     ZDApp_LeaveReset( ind->rejoin );
// 2077   }
// 2078   else
// 2079   {
// 2080     leave = FALSE;
// 2081 
// 2082     // Check if this device needs to leave as a child or descendent
// 2083     if ( ind->srcAddr == NLME_GetCoordShortAddr() )
??ZDO_LeaveInd_0:
        ; Setup parameters for call to function NLME_GetCoordShortAddr
        LCALL   ??NLME_GetCoordShortAddr?relay
        MOV     ?V0 + 0,R2
        MOV     ?V0 + 1,R3
        MOV     R0,?V0 + 0
        MOV     R1,?V0 + 1
        MOV     DPL,R6
        MOV     DPH,R7
        MOVX    A,@DPTR
        XRL     A,R0
        JNZ     ??ZDO_LeaveInd_2
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,R1
??ZDO_LeaveInd_2:
        JNZ     ??ZDO_LeaveInd_3
// 2084     {
// 2085       if ( ( ind->removeChildren == TRUE               ) ||
// 2086            ( ZDO_Config_Node_Descriptor.LogicalType ==
// 2087              NODETYPE_DEVICE                           )    )
        MOV     A,R6
        ADD     A,#0xb
        LCALL   ??Subroutine11_0 & 0xFFFF
??CrossCallReturnLabel_23:
        XRL     A,#0x1
        JZ      ??ZDO_LeaveInd_1
        LCALL   ?Subroutine7 & 0xFFFF
??CrossCallReturnLabel_17:
        JNZ     ??ZDO_LeaveInd_3
// 2088       {
// 2089         leave = TRUE;
// 2090       }
// 2091     }
// 2092     else if ( ind->removeChildren == TRUE )
// 2093     {
// 2094       // Check NWK address allocation algorithm
// 2095       //leave = RTG_ANCESTOR(nwkAddr,thisAddr);
// 2096     }
// 2097 
// 2098     if ( leave == TRUE )
// 2099     {
// 2100       // Prepare to leave with reset
// 2101       ZDApp_LeaveReset( ind->rejoin );
??ZDO_LeaveInd_1:
        ; Setup parameters for call to function ZDApp_LeaveReset
        MOV     A,R6
        ADD     A,#0xc
        LCALL   ?Subroutine10 & 0xFFFF
??CrossCallReturnLabel_19:
        SJMP    ??CrossCallReturnLabel_8
// 2102     }
// 2103     else
// 2104     {
// 2105       // Remove device address(optionally descendents) from data
// 2106       ZDApp_LeaveUpdate( ind->srcAddr,
// 2107                          ind->extAddr,
// 2108                          ind->removeChildren );
??ZDO_LeaveInd_3:
        ; Setup parameters for call to function NLME_RemoveChild
        MOV     A,R6
        ADD     A,#0xb
        MOV     DPL,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     DPH,A
        LCALL   ?Subroutine5 & 0xFFFF
// 2109     }
// 2110   }
// 2111 }
??CrossCallReturnLabel_8:
        LJMP    ?Subroutine18 & 0xFFFF
        CFI EndBlock cfiBlock90

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine11:
        CFI Block cfiCond91 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_21
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 12)
        CFI Block cfiCond92 Using cfiCommon0
        CFI (cfiCond92) NoFunction
        CFI (cfiCond92) Conditional ??CrossCallReturnLabel_25
        CFI (cfiCond92) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond92) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond92) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond92) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond92) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond92) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond92) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond92) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond92) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond92) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond92) CFA_SP SP+0
        CFI (cfiCond92) CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond93 Using cfiCommon0
        CFI (cfiCond93) NoFunction
        CFI (cfiCond93) Conditional ??CrossCallReturnLabel_26
        CFI (cfiCond93) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond93) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond93) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond93) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond93) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond93) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond93) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond93) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond93) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond93) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond93) CFA_SP SP+0
        CFI (cfiCond93) CFA_XSP16 add(XSP16, 10)
        CFI Block cfiPicker94 Using cfiCommon1
        CFI (cfiPicker94) NoFunction
        CFI (cfiPicker94) Picker
        MOV     A,R6
        ADD     A,#0xc
        CFI Block cfiCond95 Using cfiCommon0
        CFI (cfiCond95) NoFunction
        CFI (cfiCond95) Conditional ??CrossCallReturnLabel_22
        CFI (cfiCond95) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond95) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond95) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond95) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond95) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond95) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond95) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond95) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond95) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond95) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond95) CFA_SP SP+0
        CFI (cfiCond95) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiCond96 Using cfiCommon0
        CFI (cfiCond96) NoFunction
        CFI (cfiCond96) Conditional ??CrossCallReturnLabel_23
        CFI (cfiCond96) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond96) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond96) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond96) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond96) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond96) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond96) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond96) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond96) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond96) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond96) CFA_SP SP+0
        CFI (cfiCond96) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiCond97 Using cfiCommon0
        CFI (cfiCond97) NoFunction
        CFI (cfiCond97) Conditional ??CrossCallReturnLabel_24
        CFI (cfiCond97) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond97) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond97) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond97) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond97) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond97) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond97) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond97) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond97) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond97) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond97) CFA_SP SP+0
        CFI (cfiCond97) CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond98 Using cfiCommon0
        CFI (cfiCond98) NoFunction
        CFI (cfiCond98) Conditional ??CrossCallReturnLabel_27
        CFI (cfiCond98) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond98) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond98) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond98) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond98) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond98) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond98) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond98) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond98) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond98) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond98) CFA_SP SP+0
        CFI (cfiCond98) CFA_XSP16 add(XSP16, 14)
        CFI Block cfiCond99 Using cfiCommon0
        CFI (cfiCond99) NoFunction
        CFI (cfiCond99) Conditional ??CrossCallReturnLabel_28
        CFI (cfiCond99) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond99) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond99) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond99) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond99) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond99) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond99) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond99) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond99) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond99) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond99) CFA_SP SP+0
        CFI (cfiCond99) CFA_XSP16 add(XSP16, 14)
??Subroutine11_0:
        MOV     DPL,A
        MOV     A,R7
        CFI Block cfiCond100 Using cfiCommon0
        CFI (cfiCond100) NoFunction
        CFI (cfiCond100) Conditional ??CrossCallReturnLabel_20
        CFI (cfiCond100) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond100) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond100) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond100) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond100) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond100) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond100) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond100) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond100) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond100) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond100) CFA_SP SP+0
        CFI (cfiCond100) CFA_XSP16 add(XSP16, 24)
??Subroutine11_1:
        ADDC    A,#0x0
        MOV     DPH,A
        MOVX    A,@DPTR
        RET
        CFI EndBlock cfiCond91
        CFI EndBlock cfiCond92
        CFI EndBlock cfiCond93
        CFI EndBlock cfiPicker94
        CFI EndBlock cfiCond95
        CFI EndBlock cfiCond96
        CFI EndBlock cfiCond97
        CFI EndBlock cfiCond98
        CFI EndBlock cfiCond99
        CFI EndBlock cfiCond100

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine10:
        CFI Block cfiCond101 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_18
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        CFI Block cfiCond102 Using cfiCommon0
        CFI (cfiCond102) NoFunction
        CFI (cfiCond102) Conditional ??CrossCallReturnLabel_19
        CFI (cfiCond102) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond102) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond102) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond102) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond102) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond102) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond102) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond102) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond102) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond102) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond102) CFA_SP SP+0
        CFI (cfiCond102) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker103 Using cfiCommon1
        CFI (cfiPicker103) NoFunction
        CFI (cfiPicker103) Picker
        MOV     DPL,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     DPH,A
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??ZDApp_LeaveReset?relay
        RET
        CFI EndBlock cfiCond101
        CFI EndBlock cfiCond102
        CFI EndBlock cfiPicker103

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine5:
        CFI Block cfiCond104 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_7
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 9)
        CFI Block cfiCond105 Using cfiCommon0
        CFI (cfiCond105) NoFunction
        CFI (cfiCond105) Conditional ??CrossCallReturnLabel_8
        CFI (cfiCond105) R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond105) VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond105) V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond105) V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond105) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond105) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond105) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond105) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond105) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond105) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond105) CFA_SP SP+0
        CFI (cfiCond105) CFA_XSP16 add(XSP16, 12)
        CFI Block cfiPicker106 Using cfiCommon1
        CFI (cfiPicker106) NoFunction
        CFI (cfiPicker106) Picker
        MOVX    A,@DPTR
        MOV     R1,A
        MOV     A,R6
        ADD     A,#0x2
        MOV     R2,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     R3,A
        LCALL   ??NLME_RemoveChild?relay
        RET
        CFI EndBlock cfiCond104
        CFI EndBlock cfiCond105
        CFI EndBlock cfiPicker106
// 2112 
// 2113 /*********************************************************************
// 2114  * @fn          ZDO_SyncIndicationCB
// 2115  *
// 2116  * @brief       This function allows the next higher layer of a
// 2117  *              coordinator to be notified of a loss of synchronization
// 2118  *                          with the parent/child device.
// 2119  *
// 2120  * @param       type: 0 - child; 1 - parent
// 2121  *
// 2122  *
// 2123  * @return      none
// 2124  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2125 void ZDO_SyncIndicationCB( byte type, uint16 shortAddr )
ZDO_SyncIndicationCB:
        CFI Block cfiBlock107 Using cfiCommon0
        CFI Function ZDO_SyncIndicationCB
// 2126 {
        ; Saved register size: 0
        ; Auto size: 0
// 2127 
// 2128 #if !defined ( RTR_NWK )
// 2129     if ( type == 1 )
// 2130     {
// 2131       ZDApp_SendMsg( ZDAppTaskID, ZDO_NWK_JOIN_REQ, sizeof(osal_event_hdr_t), NULL );
// 2132     }
// 2133 #endif
// 2134   return;
        LJMP    ?BRET
        CFI EndBlock cfiBlock107
// 2135 }
// 2136 
// 2137 /*********************************************************************
// 2138  * @fn          ZDO_PollConfirmCB
// 2139  *
// 2140  * @brief       This function allows the next higher layer to be
// 2141  *              notified of a Poll Confirm.
// 2142  *
// 2143  * @param       none
// 2144  *
// 2145  * @return      none
// 2146  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2147 void ZDO_PollConfirmCB( byte status )
ZDO_PollConfirmCB:
        CFI Block cfiBlock108 Using cfiCommon0
        CFI Function ZDO_PollConfirmCB
// 2148 {
        ; Saved register size: 0
        ; Auto size: 0
// 2149   return;
        LJMP    ?BRET
        CFI EndBlock cfiBlock108
// 2150 }
// 2151 
// 2152 /******************************************************************************
// 2153  * @fn          ZDApp_NwkWriteNVRequest (stubs AddrMgrWriteNVRequest)
// 2154  *
// 2155  * @brief       Stub routine implemented by NHLE. NHLE should call
// 2156  *              <AddrMgrWriteNV> when appropriate.
// 2157  *
// 2158  * @param       none
// 2159  *
// 2160  * @return      none
// 2161  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2162 void ZDApp_NwkWriteNVRequest( void )
AddrMgrWriteNVRequest:
        CFI Block cfiBlock109 Using cfiCommon0
        CFI Function AddrMgrWriteNVRequest
// 2163 {
        FUNCALL AddrMgrWriteNVRequest, osal_get_timeoutEx
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL AddrMgrWriteNVRequest, ZDApp_NVUpdate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
// 2164   if ( !osal_get_timeoutEx( ZDAppTaskID, ZDO_NWK_UPDATE_NV ) )
        ; Setup parameters for call to function osal_get_timeoutEx
        MOV     R2,#0x0
        MOV     R3,#0x2
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_get_timeoutEx?relay
        MOV     A,R2
        JNZ     ??AddrMgrWriteNVRequest_0
        MOV     A,R3
??AddrMgrWriteNVRequest_0:
        JNZ     ??AddrMgrWriteNVRequest_1
// 2165   {
// 2166     // Trigger to save info into NV
// 2167     ZDApp_NVUpdate();
        ; Setup parameters for call to function ZDApp_NVUpdate
        LCALL   ??ZDApp_NVUpdate?relay
// 2168   }
// 2169 }
??AddrMgrWriteNVRequest_1:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock109
// 2170 
// 2171 /*********************************************************************
// 2172  * Call Back Functions from Security  - API
// 2173  */
// 2174 
// 2175 #if defined( ZDO_COORDINATOR )
// 2176  /*********************************************************************
// 2177  * @fn          ZDO_UpdateDeviceIndication
// 2178  *
// 2179  * @brief       This function notifies the "Trust Center" of a
// 2180  *              network when a device joins or leaves the network.
// 2181  *
// 2182  * @param       extAddr - pointer to 64 bit address of new device
// 2183  * @param       status  - 0 if a new device joined securely
// 2184  *                      - 1 if a new device joined un-securely
// 2185  *                      - 2 if a device left the network
// 2186  *
// 2187  * @return      true if newly joined device should be allowed to
// 2188  *                                              remain on network
// 2189  */
// 2190 ZStatus_t ZDO_UpdateDeviceIndication( byte *extAddr, byte status )
// 2191 {
// 2192 
// 2193 #if   ( SECURE != 0  )
// 2194   // can implement a network access policy based on the
// 2195   // IEEE address of newly joining devices...
// 2196 #endif  // Trust Center
// 2197 
// 2198   return ZSuccess;
// 2199 }
// 2200 #endif // ZDO
// 2201 
// 2202 /*********************************************************************
// 2203  * @fn          ZDApp_InMsgCB
// 2204  *
// 2205  * @brief       This function is called to pass up any message that is
// 2206  *              not yet supported.  This allows for the developer to
// 2207  *              support features themselves..
// 2208  *
// 2209  * @return      none
// 2210  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2211 void ZDApp_InMsgCB( zdoIncomingMsg_t *inMsg )
ZDApp_InMsgCB:
        CFI Block cfiBlock110 Using cfiCommon0
        CFI Function ZDApp_InMsgCB
// 2212 {
        FUNCALL ZDApp_InMsgCB, ZDP_GenericRsp
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
        MOV     A,R2
        MOV     R6,A
        MOV     A,R3
        MOV     R7,A
// 2213   if ( inMsg->clusterID & ZDO_RESPONSE_BIT )
        MOV     A,R6
        ADD     A,#0xc
        MOV     DPL,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     DPH,A
        INC     DPTR
        MOVX    A,@DPTR
        ANL     A,#0x80
        MOV     R1,A
        CLR     A
        JNZ     ??ZDApp_InMsgCB_0
        MOV     A,R1
??ZDApp_InMsgCB_0:
        JNZ     ??ZDApp_InMsgCB_1
// 2214   {
// 2215     // Handle the response message
// 2216   }
// 2217   else
// 2218   {
// 2219     // Handle the request message by sending a generic "not supported".
// 2220     // End Device Announce doesn't have a response.
// 2221     if ( !(inMsg->wasBroadcast) && inMsg->clusterID != End_Device_annce )
        MOV     A,R6
        ADD     A,#0xb
        LCALL   ??Subroutine11_0 & 0xFFFF
??CrossCallReturnLabel_24:
        JNZ     ??ZDApp_InMsgCB_1
        LCALL   ?Subroutine11 & 0xFFFF
??CrossCallReturnLabel_25:
        XRL     A,#0x13
        JNZ     ??ZDApp_InMsgCB_2
        INC     DPTR
        MOVX    A,@DPTR
??ZDApp_InMsgCB_2:
        JZ      ??ZDApp_InMsgCB_1
// 2222     {
// 2223       ZDP_GenericRsp( inMsg->TransSeq, &(inMsg->srcAddr), ZDP_NOT_SUPPORTED, 0,
// 2224                       (uint16)(inMsg->clusterID | ZDO_RESPONSE_BIT), inMsg->SecurityUse );
        ; Setup parameters for call to function ZDP_GenericRsp
        LCALL   ?Subroutine11 & 0xFFFF
??CrossCallReturnLabel_26:
        MOV     ?V0 + 0,A
        INC     DPTR
        MOVX    A,@DPTR
        ORL     A,#0x80
        MOV     ?V0 + 1,A
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 12)
        MOV     ?V0 + 0,#0x0
        MOV     ?V0 + 1,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_TWO
        CFI CFA_XSP16 add(XSP16, 14)
        MOV     A,R6
        ADD     A,#0xe
        LCALL   ??Subroutine11_0 & 0xFFFF
??CrossCallReturnLabel_27:
        MOV     R5,A
        MOV     R4,#-0x7c
        MOV     A,R6
        ADD     A,#0x2
        INC     R2
        INC     R2
        MOV     A,R7
        ADDC    A,#0x0
        MOV     R3,A
        MOV     A,R6
        ADD     A,#0xf
        LCALL   ??Subroutine11_0 & 0xFFFF
??CrossCallReturnLabel_28:
        MOV     R1,A
        LCALL   ??ZDP_GenericRsp?relay
        MOV     A,#0x4
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 10)
// 2225     }
// 2226   }
// 2227 }
??ZDApp_InMsgCB_1:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock110
// 2228 
// 2229 /*********************************************************************
// 2230  * @fn      ZDApp_ChangeMatchDescRespPermission()
// 2231  *
// 2232  * @brief   Changes the Match Descriptor Response permission.
// 2233  *
// 2234  * @param   endpoint - endpoint to allow responses
// 2235  * @param   action - true to allow responses, false to not
// 2236  *
// 2237  * @return  none
// 2238  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2239 void ZDApp_ChangeMatchDescRespPermission( uint8 endpoint, uint8 action )
ZDApp_ChangeMatchDescRespPermission:
        CFI Block cfiBlock111 Using cfiCommon0
        CFI Function ZDApp_ChangeMatchDescRespPermission
// 2240 {
        FUNCALL ZDApp_ChangeMatchDescRespPermission, afSetMatch
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 2241   // Store the action
// 2242   afSetMatch( endpoint, action );
        ; Setup parameters for call to function afSetMatch
        LCALL   ??afSetMatch?relay
// 2243 }
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock111
// 2244 
// 2245 /*********************************************************************
// 2246  * @fn      ZDApp_NetworkInit()
// 2247  *
// 2248  * @brief   Used to start the network joining process
// 2249  *
// 2250  * @param   delay - mSec delay to wait before starting
// 2251  *
// 2252  * @return  none
// 2253  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2254 void ZDApp_NetworkInit( uint16 delay )
ZDApp_NetworkInit:
        CFI Block cfiBlock112 Using cfiCommon0
        CFI Function ZDApp_NetworkInit
// 2255 {
        FUNCALL ZDApp_NetworkInit, osal_start_timerEx
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL ZDApp_NetworkInit, osal_set_event
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 2256   if ( delay )
        MOV     A,R2
        JNZ     ??ZDApp_NetworkInit_0
        MOV     A,R3
??ZDApp_NetworkInit_0:
        JZ      ??ZDApp_NetworkInit_1
// 2257   {
// 2258     // Wait awhile before starting the device
// 2259     osal_start_timerEx( ZDAppTaskID, ZDO_NETWORK_INIT, delay );
        ; Setup parameters for call to function osal_start_timerEx
        MOV     A,R2
        MOV     R4,A
        MOV     A,R3
        MOV     R5,A
        MOV     R2,#0x1
        LCALL   ??Subroutine6_0 & 0xFFFF
??CrossCallReturnLabel_12:
        SJMP    ??CrossCallReturnLabel_49
// 2260   }
// 2261   else
// 2262   {
// 2263     osal_set_event( ZDAppTaskID, ZDO_NETWORK_INIT );
??ZDApp_NetworkInit_1:
        ; Setup parameters for call to function osal_set_event
        MOV     R2,#0x1
        LCALL   ??Subroutine4_0 & 0xFFFF
// 2264   }
// 2265 }
??CrossCallReturnLabel_49:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock112

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine6:
        CFI Block cfiCond113 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_9
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond114 Using cfiCommon0
        CFI (cfiCond114) NoFunction
        CFI (cfiCond114) Conditional ??CrossCallReturnLabel_10
        CFI (cfiCond114) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond114) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond114) CFA_SP SP+-5
        CFI Block cfiPicker115 Using cfiCommon1
        CFI (cfiPicker115) NoFunction
        CFI (cfiPicker115) Picker
        MOV     R2,#0x40
        CFI Block cfiCond116 Using cfiCommon0
        CFI (cfiCond116) NoFunction
        CFI (cfiCond116) Conditional ??CrossCallReturnLabel_11
        CFI (cfiCond116) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond116) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond116) CFA_SP SP+-5
        CFI Block cfiCond117 Using cfiCommon0
        CFI (cfiCond117) NoFunction
        CFI (cfiCond117) Conditional ??CrossCallReturnLabel_12
        CFI (cfiCond117) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond117) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond117) CFA_SP SP+-5
??Subroutine6_0:
        MOV     R3,#0x0
        CFI Block cfiCond118 Using cfiCommon0
        CFI (cfiCond118) NoFunction
        CFI (cfiCond118) Conditional ??CrossCallReturnLabel_13
        CFI (cfiCond118) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond118) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond118) CFA_SP SP+-5
??Subroutine6_1:
        MOV     DPTR,#ZDAppTaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_start_timerEx?relay
        RET
        CFI EndBlock cfiCond113
        CFI EndBlock cfiCond114
        CFI EndBlock cfiPicker115
        CFI EndBlock cfiCond116
        CFI EndBlock cfiCond117
        CFI EndBlock cfiCond118
// 2266 
// 2267 /*********************************************************************
// 2268  * @fn      ZDApp_StartUpFromApp()
// 2269  *
// 2270  * @brief   Start the device.  This function will only start a device
// 2271  *          that is in the Holding state.
// 2272  *
// 2273  * @param   mode - ZDAPP_STARTUP_COORD - Start up as coordinator only
// 2274  *                 ZDAPP_STARTUP_ROUTER - Start up as router only
// 2275  *                 ZDAPP_STARTUP_AUTO - Startup in auto, look for coord,
// 2276  *                                       if not found, become coord.
// 2277  *
// 2278  * @return  TRUE if started, FALSE if in the wrong mode
// 2279  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2280 ZStatus_t ZDApp_StartUpFromApp( uint8 mode )
ZDApp_StartUpFromApp:
        CFI Block cfiBlock119 Using cfiCommon0
        CFI Function ZDApp_StartUpFromApp
// 2281 {
        FUNCALL ZDApp_StartUpFromApp, ZDOInitDevice
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 2282   ZStatus_t ret = ZFailure;
        MOV     R1,#0x1
// 2283 
// 2284   if ( devState == DEV_HOLD )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        JNZ     ??ZDApp_StartUpFromApp_0
// 2285   {
// 2286     // Start the device's joining process
// 2287     if ( ZDOInitDevice( 0 ) == ZDO_INITDEV_NEW_NETWORK_STATE )
        ; Setup parameters for call to function ZDOInitDevice
        MOV     R2,#0x0
        MOV     R3,#0x0
        LCALL   ??ZDOInitDevice?relay
// 2288     {
// 2289 #if defined( SOFT_START )
// 2290       if ( mode == ZDAPP_STARTUP_COORD )
// 2291       {
// 2292         devStartMode = MODE_HARD;     // Start as a coordinator
// 2293         ZDO_Config_Node_Descriptor.LogicalType = NODETYPE_COORDINATOR;
// 2294       }
// 2295       else
// 2296       {
// 2297         if ( mode == ZDAPP_STARTUP_ROUTER )
// 2298         {
// 2299           softStartAllowCoord = FALSE;  // Don't allow coord to start
// 2300           continueJoining = TRUE;
// 2301         }
// 2302         devStartMode = MODE_JOIN;     // Assume joining
// 2303       }
// 2304 #endif  // SOFT_START
// 2305     }
// 2306     ret = ZSuccess;
        MOV     R1,#0x0
// 2307   }
// 2308 
// 2309   return ( ret );
??ZDApp_StartUpFromApp_0:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock119
// 2310 }
// 2311 
// 2312 /*********************************************************************
// 2313  * @fn      ZDApp_StopStartUp()
// 2314  *
// 2315  * @brief   Stops the joining process of a router.  This will only
// 2316  *          work if the router is in the scanning process and
// 2317  *          the SOFT_START feature is enabled.
// 2318  *
// 2319  * @param   none
// 2320  *
// 2321  * @return  TRUE if SOFT_START is enabled, FALSE if not possible
// 2322  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2323 uint8 ZDApp_StopStartUp( void )
ZDApp_StopStartUp:
        CFI Block cfiBlock120 Using cfiCommon0
        CFI Function ZDApp_StopStartUp
// 2324 {
        ; Saved register size: 0
        ; Auto size: 0
// 2325   uint8 ret = FALSE;
// 2326 
// 2327 #if defined( SOFT_START )
// 2328   continueJoining = FALSE;
// 2329   ret = TRUE;
// 2330 #endif  // SOFT_START
// 2331 
// 2332   return ( ret );
        MOV     R1,#0x0
        LJMP    ?BRET
        CFI EndBlock cfiBlock120
// 2333 }
// 2334 
// 2335 /*********************************************************************
// 2336  * @fn      ZDApp_StartJoiningCycle()
// 2337  *
// 2338  * @brief   Starts the joining cycle of a device.  This will only
// 2339  *          continue an already started (or stopped) joining cycle.
// 2340  *
// 2341  * @param   none
// 2342  *
// 2343  * @return  TRUE if joining stopped, FALSE if joining or rejoining
// 2344  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2345 uint8 ZDApp_StartJoiningCycle( void )
ZDApp_StartJoiningCycle:
        CFI Block cfiBlock121 Using cfiCommon0
        CFI Function ZDApp_StartJoiningCycle
// 2346 {
        FUNCALL ZDApp_StartJoiningCycle, ZDApp_NetworkInit
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 2347   if ( devState == DEV_INIT || devState == DEV_NWK_DISC )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x1
        JZ      ??ZDApp_StartJoiningCycle_0
        MOVX    A,@DPTR
        XRL     A,#0x2
        JNZ     ??ZDApp_StartJoiningCycle_1
// 2348   {
// 2349     continueJoining = TRUE;
??ZDApp_StartJoiningCycle_0:
        MOV     A,#0x1
        MOV     DPTR,#continueJoining
        LCALL   ?Subroutine1 & 0xFFFF
// 2350     ZDApp_NetworkInit( 0 );
// 2351 
// 2352     return ( TRUE );
??CrossCallReturnLabel_41:
        MOV     R1,#0x1
        SJMP    ??ZDApp_StartJoiningCycle_2
// 2353   }
// 2354   else
// 2355     return ( FALSE );
??ZDApp_StartJoiningCycle_1:
        MOV     R1,#0x0
??ZDApp_StartJoiningCycle_2:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock121
// 2356 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine1:
        CFI Block cfiCond122 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_40
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        CFI Block cfiCond123 Using cfiCommon0
        CFI (cfiCond123) NoFunction
        CFI (cfiCond123) Conditional ??CrossCallReturnLabel_41
        CFI (cfiCond123) DPL0 Frame(CFA_SP, 4)
        CFI (cfiCond123) DPH0 Frame(CFA_SP, 5)
        CFI (cfiCond123) CFA_SP SP+-5
        CFI Block cfiPicker124 Using cfiCommon1
        CFI (cfiPicker124) NoFunction
        CFI (cfiPicker124) Picker
        MOVX    @DPTR,A
        ; Setup parameters for call to function ZDApp_NetworkInit
        ; Setup parameters for call to function ZDApp_NetworkInit
        MOV     R2,#0x0
        LJMP    ?Subroutine19 & 0xFFFF
        CFI EndBlock cfiCond122
        CFI EndBlock cfiCond123
        CFI EndBlock cfiPicker124
// 2357 
// 2358 /*********************************************************************
// 2359  * @fn      ZDApp_StopJoiningCycle()
// 2360  *
// 2361  * @brief   Stops the joining or rejoining process of a device.
// 2362  *
// 2363  * @param   none
// 2364  *
// 2365  * @return  TRUE if joining stopped, FALSE if joining or rejoining
// 2366  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2367 uint8 ZDApp_StopJoiningCycle( void )
ZDApp_StopJoiningCycle:
        CFI Block cfiBlock125 Using cfiCommon0
        CFI Function ZDApp_StopJoiningCycle
// 2368 {
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 2369   if ( devState == DEV_INIT || devState == DEV_NWK_DISC )
        MOV     DPTR,#devState
        MOVX    A,@DPTR
        XRL     A,#0x1
        JZ      ??ZDApp_StopJoiningCycle_0
        MOVX    A,@DPTR
        XRL     A,#0x2
        JNZ     ??ZDApp_StopJoiningCycle_1
// 2370   {
// 2371     continueJoining = FALSE;
??ZDApp_StopJoiningCycle_0:
        CLR     A
        MOV     DPTR,#continueJoining
        MOVX    @DPTR,A
// 2372     return ( TRUE );
        MOV     R1,#0x1
        SJMP    ??ZDApp_StopJoiningCycle_2
// 2373   }
// 2374   else
// 2375     return ( FALSE );
??ZDApp_StopJoiningCycle_1:
        MOV     R1,#0x0
??ZDApp_StopJoiningCycle_2:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock125
// 2376 }
// 2377 
// 2378 #if !defined ( ZDO_COORDINATOR ) || defined ( SOFT_START )
// 2379 /*********************************************************************
// 2380  * @fn      ZDApp_NodeProfileSync()
// 2381  *
// 2382  * @brief   Sync node with stack profile.
// 2383  *
// 2384  * @param   cfm - ZDO_NetworkDiscoveryCfm_t
// 2385  *
// 2386  * @return  none
// 2387  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2388 void ZDApp_NodeProfileSync( ZDO_NetworkDiscoveryCfm_t* cfm )
ZDApp_NodeProfileSync:
        CFI Block cfiBlock126 Using cfiCommon0
        CFI Function ZDApp_NodeProfileSync
// 2389 {
        FUNCALL ZDApp_NodeProfileSync, nwk_getNetworkDesc
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 10, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 10, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xa
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 10)
        ; Saved register size: 10
        ; Auto size: 0
// 2390   networkDesc_t* desc;
// 2391   uint16         panID;
// 2392 
// 2393   if ( ZDO_Config_Node_Descriptor.CapabilityFlags & CAPINFO_DEVICETYPE_FFD  )
        MOV     DPTR,#(ZDO_Config_Node_Descriptor + 2)
        MOVX    A,@DPTR
        MOV     C,0xE0 /* A   */.1
        JNC     ??ZDApp_NodeProfileSync_0
// 2394   {
// 2395     panID = BUILD_UINT16( cfm->panIdLSB, cfm->panIdMSB );
// 2396 
// 2397     desc = nwk_getNetworkDesc( cfm->extendedPANID, panID, cfm->logicalChannel );
        ; Setup parameters for call to function nwk_getNetworkDesc
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R1,A
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R6,A
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R5,A
        MOV     A,R6
        MOV     R4,A
        MOV     A,R2
        ADD     A,#0x6
        MOV     R2,A
        MOV     A,R3
        ADDC    A,#0x0
        MOV     R3,A
        LCALL   ??nwk_getNetworkDesc?relay
        MOV     DPL,R2
        MOV     DPH,R3
// 2398 
// 2399     if (desc != NULL)
        MOV     A,DPL
        JNZ     ??ZDApp_NodeProfileSync_1
        MOV     A,DPH
??ZDApp_NodeProfileSync_1:
        JZ      ??ZDApp_NodeProfileSync_0
// 2400     {
// 2401       if ( desc->stackProfile != zgStackProfile )
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R2,A
        MOV     DPTR,#zgStackProfile
        MOVX    A,@DPTR
        XRL     A,R2
        JZ      ??ZDApp_NodeProfileSync_0
// 2402       {
// 2403         ZDO_Config_Node_Descriptor.LogicalType = NODETYPE_DEVICE;
        MOV     DPTR,#ZDO_Config_Node_Descriptor
        MOVX    A,@DPTR
        ANL     A,#0xf8
        ORL     A,#0x2
        MOVX    @DPTR,A
// 2404         ZDO_Config_Node_Descriptor.CapabilityFlags = CAPINFO_DEVICETYPE_RFD | CAPINFO_POWER_AC | CAPINFO_RCVR_ON_IDLE;
        MOV     A,#0xc
        MOV     DPTR,#(ZDO_Config_Node_Descriptor + 2)
        MOVX    @DPTR,A
// 2405       }
// 2406     }
// 2407   }
// 2408 }
??ZDApp_NodeProfileSync_0:
        LJMP    ??Subroutine18_1 & 0xFFFF
        CFI EndBlock cfiBlock126
// 2409 #endif
// 2410 
// 2411 /*********************************************************************
// 2412  * @fn      ZDApp_CoordStartPANIDConflictCB()
// 2413  *
// 2414  * @brief   Returns a PAN ID for the network layer to use during
// 2415  *          a coordinator start and there is another network with
// 2416  *          the intended PANID.
// 2417  *
// 2418  * @param   panid - the intended PAN ID
// 2419  *
// 2420  * @return  PANID to try
// 2421  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2422 uint16 ZDApp_CoordStartPANIDConflictCB( uint16 panid )
ZDApp_CoordStartPANIDConflictCB:
        CFI Block cfiBlock127 Using cfiCommon0
        CFI Function ZDApp_CoordStartPANIDConflictCB
// 2423 {
        ; Saved register size: 0
        ; Auto size: 0
// 2424   return ( (panid + 1) & 0x3FFF );
        MOV     A,#0x1
        ADD     A,R2
        CLR     A
        ADDC    A,R3
        MOV     R1,A
        INC     R2
        MOV     A,#0x3f
        ANL     A,R1
        MOV     R3,A
        LJMP    ?BRET
        CFI EndBlock cfiBlock127
// 2425 }
// 2426 
// 2427 
// 2428 /*********************************************************************
// 2429  * @fn          ZDApp_NVUpdate
// 2430  *
// 2431  * @brief       Set the NV Update Timer.
// 2432  *
// 2433  * @param       none
// 2434  *
// 2435  * @return      none
// 2436  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
// 2437 void ZDApp_NVUpdate( void )
ZDApp_NVUpdate:
        CFI Block cfiBlock128 Using cfiCommon0
        CFI Function ZDApp_NVUpdate
// 2438 {
        FUNCALL ZDApp_NVUpdate, osal_start_timerEx
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
// 2439   osal_start_timerEx( ZDAppTaskID, ZDO_NWK_UPDATE_NV, ZDAPP_UPDATE_NWK_NV_TIME );
        ; Setup parameters for call to function osal_start_timerEx
        MOV     R4,#-0x44
        MOV     R5,#0x2
        MOV     R2,#0x0
        MOV     R3,#0x2
        LCALL   ??Subroutine6_1 & 0xFFFF
// 2440 }
??CrossCallReturnLabel_13:
        LJMP    ??Subroutine16_0 & 0xFFFF
        CFI EndBlock cfiBlock128

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for zdoDiscCounter>`:
        DB 1

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for continueJoining>`:
        DB 1

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for devState>`:
        DB 1

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for ZDApp_epDesc>`:
        DB 0
        DW ZDAppTaskID, 0H
        DB 0

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for __Constant_0>`:
        DD 0

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for __Constant_1>`:
        DD 1

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for __Constant_3e8>`:
        DD 1000

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_Init?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_Init

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_SecInit?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_SecInit

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_event_loop?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_event_loop

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDOInitDevice?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDOInitDevice

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ReadNetworkRestoreState?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ReadNetworkRestoreState

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDAppDetermineDeviceType?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDAppDetermineDeviceType

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_NetworkStartEvt?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_NetworkStartEvt

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_DeviceAuthEvt?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_DeviceAuthEvt

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_SaveNetworkStateEvt?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_SaveNetworkStateEvt

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_RestoreNetworkState?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_RestoreNetworkState

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_InitUserDesc?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_InitUserDesc

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDAppCheckForHoldKey?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDAppCheckForHoldKey

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ProcessOSALMsg?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ProcessOSALMsg

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ProcessMsgCBs?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ProcessMsgCBs

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_RegisterCBs?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_RegisterCBs

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ProcessNetworkJoin?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ProcessNetworkJoin

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_SaveNwkKey?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_SaveNwkKey

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ResetNwkKey?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ResetNwkKey

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_RestoreNwkKey?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_RestoreNwkKey

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ResetTimerStart?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ResetTimerStart

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ResetTimerCancel?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ResetTimerCancel

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_LeaveCtrlInit?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_LeaveCtrlInit

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_LeaveCtrlSet?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_LeaveCtrlSet

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_LeaveCtrlBypass?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_LeaveCtrlBypass

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_LeaveCtrlStartup?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_LeaveCtrlStartup

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_LeaveReset?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_LeaveReset

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_LeaveUpdate?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_LeaveUpdate

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_SendEventMsg?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_SendEventMsg

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_SendMsg?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_SendMsg

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_NetworkDiscoveryConfirmCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_NetworkDiscoveryConfirmCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_NetworkFormationConfirmCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_NetworkFormationConfirmCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_StartRouterConfirmCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_StartRouterConfirmCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_JoinConfirmCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_JoinConfirmCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_JoinIndicationCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_JoinIndicationCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_LeaveCnf?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_LeaveCnf

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_LeaveInd?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_LeaveInd

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_SyncIndicationCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_SyncIndicationCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDO_PollConfirmCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDO_PollConfirmCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??AddrMgrWriteNVRequest?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    AddrMgrWriteNVRequest

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_InMsgCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_InMsgCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_ChangeMatchDescRespPermission?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_ChangeMatchDescRespPermission

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_NetworkInit?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_NetworkInit

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_StartUpFromApp?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_StartUpFromApp

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_StopStartUp?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_StopStartUp

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_StartJoiningCycle?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_StartJoiningCycle

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_StopJoiningCycle?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_StopJoiningCycle

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_NodeProfileSync?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_NodeProfileSync

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_CoordStartPANIDConflictCB?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_CoordStartPANIDConflictCB

        RSEG BANK_RELAYS:CODE:REORDER:NOROOT(0)
??ZDApp_NVUpdate?relay:
        LCALL   ?BDISPATCH
        DATA
        DC24    ZDApp_NVUpdate

        END
// 2441 
// 2442 
// 2443 /*********************************************************************
// 2444 *********************************************************************/
// 
// 3 510 bytes in segment BANKED_CODE
//   294 bytes in segment BANK_RELAYS
//     2 bytes in segment SFR_AN
//    21 bytes in segment XDATA_I
//    21 bytes in segment XDATA_ID
//    19 bytes in segment XDATA_Z
// 
// 3 813 bytes of CODE  memory (+ 12 bytes shared)
//     0 bytes of DATA  memory (+  2 bytes shared)
//    28 bytes of XDATA memory (+ 12 bytes shared)
//
//Errors: none
//Warnings: none
