///////////////////////////////////////////////////////////////////////////////
//                                                                            /
// IAR 8051 C/C++ Compiler V7.30B/W32                   12/Sep/2010  21:57:36 /
// 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\Projec /
//                          ts\zstack\Project\Location\Source\SampleApp.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\Proje /
//                          cts\zstack\Project\Location\Source\SampleApp.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\ /
//                          SampleApp.s51                                     /
//                                                                            /
//                                                                            /
///////////////////////////////////////////////////////////////////////////////

        NAME SampleApp

        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 ??SampleApp_Sleep?relay
        EXTERN ?BANKED_ENTER_XDATA
        EXTERN ?BANKED_LEAVE_XDATA
        EXTERN ?BDISPATCH
        EXTERN ?BRET
        EXTERN ?UC_SWITCH_DENSE
        EXTERN ?V0
        EXTERN __INIT_XDATA_I
        EXTERN __INIT_XDATA_Z

        PUBLIC ??Debug_HalUARTWrite?relay
        FUNCTION ??Debug_HalUARTWrite?relay,0203H
        PUBLIC ??SampleApp_NoACK?relay
        FUNCTION ??SampleApp_NoACK?relay,0203H
        PUBLIC ??SampleApp_ProcessEvent?relay
        FUNCTION ??SampleApp_ProcessEvent?relay,0203H
        PUBLIC ??SampleApp_Sleep?relay
        FUNCTION ??SampleApp_Sleep?relay,0203H
        PUBLIC ??osalInitTasks?relay
        FUNCTION ??osalInitTasks?relay,0203H
        PUBLIC Debug_HalUARTWrite
        FUNCTION Debug_HalUARTWrite,0203H
        ARGFRAME XSTACK, 0, STACK
        PUBLIC SampleApp_NoACK
        FUNCTION SampleApp_NoACK,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC SampleApp_ProcessEvent
        FUNCTION SampleApp_ProcessEvent,0a1603H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME XSTACK, 12, STACK
        PUBLIC SampleApp_Sleep
        FUNCTION SampleApp_Sleep,021203H
        ARGFRAME XSTACK, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC SampleApp_TaskID
        PUBLIC osalInitTasks
        FUNCTION osalInitTasks,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC tasksArr
        PUBLIC tasksCnt
        PUBLIC tasksEvents
        
        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
        
osal_mem_alloc      SYMBOL "osal_mem_alloc"
osal_memset         SYMBOL "osal_memset"
macTaskInit         SYMBOL "macTaskInit"
nwk_init            SYMBOL "nwk_init"
Hal_Init            SYMBOL "Hal_Init"
MT_TaskInit         SYMBOL "MT_TaskInit"
APS_Init            SYMBOL "APS_Init"
ZDApp_Init          SYMBOL "ZDApp_Init"
afRegister          SYMBOL "afRegister"
RegisterForKeys     SYMBOL "RegisterForKeys"
RefNode_Init        SYMBOL "RefNode_Init"
osal_msg_receive    SYMBOL "osal_msg_receive"
osal_msg_deallocate SYMBOL "osal_msg_deallocate"
ZDApp_SendEventMsg  SYMBOL "ZDApp_SendEventMsg"
osal_pwrmgr_task_state SYMBOL "osal_pwrmgr_task_state"
NLME_SetPollRate    SYMBOL "NLME_SetPollRate"
??APS_Init?relay    SYMBOL "?relay", APS_Init
`?<Name APS_event_loop 17>` SYMBOL "APS_event_loop"
??APS_event_loop?relay SYMBOL "?relay", `?<Name APS_event_loop 17>`
??Hal_Init?relay    SYMBOL "?relay", Hal_Init
`?<Name Hal_ProcessEvent 20>` SYMBOL "Hal_ProcessEvent"
??Hal_ProcessEvent?relay SYMBOL "?relay", `?<Name Hal_ProcessEvent 20>`
`?<Name MT_ProcessEvent 22>` SYMBOL "MT_ProcessEvent"
??MT_ProcessEvent?relay SYMBOL "?relay", `?<Name MT_ProcessEvent 22>`
??MT_TaskInit?relay SYMBOL "?relay", MT_TaskInit
??NLME_SetPollRate?relay SYMBOL "?relay", NLME_SetPollRate
??RefNode_Init?relay SYMBOL "?relay", RefNode_Init
`?<Name RefNode_ProcessEvent 27>` SYMBOL "RefNode_ProcessEvent"
??RefNode_ProcessEvent?relay SYMBOL "?relay", `?<Name RefNode_ProcessEvent 27>`
??RegisterForKeys?relay SYMBOL "?relay", RegisterForKeys
??ZDApp_Init?relay  SYMBOL "?relay", ZDApp_Init
??ZDApp_SendEventMsg?relay SYMBOL "?relay", ZDApp_SendEventMsg
`?<Name ZDApp_event_loop 32>` SYMBOL "ZDApp_event_loop"
??ZDApp_event_loop?relay SYMBOL "?relay", `?<Name ZDApp_event_loop 32>`
??afRegister?relay  SYMBOL "?relay", afRegister
`?<Name macEventLoop 35>` SYMBOL "macEventLoop"
??macEventLoop?relay SYMBOL "?relay", `?<Name macEventLoop 35>`
??macTaskInit?relay SYMBOL "?relay", macTaskInit
`?<Name nwk_event_loop 38>` SYMBOL "nwk_event_loop"
??nwk_event_loop?relay SYMBOL "?relay", `?<Name nwk_event_loop 38>`
??nwk_init?relay    SYMBOL "?relay", nwk_init
??osal_mem_alloc?relay SYMBOL "?relay", osal_mem_alloc
??osal_memset?relay SYMBOL "?relay", osal_memset
??osal_msg_deallocate?relay SYMBOL "?relay", osal_msg_deallocate
??osal_msg_receive?relay SYMBOL "?relay", osal_msg_receive
??osal_pwrmgr_task_state?relay SYMBOL "?relay", osal_pwrmgr_task_state
Debug_HalUARTWrite  SYMBOL "Debug_HalUARTWrite"
??Debug_HalUARTWrite?relay SYMBOL "?relay", Debug_HalUARTWrite
SampleApp_NoACK     SYMBOL "SampleApp_NoACK"
??SampleApp_NoACK?relay SYMBOL "?relay", SampleApp_NoACK
SampleApp_ProcessEvent SYMBOL "SampleApp_ProcessEvent"
??SampleApp_ProcessEvent?relay SYMBOL "?relay", SampleApp_ProcessEvent
SampleApp_Sleep     SYMBOL "SampleApp_Sleep"
??SampleApp_Sleep?relay SYMBOL "?relay", SampleApp_Sleep
osalInitTasks       SYMBOL "osalInitTasks"
??osalInitTasks?relay SYMBOL "?relay", osalInitTasks

        EXTERN osal_mem_alloc
        FUNCTION osal_mem_alloc,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_memset
        FUNCTION osal_memset,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN macTaskInit
        FUNCTION macTaskInit,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN nwk_init
        FUNCTION nwk_init,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN Hal_Init
        FUNCTION Hal_Init,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN MT_TaskInit
        FUNCTION MT_TaskInit,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN APS_Init
        FUNCTION APS_Init,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDApp_Init
        FUNCTION ZDApp_Init,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN afRegister
        FUNCTION afRegister,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN RegisterForKeys
        FUNCTION RegisterForKeys,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN RefNode_Init
        FUNCTION RefNode_Init,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, 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, 12, 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, 12, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ZDApp_SendEventMsg
        FUNCTION ZDApp_SendEventMsg,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_pwrmgr_task_state
        FUNCTION osal_pwrmgr_task_state,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN NLME_SetPollRate
        FUNCTION NLME_SetPollRate,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ??APS_Init?relay
        FUNCTION ??APS_Init?relay,00H
        EXTERN ??APS_event_loop?relay
        FUNCTION ??APS_event_loop?relay,00H
        EXTERN ??Hal_Init?relay
        FUNCTION ??Hal_Init?relay,00H
        EXTERN ??Hal_ProcessEvent?relay
        FUNCTION ??Hal_ProcessEvent?relay,00H
        EXTERN ??MT_ProcessEvent?relay
        FUNCTION ??MT_ProcessEvent?relay,00H
        EXTERN ??MT_TaskInit?relay
        FUNCTION ??MT_TaskInit?relay,00H
        EXTERN ??NLME_SetPollRate?relay
        FUNCTION ??NLME_SetPollRate?relay,00H
        EXTERN ??RefNode_Init?relay
        FUNCTION ??RefNode_Init?relay,00H
        EXTERN ??RefNode_ProcessEvent?relay
        FUNCTION ??RefNode_ProcessEvent?relay,00H
        EXTERN ??RegisterForKeys?relay
        FUNCTION ??RegisterForKeys?relay,00H
        EXTERN ??ZDApp_Init?relay
        FUNCTION ??ZDApp_Init?relay,00H
        EXTERN ??ZDApp_SendEventMsg?relay
        FUNCTION ??ZDApp_SendEventMsg?relay,00H
        EXTERN ??ZDApp_event_loop?relay
        FUNCTION ??ZDApp_event_loop?relay,00H
        EXTERN ??afRegister?relay
        FUNCTION ??afRegister?relay,00H
        EXTERN ??macEventLoop?relay
        FUNCTION ??macEventLoop?relay,00H
        EXTERN ??macTaskInit?relay
        FUNCTION ??macTaskInit?relay,00H
        EXTERN ??nwk_event_loop?relay
        FUNCTION ??nwk_event_loop?relay,00H
        EXTERN ??nwk_init?relay
        FUNCTION ??nwk_init?relay,00H
        EXTERN ??osal_mem_alloc?relay
        FUNCTION ??osal_mem_alloc?relay,00H
        EXTERN ??osal_memset?relay
        FUNCTION ??osal_memset?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_pwrmgr_task_state?relay
        FUNCTION ??osal_pwrmgr_task_state?relay,00H
        EXTERN NWK_TaskID

// C:\Texas Instruments 33\ZStack-1.4.3-1.2.1\Projects\zstack\Project\Location\Source\SampleApp.c
//    1 /**************************************************************************************************
//    2   Filename:       SampleApp.c
//    3   Revised:        $Date: 2007-10-27 17:16:54 -0700 (Sat, 27 Oct 2007) $
//    4   Revision:       $Revision: 15793 $
//    5 
//    6   Description:    Sample Application for incorporating the Z-Stack Location
//    7                   Profile into another Application.
//    8 
//    9 
//   10   Copyright 2006-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 
//   45 #include "ZComDef.h"
//   46 #include "SampleApp.h"
//   47 #include "LocationProfile.h"
//   48 
//   49 #include "AF.h"
//   50 #if !defined( NONWK )
//   51   #include "APS.h"
//   52   #include "nwk.h"
//   53   #include "ZDApp.h"
//   54 #endif
//   55 #include "OSAL.h"
//   56 #include "OSAL_Custom.h"
//   57 #include "OSAL_Nv.h"
//   58 #if defined( POWER_SAVING )
//   59 #include "OSAL_PwrMgr.h"
//   60 #endif
//   61 #include "OSAL_Tasks.h"
//   62 
//   63 #include "hal_drivers.h"
//   64 #include "hal_key.h"
//   65 #include "hal_led.h"
//   66 #include "OnBoard.h"
//   67 
//   68 #if defined ( MT_TASK )
//   69   #include "MTEL.h"
//   70 #endif
//   71 
//   72 /*********************************************************************
//   73  * CONSTANTS
//   74  */
//   75 
//   76 #define SAMPLE_APP_ENDPOINT                 10
//   77 #define SAMPLE_APP_PROFID                   0x2001
//   78 #define SAMPLE_APP_DEVICEID                 13
//   79 #define SAMPLE_APP_VERSION                  31
//   80 #define SAMPLE_APP_FLAGS                    0
//   81 
//   82 #define SAMPLE_APP_GENERIC_ID               0x0001
//   83 #define SAMPLE_APP_ON_OFF_ID                0x0010
//   84 
//   85 #define SAMPLE_APP_ON                       0xFF
//   86 #define SAMPLE_APP_OFF                      0x00
//   87 #define SAMPLE_APP_TOGGLE                   0xF0
//   88 
//   89 /*********************************************************************
//   90  * TYPEDEFS
//   91  */
//   92 
//   93 /*********************************************************************
//   94  * GLOBAL VARIABLES
//   95  */
//   96 

        RSEG XDATA_Z:XDATA:NOROOT(0)
//   97 uint8 SampleApp_TaskID;
SampleApp_TaskID:
        DS 1
        REQUIRE __INIT_XDATA_Z
//   98 
//   99 // The order in this table must be identical to the task initialization calls below in osalInitTask.

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  100 const pTaskEventHandlerFn tasksArr[] = {
tasksArr:
        DS 16
        REQUIRE `?<Initializer for tasksArr>`
        REQUIRE __INIT_XDATA_I
//  101 #if defined( ZMAC_F8W )
//  102   macEventLoop,
//  103 #endif
//  104 #if !defined( NONWK )
//  105   nwk_event_loop,
//  106 #endif
//  107   Hal_ProcessEvent,
//  108 #if defined( MT_TASK )
//  109   MT_ProcessEvent,
//  110 #endif
//  111 #if !defined( NONWK )
//  112   APS_event_loop,
//  113   ZDApp_event_loop,
//  114 #endif
//  115   SampleApp_ProcessEvent,
//  116 #if defined ( LOCATION_REFNODE )
//  117   RefNode_ProcessEvent
//  118 #endif
//  119 #if defined ( LOCATION_BLINDNODE )
//  120   BlindNode_ProcessEvent
//  121 #endif
//  122 #if defined ( LOCATION_DONGLE )
//  123   LocDongle_ProcessEvent
//  124 #endif
//  125 };
//  126 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  127 const uint8 tasksCnt = sizeof( tasksArr ) / sizeof( tasksArr[0] );
tasksCnt:
        DS 1
        REQUIRE `?<Initializer for tasksCnt>`
        REQUIRE __INIT_XDATA_I

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  128 uint16 *tasksEvents;
tasksEvents:
        DS 2
        REQUIRE __INIT_XDATA_Z
//  129 
//  130 /*********************************************************************
//  131  * LOCAL VARIABLES
//  132  */
//  133 
//  134 #if defined ( LOCATION_REFNODE )

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  135 static const cId_t SampleApp_InputClusterList[] =
SampleApp_InputClusterList:
        DS 4
        REQUIRE `?<Initializer for SampleApp_InputClusterList>`
        REQUIRE __INIT_XDATA_I
//  136 {
//  137   SAMPLE_APP_GENERIC_ID,
//  138   SAMPLE_APP_ON_OFF_ID
//  139 };
//  140 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  141 static const cId_t SampleApp_OutputClusterList[] =
SampleApp_OutputClusterList:
        DS 2
        REQUIRE `?<Initializer for SampleApp_OutputClusterList>`
        REQUIRE __INIT_XDATA_I
//  142 {
//  143   SAMPLE_APP_GENERIC_ID
//  144 };
//  145 #endif
//  146 
//  147 #if defined ( LOCATION_BLINDNODE )
//  148 static const cId_t SampleApp_InputClusterList[] =
//  149 {
//  150   SAMPLE_APP_GENERIC_ID
//  151 };
//  152 
//  153 static const cId_t SampleApp_OutputClusterList[] =
//  154 {
//  155   SAMPLE_APP_GENERIC_ID,
//  156   SAMPLE_APP_ON_OFF_ID
//  157 };
//  158 #endif
//  159 
//  160 #if defined ( LOCATION_DONGLE )
//  161 static const cId_t SampleApp_InputClusterList[] =
//  162 {
//  163   SAMPLE_APP_GENERIC_ID,
//  164   SAMPLE_APP_ON_OFF_ID
//  165 };
//  166 
//  167 static const cId_t SampleApp_OutputClusterList[] =
//  168 {
//  169   SAMPLE_APP_GENERIC_ID
//  170 };
//  171 #endif
//  172 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  173 static const SimpleDescriptionFormat_t SampleApp_SimpleDesc =
SampleApp_SimpleDesc:
        DS 12
        REQUIRE `?<Initializer for SampleApp_SimpleDesc>`
        REQUIRE __INIT_XDATA_I
//  174 {
//  175   SAMPLE_APP_ENDPOINT,
//  176   SAMPLE_APP_PROFID,
//  177 
//  178   SAMPLE_APP_DEVICEID,
//  179 
//  180   SAMPLE_APP_VERSION,
//  181   SAMPLE_APP_FLAGS,
//  182 
//  183   sizeof( SampleApp_InputClusterList ),
//  184   (cId_t*)SampleApp_InputClusterList,
//  185 
//  186   sizeof( SampleApp_OutputClusterList ),
//  187   (cId_t*)SampleApp_OutputClusterList
//  188 };
//  189 

        RSEG XDATA_I:XDATA:NOROOT(0)
        DATA
//  190 static const endPointDesc_t SampleApp_epDesc =
SampleApp_epDesc:
        DS 6
        REQUIRE `?<Initializer for SampleApp_epDesc>`
        REQUIRE __INIT_XDATA_I
//  191 {
//  192   SAMPLE_APP_ENDPOINT,
//  193   &SampleApp_TaskID,
//  194   (SimpleDescriptionFormat_t *)&SampleApp_SimpleDesc,
//  195   noLatencyReqs
//  196 };
//  197 
//  198 #if defined( POWER_SAVING )
//  199 /* The ZDO_STATE_CHANGE event will be received twice after initiating the
//  200  * rejoin process, only act on one of them.
//  201  */

        RSEG XDATA_Z:XDATA:NOROOT(0)
//  202 static uint8 rejoinPending;
rejoinPending:
        DS 1
        REQUIRE __INIT_XDATA_Z
//  203 #endif
//  204 
//  205 /*********************************************************************
//  206  * LOCAL FUNCTIONS
//  207  */
//  208 
//  209 static void SampleApp_Init( uint8 task_id );
//  210 
//  211 /*********************************************************************
//  212  * FUNCTIONS
//  213  *********************************************************************/
//  214 
//  215 /*********************************************************************
//  216  * @fn      osalInitTasks
//  217  *
//  218  * @brief   This function invokes the initialization function for each task.
//  219  *
//  220  * @param   void
//  221  *
//  222  * @return  none
//  223  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  224 void osalInitTasks( void )
osalInitTasks:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function osalInitTasks
//  225 {
        FUNCALL osalInitTasks, osal_mem_alloc
        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 osalInitTasks, osal_memset
        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 osalInitTasks, macTaskInit
        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 osalInitTasks, nwk_init
        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 osalInitTasks, Hal_Init
        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 osalInitTasks, MT_TaskInit
        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 osalInitTasks, APS_Init
        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 osalInitTasks, ZDApp_Init
        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 osalInitTasks, afRegister
        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 osalInitTasks, RegisterForKeys
        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 osalInitTasks, RefNode_Init
        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
//  226   uint8 taskID = 0;
//  227 
//  228   tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);
        ; Setup parameters for call to function osal_mem_alloc
        MOV     R2,#0x10
        MOV     R3,#0x0
        LCALL   ??osal_mem_alloc?relay
        MOV     DPTR,#tasksEvents
        MOV     A,R2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R3
        MOVX    @DPTR,A
//  229   osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt));
        ; Setup parameters for call to function osal_memset
        MOV     R4,#0x10
        MOV     R5,#0x0
        MOV     R1,#0x0
        LCALL   ??osal_memset?relay
//  230 
//  231 #if defined( ZMAC_F8W )
//  232   macTaskInit( taskID++ );
        ; Setup parameters for call to function macTaskInit
        MOV     R1,#0x0
        LCALL   ??macTaskInit?relay
//  233 #endif
//  234 #if !defined( NONWK )
//  235   nwk_init( taskID++ );
        ; Setup parameters for call to function nwk_init
        MOV     R1,#0x1
        LCALL   ??nwk_init?relay
//  236 #endif
//  237   Hal_Init( taskID++ );
        ; Setup parameters for call to function Hal_Init
        MOV     R1,#0x2
        LCALL   ??Hal_Init?relay
//  238 #if defined( MT_TASK )
//  239   MT_TaskInit( taskID++ );
        ; Setup parameters for call to function MT_TaskInit
        MOV     R1,#0x3
        LCALL   ??MT_TaskInit?relay
//  240 #endif
//  241 #if !defined( NONWK )
//  242   APS_Init( taskID++ );
        ; Setup parameters for call to function APS_Init
        MOV     R1,#0x4
        LCALL   ??APS_Init?relay
//  243   ZDApp_Init( taskID++ );
        ; Setup parameters for call to function ZDApp_Init
        MOV     R1,#0x5
        LCALL   ??ZDApp_Init?relay
//  244 #endif
//  245   SampleApp_Init( taskID++ );
        MOV     A,#0x6
        MOV     DPTR,#SampleApp_TaskID
        MOVX    @DPTR,A
        ; Setup parameters for call to function afRegister
        MOV     R2,#(SampleApp_epDesc & 0xff)
        MOV     R3,#((SampleApp_epDesc >> 8) & 0xff)
        LCALL   ??afRegister?relay
        ; Setup parameters for call to function RegisterForKeys
        MOV     DPTR,#SampleApp_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??RegisterForKeys?relay
//  246 #if defined ( LOCATION_REFNODE )
//  247   RefNode_Init( taskID );
        ; Setup parameters for call to function RefNode_Init
        MOV     R1,#0x7
        LCALL   ??RefNode_Init?relay
        CFI EndBlock cfiBlock0
//  248 #endif
//  249 #if defined ( LOCATION_BLINDNODE )
//  250   BlindNode_Init( taskID );
//  251 #endif
//  252 #if defined ( LOCATION_DONGLE )
//  253   LocDongle_Init( taskID );
//  254 #endif
//  255 }
        REQUIRE ?Subroutine0
        ; // Fall through to label ?Subroutine0

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine0:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+-5
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        POP     DPH
        CFI CFA_SP SP+-4
        CFI DPH0 SameValue
        POP     DPL
        CFI CFA_SP SP+-3
        CFI DPL0 SameValue
        LJMP    ?BRET
        CFI EndBlock cfiBlock1
//  256 
//  257 /*********************************************************************
//  258  * @fn      SampleApp_Init
//  259  *
//  260  * @brief   Initialization function for the SampleApp OSAL task.
//  261  *
//  262  * @param   task_id - the ID assigned by OSAL.
//  263  *
//  264  * @return  none
//  265  */
//  266 static void SampleApp_Init( uint8 task_id )
//  267 {
//  268   SampleApp_TaskID = task_id;
//  269 
//  270   /* Sample NV Restore.
//  271   if ( ZSUCCESS == osal_nv_item_init( SAMPLE_APP_NV_ITEM,
//  272                             sizeof( sampleAppNV_Item_t ), &sampleAppNV_Item ) )
//  273   {
//  274     osal_nv_read( SAMPLE_APP_NV_ITEM, 0,
//  275                             sizeof( sampleAppNV_Item_t ), &sampleAppNV_Item ) )
//  276   }
//  277   else
//  278   {
//  279     osal_nv_read( SAMPLE_APP_NV_ITEM, 0,
//  280                             sizeof( sampleAppNV_Item_t ), &sampleAppNV_Item ) )
//  281   }
//  282    */
//  283 
//  284   // Register the endpoint/interface description with the AF.
//  285   afRegister( (endPointDesc_t *)&SampleApp_epDesc );
//  286 
//  287   // Register for all key events - This app will handle all key events.
//  288   RegisterForKeys( SampleApp_TaskID );
//  289 
//  290 }
//  291 
//  292 /*********************************************************************
//  293  * @fn      SampleApp_ProcessEvent
//  294  *
//  295  * @brief   Generic Application Task event processor.
//  296  *
//  297  * @param   task_id  - The OSAL assigned task ID.
//  298  * @param   events - Bit map of events to process.
//  299  *
//  300  * @return  none
//  301  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  302 uint16 SampleApp_ProcessEvent( uint8 task_id, uint16 events )
SampleApp_ProcessEvent:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function SampleApp_ProcessEvent
//  303 {
        FUNCALL SampleApp_ProcessEvent, osal_msg_receive
        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 SampleApp_ProcessEvent, SampleApp_Sleep
        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 SampleApp_ProcessEvent, osal_msg_deallocate
        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 SampleApp_ProcessEvent, osal_msg_receive
        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
        MOV     A,R2
        MOV     R6,A
        MOV     A,R3
        MOV     R7,A
//  304   if ( events & SYS_EVENT_MSG )
        MOV     A,#-0x80
        ANL     A,R7
        MOV     R1,A
        CLR     A
        JNZ     ??SampleApp_ProcessEvent_0
        MOV     A,R1
??SampleApp_ProcessEvent_0:
        JZ      ??SampleApp_ProcessEvent_1
//  305   {
//  306     afIncomingMSGPacket_t *MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive(
//  307                                                              SampleApp_TaskID );
        ; Setup parameters for call to function osal_msg_receive
        SJMP    ??SampleApp_ProcessEvent_2
//  308 
//  309     while ( MSGpkt != NULL )
//  310     {
//  311       switch ( MSGpkt->hdr.event )
??SampleApp_ProcessEvent_3:
        MOV     DPL,?V0 + 0
        MOV     DPH,?V0 + 1
        MOVX    A,@DPTR
        LCALL   ?UC_SWITCH_DENSE
`?<Jumptable for SampleApp_ProcessEvent>_0`:
        DATA
        DB        209
        DB        0
        DW        ??SampleApp_ProcessEvent_4
        DW        ??SampleApp_ProcessEvent_5
        CODE
//  312       {
//  313 
//  314       case AF_DATA_CONFIRM_CMD:
//  315 
//  316         break;
//  317 
//  318       case AF_INCOMING_MSG_CMD:
//  319         break;
//  320 
//  321       case ZDO_STATE_CHANGE:
//  322 
//  323 #if defined( POWER_SAVING )
//  324           // Ok to resume power saving ops.
//  325           SampleApp_Sleep( TRUE );
??SampleApp_ProcessEvent_5:
        ; Setup parameters for call to function SampleApp_Sleep
        MOV     R1,#0x1
        LCALL   ??SampleApp_Sleep?relay
//  326 #endif
//  327         break;
//  328 
//  329       default:
//  330         break;
//  331       }
//  332 
//  333       osal_msg_deallocate( (uint8 *)MSGpkt );
??SampleApp_ProcessEvent_4:
        ; Setup parameters for call to function osal_msg_deallocate
        MOV     R2,?V0 + 0
        MOV     R3,?V0 + 1
        LCALL   ??osal_msg_deallocate?relay
//  334       MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( SampleApp_TaskID );
        ; Setup parameters for call to function osal_msg_receive
??SampleApp_ProcessEvent_2:
        MOV     DPTR,#SampleApp_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_msg_receive?relay
        MOV     ?V0 + 0,R2
        MOV     ?V0 + 1,R3
//  335     }
        MOV     A,?V0 + 0
        JNZ     ??SampleApp_ProcessEvent_6
        MOV     A,?V0 + 1
??SampleApp_ProcessEvent_6:
        JNZ     ??SampleApp_ProcessEvent_3
//  336 
//  337     // Return unprocessed events.
//  338     return ( events ^ SYS_EVENT_MSG );
        MOV     A,R6
        MOV     R2,A
        MOV     A,#-0x80
        XRL     A,R7
        MOV     R3,A
        SJMP    ??SampleApp_ProcessEvent_7
//  339   }
//  340 
//  341   return 0;  // Discard unknown events
??SampleApp_ProcessEvent_1:
        MOV     R2,#0x0
        MOV     R3,#0x0
??SampleApp_ProcessEvent_7:
        MOV     R7,#0x4
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock2
//  342 }
//  343 
//  344 /*********************************************************************
//  345  * @fn      SampleApp_NoACK
//  346  *
//  347  * @brief   Sample Application recovery from getting a ZMacNoAck.
//  348  *
//  349  * @return  none
//  350  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  351 void SampleApp_NoACK( void )
SampleApp_NoACK:
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function SampleApp_NoACK
//  352 {
        FUNCALL SampleApp_NoACK, ZDApp_SendEventMsg
        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 SampleApp_NoACK, SampleApp_Sleep
        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
//  353 #if defined( POWER_SAVING )
//  354   rejoinPending = TRUE;
        MOV     A,#0x1
        MOV     DPTR,#rejoinPending
        MOVX    @DPTR,A
//  355   ZDApp_SendEventMsg( ZDO_NWK_JOIN_REQ, 0, NULL );
        ; Setup parameters for call to function ZDApp_SendEventMsg
        MOV     R4,#0x0
        MOV     R5,#0x0
        MOV     R2,#0x0
        MOV     R1,#0x3
        LCALL   ??ZDApp_SendEventMsg?relay
//  356 
//  357   SampleApp_Sleep( FALSE );
        ; Setup parameters for call to function SampleApp_Sleep
        MOV     R1,#0x0
        LCALL   ??SampleApp_Sleep?relay
//  358 #endif
//  359 }
        SJMP    ?Subroutine0
        CFI EndBlock cfiBlock3
//  360 
//  361 /*********************************************************************
//  362  * @fn      SampleApp_Sleep
//  363  *
//  364  * @brief   Sample Application set allow/disallow sleep mode.
//  365  *
//  366  * @return  none
//  367  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  368 void SampleApp_Sleep( uint8 allow )
SampleApp_Sleep:
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function SampleApp_Sleep
//  369 {
        FUNCALL SampleApp_Sleep, osal_pwrmgr_task_state
        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 SampleApp_Sleep, NLME_SetPollRate
        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 SampleApp_Sleep, osal_pwrmgr_task_state
        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 SampleApp_Sleep, NLME_SetPollRate
        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
//  370 #if defined( POWER_SAVING )
//  371   if ( allow )
        MOV     A,R1
        JZ      ??SampleApp_Sleep_0
//  372   {
//  373     osal_pwrmgr_task_state( NWK_TaskID, PWRMGR_CONSERVE );
        ; Setup parameters for call to function osal_pwrmgr_task_state
        MOV     R2,#0x0
        MOV     DPTR,#NWK_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_pwrmgr_task_state?relay
//  374     NLME_SetPollRate( 0 );
        ; Setup parameters for call to function NLME_SetPollRate
        MOV     R2,#0x0
        MOV     R3,#0x0
        SJMP    ??SampleApp_Sleep_1
//  375   }
//  376   else
//  377   {
//  378     osal_pwrmgr_task_state( NWK_TaskID, PWRMGR_HOLD );
??SampleApp_Sleep_0:
        ; Setup parameters for call to function osal_pwrmgr_task_state
        MOV     R2,#0x1
        MOV     DPTR,#NWK_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_pwrmgr_task_state?relay
//  379     NLME_SetPollRate( 1000 );
        ; Setup parameters for call to function NLME_SetPollRate
        MOV     R2,#-0x18
        MOV     R3,#0x3
??SampleApp_Sleep_1:
        LCALL   ??NLME_SetPollRate?relay
//  380   }
//  381 #endif
//  382 }
        LJMP    ?Subroutine0 & 0xFFFF
        CFI EndBlock cfiBlock4
//  383 
//  384 
//  385 /*********************************************************************
//  386  * @fn      Debug_HalUARTWrite
//  387  *
//  388  * @brief   For debug use only.
//  389  *
//  390  * @return  none
//  391  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  392 uint16 Debug_HalUARTWrite( uint8 port, uint8 *buf, uint16 len )
Debug_HalUARTWrite:
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function Debug_HalUARTWrite
//  393 {
        ; Saved register size: 0
        ; Auto size: 0
//  394   #if 0
//  395   HalUARTWrite(port, buf, len );
//  396   #endif
//  397   return len;
        MOV     A,R4
        MOV     R2,A
        MOV     A,R5
        MOV     R3,A
        LJMP    ?BRET
        CFI EndBlock cfiBlock5
//  398 }

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for tasksArr>`:
        DW ??macEventLoop?relay, ??nwk_event_loop?relay
        DW ??Hal_ProcessEvent?relay, ??MT_ProcessEvent?relay
        DW ??APS_event_loop?relay, ??ZDApp_event_loop?relay
        DW ??SampleApp_ProcessEvent?relay, ??RefNode_ProcessEvent?relay

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

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for SampleApp_InputClusterList>`:
        DW 1, 16

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

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for SampleApp_SimpleDesc>`:
        DB 10
        DW 8193, 13
        DB 15, 4
        DW SampleApp_InputClusterList
        DB 2
        DW SampleApp_OutputClusterList

        RSEG XDATA_ID:CODE:NOROOT(0)
        DATA
`?<Initializer for SampleApp_epDesc>`:
        DB 10
        DW SampleApp_TaskID, SampleApp_SimpleDesc
        DB 0

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

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

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

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

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

        END
//  399 
//  400 /*********************************************************************
//  401 *********************************************************************/
// 
// 255 bytes in segment BANKED_CODE
//  30 bytes in segment BANK_RELAYS
//  41 bytes in segment XDATA_I
//  41 bytes in segment XDATA_ID
//   4 bytes in segment XDATA_Z
// 
// 326 bytes of CODE  memory
//  45 bytes of XDATA memory
//
//Errors: none
//Warnings: none
