###############################################################################
#                                                                             #
# IAR 8051 C/C++ Compiler V7.30B/W32                    19/May/2010  09:38:52 #
# 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\ZStack-1.4.3-1.2.1\Components #
#                          \stack\zdo\ZDProfile.c                             #
#    Command line       =  -f "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projec #
#                          ts\zstack\Samples\Location\CC2430DB\..\..\..\Tools #
#                          \CC2430DB\f8wCoord.cfg" (-DCPU32MHZ                #
#                          -DFORCE_MAC_NEAR -DROOT=__near_func                #
#                          -DMAC_CFG_APP_PENDING_QUEUE=TRUE                   #
#                          -DZDO_COORDINATOR -DRTR_NWK -DBLINK_LEDS           #
#                          "-DCONST=const __code" -DGENERIC=__generic) -f     #
#                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\ #
#                          zstack\Samples\Location\CC2430DB\..\..\..\Tools\CC #
#                          2430DB\f8wConfig.cfg" (-DSECURE=1                  #
#                          -DDEFAULT_CHANLIST=0x04000000                      #
#                          -DZDAPP_CONFIG_PAN_ID=0x00FF                       #
#                          -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_MA #
#                          SK=0x007F -DBEACON_REQUEST_DELAY=100               #
#                          -DBEACON_REQ_DELAY_MASK=0x00FF                     #
#                          -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_PO #
#                          LLED=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\ZStack-1.4.3-1.2.1\Components\stack\zd #
#                          o\ZDProfile.c" -D CC2430EB -D ZTOOL_P1 -D          #
#                          LOCATION_DONGLE -D MT_TASK -D xNV_RESTORE -D       #
#                          INT_HEAP_LEN=4608 -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\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\LocDongle\List\" -lA        #
#                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\ #
#                          zstack\Samples\Location\CC2430DB\LocDongle\List\"  #
#                          --diag_suppress Pe001,Pa010 --diag_remark pe550    #
#                          -o "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projec #
#                          ts\zstack\Samples\Location\CC2430DB\LocDongle\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\ZStack-1.4.3-1.2.1\Projects\ #
#                          zstack\Samples\Location\CC2430DB\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\SOURCE\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\ZMAIN\TI2430DB\"   #
#                          -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projec #
#                          ts\zstack\Samples\Location\CC2430DB\..\..\..\..\WX #
#                          L\INCLUDE\" -I "C:\Texas                           #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          T\" -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Pr #
#                          ojects\zstack\Samples\Location\CC2430DB\..\..\..\. #
#                          .\..\COMPONENTS\HAL\INCLUDE\" -I "C:\Texas         #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\H #
#                          AL\TARGET\CC2430EB\" -I "C:\Texas                  #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\O #
#                          SAL\MCU\CCSOC\" -I "C:\Texas                       #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\O #
#                          SAL\INCLUDE\" -I "C:\Texas                         #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          TACK\AF\" -I "C:\Texas Instruments\ZStack-1.4.3-1. #
#                          2.1\Projects\zstack\Samples\Location\CC2430DB\..\. #
#                          .\..\..\..\COMPONENTS\STACK\NWK\" -I "C:\Texas     #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          TACK\SEC\" -I "C:\Texas Instruments\ZStack-1.4.3-1 #
#                          .2.1\Projects\zstack\Samples\Location\CC2430DB\..\ #
#                          ..\..\..\..\COMPONENTS\STACK\SYS\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          TACK\ZDO\" -I "C:\Texas Instruments\ZStack-1.4.3-1 #
#                          .2.1\Projects\zstack\Samples\Location\CC2430DB\..\ #
#                          ..\..\..\..\COMPONENTS\ZMAC\F8W\" -I "C:\Texas     #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\Z #
#                          MAC\" -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\ #
#                          Projects\zstack\Samples\Location\CC2430DB\..\..\.. #
#                          \..\..\COMPONENTS\SERVICES\SADDR\" -I "C:\Texas    #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\S #
#                          ERVICES\SDATA\" -I "C:\Texas                       #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\INCLUDE\" -I "C:\Texas                          #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\HIGH_LEVEL\" -I "C:\Texas                       #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\LOW_LEVEL\SRF03\" -I "C:\Texas                  #
#                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sam #
#                          ples\Location\CC2430DB\..\..\..\..\..\COMPONENTS\M #
#                          AC\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\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\CC2430DB\LocDongle\List\ZDP #
#                          rofile.lst                                         #
#    Object file        =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\CC2430DB\LocDongle\Obj\ZDPr #
#                          ofile.r51                                          #
#                                                                             #
#                                                                             #
###############################################################################

C:\Texas Instruments\ZStack-1.4.3-1.2.1\Components\stack\zdo\ZDProfile.c
      1          /**************************************************************************************************
      2            Filename:       ZDProfile.c
      3            Revised:        $Date: 2007-10-28 18:43:04 -0700 (Sun, 28 Oct 2007) $
      4            Revision:       $Revision: 15800 $
      5          
      6            Description:    This is the Zigbee Device Profile.
      7          
      8          
      9            Copyright 2004-2007 Texas Instruments Incorporated. All rights reserved.
     10          
     11            IMPORTANT: Your use of this Software is limited to those specific rights
     12            granted under the terms of a software license agreement between the user
     13            who downloaded the software, his/her employer (which must be your employer)
     14            and Texas Instruments Incorporated (the "License").  You may not use this
     15            Software unless you agree to abide by the terms of the License. The License
     16            limits your use, and you acknowledge, that the Software may not be modified,
     17            copied or distributed unless embedded on a Texas Instruments microcontroller
     18            or used solely and exclusively in conjunction with a Texas Instruments radio
     19            frequency transceiver, which is integrated into your product.  Other than for
     20            the foregoing purpose, you may not use, reproduce, copy, prepare derivative
     21            works of, modify, distribute, perform, display or sell this Software and/or
     22            its documentation for any purpose.
     23          
     24            YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
     25            PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
     26            INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
     27            NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
     28            TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
     29            NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
     30            LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
     31            INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
     32            OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
     33            OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
     34            (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
     35          
     36            Should you have any questions regarding your right to use this Software,
     37            contact Texas Instruments Incorporated at www.TI.com.
     38          **************************************************************************************************/
     39          
     40          /*********************************************************************
     41           * INCLUDES
     42           */
     43          #include "ZComdef.h"
     44          #include "OSAL.h"
     45          #include "AF.h"
     46          #include "NLMEDE.h"
     47          #include "nwk_util.h"
     48          #include "APS.h"
     49          
     50          #include "AddrMgr.h"
     51          #include "ZDConfig.h"
     52          #include "ZDProfile.h"
     53          #include "ZDObject.h"
     54          
     55          #if defined( LCD_SUPPORTED )
     56            #include "OnBoard.h"
     57          #endif
     58          
     59          #include "nwk_util.h"
     60          
     61          #if defined( MT_ZDO_FUNC )
     62            #include "MT_ZDO.h"
     63          #endif
     64          
     65          /*********************************************************************
     66           * MACROS
     67           */
     68          
     69          #define ZADDR_TO_AFADDR( pZADDR, AFADDR ) {                            \
     70            (AFADDR).endPoint = ZDP_AF_ENDPOINT;                                 \
     71            (AFADDR).addrMode = (afAddrMode_t)(pZADDR)->addrMode;                \
     72            (AFADDR).addr.shortAddr = (pZADDR)->addr.shortAddr;                  \
     73          }
     74          
     75          #define FillAndSendBuffer( TRANSSEQ, ADDR, ID, LEN, BUF ) {     \
     76            afStatus_t stat;                                    \
     77            ZDP_TmpBuf = (BUF)+1;                               \
     78            stat = fillAndSend( (TRANSSEQ), (ADDR), (ID), (LEN) );          \
     79            osal_mem_free( (BUF) );                             \
     80            ZDP_TmpBuf = ZDP_Buf+1;                             \
     81            return stat;                                        \
     82          }
     83          
     84          #define FillAndSendTxOptions( TRANSSEQ, ADDR, ID, LEN, TxO ) {  \
     85            afStatus_t stat;                                    \
     86            ZDP_TxOptions = (TxO);                              \
     87            stat = fillAndSend( (TRANSSEQ), (ADDR), (ID), (LEN) );          \
     88            ZDP_TxOptions = AF_TX_OPTIONS_NONE;                 \
     89            return stat;                                        \
     90          }
     91          
     92          /*********************************************************************
     93           * CONSTANTS
     94           */
     95          
     96          #define ZDP_BUF_SZ          80
     97          

   \                                 In  segment CODE_C, align 1
     98          CONST byte ZDP_AF_ENDPOINT = 0;
   \                     ZDP_AF_ENDPOINT:
   \   000000   00           DB 0
     99          
    100          /*********************************************************************
    101           * TYPEDEFS
    102           */
    103          typedef struct
    104          {
    105            void *next;
    106            uint8 taskID;
    107            uint16 clusterID;
    108          } ZDO_MsgCB_t;
    109          
    110          
    111          /*********************************************************************
    112           * GLOBAL VARIABLES
    113           */
    114          

   \                                 In  segment XDATA_Z, align 1, keep-with-next
    115          byte ZDP_TransID = 0;
   \                     ZDP_TransID:
   \   000000                DS 1
   \   000001                REQUIRE __INIT_XDATA_Z
    116          
    117          /*********************************************************************
    118           * EXTERNAL VARIABLES
    119           */
    120          
    121          extern endPointDesc_t ZDApp_epDesc;
    122          
    123          /*********************************************************************
    124           * EXTERNAL FUNCTIONS
    125           */
    126          
    127          /*********************************************************************
    128           * LOCAL FUNCTIONS
    129           */
    130          
    131          static afStatus_t fillAndSend( uint8 *transSeq, zAddrType_t *addr, cId_t clusterID, byte len );
    132          uint8 ZDO_SendMsgCBs( zdoIncomingMsg_t *inMsg );
    133          void zdpProcessAddrReq( zdoIncomingMsg_t *inMsg );
    134          
    135          /*********************************************************************
    136           * LOCAL VARIABLES
    137           */
    138          

   \                                 In  segment XDATA_Z, align 1, keep-with-next
    139          static uint8  ZDP_Buf[ ZDP_BUF_SZ ];
   \                     ZDP_Buf:
   \   000000                DS 80
   \   000050                REQUIRE __INIT_XDATA_Z

   \                                 In  segment XDATA_I, align 1, keep-with-next
    140          static uint8 *ZDP_TmpBuf = ZDP_Buf+1;
   \                     ZDP_TmpBuf:
   \   000000                DS 2
   \   000002                REQUIRE `?<Initializer for ZDP_TmpBuf>`
   \   000002                REQUIRE __INIT_XDATA_I

   \                                 In  segment XDATA_Z, align 1, keep-with-next
    141          static byte ZDP_TxOptions = AF_TX_OPTIONS_NONE;
   \                     ZDP_TxOptions:
   \   000000                DS 1
   \   000001                REQUIRE __INIT_XDATA_Z
    142          

   \                                 In  segment XDATA_Z, align 1, keep-with-next
    143          ZDO_MsgCB_t *zdoMsgCBs = (ZDO_MsgCB_t *)NULL;
   \                     zdoMsgCBs:
   \   000000                DS 2
   \   000002                REQUIRE __INIT_XDATA_Z
    144          
    145          /*********************************************************************
    146           * ZDO Message Processing table
    147           */
    148          
    149          typedef void (*pfnZDPMsgProcessor)( zdoIncomingMsg_t *inMsg );
    150          
    151          typedef struct
    152          {
    153            uint16                clusterID;
    154            pfnZDPMsgProcessor    pFn;
    155          } zdpMsgProcItem_t;
    156          

   \                                 In  segment CODE_C, align 1
    157          CONST zdpMsgProcItem_t zdpMsgProcs[] =
   \                     zdpMsgProcs:
   \   000000   0000....     DW 0, ??zdpProcessAddrReq?relay, 1, ??zdpProcessAddrReq?relay, 2
   \            0100....
   \            0200    
   \   00000A   ....0300     DW ??ZDO_ProcessNodeDescReq?relay, 3, ??ZDO_ProcessPowerDescReq?relay
   \            ....    
   \   000010   0400....     DW 4, ??ZDO_ProcessSimpleDescReq?relay, 5
   \            0500    
   \   000016   ....0600     DW ??ZDO_ProcessActiveEPReq?relay, 6, ??ZDO_ProcessMatchDescReq?relay
   \            ....    
   \   00001C   FFFF0000     DW 65535, 0H
    158          {
    159            { NWK_addr_req,           zdpProcessAddrReq },
    160            { IEEE_addr_req,          zdpProcessAddrReq },
    161            { Node_Desc_req,          ZDO_ProcessNodeDescReq },
    162            { Power_Desc_req,         ZDO_ProcessPowerDescReq },
    163            { Simple_Desc_req,        ZDO_ProcessSimpleDescReq },
    164            { Active_EP_req,          ZDO_ProcessActiveEPReq },
    165            { Match_Desc_req,         ZDO_ProcessMatchDescReq },
    166          #if defined ( ZDO_MGMT_NWKDISC_RESPONSE )
    167            { Mgmt_NWK_Disc_req,      ZDO_ProcessMgmtNwkDiscReq },
    168          #endif
    169          #if defined ( ZDO_MGMT_LQI_RESPONSE ) && defined ( RTR_NWK )
    170            { Mgmt_Lqi_req,           ZDO_ProcessMgmtLqiReq },
    171          #endif
    172          #if defined ( ZDO_MGMT_RTG_RESPONSE ) && defined ( RTR_NWK )
    173            { Mgmt_Rtg_req,           ZDO_ProcessMgmtRtgReq },
    174          #endif
    175          #if defined ( ZDO_MGMT_BIND_RESPONSE ) && defined ( REFLECTOR )
    176            { Mgmt_Bind_req,          ZDO_ProcessMgmtBindReq },
    177          #endif
    178          #if defined ( ZDO_MGMT_JOINDIRECT_RESPONSE ) && defined ( RTR_NWK )
    179            { Mgmt_Direct_Join_req,   ZDO_ProcessMgmtDirectJoinReq },
    180          #endif
    181          #if defined ( ZDO_MGMT_LEAVE_RESPONSE )
    182            { Mgmt_Leave_req,         ZDO_ProcessMgmtLeaveReq },
    183          #endif
    184          #if defined ( ZDO_MGMT_PERMIT_JOIN_RESPONSE )  && defined ( RTR_NWK )
    185            { Mgmt_Permit_Join_req,   ZDO_ProcessMgmtPermitJoinReq },
    186          #endif
    187          #if defined ( ZDO_USERDESC_RESPONSE )
    188            { User_Desc_req,          ZDO_ProcessUserDescReq },
    189          #endif
    190          #if defined ( ZDO_USERDESCSET_RESPONSE )
    191            { User_Desc_set,          ZDO_ProcessUserDescSet },
    192          #endif
    193          #if defined ( ZDO_SERVERDISC_RESPONSE )
    194            { Server_Discovery_req,   ZDO_ProcessServerDiscReq },
    195          #endif
    196          #if defined ( ZDO_ENDDEVICE_ANNCE ) && defined ( RTR_NWK )
    197            { End_Device_annce,       ZDO_ProcessEndDeviceAnnce },
    198          #endif
    199            {0xFFFF, NULL} // Last
    200          };
    201          
    202          /*********************************************************************
    203           * @fn          fillAndSend
    204           *
    205           * @brief       Combined to reduce space
    206           *
    207           * @param
    208           * @param
    209           *
    210           * @return      afStatus_t
    211           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    212          static afStatus_t fillAndSend( uint8 *transSeq, zAddrType_t *addr, cId_t clusterID, byte len )
   \                     fillAndSend:
    213          {
   \   000000   74F1         MOV     A,#-0xf
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 15
   \   000005                ; Auto size: 4
   \   000005   74FC         MOV     A,#-0x4
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   8A..         MOV     ?V0 + 0,R2
   \   00000C   8B..         MOV     ?V0 + 1,R3
   \   00000E   7413         MOV     A,#0x13
   \   000010   12....       LCALL   ?XSTACK_DISP0_8
   \   000013   E0           MOVX    A,@DPTR
   \   000014   F5..         MOV     ?V0 + 2,A
   \   000016   A3           INC     DPTR
   \   000017   E0           MOVX    A,@DPTR
   \   000018   F5..         MOV     ?V0 + 3,A
    214            afAddrType_t afAddr;
    215          
    216            ZADDR_TO_AFADDR( addr, afAddr );
   \   00001A   7403         MOV     A,#0x3
   \   00001C   12....       LCALL   ?XSTACK_DISP0_8
   \   00001F   E4           CLR     A
   \   000020   F0           MOVX    @DPTR,A
   \   000021   8C82         MOV     DPL,R4
   \   000023   8D83         MOV     DPH,R5
   \   000025   A3           INC     DPTR
   \   000026   A3           INC     DPTR
   \   000027   A3           INC     DPTR
   \   000028   A3           INC     DPTR
   \   000029   A3           INC     DPTR
   \   00002A   A3           INC     DPTR
   \   00002B   A3           INC     DPTR
   \   00002C   A3           INC     DPTR
   \   00002D   E0           MOVX    A,@DPTR
   \   00002E   C0E0         PUSH    A
   \   000030   7402         MOV     A,#0x2
   \   000032   12....       LCALL   ?XSTACK_DISP0_8
   \   000035   D0E0         POP     A
   \   000037   F0           MOVX    @DPTR,A
   \   000038   8C82         MOV     DPL,R4
   \   00003A   8D83         MOV     DPH,R5
   \   00003C   12....       LCALL   ??Subroutine15_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_44:
   \   00003F   85..82       MOV     DPL,?XSP + 0
   \   000042   85..83       MOV     DPH,?XSP + 1
   \   000045   EA           MOV     A,R2
   \   000046   F0           MOVX    @DPTR,A
   \   000047   A3           INC     DPTR
   \   000048   EB           MOV     A,R3
   \   000049   F0           MOVX    @DPTR,A
    217          
    218            *(ZDP_TmpBuf-1) = *transSeq;
   \   00004A   90....       MOV     DPTR,#ZDP_TmpBuf
   \   00004D   E0           MOVX    A,@DPTR
   \   00004E   24FF         ADD     A,#-0x1
   \   000050   F5..         MOV     ?V0 + 4,A
   \   000052   A3           INC     DPTR
   \   000053   E0           MOVX    A,@DPTR
   \   000054   34FF         ADDC    A,#-0x1
   \   000056   F5..         MOV     ?V0 + 5,A
   \   000058   85..82       MOV     DPL,?V0 + 0
   \   00005B   85..83       MOV     DPH,?V0 + 1
   \   00005E   E0           MOVX    A,@DPTR
   \   00005F   85..82       MOV     DPL,?V0 + 4
   \   000062   85..83       MOV     DPH,?V0 + 5
   \   000065   F0           MOVX    @DPTR,A
    219          
    220            return AF_DataRequest( &afAddr, &ZDApp_epDesc, clusterID,
    221                                     (uint16)(len+1), (uint8*)(ZDP_TmpBuf-1),
    222                                     transSeq, ZDP_TxOptions,  AF_DEFAULT_RADIUS );
   \   000066                ; Setup parameters for call to function AF_DataRequest
   \   000066   75..0A       MOV     ?V0 + 6,#0xa
   \   000069   78..         MOV     R0,#?V0 + 6
   \   00006B   12....       LCALL   ?PUSH_XSTACK_I_ONE
   \   00006E   78..         MOV     R0,#?V0 + 0
   \   000070   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   000073   78..         MOV     R0,#?V0 + 4
   \   000075   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   000078   89..         MOV     ?V0 + 0,R1
   \   00007A   7401         MOV     A,#0x1
   \   00007C   25..         ADD     A,?V0 + 0
   \   00007E   F5..         MOV     ?V0 + 0,A
   \   000080   E4           CLR     A
   \   000081   3400         ADDC    A,#0x0
   \   000083   F5..         MOV     ?V0 + 1,A
   \   000085   78..         MOV     R0,#?V0 + 0
   \   000087   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   00008A   78..         MOV     R0,#?V0 + 2
   \   00008C   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   00008F   90....       MOV     DPTR,#ZDP_TxOptions
   \   000092   E0           MOVX    A,@DPTR
   \   000093   F9           MOV     R1,A
   \   000094   7C..         MOV     R4,#(ZDApp_epDesc & 0xff)
   \   000096   7D..         MOV     R5,#((ZDApp_epDesc >> 8) & 0xff)
   \   000098   7409         MOV     A,#0x9
   \   00009A   12....       LCALL   ?XSTACK_DISP0_8
   \   00009D   AA82         MOV     R2,DPL
   \   00009F   AB83         MOV     R3,DPH
   \   0000A1   12....       LCALL   ??AF_DataRequest?relay
   \   0000A4   7409         MOV     A,#0x9
   \   0000A6   12....       LCALL   ?DEALLOC_XSTACK8
   \   0000A9   7404         MOV     A,#0x4
   \   0000AB   12....       LCALL   ?DEALLOC_XSTACK8
   \   0000AE   7F07         MOV     R7,#0x7
   \   0000B0   02....       LJMP    ?BANKED_LEAVE_XDATA
    223          
    224          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine15:
   \   000000   90....       MOV     DPTR,#ZDP_TmpBuf
   \                     ??Subroutine15_0:
   \   000003   E0           MOVX    A,@DPTR
   \   000004   FA           MOV     R2,A
   \   000005   A3           INC     DPTR
   \   000006   E0           MOVX    A,@DPTR
   \   000007   FB           MOV     R3,A
   \   000008   22           RET
    225          
    226          /*********************************************************************
    227           * @fn          ZDP_SendData
    228           *
    229           * @brief       This builds and send a request message that has
    230           *              NWKAddrOfInterest as its only parameter.
    231           *
    232           * @param       dstAddr - destination address
    233           * @param       cmd - clusterID
    234           * @param       dataLen - number of bytes of data
    235           * @param       data - pointer to the data
    236           * @param       SecurityEnable - Security Options
    237           *
    238           * @return      afStatus_t
    239           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    240          afStatus_t ZDP_SendData( byte *TransSeq, zAddrType_t *dstAddr, uint16 cmd,
   \                     ZDP_SendData:
    241                                  byte len, byte *buf, byte SecurityEnable )
    242          {
   \   000000   74F2         MOV     A,#-0xe
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 14
   \   000005                ; Auto size: 0
   \   000005   89..         MOV     ?V0 + 2,R1
   \   000007   740E         MOV     A,#0xe
   \   000009   12....       LCALL   ?XSTACK_DISP0_8
   \   00000C   12....       LCALL   ?Subroutine3 & 0xFFFF
   \                     ??CrossCallReturnLabel_6:
   \   00000F   7410         MOV     A,#0x10
   \   000011   12....       LCALL   ?XSTACK_DISP0_8
   \   000014   E0           MOVX    A,@DPTR
   \   000015   FE           MOV     R6,A
   \   000016   A3           INC     DPTR
   \   000017   E0           MOVX    A,@DPTR
   \   000018   FF           MOV     R7,A
   \   000019   7412         MOV     A,#0x12
   \   00001B   12....       LCALL   ?XSTACK_DISP0_8
   \   00001E   12....       LCALL   ?Subroutine5 & 0xFFFF
    243            byte *pBuf = ZDP_TmpBuf;
    244            byte cnt = len;
   \                     ??CrossCallReturnLabel_16:
   \   000021   85....       MOV     ?V0 + 4,?V0 + 2
   \   000024   8019         SJMP    ??ZDP_SendData_0
    245          
    246            while ( cnt-- )
    247            {
    248              *pBuf++ = *buf++;
   \                     ??ZDP_SendData_1:
   \   000026   8E82         MOV     DPL,R6
   \   000028   8F83         MOV     DPH,R7
   \   00002A   12....       LCALL   ?Subroutine16 & 0xFFFF
   \                     ??CrossCallReturnLabel_50:
   \   00002D   8E82         MOV     DPL,R6
   \   00002F   8F83         MOV     DPH,R7
   \   000031   A3           INC     DPTR
   \   000032   AE82         MOV     R6,DPL
   \   000034   AF83         MOV     R7,DPH
   \   000036   8882         MOV     DPL,R0
   \   000038   8983         MOV     DPH,R1
   \   00003A   A3           INC     DPTR
   \   00003B   A882         MOV     R0,DPL
   \   00003D   A983         MOV     R1,DPH
    249            }
   \                     ??ZDP_SendData_0:
   \   00003F   85....       MOV     ?V0 + 5,?V0 + 4
   \   000042   74FF         MOV     A,#-0x1
   \   000044   25..         ADD     A,?V0 + 5
   \   000046   F5..         MOV     ?V0 + 4,A
   \   000048   E5..         MOV     A,?V0 + 5
   \   00004A   70DA         JNZ     ??ZDP_SendData_1
    250          
    251            FillAndSendTxOptions( TransSeq, dstAddr, cmd, len,
    252                         (AF_DEFAULT_RADIUS | ((SecurityEnable) ? AF_EN_SECURITY : 0)) );
   \   00004C   E5..         MOV     A,?V0 + 3
   \   00004E   6004         JZ      ??ZDP_SendData_2
   \   000050   7840         MOV     R0,#0x40
   \   000052   8002         SJMP    ??ZDP_SendData_3
   \                     ??ZDP_SendData_2:
   \   000054   7800         MOV     R0,#0x0
   \                     ??ZDP_SendData_3:
   \   000056   E8           MOV     A,R0
   \   000057   440A         ORL     A,#0xa
   \   000059   90....       MOV     DPTR,#ZDP_TxOptions
   \   00005C   F0           MOVX    @DPTR,A
   \   00005D                ; Setup parameters for call to function fillAndSend
   \   00005D   78..         MOV     R0,#?V0 + 0
   \   00005F   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   000062   A9..         MOV     R1,?V0 + 2
   \   000064   12....       LCALL   ?Subroutine47 & 0xFFFF
   \                     ??CrossCallReturnLabel_129:
   \   000067   12....       LCALL   ?DEALLOC_XSTACK8
   \   00006A   E4           CLR     A
   \   00006B   90....       MOV     DPTR,#ZDP_TxOptions
   \   00006E   F0           MOVX    @DPTR,A
   \   00006F                REQUIRE ?Subroutine43
   \   00006F                ; // Fall through to label ?Subroutine43
    253          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine43:
   \   000000   7F06         MOV     R7,#0x6
   \   000002   02....       LJMP    ?BANKED_LEAVE_XDATA

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine47:
   \   000000   12....       LCALL   ??fillAndSend?relay
   \   000003   7402         MOV     A,#0x2
   \   000005   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine16:
   \   000000   12....       LCALL   ?Subroutine40 & 0xFFFF
   \                     ??CrossCallReturnLabel_107:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine40:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   8882         MOV     DPL,R0
   \   000003   8983         MOV     DPH,R1
   \   000005   F0           MOVX    @DPTR,A
   \   000006   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine3:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   F5..         MOV     ?V0 + 0,A
   \   000003   A3           INC     DPTR
   \   000004   E0           MOVX    A,@DPTR
   \   000005   F5..         MOV     ?V0 + 1,A
   \   000007   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine5:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   F5..         MOV     ?V0 + 3,A
   \                     ??Subroutine5_0:
   \   000003   90....       MOV     DPTR,#ZDP_TmpBuf
   \                     ??Subroutine5_1:
   \   000006   E0           MOVX    A,@DPTR
   \   000007   F8           MOV     R0,A
   \   000008   A3           INC     DPTR
   \   000009   E0           MOVX    A,@DPTR
   \   00000A   F9           MOV     R1,A
   \   00000B   22           RET
    254          
    255          #if defined ( ZDO_NODEDESC_REQUEST ) || defined ( ZDO_POWERDESC_REQUEST ) ||\
    256              defined ( ZDO_ACTIVEEP_REQUEST ) || defined ( ZDO_COMPLEXDESC_REQUEST ) ||\
    257              defined ( ZDO_USERDESC_REQUEST )
    258          /*********************************************************************
    259           * @fn          ZDP_NWKAddrOfInterestReq
    260           *
    261           * @brief       This builds and send a request message that has
    262           *              NWKAddrOfInterest as its only parameter.
    263           *
    264           * @param       dstAddr - destination address
    265           * @param       nwkAddr - 16 bit address
    266           * @param       SecurityEnable - Security Options
    267           *
    268           * @return      afStatus_t
    269           */
    270          afStatus_t ZDP_NWKAddrOfInterestReq( zAddrType_t *dstAddr, uint16 nwkAddr,
    271                                               byte cmd, byte SecurityEnable )
    272          {
    273            ZDP_TmpBuf[0] = LO_UINT16( nwkAddr );
    274            ZDP_TmpBuf[1] = HI_UINT16( nwkAddr );
    275          
    276            return fillAndSend( &ZDP_TransID, dstAddr, cmd, 2 );
    277          }
    278          #endif // ZDO_NODEDESC_REQUEST ZDO_POWERDESC_REQUEST ZDO_ACTIVEEP_REQUEST ZDO_COMPLEXDESC_REQUEST  ZDO_USERDESC_REQUEST
    279          
    280          /*********************************************************************
    281           * Address Requests
    282           */
    283          
    284          #if defined ( ZDO_NWKADDR_REQUEST )
    285          /*********************************************************************
    286           * @fn          ZDP_NwkAddrReq
    287           *
    288           * @brief       This builds and send a NWK_addr_req message.  This
    289           *              function sends a broadcast message looking for a 16
    290           *              bit address with a 64 bit address as bait.
    291           *
    292           * @param       IEEEAddress - looking for this device
    293           * @param       SecurityEnable - Security Options
    294           *
    295           * @return      afStatus_t
    296           */
    297          afStatus_t ZDP_NwkAddrReq( byte *IEEEAddress, byte ReqType,
    298                                     byte StartIndex, byte SecurityEnable )
    299          {
    300            byte *pBuf = ZDP_TmpBuf;
    301            byte len = Z_EXTADDR_LEN + 1 + 1;  // IEEEAddress + ReqType + StartIndex.
    302            zAddrType_t dstAddr;
    303          
    304            if ( osal_ExtAddrEqual( saveExtAddr, IEEEAddress ) == FALSE )
    305            {
    306              dstAddr.addrMode = AddrBroadcast;
    307              dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR;
    308            }
    309            else
    310            {
    311              dstAddr.addrMode = Addr16Bit;
    312              dstAddr.addr.shortAddr = ZDAppNwkAddr.addr.shortAddr;
    313            }
    314          
    315            pBuf = osal_cpyExtAddr( pBuf, IEEEAddress );
    316          
    317            *pBuf++ = ReqType;
    318            *pBuf++ = StartIndex;
    319          
    320            return fillAndSend( &ZDP_TransID, &dstAddr, NWK_addr_req, len );
    321          }
    322          #endif
    323          
    324          #if defined ( ZDO_IEEEADDR_REQUEST )
    325          /*********************************************************************
    326           * @fn          ZDP_IEEEAddrReq
    327           *
    328           * @brief       This builds and send a IEEE_addr_req message.  This
    329           *              function sends a unicast message looking for a 64
    330           *              bit IEEE address with a 16 bit address as bait.
    331           *
    332           * @param       ReqType - ZDP_IEEEADDR_REQTYPE_SINGLE or
    333           *                        ZDP_IEEEADDR_REQTYPE_EXTENDED
    334           * @param       SecurityEnable - Security Options
    335           *
    336           * @return      afStatus_t
    337           */
    338          afStatus_t ZDP_IEEEAddrReq( uint16 shortAddr, byte ReqType,
    339                                      byte StartIndex, byte SecurityEnable )
    340          {
    341            byte *pBuf = ZDP_TmpBuf;
    342            byte len = 2 + 1 + 1;  // shortAddr + ReqType + StartIndex.
    343            zAddrType_t dstAddr;
    344          
    345            dstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    346            dstAddr.addr.shortAddr = shortAddr;
    347          
    348            *pBuf++ = LO_UINT16( shortAddr );
    349            *pBuf++ = HI_UINT16( shortAddr );
    350          
    351            *pBuf++ = ReqType;
    352            *pBuf++ = StartIndex;
    353          
    354            return fillAndSend( &ZDP_TransID, &dstAddr, IEEE_addr_req, len );
    355          }
    356          #endif
    357          
    358          #if defined ( ZDO_MATCH_REQUEST )
    359          /*********************************************************************
    360           * @fn          ZDP_MatchDescReq
    361           *
    362           * @brief       This builds and send a Match_Desc_req message.  This
    363           *              function sends a broadcast or unicast message
    364           *              requesting the list of endpoint/interfaces that
    365           *              match profile ID and cluster IDs.
    366           *
    367           * @param       dstAddr - destination address
    368           * @param       ProfileID - Profile ID
    369           * @param       NumInClusters - number of input clusters
    370           * @param       InClusterList - input cluster ID list
    371           * @param       NumOutClusters - number of output clusters
    372           * @param       OutClusterList - output cluster ID list
    373           * @param       SecurityEnable - Security Options
    374           *
    375           * @return      afStatus_t
    376           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    377          afStatus_t ZDP_MatchDescReq( zAddrType_t *dstAddr, uint16 nwkAddr,
   \                     ZDP_MatchDescReq:
    378                                          uint16 ProfileID,
    379                                          byte NumInClusters, cId_t *InClusterList,
    380                                          byte NumOutClusters, cId_t *OutClusterList,
    381                                          byte SecurityEnable )
    382          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 0
   \   000005   8A..         MOV     ?V0 + 6,R2
   \   000007   8B..         MOV     ?V0 + 7,R3
   \   000009   E9           MOV     A,R1
   \   00000A   FF           MOV     R7,A
   \   00000B   7410         MOV     A,#0x10
   \   00000D   12....       LCALL   ?XSTACK_DISP0_8
   \   000010   12....       LCALL   ??Subroutine15_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_45:
   \   000013   7412         MOV     A,#0x12
   \   000015   12....       LCALL   ?XSTACK_DISP0_8
   \   000018   12....       LCALL   ?Subroutine3 & 0xFFFF
   \                     ??CrossCallReturnLabel_7:
   \   00001B   7414         MOV     A,#0x14
   \   00001D   12....       LCALL   ?XSTACK_DISP0_8
   \   000020   E0           MOVX    A,@DPTR
   \   000021   F5..         MOV     ?V0 + 4,A
   \   000023   7415         MOV     A,#0x15
   \   000025   12....       LCALL   ?XSTACK_DISP0_8
   \   000028   E0           MOVX    A,@DPTR
   \   000029   F5..         MOV     ?V0 + 2,A
   \   00002B   A3           INC     DPTR
   \   00002C   12....       LCALL   ?Subroutine5 & 0xFFFF
    383            byte *pBuf = ZDP_TmpBuf;
    384            // nwkAddr+ProfileID+NumInClusters+NumOutClusters.
    385            byte i, len = 2 + 2 + 1 + 1;  // nwkAddr+ProfileID+NumInClusters+NumOutClusters.
    386          
    387            len += (NumInClusters + NumOutClusters) * sizeof(uint16);
   \                     ??CrossCallReturnLabel_17:
   \   00002F   E5..         MOV     A,?V0 + 4
   \   000031   2F           ADD     A,R7
   \   000032   C3           CLR     C
   \   000033   33           RLC     A
   \   000034   2406         ADD     A,#0x6
   \   000036   FE           MOV     R6,A
    388          
    389            if ( len >= ZDP_BUF_SZ-1 )
   \   000037   C3           CLR     C
   \   000038   944F         SUBB    A,#0x4f
   \   00003A   4005         JC      ??ZDP_MatchDescReq_0
    390            {
    391              return afStatus_MEM_FAIL;
   \   00003C   7981         MOV     R1,#-0x7f
   \   00003E   02....       LJMP    ??ZDP_MatchDescReq_1 & 0xFFFF
    392            }
    393          
    394            *pBuf++ = LO_UINT16( nwkAddr );   // NWKAddrOfInterest
   \                     ??ZDP_MatchDescReq_0:
   \   000041   EC           MOV     A,R4
   \   000042   8882         MOV     DPL,R0
   \   000044   8983         MOV     DPH,R1
   \   000046   F0           MOVX    @DPTR,A
   \   000047   A3           INC     DPTR
    395            *pBuf++ = HI_UINT16( nwkAddr );
   \   000048   ED           MOV     A,R5
   \   000049   F0           MOVX    @DPTR,A
   \   00004A   A3           INC     DPTR
    396          
    397            *pBuf++ = LO_UINT16( ProfileID );   // Profile ID
   \   00004B   EA           MOV     A,R2
   \   00004C   F0           MOVX    @DPTR,A
   \   00004D   A3           INC     DPTR
    398            *pBuf++ = HI_UINT16( ProfileID );
   \   00004E   EB           MOV     A,R3
   \   00004F   F0           MOVX    @DPTR,A
   \   000050   A3           INC     DPTR
    399          
    400            *pBuf++ = NumInClusters; // Input cluster list
   \   000051   EF           MOV     A,R7
   \   000052   12....       LCALL   ?Subroutine23 & 0xFFFF
    401            if ( NumInClusters )
   \                     ??CrossCallReturnLabel_119:
   \   000055   6024         JZ      ??ZDP_MatchDescReq_2
    402            {
    403              for (i=0; i<NumInClusters; ++i)  {
   \   000057   75..00       MOV     ?V0 + 5,#0x0
    404                *pBuf++ = LO_UINT16( InClusterList[i] );
   \                     ??ZDP_MatchDescReq_3:
   \   00005A   E5..         MOV     A,?V0 + 5
   \   00005C   C3           CLR     C
   \   00005D   33           RLC     A
   \   00005E   FA           MOV     R2,A
   \   00005F   E4           CLR     A
   \   000060   33           RLC     A
   \   000061   FB           MOV     R3,A
   \   000062   E5..         MOV     A,?V0 + 0
   \   000064   2A           ADD     A,R2
   \   000065   FC           MOV     R4,A
   \   000066   E5..         MOV     A,?V0 + 1
   \   000068   3B           ADDC    A,R3
   \   000069   FD           MOV     R5,A
   \   00006A   8C82         MOV     DPL,R4
   \   00006C   8D83         MOV     DPH,R5
   \   00006E   12....       LCALL   ?Subroutine7 & 0xFFFF
    405                *pBuf++ = HI_UINT16( InClusterList[i] );
   \                     ??CrossCallReturnLabel_29:
   \   000071   8C82         MOV     DPL,R4
   \   000073   8D83         MOV     DPH,R5
   \   000075   12....       LCALL   ?Subroutine10 & 0xFFFF
    406              }
   \                     ??CrossCallReturnLabel_36:
   \   000078   9F           SUBB    A,R7
   \   000079   40DF         JC      ??ZDP_MatchDescReq_3
    407            }
    408          
    409            *pBuf++ = NumOutClusters; // Output cluster list
   \                     ??ZDP_MatchDescReq_2:
   \   00007B   8882         MOV     DPL,R0
   \   00007D   8983         MOV     DPH,R1
   \   00007F   E5..         MOV     A,?V0 + 4
   \   000081   12....       LCALL   ?Subroutine23 & 0xFFFF
    410            if ( NumOutClusters )
   \                     ??CrossCallReturnLabel_120:
   \   000084   6025         JZ      ??ZDP_MatchDescReq_4
    411            {
    412              for (i=0; i<NumOutClusters; ++i)  {
   \   000086   75..00       MOV     ?V0 + 5,#0x0
    413                *pBuf++ = LO_UINT16( OutClusterList[i] );
   \                     ??ZDP_MatchDescReq_5:
   \   000089   E5..         MOV     A,?V0 + 5
   \   00008B   C3           CLR     C
   \   00008C   33           RLC     A
   \   00008D   FA           MOV     R2,A
   \   00008E   E4           CLR     A
   \   00008F   33           RLC     A
   \   000090   FB           MOV     R3,A
   \   000091   E5..         MOV     A,?V0 + 2
   \   000093   2A           ADD     A,R2
   \   000094   FA           MOV     R2,A
   \   000095   E5..         MOV     A,?V0 + 3
   \   000097   3B           ADDC    A,R3
   \   000098   FB           MOV     R3,A
   \   000099   8A82         MOV     DPL,R2
   \   00009B   8B83         MOV     DPH,R3
   \   00009D   12....       LCALL   ?Subroutine7 & 0xFFFF
    414                *pBuf++ = HI_UINT16( OutClusterList[i] );
   \                     ??CrossCallReturnLabel_30:
   \   0000A0   8A82         MOV     DPL,R2
   \   0000A2   8B83         MOV     DPH,R3
   \   0000A4   12....       LCALL   ?Subroutine10 & 0xFFFF
    415              }
   \                     ??CrossCallReturnLabel_37:
   \   0000A7   95..         SUBB    A,?V0 + 4
   \   0000A9   40DE         JC      ??ZDP_MatchDescReq_5
    416            }
    417          
    418            return fillAndSend( &ZDP_TransID, dstAddr, Match_Desc_req, len );
   \                     ??ZDP_MatchDescReq_4:
   \   0000AB                ; Setup parameters for call to function fillAndSend
   \   0000AB   75..06       MOV     ?V0 + 0,#0x6
   \   0000AE   75..00       MOV     ?V0 + 1,#0x0
   \   0000B1   78..         MOV     R0,#?V0 + 0
   \   0000B3   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000B6   EE           MOV     A,R6
   \   0000B7   F9           MOV     R1,A
   \   0000B8   AC..         MOV     R4,?V0 + 6
   \   0000BA   AD..         MOV     R5,?V0 + 7
   \   0000BC   7A..         MOV     R2,#(ZDP_TransID & 0xff)
   \   0000BE   7B..         MOV     R3,#((ZDP_TransID >> 8) & 0xff)
   \   0000C0   12....       LCALL   ?Subroutine47 & 0xFFFF
   \                     ??CrossCallReturnLabel_130:
   \   0000C3   12....       LCALL   ?DEALLOC_XSTACK8
   \                     ??ZDP_MatchDescReq_1:
   \   0000C6   02....       LJMP    ??Subroutine44_1 & 0xFFFF
    419          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine10:
   \   000000   12....       LCALL   ?Subroutine32 & 0xFFFF
   \                     ??CrossCallReturnLabel_92:
   \   000003   05..         INC     ?V0 + 5
   \   000005   E5..         MOV     A,?V0 + 5
   \   000007   C3           CLR     C
   \   000008   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine32:
   \   000000   A3           INC     DPTR
   \                     ??Subroutine32_0:
   \   000001   12....       LCALL   ?Subroutine40 & 0xFFFF
   \                     ??CrossCallReturnLabel_108:
   \   000004   A3           INC     DPTR
   \   000005   08           INC     R0
   \   000006   A983         MOV     R1,DPH
   \   000008   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine23:
   \   000000   F0           MOVX    @DPTR,A
   \   000001                REQUIRE ?Subroutine46
   \   000001                ; // Fall through to label ?Subroutine46

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine46:
   \   000000   A3           INC     DPTR
   \   000001   A882         MOV     R0,DPL
   \   000003   A983         MOV     R1,DPH
   \   000005   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine7:
   \   000000   12....       LCALL   ?Subroutine34 & 0xFFFF
   \                     ??CrossCallReturnLabel_123:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine34:
   \   000000   12....       LCALL   ?Subroutine40 & 0xFFFF
   \                     ??CrossCallReturnLabel_109:
   \   000003   80..         SJMP    ?Subroutine46

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine44:
   \   000000   7401         MOV     A,#0x1
   \                     ??Subroutine44_0:
   \   000002   12....       LCALL   ?DEALLOC_XSTACK8
   \                     ??Subroutine44_1:
   \   000005   7F08         MOV     R7,#0x8
   \   000007   02....       LJMP    ?BANKED_LEAVE_XDATA
    420          #endif // ZDO_MATCH_REQUEST
    421          
    422          #if defined ( ZDO_SIMPLEDESC_REQUEST )
    423          /*********************************************************************
    424           * @fn          ZDP_SimpleDescReq
    425           *
    426           * @brief       This builds and send a NWK_Simple_Desc_req
    427           *              message.  This function sends unicast message to the
    428           *              destination device.
    429           *
    430           * @param       dstAddr - destination address
    431           * @param       nwkAddr - 16 bit address
    432           * @param       epIntf - endpoint/interface
    433           * @param       SecurityEnable - Security Options
    434           *
    435           * @return      afStatus_t
    436           */
    437          afStatus_t ZDP_SimpleDescReq( zAddrType_t *dstAddr, uint16 nwkAddr,
    438                                              byte endPoint, byte SecurityEnable )
    439          
    440          {
    441            ZDP_TmpBuf[0] = LO_UINT16( nwkAddr );
    442            ZDP_TmpBuf[1] = HI_UINT16( nwkAddr );
    443            ZDP_TmpBuf[2] = endPoint;
    444          
    445            return fillAndSend( &ZDP_TransID, dstAddr, Simple_Desc_req, 3 );
    446          }
    447          #endif // ZDO_SIMPLEDESC_REQUEST
    448          
    449          #if defined ( ZDO_USERDESCSET_REQUEST )
    450          /*********************************************************************
    451           * @fn          ZDP_UserDescSet
    452           *
    453           * @brief       This builds and send a User_Desc_set message to set
    454           *              the user descriptor.  This function sends unicast
    455           *              message to the destination device.
    456           *
    457           * @param       dstAddr - destination address
    458           * @param       nwkAddr - 16 bit address
    459           * @param       UserDescriptor - user descriptor
    460           * @param       SecurityEnable - Security Options
    461           *
    462           * @return      afStatus_t
    463           */
    464          afStatus_t ZDP_UserDescSet( zAddrType_t *dstAddr, uint16 nwkAddr,
    465                                    UserDescriptorFormat_t *UserDescriptor,
    466                                    byte SecurityEnable )
    467          {
    468            byte *pBuf = ZDP_TmpBuf;
    469            byte len = (UserDescriptor->len < AF_MAX_USER_DESCRIPTOR_LEN) ?
    470                        UserDescriptor->len : AF_MAX_USER_DESCRIPTOR_LEN;
    471            byte addrLen = 2;
    472          
    473            *pBuf++ = LO_UINT16( nwkAddr );
    474            *pBuf++ = HI_UINT16( nwkAddr );
    475          
    476            *pBuf++ = len;
    477            addrLen = 3;
    478          
    479            pBuf = osal_memcpy( pBuf, UserDescriptor->desc, len );
    480            osal_memset( pBuf, AF_USER_DESCRIPTOR_FILL, AF_MAX_USER_DESCRIPTOR_LEN-len );
    481          
    482            return fillAndSend( &ZDP_TransID, dstAddr, User_Desc_set, (AF_MAX_USER_DESCRIPTOR_LEN + addrLen) );
    483          }
    484          #endif // ZDO_USERDESCSET_REQUEST
    485          
    486          #if defined ( ZDO_SERVERDISC_REQUEST )
    487          /*********************************************************************
    488           * @fn          ZDP_ServerDiscReq
    489           *
    490           * @brief       Build and send a Server_Discovery_req request message.
    491           *
    492           * @param       serverMask - 16-bit bit-mask of server services being sought.
    493           * @param       SecurityEnable - Security Options
    494           *
    495           * @return      afStatus_t
    496           */
    497          afStatus_t ZDP_ServerDiscReq( uint16 serverMask, byte SecurityEnable )
    498          {
    499            byte *pBuf = ZDP_TmpBuf;
    500            zAddrType_t dstAddr;
    501          
    502            dstAddr.addrMode = AddrBroadcast;
    503            dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR_DEVZCZR;
    504          
    505            *pBuf++ = LO_UINT16( serverMask );
    506            *pBuf = HI_UINT16( serverMask );
    507          
    508            FillAndSendTxOptions( &ZDP_TransID, &dstAddr, Server_Discovery_req, 2,
    509                       ((SecurityEnable) ? AF_EN_SECURITY : AF_TX_OPTIONS_NONE) );
    510          }
    511          #endif
    512          
    513          #if defined ( ZDO_ENDDEVICE_ANNCE_REQUEST ) || defined ( ZDO_ENDDEVICE_ANNCE_GENERATE )
    514          /*********************************************************************
    515           * @fn          ZDP_EndDeviceAnnce
    516           *
    517           * @brief       This builds and send an End_Device_Annce
    518           *              message.  This function sends a broadcast message.
    519           *
    520           * @param       nwkAddr - 16 bit address of the device
    521           * @param       IEEEAddr - 64 bit address of the device
    522           * @param       capabilities - device capabilities.  This field is only
    523           *                 sent for v1.1 networks.
    524           * @param       SecurityEnable - Security Options
    525           *
    526           * @return      afStatus_t
    527           */
    528          afStatus_t ZDP_EndDeviceAnnce( uint16 nwkAddr, byte *IEEEAddr,
    529                                        byte capabilities, byte SecurityEnable )
    530          {
    531            zAddrType_t dstAddr;
    532            uint8 len;
    533          
    534            dstAddr.addrMode = (afAddrMode_t)AddrBroadcast;
    535            dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR;
    536          
    537            ZDP_TmpBuf[0] = LO_UINT16( nwkAddr );
    538            ZDP_TmpBuf[1] = HI_UINT16( nwkAddr );
    539            osal_cpyExtAddr( &ZDP_TmpBuf[2], IEEEAddr );
    540            len = 2 + Z_EXTADDR_LEN;
    541          
    542            ZDP_TmpBuf[10] = capabilities;
    543            len++;
    544          
    545            return fillAndSend( &ZDP_TransID, &dstAddr, End_Device_annce, len );
    546          }
    547          #endif // ZDO_ENDDEVICE_ANNCE_REQUEST
    548          
    549          /*********************************************************************
    550           * Address Responses
    551           */
    552          
    553          /*********************************************************************
    554           * @fn      zdpProcessAddrReq
    555           *
    556           * @brief   Process an incoming NWK_addr_req or IEEE_addr_req message and then
    557           *          build and send a corresponding NWK_addr_rsp or IEEE_addr_rsp msg.
    558           *
    559           * @param   inMsg - incoming message
    560           *
    561           * @return  none
    562           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    563          void zdpProcessAddrReq( zdoIncomingMsg_t *inMsg )
   \                     zdpProcessAddrReq:
    564          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 1
   \   000005   74FF         MOV     A,#-0x1
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   8A..         MOV     ?V0 + 6,R2
   \   00000C   8B..         MOV     ?V0 + 7,R3
    565            uint8 reqType;
    566            uint16 aoi = INVALID_NODE_ADDR;
    567            uint8 *ieee = NULL;
   \   00000E   75..00       MOV     ?V0 + 4,#0x0
   \   000011   75..00       MOV     ?V0 + 5,#0x0
    568          
    569            reqType = inMsg->asdu[(inMsg->clusterID == NWK_addr_req) ? Z_EXTADDR_LEN : sizeof( uint16 ) ];
   \   000014   EA           MOV     A,R2
   \   000015   240C         ADD     A,#0xc
   \   000017   F582         MOV     DPL,A
   \   000019   EB           MOV     A,R3
   \   00001A   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_68:
   \   00001D   7002         JNZ     ??zdpProcessAddrReq_0
   \   00001F   A3           INC     DPTR
   \   000020   E0           MOVX    A,@DPTR
   \                     ??zdpProcessAddrReq_0:
   \   000021   7004         JNZ     ??zdpProcessAddrReq_1
   \   000023   7808         MOV     R0,#0x8
   \   000025   8002         SJMP    ??zdpProcessAddrReq_2
   \                     ??zdpProcessAddrReq_1:
   \   000027   7802         MOV     R0,#0x2
   \                     ??zdpProcessAddrReq_2:
   \   000029   EA           MOV     A,R2
   \   00002A   2411         ADD     A,#0x11
   \   00002C   F582         MOV     DPL,A
   \   00002E   EB           MOV     A,R3
   \   00002F   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_69:
   \   000032   28           ADD     A,R0
   \   000033   FA           MOV     R2,A
   \   000034   A3           INC     DPTR
   \   000035   E0           MOVX    A,@DPTR
   \   000036   3400         ADDC    A,#0x0
   \   000038   8A82         MOV     DPL,R2
   \   00003A   F583         MOV     DPH,A
   \   00003C   E0           MOVX    A,@DPTR
   \   00003D   F5..         MOV     ?V0 + 3,A
    570          
    571            if ( inMsg->clusterID == NWK_addr_req )
   \   00003F   E5..         MOV     A,?V0 + 6
   \   000041   240C         ADD     A,#0xc
   \   000043   F582         MOV     DPL,A
   \   000045   EB           MOV     A,R3
   \   000046   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_70:
   \   000049   7002         JNZ     ??zdpProcessAddrReq_3
   \   00004B   A3           INC     DPTR
   \   00004C   E0           MOVX    A,@DPTR
   \                     ??zdpProcessAddrReq_3:
   \   00004D   702A         JNZ     ??zdpProcessAddrReq_4
    572            {
    573              ieee = inMsg->asdu;
   \   00004F   E5..         MOV     A,?V0 + 6
   \   000051   2411         ADD     A,#0x11
   \   000053   F582         MOV     DPL,A
   \   000055   EB           MOV     A,R3
   \   000056   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_71:
   \   000059   F5..         MOV     ?V0 + 4,A
   \   00005B   A3           INC     DPTR
   \   00005C   E0           MOVX    A,@DPTR
   \   00005D   F5..         MOV     ?V0 + 5,A
    574          
    575              if ( osal_ExtAddrEqual( saveExtAddr, ieee ) )
   \   00005F                ; Setup parameters for call to function osal_ExtAddrEqual
   \   00005F   AC..         MOV     R4,?V0 + 4
   \   000061   FD           MOV     R5,A
   \   000062   7A..         MOV     R2,#(saveExtAddr & 0xff)
   \   000064   7B..         MOV     R3,#((saveExtAddr >> 8) & 0xff)
   \   000066   12....       LCALL   ??osal_ExtAddrEqual?relay
   \   000069   E9           MOV     A,R1
   \   00006A   7003         JNZ     $+5
   \   00006C   02....       LJMP    ??zdpProcessAddrReq_5 & 0xFFFF
    576              {
    577                aoi = ZDAppNwkAddr.addr.shortAddr;
   \   00006F   90....       MOV     DPTR,#ZDAppNwkAddr
   \   000072   E0           MOVX    A,@DPTR
   \   000073   FE           MOV     R6,A
   \   000074   A3           INC     DPTR
   \   000075   E0           MOVX    A,@DPTR
   \   000076   FF           MOV     R7,A
   \   000077   802D         SJMP    ??zdpProcessAddrReq_6
    578              }
    579              /*
    580              else if ( reqType == ZDP_ADDR_REQTYPE_MEMBERSHIP )
    581              {
    582                //ggg - what to do?
    583              }
    584              */
    585            }
   \                     ??zdpProcessAddrReq_4:
   \   000079   E5..         MOV     A,?V0 + 6
   \   00007B   2411         ADD     A,#0x11
   \   00007D   F582         MOV     DPL,A
   \   00007F   EB           MOV     A,R3
   \   000080   3400         ADDC    A,#0x0
   \   000082   F583         MOV     DPH,A
   \   000084   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_18:
   \   000087   8882         MOV     DPL,R0
   \   000089   8983         MOV     DPH,R1
   \   00008B   E0           MOVX    A,@DPTR
   \   00008C   FA           MOV     R2,A
   \   00008D   A3           INC     DPTR
   \   00008E   E0           MOVX    A,@DPTR
   \   00008F   F9           MOV     R1,A
   \   000090   EA           MOV     A,R2
   \   000091   FE           MOV     R6,A
   \   000092   E9           MOV     A,R1
   \   000093   FF           MOV     R7,A
    586            else  // if ( inMsg->clusterID == IEEE_addr_req )
    587            {
    588              aoi = BUILD_UINT16( inMsg->asdu[0], inMsg->asdu[1] );
    589          
    590              if ( aoi == ZDAppNwkAddr.addr.shortAddr )
   \   000094   90....       MOV     DPTR,#ZDAppNwkAddr
   \   000097   E0           MOVX    A,@DPTR
   \   000098   6E           XRL     A,R6
   \   000099   7003         JNZ     ??zdpProcessAddrReq_7
   \   00009B   A3           INC     DPTR
   \   00009C   E0           MOVX    A,@DPTR
   \   00009D   6F           XRL     A,R7
   \                     ??zdpProcessAddrReq_7:
   \   00009E   7006         JNZ     ??zdpProcessAddrReq_6
    591              {
    592                ieee = saveExtAddr;
   \   0000A0   75....       MOV     ?V0 + 4,#(saveExtAddr & 0xff)
   \   0000A3   75....       MOV     ?V0 + 5,#((saveExtAddr >> 8) & 0xff)
    593              }
    594            }
    595          
    596            if ( (aoi != INVALID_NODE_ADDR) && (ieee != NULL) )
   \                     ??zdpProcessAddrReq_6:
   \   0000A6   74FE         MOV     A,#-0x2
   \   0000A8   6E           XRL     A,R6
   \   0000A9   7003         JNZ     ??zdpProcessAddrReq_8
   \   0000AB   74FF         MOV     A,#-0x1
   \   0000AD   6F           XRL     A,R7
   \                     ??zdpProcessAddrReq_8:
   \   0000AE   7003         JNZ     $+5
   \   0000B0   02....       LJMP    ??zdpProcessAddrReq_5 & 0xFFFF
   \   0000B3   E5..         MOV     A,?V0 + 4
   \   0000B5   7002         JNZ     ??zdpProcessAddrReq_9
   \   0000B7   E5..         MOV     A,?V0 + 5
   \                     ??zdpProcessAddrReq_9:
   \   0000B9   7003         JNZ     $+5
   \   0000BB   02....       LJMP    ??zdpProcessAddrReq_5 & 0xFFFF
    597            {
    598              byte *pBuf = ZDP_TmpBuf;
   \   0000BE   90....       MOV     DPTR,#ZDP_TmpBuf
   \   0000C1   12....       LCALL   ?Subroutine3 & 0xFFFF
    599              // Status + IEEE-Addr + Nwk-Addr.
    600              byte len = 1 + Z_EXTADDR_LEN + 2;
   \                     ??CrossCallReturnLabel_8:
   \   0000C4   75..0B       MOV     ?V0 + 2,#0xb
    601          
    602              byte stat = ((reqType == ZDP_ADDR_REQTYPE_SINGLE)
    603                      || (reqType == ZDP_ADDR_REQTYPE_EXTENDED)
    604                    || ((reqType == ZDP_ADDR_REQTYPE_MEMBERSHIP)
    605                   && (inMsg->clusterID == NWK_addr_req)) ) ? ZDP_SUCCESS : ZDP_INVALID_REQTYPE;
   \   0000C7   E5..         MOV     A,?V0 + 3
   \   0000C9   6015         JZ      ??zdpProcessAddrReq_10
   \   0000CB   7401         MOV     A,#0x1
   \   0000CD   65..         XRL     A,?V0 + 3
   \   0000CF   600F         JZ      ??zdpProcessAddrReq_10
   \   0000D1   7402         MOV     A,#0x2
   \   0000D3   65..         XRL     A,?V0 + 3
   \   0000D5   700D         JNZ     ??zdpProcessAddrReq_11
   \   0000D7   12....       LCALL   ?Subroutine26 & 0xFFFF
   \                     ??CrossCallReturnLabel_72:
   \   0000DA   7002         JNZ     ??zdpProcessAddrReq_12
   \   0000DC   A3           INC     DPTR
   \   0000DD   E0           MOVX    A,@DPTR
   \                     ??zdpProcessAddrReq_12:
   \   0000DE   7004         JNZ     ??zdpProcessAddrReq_11
   \                     ??zdpProcessAddrReq_10:
   \   0000E0   7A00         MOV     R2,#0x0
   \   0000E2   8002         SJMP    ??zdpProcessAddrReq_13
   \                     ??zdpProcessAddrReq_11:
   \   0000E4   7A80         MOV     R2,#-0x80
   \                     ??zdpProcessAddrReq_13:
   \   0000E6   EA           MOV     A,R2
    606          
    607              *pBuf++ = stat;
   \   0000E7   85..82       MOV     DPL,?V0 + 0
   \   0000EA   85..83       MOV     DPH,?V0 + 1
   \   0000ED   12....       LCALL   ?Subroutine20 & 0xFFFF
    608          
    609              pBuf = osal_cpyExtAddr( pBuf, ieee );
   \                     ??CrossCallReturnLabel_116:
   \   0000F0                ; Setup parameters for call to function osal_cpyExtAddr
   \   0000F0   AC..         MOV     R4,?V0 + 4
   \   0000F2   AD..         MOV     R5,?V0 + 5
   \   0000F4   AA..         MOV     R2,?V0 + 0
   \   0000F6   AB..         MOV     R3,?V0 + 1
   \   0000F8   12....       LCALL   ??osal_cpyExtAddr?relay
    610          
    611              *pBuf++ = LO_UINT16( aoi );
   \   0000FB   EE           MOV     A,R6
   \   0000FC   8A82         MOV     DPL,R2
   \   0000FE   8B83         MOV     DPH,R3
   \   000100   F0           MOVX    @DPTR,A
   \   000101   A3           INC     DPTR
    612              *pBuf++ = HI_UINT16( aoi );
   \   000102   EF           MOV     A,R7
   \   000103   12....       LCALL   ?Subroutine20 & 0xFFFF
    613          
    614          #if defined( RTR_NWK )
    615              if ( (reqType == ZDP_ADDR_REQTYPE_EXTENDED) &&
    616                   (aoi == ZDAppNwkAddr.addr.shortAddr) )
   \                     ??CrossCallReturnLabel_117:
   \   000106   7401         MOV     A,#0x1
   \   000108   65..         XRL     A,?V0 + 3
   \   00010A   6003         JZ      $+5
   \   00010C   02....       LJMP    ??zdpProcessAddrReq_14 & 0xFFFF
   \   00010F   90....       MOV     DPTR,#ZDAppNwkAddr
   \   000112   E0           MOVX    A,@DPTR
   \   000113   6E           XRL     A,R6
   \   000114   7003         JNZ     ??zdpProcessAddrReq_15
   \   000116   A3           INC     DPTR
   \   000117   E0           MOVX    A,@DPTR
   \   000118   6F           XRL     A,R7
   \                     ??zdpProcessAddrReq_15:
   \   000119   6003         JZ      $+5
   \   00011B   02....       LJMP    ??zdpProcessAddrReq_14 & 0xFFFF
    617              {
    618                byte cnt = 0;
   \   00011E   E4           CLR     A
   \   00011F   85..82       MOV     DPL,?XSP + 0
   \   000122   85..83       MOV     DPH,?XSP + 1
   \   000125   F0           MOVX    @DPTR,A
    619                uint16 *list = AssocMakeList( &cnt );
   \   000126                ; Setup parameters for call to function AssocMakeList
   \   000126   AA82         MOV     R2,DPL
   \   000128   AB83         MOV     R3,DPH
   \   00012A   12....       LCALL   ??AssocMakeList?relay
    620          
    621                if ( list != NULL )
   \   00012D   EA           MOV     A,R2
   \   00012E   7001         JNZ     ??zdpProcessAddrReq_16
   \   000130   EB           MOV     A,R3
   \                     ??zdpProcessAddrReq_16:
   \   000131   7003         JNZ     $+5
   \   000133   02....       LJMP    ??zdpProcessAddrReq_17 & 0xFFFF
    622                {
    623                  byte idx = inMsg->asdu[(((inMsg->clusterID == NWK_addr_req) ? Z_EXTADDR_LEN : sizeof( uint16 )) + 1)];
   \   000136   12....       LCALL   ?Subroutine26 & 0xFFFF
   \                     ??CrossCallReturnLabel_73:
   \   000139   7002         JNZ     ??zdpProcessAddrReq_18
   \   00013B   A3           INC     DPTR
   \   00013C   E0           MOVX    A,@DPTR
   \                     ??zdpProcessAddrReq_18:
   \   00013D   7004         JNZ     ??zdpProcessAddrReq_19
   \   00013F   7808         MOV     R0,#0x8
   \   000141   8002         SJMP    ??zdpProcessAddrReq_20
   \                     ??zdpProcessAddrReq_19:
   \   000143   7802         MOV     R0,#0x2
   \                     ??zdpProcessAddrReq_20:
   \   000145   E5..         MOV     A,?V0 + 6
   \   000147   2411         ADD     A,#0x11
   \   000149   12....       LCALL   ??Subroutine26_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_74:
   \   00014C   28           ADD     A,R0
   \   00014D   FC           MOV     R4,A
   \   00014E   A3           INC     DPTR
   \   00014F   E0           MOVX    A,@DPTR
   \   000150   3400         ADDC    A,#0x0
   \   000152   8C82         MOV     DPL,R4
   \   000154   F583         MOV     DPH,A
   \   000156   A3           INC     DPTR
   \   000157   E0           MOVX    A,@DPTR
   \   000158   FC           MOV     R4,A
    624                  uint16 *pList = list + idx;
   \   000159   C3           CLR     C
   \   00015A   33           RLC     A
   \   00015B   F8           MOV     R0,A
   \   00015C   E4           CLR     A
   \   00015D   33           RLC     A
   \   00015E   F9           MOV     R1,A
   \   00015F   EA           MOV     A,R2
   \   000160   28           ADD     A,R0
   \   000161   F8           MOV     R0,A
   \   000162   EB           MOV     A,R3
   \   000163   39           ADDC    A,R1
   \   000164   F9           MOV     R1,A
    625          
    626                  // NumAssocDev field is only present on success.
    627                  if ( cnt > idx )
   \   000165   85..82       MOV     DPL,?XSP + 0
   \   000168   85..83       MOV     DPH,?XSP + 1
   \   00016B   E0           MOVX    A,@DPTR
   \   00016C   FD           MOV     R5,A
   \   00016D   EC           MOV     A,R4
   \   00016E   C3           CLR     C
   \   00016F   9D           SUBB    A,R5
   \   000170   500C         JNC     ??zdpProcessAddrReq_21
    628                  {
    629                    cnt -= idx;
   \   000172   E0           MOVX    A,@DPTR
   \   000173   C3           CLR     C
   \   000174   9C           SUBB    A,R4
   \   000175   F0           MOVX    @DPTR,A
    630                    len += (cnt * sizeof( uint16 ));
   \   000176   C3           CLR     C
   \   000177   33           RLC     A
   \   000178   240B         ADD     A,#0xb
   \   00017A   F5..         MOV     ?V0 + 2,A
   \   00017C   8002         SJMP    ??zdpProcessAddrReq_22
    631                  }
    632                  else
    633                  {
    634                    cnt = 0;
   \                     ??zdpProcessAddrReq_21:
   \   00017E   E4           CLR     A
   \   00017F   F0           MOVX    @DPTR,A
    635                  }
    636                  *pBuf++ = cnt;
   \                     ??zdpProcessAddrReq_22:
   \   000180   12....       LCALL   ?Subroutine35 & 0xFFFF
    637                  len++;
    638          
    639                  // StartIndex field is only present if NumAssocDev field is non-zero.
    640                  *pBuf++ = idx;
   \                     ??CrossCallReturnLabel_96:
   \   000183   EC           MOV     A,R4
   \   000184   12....       LCALL   ?Subroutine20 & 0xFFFF
    641                  len++;
   \                     ??CrossCallReturnLabel_118:
   \   000187   05..         INC     ?V0 + 2
   \   000189   05..         INC     ?V0 + 2
   \   00018B   8021         SJMP    ??zdpProcessAddrReq_23
    642          
    643                  while ( cnt != 0 )
    644                  {
    645                    *pBuf++ = LO_UINT16( *pList );
   \                     ??zdpProcessAddrReq_24:
   \   00018D   8882         MOV     DPL,R0
   \   00018F   8983         MOV     DPH,R1
   \   000191   12....       LCALL   ?Subroutine13 & 0xFFFF
    646                    *pBuf++ = HI_UINT16( *pList );
   \                     ??CrossCallReturnLabel_114:
   \   000194   8882         MOV     DPL,R0
   \   000196   8983         MOV     DPH,R1
   \   000198   A3           INC     DPTR
   \   000199   12....       LCALL   ?Subroutine13 & 0xFFFF
    647                    pList++;
   \                     ??CrossCallReturnLabel_115:
   \   00019C   E8           MOV     A,R0
   \   00019D   2402         ADD     A,#0x2
   \   00019F   08           INC     R0
   \   0001A0   08           INC     R0
   \   0001A1   E9           MOV     A,R1
   \   0001A2   3400         ADDC    A,#0x0
   \   0001A4   F9           MOV     R1,A
    648                    cnt--;
   \   0001A5   85..82       MOV     DPL,?XSP + 0
   \   0001A8   85..83       MOV     DPH,?XSP + 1
   \   0001AB   E0           MOVX    A,@DPTR
   \   0001AC   14           DEC     A
   \   0001AD   F0           MOVX    @DPTR,A
    649                  }
   \                     ??zdpProcessAddrReq_23:
   \   0001AE   85..82       MOV     DPL,?XSP + 0
   \   0001B1   85..83       MOV     DPH,?XSP + 1
   \   0001B4   E0           MOVX    A,@DPTR
   \   0001B5   70D6         JNZ     ??zdpProcessAddrReq_24
    650          
    651                  osal_mem_free( (uint8 *)list );
   \   0001B7                ; Setup parameters for call to function osal_mem_free
   \   0001B7   12....       LCALL   ??osal_mem_free?relay
   \   0001BA   800B         SJMP    ??zdpProcessAddrReq_14
    652                }
    653                else
    654                {
    655                  // NumAssocDev field is only present on success.
    656                  *pBuf++ = 0;
   \                     ??zdpProcessAddrReq_17:
   \   0001BC   E4           CLR     A
   \   0001BD   85..82       MOV     DPL,?V0 + 0
   \   0001C0   85..83       MOV     DPH,?V0 + 1
   \   0001C3   F0           MOVX    @DPTR,A
    657                  len++;
   \   0001C4   75..0C       MOV     ?V0 + 2,#0xc
    658                }
    659              }
    660          
    661          #endif
    662          
    663              ZDP_TxOptions = AF_MSG_ACK_REQUEST;
   \                     ??zdpProcessAddrReq_14:
   \   0001C7   7410         MOV     A,#0x10
   \   0001C9   90....       MOV     DPTR,#ZDP_TxOptions
   \   0001CC   F0           MOVX    @DPTR,A
    664              fillAndSend( &(inMsg->TransSeq), &(inMsg->srcAddr),
    665                          (cId_t)(inMsg->clusterID | ZDO_RESPONSE_BIT), len );
   \   0001CD                ; Setup parameters for call to function fillAndSend
   \   0001CD   12....       LCALL   ?Subroutine26 & 0xFFFF
   \                     ??CrossCallReturnLabel_75:
   \   0001D0   F5..         MOV     ?V0 + 0,A
   \   0001D2   A3           INC     DPTR
   \   0001D3   E0           MOVX    A,@DPTR
   \   0001D4   4480         ORL     A,#0x80
   \   0001D6   F5..         MOV     ?V0 + 1,A
   \   0001D8   78..         MOV     R0,#?V0 + 0
   \   0001DA   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0001DD   A9..         MOV     R1,?V0 + 2
   \   0001DF   E5..         MOV     A,?V0 + 6
   \   0001E1   2402         ADD     A,#0x2
   \   0001E3   FC           MOV     R4,A
   \   0001E4   E5..         MOV     A,?V0 + 7
   \   0001E6   3400         ADDC    A,#0x0
   \   0001E8   FD           MOV     R5,A
   \   0001E9   E5..         MOV     A,?V0 + 6
   \   0001EB   240F         ADD     A,#0xf
   \   0001ED   FA           MOV     R2,A
   \   0001EE   E5..         MOV     A,?V0 + 7
   \   0001F0   3400         ADDC    A,#0x0
   \   0001F2   FB           MOV     R3,A
   \   0001F3   12....       LCALL   ?Subroutine47 & 0xFFFF
   \                     ??CrossCallReturnLabel_131:
   \   0001F6   12....       LCALL   ?DEALLOC_XSTACK8
    666              ZDP_TxOptions = AF_TX_OPTIONS_NONE;
   \   0001F9   E4           CLR     A
   \   0001FA   90....       MOV     DPTR,#ZDP_TxOptions
   \   0001FD   F0           MOVX    @DPTR,A
    667            }
    668          }
   \                     ??zdpProcessAddrReq_5:
   \   0001FE   02....       LJMP    ?Subroutine44 & 0xFFFF

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine20:
   \   000000   F0           MOVX    @DPTR,A
   \   000001   A3           INC     DPTR
   \   000002                REQUIRE ?Subroutine45
   \   000002                ; // Fall through to label ?Subroutine45

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine45:
   \   000000   8582..       MOV     ?V0 + 0,DPL
   \   000003   8583..       MOV     ?V0 + 1,DPH
   \   000006   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine13:
   \   000000   12....       LCALL   ?Subroutine35 & 0xFFFF
   \                     ??CrossCallReturnLabel_97:
   \   000003   80..         SJMP    ?Subroutine45

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine35:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   85..82       MOV     DPL,?V0 + 0
   \   000004   85..83       MOV     DPH,?V0 + 1
   \   000007   F0           MOVX    @DPTR,A
   \   000008   A3           INC     DPTR
   \   000009   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine26:
   \   000000   E5..         MOV     A,?V0 + 6
   \   000002   240C         ADD     A,#0xc
   \                     ??Subroutine26_0:
   \   000004   F582         MOV     DPL,A
   \   000006   E5..         MOV     A,?V0 + 7
   \                     ??Subroutine26_1:
   \   000008   3400         ADDC    A,#0x0
   \   00000A   F583         MOV     DPH,A
   \   00000C   E0           MOVX    A,@DPTR
   \   00000D   22           RET
    669          
    670          /*********************************************************************
    671           * @fn          ZDP_NodeDescMsg
    672           *
    673           * @brief       Builds and sends a Node Descriptor message, unicast to the
    674           *              specified device.
    675           *
    676           * @param       inMsg - incoming message
    677           * @param       nwkAddr - 16 bit network address for device
    678           * @param       pNodeDesc - pointer to the node descriptor
    679           *
    680           * @return      afStatus_t
    681           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    682          afStatus_t ZDP_NodeDescMsg( zdoIncomingMsg_t *inMsg,
   \                     ZDP_NodeDescMsg:
    683                                     uint16 nwkAddr, NodeDescriptorFormat_t *pNodeDesc )
    684          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
   \   000005   740A         MOV     A,#0xa
   \   000007   12....       LCALL   ?XSTACK_DISP0_8
   \   00000A   12....       LCALL   ?Subroutine2 & 0xFFFF
    685            byte *pBuf = ZDP_TmpBuf;
    686            byte len;
    687          
    688            len = 1 + 2 + 10;  // Status + nwkAddr + Node descriptor
    689          
    690            *pBuf++ = ZDP_SUCCESS;
    691          
    692            *pBuf++ = LO_UINT16( nwkAddr );
    693            *pBuf++ = HI_UINT16( nwkAddr );
    694          
    695            *pBuf++ = (byte)((pNodeDesc->ComplexDescAvail << 3) |
    696                               (pNodeDesc->UserDescAvail << 4) |
    697                               (pNodeDesc->LogicalType & 0x07));
   \                     ??CrossCallReturnLabel_4:
   \   00000D   541F         ANL     A,#0x1f
   \   00000F   12....       LCALL   ?Subroutine21 & 0xFFFF
    698          
    699            *pBuf++ = (byte)((pNodeDesc->FrequencyBand << 3) | (pNodeDesc->APSFlags & 0x07));
   \                     ??CrossCallReturnLabel_60:
   \   000012   12....       LCALL   ?Subroutine9 & 0xFFFF
    700            *pBuf++ = pNodeDesc->CapabilityFlags;
   \                     ??CrossCallReturnLabel_34:
   \   000015   12....       LCALL   ?Subroutine9 & 0xFFFF
    701            *pBuf++ = pNodeDesc->ManufacturerCode[0];
   \                     ??CrossCallReturnLabel_35:
   \   000018   A3           INC     DPTR
   \   000019   12....       LCALL   ?Subroutine8 & 0xFFFF
    702            *pBuf++ = pNodeDesc->ManufacturerCode[1];
   \                     ??CrossCallReturnLabel_32:
   \   00001C   12....       LCALL   ?Subroutine8 & 0xFFFF
    703            *pBuf++ = pNodeDesc->MaxBufferSize;
   \                     ??CrossCallReturnLabel_33:
   \   00001F   A3           INC     DPTR
   \   000020   12....       LCALL   ?Subroutine6 & 0xFFFF
    704            *pBuf++ = pNodeDesc->MaxTransferSize[0];
   \                     ??CrossCallReturnLabel_27:
   \   000023   12....       LCALL   ?Subroutine6 & 0xFFFF
    705            *pBuf++ = pNodeDesc->MaxTransferSize[1];
   \                     ??CrossCallReturnLabel_28:
   \   000026   A3           INC     DPTR
   \   000027   12....       LCALL   ?Subroutine12 & 0xFFFF
    706          
    707            *pBuf++ = LO_UINT16( pNodeDesc->ServerMask );
   \                     ??CrossCallReturnLabel_40:
   \   00002A   EE           MOV     A,R6
   \   00002B   2408         ADD     A,#0x8
   \   00002D   FC           MOV     R4,A
   \   00002E   EF           MOV     A,R7
   \   00002F   3400         ADDC    A,#0x0
   \   000031   FD           MOV     R5,A
   \   000032   12....       LCALL   ?Subroutine4 & 0xFFFF
    708            *pBuf++ = HI_UINT16( pNodeDesc->ServerMask );
   \                     ??CrossCallReturnLabel_13:
   \   000035   12....       LCALL   ?Subroutine16 & 0xFFFF
    709          
    710            return fillAndSend( &(inMsg->TransSeq), &(inMsg->srcAddr), Node_Desc_rsp, len );
   \                     ??CrossCallReturnLabel_51:
   \   000038                ; Setup parameters for call to function fillAndSend
   \   000038   75..02       MOV     ?V0 + 0,#0x2
   \   00003B   75..80       MOV     ?V0 + 1,#-0x80
   \   00003E   78..         MOV     R0,#?V0 + 0
   \   000040   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   000043   790D         MOV     R1,#0xd
   \   000045                REQUIRE ?Subroutine48
   \   000045                ; // Fall through to label ?Subroutine48
    711          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine48:
   \   000000   12....       LCALL   ?Subroutine27 & 0xFFFF
   \                     ??Subroutine48_0:
   \   000003   12....       LCALL   ?DEALLOC_XSTACK8
   \   000006   7F02         MOV     R7,#0x2
   \   000008   02....       LJMP    ?BANKED_LEAVE_XDATA

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine9:
   \   000000   12....       LCALL   ?Subroutine31 & 0xFFFF
   \                     ??CrossCallReturnLabel_88:
   \   000003   A3           INC     DPTR
   \   000004   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine8:
   \   000000   12....       LCALL   ?Subroutine30 & 0xFFFF
   \                     ??CrossCallReturnLabel_86:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine30:
   \   000000   12....       LCALL   ?Subroutine39 & 0xFFFF
   \                     ??CrossCallReturnLabel_105:
   \   000003   A3           INC     DPTR
   \   000004   A3           INC     DPTR
   \   000005   A3           INC     DPTR
   \   000006   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine6:
   \   000000   12....       LCALL   ?Subroutine30 & 0xFFFF
   \                     ??CrossCallReturnLabel_87:
   \   000003   A3           INC     DPTR
   \   000004   A3           INC     DPTR
   \   000005   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine4:
   \   000000   8C82         MOV     DPL,R4
   \   000002   8D83         MOV     DPH,R5
   \                     ??Subroutine4_0:
   \   000004   12....       LCALL   ??Subroutine32_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_91:
   \   000007   8C82         MOV     DPL,R4
   \   000009   8D83         MOV     DPH,R5
   \   00000B   A3           INC     DPTR
   \   00000C   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine27:
   \   000000   EA           MOV     A,R2
   \   000001   2402         ADD     A,#0x2
   \   000003   FC           MOV     R4,A
   \   000004   EB           MOV     A,R3
   \   000005   3400         ADDC    A,#0x0
   \   000007   FD           MOV     R5,A
   \   000008   EA           MOV     A,R2
   \   000009   240F         ADD     A,#0xf
   \   00000B   FA           MOV     R2,A
   \   00000C   EB           MOV     A,R3
   \   00000D   3400         ADDC    A,#0x0
   \   00000F   FB           MOV     R3,A
   \   000010   02....       LJMP    ?Subroutine47 & 0xFFFF

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine21:
   \   000000   12....       LCALL   ?Subroutine42 & 0xFFFF
   \                     ??CrossCallReturnLabel_112:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine2:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   F8           MOV     R0,A
   \   000002   A3           INC     DPTR
   \   000003   E0           MOVX    A,@DPTR
   \   000004   F9           MOV     R1,A
   \   000005   E8           MOV     A,R0
   \   000006   FE           MOV     R6,A
   \   000007   E9           MOV     A,R1
   \   000008   FF           MOV     R7,A
   \   000009   90....       MOV     DPTR,#ZDP_TmpBuf
   \   00000C   E0           MOVX    A,@DPTR
   \   00000D   F8           MOV     R0,A
   \   00000E   A3           INC     DPTR
   \   00000F   E0           MOVX    A,@DPTR
   \   000010   F9           MOV     R1,A
   \   000011   E4           CLR     A
   \   000012   8882         MOV     DPL,R0
   \   000014   8983         MOV     DPH,R1
   \   000016   F0           MOVX    @DPTR,A
   \   000017   A3           INC     DPTR
   \   000018   EC           MOV     A,R4
   \   000019   F0           MOVX    @DPTR,A
   \   00001A   A3           INC     DPTR
   \   00001B   ED           MOV     A,R5
   \   00001C   F0           MOVX    @DPTR,A
   \   00001D   A3           INC     DPTR
   \   00001E   A882         MOV     R0,DPL
   \   000020   A983         MOV     R1,DPH
   \   000022   8E82         MOV     DPL,R6
   \   000024   8F83         MOV     DPH,R7
   \   000026   E0           MOVX    A,@DPTR
   \   000027   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine12:
   \   000000   12....       LCALL   ??Subroutine32_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_93:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine31:
   \   000000   12....       LCALL   ?Subroutine39 & 0xFFFF
   \                     ??CrossCallReturnLabel_106:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine39:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   12....       LCALL   ?Subroutine42 & 0xFFFF
   \                     ??CrossCallReturnLabel_113:
   \   000004   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine42:
   \   000000   8882         MOV     DPL,R0
   \   000002   8983         MOV     DPH,R1
   \   000004   F0           MOVX    @DPTR,A
   \   000005   A3           INC     DPTR
   \   000006   08           INC     R0
   \   000007   A983         MOV     R1,DPH
   \   000009   8E82         MOV     DPL,R6
   \   00000B   8F83         MOV     DPH,R7
   \   00000D   A3           INC     DPTR
   \   00000E   22           RET
    712          
    713          /*********************************************************************
    714           * @fn          ZDP_PowerDescMsg
    715           *
    716           * @brief       Builds and sends a Power Descriptor message, unicast to the
    717           *              specified device.
    718           *
    719           * @param       inMsg - incoming message (request)
    720           * @param       nwkAddr - 16 bit network address for device
    721           * @param       pPowerDesc - pointer to the node descriptor
    722           *
    723           * @return      afStatus_t
    724           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    725          afStatus_t ZDP_PowerDescMsg( zdoIncomingMsg_t *inMsg,
   \                     ZDP_PowerDescMsg:
    726                               uint16 nwkAddr, NodePowerDescriptorFormat_t *pPowerDesc )
    727          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
   \   000005   740A         MOV     A,#0xa
   \   000007   12....       LCALL   ?XSTACK_DISP0_8
   \   00000A   12....       LCALL   ?Subroutine2 & 0xFFFF
    728            byte *pBuf = ZDP_TmpBuf;
    729            byte len = 1 + 2 + 2;  // Status + nwkAddr + Node Power descriptor.
    730          
    731            *pBuf++ = ZDP_SUCCESS;
    732          
    733            *pBuf++ = LO_UINT16( nwkAddr );
    734            *pBuf++ = HI_UINT16( nwkAddr );
    735          
    736            *pBuf++ = (byte)((pPowerDesc->AvailablePowerSources << 4)
    737                              | (pPowerDesc->PowerMode & 0x0F));
   \                     ??CrossCallReturnLabel_5:
   \   00000D   12....       LCALL   ?Subroutine21 & 0xFFFF
    738            *pBuf++ = (byte)((pPowerDesc->CurrentPowerSourceLevel << 4)
    739                              | (pPowerDesc->CurrentPowerSource & 0x0F));
   \                     ??CrossCallReturnLabel_61:
   \   000010   12....       LCALL   ?Subroutine16 & 0xFFFF
    740          
    741            return fillAndSend( &(inMsg->TransSeq), &(inMsg->srcAddr), Power_Desc_rsp, len );
   \                     ??CrossCallReturnLabel_52:
   \   000013                ; Setup parameters for call to function fillAndSend
   \   000013   75..03       MOV     ?V0 + 0,#0x3
   \   000016   75..80       MOV     ?V0 + 1,#-0x80
   \   000019   78..         MOV     R0,#?V0 + 0
   \   00001B   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   00001E   7905         MOV     R1,#0x5
   \   000020   80..         SJMP    ?Subroutine48
    742          }
    743          
    744          /*********************************************************************
    745           * @fn          ZDP_SimpleDescMsg
    746           *
    747           * @brief       Builds and sends a Simple Descriptor message, unicast to the
    748           *              specified device.
    749           *
    750           * @param       inMsg - incoming message (request)
    751           * @param       Status - message status (ZDP_SUCCESS or other)
    752           * @param       pSimpleDesc - pointer to the node descriptor
    753           *
    754           * @return      afStatus_t
    755           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    756          afStatus_t ZDP_SimpleDescMsg( zdoIncomingMsg_t *inMsg, byte Status,
   \                     ZDP_SimpleDescMsg:
    757                                        SimpleDescriptionFormat_t *pSimpleDesc )
    758          {
   \   000000   74F2         MOV     A,#-0xe
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 14
   \   000005                ; Auto size: 0
   \   000005   E9           MOV     A,R1
   \   000006   FE           MOV     R6,A
    759            uint8 *pBuf = ZDP_TmpBuf;
   \   000007   12....       LCALL   ??Subroutine5_0 & 0xFFFF
    760            uint8 i, len;
    761          
    762            if ( Status == ZDP_SUCCESS && pSimpleDesc )
   \                     ??CrossCallReturnLabel_19:
   \   00000A   EE           MOV     A,R6
   \   00000B   7031         JNZ     ??ZDP_SimpleDescMsg_0
   \   00000D   EC           MOV     A,R4
   \   00000E   7001         JNZ     ??ZDP_SimpleDescMsg_1
   \   000010   ED           MOV     A,R5
   \                     ??ZDP_SimpleDescMsg_1:
   \   000011   602B         JZ      ??ZDP_SimpleDescMsg_0
    763            {
    764              // Status + NWKAddrOfInterest + desc length + empty simple descriptor.
    765              len = 1 + 2 + 1 + 8;
    766              len += (pSimpleDesc->AppNumInClusters + pSimpleDesc->AppNumOutClusters) * sizeof ( uint16 );
   \   000013   8C82         MOV     DPL,R4
   \   000015   8D83         MOV     DPH,R5
   \   000017   A3           INC     DPTR
   \   000018   A3           INC     DPTR
   \   000019   A3           INC     DPTR
   \   00001A   A3           INC     DPTR
   \   00001B   A3           INC     DPTR
   \   00001C   A3           INC     DPTR
   \   00001D   A3           INC     DPTR
   \   00001E   A3           INC     DPTR
   \   00001F   A3           INC     DPTR
   \   000020   E0           MOVX    A,@DPTR
   \   000021   8C82         MOV     DPL,R4
   \   000023   8D83         MOV     DPH,R5
   \   000025   A3           INC     DPTR
   \   000026   A3           INC     DPTR
   \   000027   A3           INC     DPTR
   \   000028   A3           INC     DPTR
   \   000029   A3           INC     DPTR
   \   00002A   A3           INC     DPTR
   \   00002B   FF           MOV     R7,A
   \   00002C   E0           MOVX    A,@DPTR
   \   00002D   2F           ADD     A,R7
   \   00002E   C3           CLR     C
   \   00002F   33           RLC     A
   \   000030   240C         ADD     A,#0xc
   \   000032   F5..         MOV     ?V0 + 2,A
    767            }
    768            else
    769            {
    770              len = 2; // Status + desc length
    771            }
    772            if ( len >= ZDP_BUF_SZ-1 )
   \   000034   C3           CLR     C
   \   000035   944F         SUBB    A,#0x4f
   \   000037   4008         JC      ??ZDP_SimpleDescMsg_2
    773            {
    774              return afStatus_MEM_FAIL;
   \   000039   7981         MOV     R1,#-0x7f
   \   00003B   02....       LJMP    ??ZDP_SimpleDescMsg_3 & 0xFFFF
    775            }
   \                     ??ZDP_SimpleDescMsg_0:
   \   00003E   75..02       MOV     ?V0 + 2,#0x2
    776          
    777            *pBuf++ = Status;
   \                     ??ZDP_SimpleDescMsg_2:
   \   000041   EE           MOV     A,R6
   \   000042   8882         MOV     DPL,R0
   \   000044   8983         MOV     DPH,R1
   \   000046   12....       LCALL   ?Subroutine23 & 0xFFFF
    778          
    779            *pBuf++ = LO_UINT16( ZDAppNwkAddr.addr.shortAddr );
   \                     ??CrossCallReturnLabel_121:
   \   000049   90....       MOV     DPTR,#ZDAppNwkAddr
   \   00004C   12....       LCALL   ?Subroutine12 & 0xFFFF
    780            *pBuf++ = HI_UINT16( ZDAppNwkAddr.addr.shortAddr );
   \                     ??CrossCallReturnLabel_41:
   \   00004F   90....       MOV     DPTR,#(ZDAppNwkAddr + 1)
   \   000052   12....       LCALL   ?Subroutine16 & 0xFFFF
   \                     ??CrossCallReturnLabel_53:
   \   000055   A3           INC     DPTR
    781          
    782            if ( len > 2 )
   \   000056   E5..         MOV     A,?V0 + 2
   \   000058   C3           CLR     C
   \   000059   9403         SUBB    A,#0x3
   \   00005B   5003         JNC     $+5
   \   00005D   02....       LJMP    ??ZDP_SimpleDescMsg_4 & 0xFFFF
    783            {
    784              *pBuf++ = len - 4;   // Simple descriptor length
   \   000060   74FC         MOV     A,#-0x4
   \   000062   25..         ADD     A,?V0 + 2
   \   000064   F0           MOVX    @DPTR,A
   \   000065   A3           INC     DPTR
   \   000066   08           INC     R0
   \   000067   08           INC     R0
   \   000068   A983         MOV     R1,DPH
    785          
    786              *pBuf++ = pSimpleDesc->EndPoint;
   \   00006A   12....       LCALL   ?Subroutine4 & 0xFFFF
    787              *pBuf++ = LO_UINT16( pSimpleDesc->AppProfId );
   \                     ??CrossCallReturnLabel_14:
   \   00006D   AE82         MOV     R6,DPL
   \   00006F   AF83         MOV     R7,DPH
   \   000071   12....       LCALL   ?Subroutine11 & 0xFFFF
    788              *pBuf++ = HI_UINT16( pSimpleDesc->AppProfId );
   \                     ??CrossCallReturnLabel_38:
   \   000074   12....       LCALL   ?Subroutine12 & 0xFFFF
    789              *pBuf++ = LO_UINT16( pSimpleDesc->AppDeviceId );
   \                     ??CrossCallReturnLabel_42:
   \   000077   EC           MOV     A,R4
   \   000078   2403         ADD     A,#0x3
   \   00007A   12....       LCALL   ?Subroutine28 & 0xFFFF
   \                     ??CrossCallReturnLabel_83:
   \   00007D   12....       LCALL   ?Subroutine11 & 0xFFFF
    790              *pBuf++ = HI_UINT16( pSimpleDesc->AppDeviceId );
   \                     ??CrossCallReturnLabel_39:
   \   000080   12....       LCALL   ??Subroutine4_0 & 0xFFFF
    791          
    792              *pBuf++ = (byte)(pSimpleDesc->AppDevVer << 4);
   \                     ??CrossCallReturnLabel_15:
   \   000083   A3           INC     DPTR
   \   000084   A3           INC     DPTR
   \   000085   A3           INC     DPTR
   \   000086   A3           INC     DPTR
   \   000087   E0           MOVX    A,@DPTR
   \   000088   C4           SWAP    A
   \   000089   54F0         ANL     A,#0xf0
   \   00008B   8882         MOV     DPL,R0
   \   00008D   8983         MOV     DPH,R1
   \   00008F   F0           MOVX    @DPTR,A
   \   000090   A3           INC     DPTR
   \   000091   08           INC     R0
   \   000092   A983         MOV     R1,DPH
    793          
    794              *pBuf++ = pSimpleDesc->AppNumInClusters;
   \   000094   EC           MOV     A,R4
   \   000095   2406         ADD     A,#0x6
   \   000097   0E           INC     R6
   \   000098   0E           INC     R6
   \   000099   0E           INC     R6
   \   00009A   12....       LCALL   ??Subroutine28_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_84:
   \   00009D   12....       LCALL   ?Subroutine12 & 0xFFFF
    795              if ( pSimpleDesc->AppNumInClusters )
   \                     ??CrossCallReturnLabel_43:
   \   0000A0   8E82         MOV     DPL,R6
   \   0000A2   8F83         MOV     DPH,R7
   \   0000A4   E0           MOVX    A,@DPTR
   \   0000A5   6025         JZ      ??ZDP_SimpleDescMsg_5
    796              {
    797                for (i=0; i<pSimpleDesc->AppNumInClusters; ++i)
   \   0000A7   75..00       MOV     ?V0 + 3,#0x0
   \   0000AA   800E         SJMP    ??CrossCallReturnLabel_0
    798                {
    799                  *pBuf++ = LO_UINT16( pSimpleDesc->pAppInClusterList[i] );
   \                     ??ZDP_SimpleDescMsg_6:
   \   0000AC   E5..         MOV     A,?V0 + 3
   \   0000AE   C3           CLR     C
   \   0000AF   33           RLC     A
   \   0000B0   FE           MOV     R6,A
   \   0000B1   E4           CLR     A
   \   0000B2   33           RLC     A
   \   0000B3   FF           MOV     R7,A
   \   0000B4   EC           MOV     A,R4
   \   0000B5   2407         ADD     A,#0x7
   \   0000B7   12....       LCALL   ?Subroutine0 & 0xFFFF
    800                  *pBuf++ = HI_UINT16( pSimpleDesc->pAppInClusterList[i] );
    801                }
   \                     ??CrossCallReturnLabel_0:
   \   0000BA   8C82         MOV     DPL,R4
   \   0000BC   8D83         MOV     DPH,R5
   \   0000BE   A3           INC     DPTR
   \   0000BF   A3           INC     DPTR
   \   0000C0   A3           INC     DPTR
   \   0000C1   A3           INC     DPTR
   \   0000C2   A3           INC     DPTR
   \   0000C3   A3           INC     DPTR
   \   0000C4   E0           MOVX    A,@DPTR
   \   0000C5   FE           MOV     R6,A
   \   0000C6   E5..         MOV     A,?V0 + 3
   \   0000C8   C3           CLR     C
   \   0000C9   9E           SUBB    A,R6
   \   0000CA   40E0         JC      ??ZDP_SimpleDescMsg_6
    802              }
    803          
    804              *pBuf++ = pSimpleDesc->AppNumOutClusters;
   \                     ??ZDP_SimpleDescMsg_5:
   \   0000CC   EC           MOV     A,R4
   \   0000CD   2409         ADD     A,#0x9
   \   0000CF   12....       LCALL   ?Subroutine28 & 0xFFFF
   \                     ??CrossCallReturnLabel_85:
   \   0000D2   12....       LCALL   ?Subroutine7 & 0xFFFF
    805              if ( pSimpleDesc->AppNumOutClusters )
   \                     ??CrossCallReturnLabel_31:
   \   0000D5   8E82         MOV     DPL,R6
   \   0000D7   8F83         MOV     DPH,R7
   \   0000D9   E0           MOVX    A,@DPTR
   \   0000DA   602A         JZ      ??ZDP_SimpleDescMsg_7
    806              {
    807                for (i=0; i<pSimpleDesc->AppNumOutClusters; ++i)
   \   0000DC   75..00       MOV     ?V0 + 3,#0x0
   \                     ??ZDP_SimpleDescMsg_8:
   \   0000DF   8C82         MOV     DPL,R4
   \   0000E1   8D83         MOV     DPH,R5
   \   0000E3   A3           INC     DPTR
   \   0000E4   A3           INC     DPTR
   \   0000E5   A3           INC     DPTR
   \   0000E6   A3           INC     DPTR
   \   0000E7   A3           INC     DPTR
   \   0000E8   A3           INC     DPTR
   \   0000E9   A3           INC     DPTR
   \   0000EA   A3           INC     DPTR
   \   0000EB   A3           INC     DPTR
   \   0000EC   E0           MOVX    A,@DPTR
   \   0000ED   FE           MOV     R6,A
   \   0000EE   E5..         MOV     A,?V0 + 3
   \   0000F0   C3           CLR     C
   \   0000F1   9E           SUBB    A,R6
   \   0000F2   5012         JNC     ??ZDP_SimpleDescMsg_7
    808                {
    809                  *pBuf++ = LO_UINT16( pSimpleDesc->pAppOutClusterList[i] );
   \   0000F4   E5..         MOV     A,?V0 + 3
   \   0000F6   C3           CLR     C
   \   0000F7   33           RLC     A
   \   0000F8   FE           MOV     R6,A
   \   0000F9   E4           CLR     A
   \   0000FA   33           RLC     A
   \   0000FB   FF           MOV     R7,A
   \   0000FC   EC           MOV     A,R4
   \   0000FD   240A         ADD     A,#0xa
   \   0000FF   12....       LCALL   ?Subroutine0 & 0xFFFF
    810                  *pBuf++ = HI_UINT16( pSimpleDesc->pAppOutClusterList[i] );
    811                }
   \                     ??CrossCallReturnLabel_1:
   \   000102   80DB         SJMP    ??ZDP_SimpleDescMsg_8
    812              }
    813            }
    814          
    815            else
    816            {
    817              *pBuf = 0; // Description Length = 0;
   \                     ??ZDP_SimpleDescMsg_4:
   \   000104   E4           CLR     A
   \   000105   F0           MOVX    @DPTR,A
    818            }
    819          
    820            return fillAndSend( &(inMsg->TransSeq), &(inMsg->srcAddr), Simple_Desc_rsp, len );
   \                     ??ZDP_SimpleDescMsg_7:
   \   000106                ; Setup parameters for call to function fillAndSend
   \   000106   75..04       MOV     ?V0 + 0,#0x4
   \   000109   75..80       MOV     ?V0 + 1,#-0x80
   \   00010C   78..         MOV     R0,#?V0 + 0
   \   00010E   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   000111   A9..         MOV     R1,?V0 + 2
   \   000113   12....       LCALL   ?Subroutine27 & 0xFFFF
   \                     ??CrossCallReturnLabel_126:
   \   000116   12....       LCALL   ?DEALLOC_XSTACK8
   \                     ??ZDP_SimpleDescMsg_3:
   \   000119   02....       LJMP    ?Subroutine43 & 0xFFFF
    821          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine28:
   \   000000   FE           MOV     R6,A
   \                     ??Subroutine28_0:
   \   000001   ED           MOV     A,R5
   \   000002   3400         ADDC    A,#0x0
   \   000004   FF           MOV     R7,A
   \   000005   8E82         MOV     DPL,R6
   \   000007   8F83         MOV     DPH,R7
   \   000009   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine11:
   \   000000   12....       LCALL   ?Subroutine31 & 0xFFFF
   \                     ??CrossCallReturnLabel_89:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine0:
   \   000000   F5..         MOV     ?V0 + 0,A
   \   000002   ED           MOV     A,R5
   \   000003   3400         ADDC    A,#0x0
   \   000005   F5..         MOV     ?V0 + 1,A
   \   000007   85..82       MOV     DPL,?V0 + 0
   \   00000A   F583         MOV     DPH,A
   \   00000C   E0           MOVX    A,@DPTR
   \   00000D   2E           ADD     A,R6
   \   00000E   F5..         MOV     ?V0 + 4,A
   \   000010   A3           INC     DPTR
   \   000011   E0           MOVX    A,@DPTR
   \   000012   3F           ADDC    A,R7
   \   000013   85..82       MOV     DPL,?V0 + 4
   \   000016   F583         MOV     DPH,A
   \   000018   12....       LCALL   ?Subroutine34 & 0xFFFF
   \                     ??CrossCallReturnLabel_122:
   \   00001B   85..82       MOV     DPL,?V0 + 0
   \   00001E   85..83       MOV     DPH,?V0 + 1
   \   000021   E0           MOVX    A,@DPTR
   \   000022   2E           ADD     A,R6
   \   000023   F5..         MOV     ?V0 + 0,A
   \   000025   A3           INC     DPTR
   \   000026   E0           MOVX    A,@DPTR
   \   000027   3F           ADDC    A,R7
   \   000028   85..82       MOV     DPL,?V0 + 0
   \   00002B   F583         MOV     DPH,A
   \   00002D   12....       LCALL   ?Subroutine32 & 0xFFFF
   \                     ??CrossCallReturnLabel_90:
   \   000030   05..         INC     ?V0 + 3
   \   000032   22           RET
    822          
    823          /*********************************************************************
    824           * @fn          ZDP_EPRsp
    825           *
    826           * @brief       This builds and send an endpoint list. Used in
    827           *              Active_EP_rsp and Match_Desc_Rsp
    828           *              message.  This function sends unicast message to the
    829           *              requesting device.
    830           *
    831           * @param       MsgType - either Active_EP_rsp or Match_Desc_Rsp
    832           * @param       dstAddr - destination address
    833           * @param       Status - message status (ZDP_SUCCESS or other)
    834           * @param       nwkAddr - Device's short address that this response describes
    835           * @param       Count - number of endpoint/interfaces in list
    836           * @param       pEPIntfList - Array of Endpoint/Interfaces
    837           * @param       SecurityEnable - Security Options
    838           *
    839           * @return      afStatus_t
    840           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine29:
   \   000000   AA82         MOV     R2,DPL
   \   000002   AB83         MOV     R3,DPH
   \   000004                REQUIRE ?Subroutine47
   \   000004                ; // Fall through to label ?Subroutine47

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    841          afStatus_t ZDP_EPRsp( uint16 MsgType, byte TransSeq, zAddrType_t *dstAddr,
   \                     ZDP_EPRsp:
    842                                  byte Status, uint16 nwkAddr, byte Count,
    843                                  byte *pEPList,
    844                                  byte SecurityEnable )
    845          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 1
   \   000005   74FF         MOV     A,#-0x1
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   E9           MOV     A,R1
   \   00000B   85..82       MOV     DPL,?XSP + 0
   \   00000E   85..83       MOV     DPH,?XSP + 1
   \   000011   F0           MOVX    @DPTR,A
   \   000012   EA           MOV     A,R2
   \   000013   FE           MOV     R6,A
   \   000014   EB           MOV     A,R3
   \   000015   FF           MOV     R7,A
   \   000016   8C..         MOV     ?V0 + 6,R4
   \   000018   8D..         MOV     ?V0 + 7,R5
   \   00001A   7411         MOV     A,#0x11
   \   00001C   12....       LCALL   ?XSTACK_DISP0_8
   \   00001F   E0           MOVX    A,@DPTR
   \   000020   FD           MOV     R5,A
   \   000021   7412         MOV     A,#0x12
   \   000023   12....       LCALL   ?XSTACK_DISP0_8
   \   000026   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_20:
   \   000029   7414         MOV     A,#0x14
   \   00002B   12....       LCALL   ?XSTACK_DISP0_8
   \   00002E   E0           MOVX    A,@DPTR
   \   00002F   FC           MOV     R4,A
   \   000030   7415         MOV     A,#0x15
   \   000032   12....       LCALL   ?XSTACK_DISP0_8
   \   000035   12....       LCALL   ?Subroutine3 & 0xFFFF
    846            byte *pBuf = ZDP_TmpBuf;
   \                     ??CrossCallReturnLabel_9:
   \   000038   12....       LCALL   ?Subroutine15 & 0xFFFF
    847            byte len = 1 + 2 + 1;  // Status + nwkAddr + endpoint/interface count.
   \                     ??CrossCallReturnLabel_46:
   \   00003B   75..04       MOV     ?V0 + 3,#0x4
    848            byte txOptions;
    849          
    850            if ( MsgType == Match_Desc_rsp )
   \   00003E   7406         MOV     A,#0x6
   \   000040   6E           XRL     A,R6
   \   000041   7003         JNZ     ??ZDP_EPRsp_0
   \   000043   7480         MOV     A,#-0x80
   \   000045   6F           XRL     A,R7
   \                     ??ZDP_EPRsp_0:
   \   000046   7005         JNZ     ??ZDP_EPRsp_1
    851              txOptions = AF_MSG_ACK_REQUEST;
   \   000048   75..10       MOV     ?V0 + 4,#0x10
   \   00004B   8003         SJMP    ??ZDP_EPRsp_2
    852            else
    853              txOptions = 0;
   \                     ??ZDP_EPRsp_1:
   \   00004D   75..00       MOV     ?V0 + 4,#0x0
    854          
    855              *pBuf++ = Status;
   \                     ??ZDP_EPRsp_2:
   \   000050   ED           MOV     A,R5
   \   000051   8A82         MOV     DPL,R2
   \   000053   8B83         MOV     DPH,R3
   \   000055   F0           MOVX    @DPTR,A
   \   000056   A3           INC     DPTR
    856            *pBuf++ = LO_UINT16( nwkAddr );
   \   000057   E8           MOV     A,R0
   \   000058   F0           MOVX    @DPTR,A
   \   000059   A3           INC     DPTR
    857            *pBuf++ = HI_UINT16( nwkAddr );
   \   00005A   E9           MOV     A,R1
   \   00005B   F0           MOVX    @DPTR,A
   \   00005C   A3           INC     DPTR
    858          
    859            *pBuf++ = Count;   // Endpoint/Interface count
   \   00005D   EC           MOV     A,R4
   \   00005E   F0           MOVX    @DPTR,A
   \   00005F   A3           INC     DPTR
   \   000060   AA82         MOV     R2,DPL
   \   000062   AB83         MOV     R3,DPH
    860          
    861            if ( Count )
   \   000064   6017         JZ      ??ZDP_EPRsp_3
    862            {
    863              len += Count;
   \   000066   7404         MOV     A,#0x4
   \   000068   2C           ADD     A,R4
   \   000069   F5..         MOV     ?V0 + 3,A
    864              osal_memcpy( pBuf, pEPList, Count );
   \   00006B                ; Setup parameters for call to function osal_memcpy
   \   00006B   75..00       MOV     ?V0 + 2,#0x0
   \   00006E   78..         MOV     R0,#?V0 + 0
   \   000070   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   000073   7D00         MOV     R5,#0x0
   \   000075   12....       LCALL   ??osal_memcpy?relay
   \   000078   7403         MOV     A,#0x3
   \   00007A   12....       LCALL   ?DEALLOC_XSTACK8
    865            }
    866          
    867            FillAndSendTxOptions( &TransSeq, dstAddr, MsgType, len, txOptions );
   \                     ??ZDP_EPRsp_3:
   \   00007D   E5..         MOV     A,?V0 + 4
   \   00007F   90....       MOV     DPTR,#ZDP_TxOptions
   \   000082   F0           MOVX    @DPTR,A
   \   000083                ; Setup parameters for call to function fillAndSend
   \   000083   8E..         MOV     ?V0 + 0,R6
   \   000085   8F..         MOV     ?V0 + 1,R7
   \   000087   78..         MOV     R0,#?V0 + 0
   \   000089   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   00008C   A9..         MOV     R1,?V0 + 3
   \   00008E   AC..         MOV     R4,?V0 + 6
   \   000090   AD..         MOV     R5,?V0 + 7
   \   000092   7402         MOV     A,#0x2
   \   000094   12....       LCALL   ?XSTACK_DISP0_8
   \   000097   12....       LCALL   ?Subroutine29 & 0xFFFF
   \                     ??CrossCallReturnLabel_127:
   \   00009A   12....       LCALL   ?DEALLOC_XSTACK8
   \   00009D   E4           CLR     A
   \   00009E   90....       MOV     DPTR,#ZDP_TxOptions
   \   0000A1   F0           MOVX    @DPTR,A
   \   0000A2   02....       LJMP    ?Subroutine44 & 0xFFFF
    868          }
    869          
    870          #if defined ( ZDO_USERDESC_RESPONSE )
    871          /*********************************************************************
    872           * @fn          ZDP_UserDescRsp
    873           *
    874           * @brief       Build and send the User Decriptor Response.
    875           *
    876           *
    877           * @param       dstAddr - destination address
    878           * @param       nwkAddrOfInterest -
    879           * @param       userDesc -
    880           * @param       SecurityEnable - Security Options
    881           *
    882           * @return      ZStatus_t
    883           */
    884          ZStatus_t ZDP_UserDescRsp( byte TransSeq, zAddrType_t *dstAddr,
    885                          uint16 nwkAddrOfInterest, UserDescriptorFormat_t *userDesc,
    886                          byte SecurityEnable )
    887          {
    888            byte *pBuf = ZDP_TmpBuf;
    889            byte len = 1 + 2 + 1;  // Status + nwkAddr + descriptor length.
    890          
    891            len += userDesc->len;
    892          
    893            *pBuf++ = ZSUCCESS;
    894          
    895            *pBuf++ = LO_UINT16( nwkAddrOfInterest );
    896            *pBuf++ = HI_UINT16( nwkAddrOfInterest );
    897          
    898            *pBuf++ = userDesc->len;
    899            osal_memcpy( pBuf, userDesc->desc, userDesc->len );
    900          
    901            return (ZStatus_t)fillAndSend( &TransSeq, dstAddr, User_Desc_rsp, len );
    902          }
    903          #endif // ZDO_USERDESC_RESPONSE
    904          
    905          #if defined ( ZDO_SERVERDISC_RESPONSE )
    906          /*********************************************************************
    907           * @fn          ZDP_ServerDiscRsp
    908           *
    909           * @brief       Build and send the Server_Discovery_rsp response.
    910           *
    911           * @param       transID - Transaction sequence number of request.
    912           * @param       dstAddr - Network Destination Address.
    913           * @param       status - Status of response to request.
    914           * @param       aoi - Network Address of Interest of request.
    915           * @param       serverMask - Bit map of service(s) being sought.
    916           * @param       SecurityEnable - Security Options
    917           *
    918           * @return      ZStatus_t
    919           */
    920          ZStatus_t ZDP_ServerDiscRsp( byte transID, zAddrType_t *dstAddr, byte status,
    921                                     uint16 aoi, uint16 serverMask, byte SecurityEnable )
    922          {
    923            const byte len = 1  + 2;  // status + aoi + mask.
    924            byte *pBuf = ZDP_TmpBuf;
    925          
    926            *pBuf++ = status;
    927          
    928            *pBuf++ = LO_UINT16( serverMask );
    929            *pBuf++ = HI_UINT16( serverMask );
    930          
    931            return (ZStatus_t)fillAndSend( &transID, dstAddr, Server_Discovery_rsp, len );
    932          }
    933          #endif // ZDO_USERDESC_RESPONSE
    934          
    935          /*********************************************************************
    936           * @fn          ZDP_GenericRsp
    937           *
    938           * @brief       Sends a response message with only the parameter status
    939           *              byte and the addr of interest for data.
    940           *              This function sends unicast message to the
    941           *              requesting device.
    942           *
    943           * @param       dstAddr - destination address
    944           * @param       status  - generic status for response
    945           * @param       aoi     - address of interest
    946           * @param       dstAddr - destination address
    947           * @param       rspId   - response cluster ID
    948           * @param       SecurityEnable - Security Options
    949           *
    950           * @return      afStatus_t
    951           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    952          afStatus_t ZDP_GenericRsp( byte TransSeq, zAddrType_t *dstAddr,
   \                     ZDP_GenericRsp:
    953                               byte status, uint16 aoi, uint16 rspID, byte SecurityEnable )
    954          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 1
   \   000005   74FF         MOV     A,#-0x1
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   E9           MOV     A,R1
   \   00000B   85..82       MOV     DPL,?XSP + 0
   \   00000E   85..83       MOV     DPH,?XSP + 1
   \   000011   F0           MOVX    @DPTR,A
   \   000012   740B         MOV     A,#0xb
   \   000014   12....       LCALL   ?XSTACK_DISP0_8
   \   000017   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_21:
   \   00001A   740D         MOV     A,#0xd
   \   00001C   12....       LCALL   ?XSTACK_DISP0_8
   \   00001F   12....       LCALL   ?Subroutine3 & 0xFFFF
    955            uint8 len;
    956          
    957            ZDP_TmpBuf[0] = status;
   \                     ??CrossCallReturnLabel_10:
   \   000022   EC           MOV     A,R4
   \   000023   C0E0         PUSH    A
   \   000025   12....       LCALL   ?Subroutine19 & 0xFFFF
   \                     ??CrossCallReturnLabel_58:
   \   000028   D0E0         POP     A
   \   00002A   F0           MOVX    @DPTR,A
    958            ZDP_TmpBuf[1] = LO_UINT16( aoi );
   \   00002B   12....       LCALL   ?Subroutine19 & 0xFFFF
   \                     ??CrossCallReturnLabel_59:
   \   00002E   A3           INC     DPTR
   \   00002F   E8           MOV     A,R0
   \   000030   12....       LCALL   ?Subroutine17 & 0xFFFF
    959            ZDP_TmpBuf[2] = HI_UINT16( aoi );
   \                     ??CrossCallReturnLabel_54:
   \   000033   E9           MOV     A,R1
   \   000034   12....       LCALL   ?Subroutine17 & 0xFFFF
    960          
    961            // Length byte
    962            ZDP_TmpBuf[3] = 0;
   \                     ??CrossCallReturnLabel_55:
   \   000037   A3           INC     DPTR
   \   000038   E4           CLR     A
   \   000039   F0           MOVX    @DPTR,A
    963            len = 4;
    964          
    965            return fillAndSend( &TransSeq, dstAddr, rspID, len );
   \   00003A                ; Setup parameters for call to function fillAndSend
   \   00003A   78..         MOV     R0,#?V0 + 0
   \   00003C   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   00003F   7904         MOV     R1,#0x4
   \   000041   EA           MOV     A,R2
   \   000042   FC           MOV     R4,A
   \   000043   EB           MOV     A,R3
   \   000044   FD           MOV     R5,A
   \   000045   7402         MOV     A,#0x2
   \   000047   12....       LCALL   ?XSTACK_DISP0_8
   \   00004A   12....       LCALL   ?Subroutine29 & 0xFFFF
   \                     ??CrossCallReturnLabel_128:
   \   00004D   12....       LCALL   ?DEALLOC_XSTACK8
   \   000050   7401         MOV     A,#0x1
   \   000052   02....       LJMP    ??Subroutine48_0 & 0xFFFF
    966          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine19:
   \   000000   90....       MOV     DPTR,#ZDP_TmpBuf
   \   000003   E0           MOVX    A,@DPTR
   \   000004   FC           MOV     R4,A
   \   000005   A3           INC     DPTR
   \   000006   E0           MOVX    A,@DPTR
   \   000007   F583         MOV     DPH,A
   \   000009   8C82         MOV     DPL,R4
   \   00000B   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine17:
   \   000000   F0           MOVX    @DPTR,A
   \   000001   90....       MOV     DPTR,#ZDP_TmpBuf
   \   000004   12....       LCALL   ?Subroutine37 & 0xFFFF
   \                     ??CrossCallReturnLabel_102:
   \   000007   A3           INC     DPTR
   \   000008   A3           INC     DPTR
   \   000009   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine37:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   F8           MOV     R0,A
   \   000002   A3           INC     DPTR
   \   000003   E0           MOVX    A,@DPTR
   \   000004   F583         MOV     DPH,A
   \   000006   8882         MOV     DPL,R0
   \   000008   22           RET
    967          
    968          /*********************************************************************
    969           * Binding
    970           */
    971          #if defined ( ZDO_ENDDEVICEBIND_REQUEST )
    972          /*********************************************************************
    973           * @fn          ZDP_EndDeviceBindReq
    974           *
    975           * @brief       This builds and sends a End_Device_Bind_req message.
    976           *              This function sends a unicast message.
    977           *
    978           * @param       dstAddr - destination address
    979           * @param       LocalCoordinator - short address of local coordinator
    980           * @param       epIntf - Endpoint/Interface of Simple Desc
    981           * @param       ProfileID - Profile ID
    982           *
    983           *   The Input cluster list is the opposite of what you would think.
    984           *   This is the output cluster list of this device
    985           * @param       NumInClusters - number of input clusters
    986           * @param       InClusterList - input cluster ID list
    987           *
    988           *   The Output cluster list is the opposite of what you would think.
    989           *   This is the input cluster list of this device
    990           * @param       NumOutClusters - number of output clusters
    991           * @param       OutClusterList - output cluster ID list
    992           *
    993           * @param       SecurityEnable - Security Options
    994           *
    995           * @return      afStatus_t
    996           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    997          afStatus_t ZDP_EndDeviceBindReq( zAddrType_t *dstAddr,
   \                     ZDP_EndDeviceBindReq:
    998                                           uint16 LocalCoordinator,
    999                                           byte endPoint,
   1000                                           uint16 ProfileID,
   1001                                           byte NumInClusters, cId_t *InClusterList,
   1002                                           byte NumOutClusters, cId_t *OutClusterList,
   1003                                           byte SecurityEnable )
   1004          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 3
   \   000005   74FD         MOV     A,#-0x3
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   7401         MOV     A,#0x1
   \   00000C   12....       LCALL   ?XSTACK_DISP0_8
   \   00000F   EA           MOV     A,R2
   \   000010   F0           MOVX    @DPTR,A
   \   000011   A3           INC     DPTR
   \   000012   EB           MOV     A,R3
   \   000013   F0           MOVX    @DPTR,A
   \   000014   E9           MOV     A,R1
   \   000015   85..82       MOV     DPL,?XSP + 0
   \   000018   85..83       MOV     DPH,?XSP + 1
   \   00001B   F0           MOVX    @DPTR,A
   \   00001C   EC           MOV     A,R4
   \   00001D   FE           MOV     R6,A
   \   00001E   ED           MOV     A,R5
   \   00001F   FF           MOV     R7,A
   \   000020   7413         MOV     A,#0x13
   \   000022   12....       LCALL   ?XSTACK_DISP0_8
   \   000025   12....       LCALL   ?Subroutine3 & 0xFFFF
   \                     ??CrossCallReturnLabel_11:
   \   000028   7418         MOV     A,#0x18
   \   00002A   12....       LCALL   ?XSTACK_DISP0_8
   \   00002D   E0           MOVX    A,@DPTR
   \   00002E   F5..         MOV     ?V0 + 7,A
   1005            uint8 *pBuf = ZDP_TmpBuf;
   \   000030   90....       MOV     DPTR,#ZDP_TmpBuf
   \   000033   E0           MOVX    A,@DPTR
   \   000034   F5..         MOV     ?V0 + 2,A
   \   000036   A3           INC     DPTR
   \   000037   E0           MOVX    A,@DPTR
   \   000038   F5..         MOV     ?V0 + 3,A
   1006            uint8 i, len;
   1007            uint8 *ieeeAddr;
   1008          
   1009            // LocalCoordinator + SrcExtAddr + ep + ProfileID +  NumInClusters + NumOutClusters.
   1010            len = 2 + Z_EXTADDR_LEN + 1 + 2 + 1 + 1;
   1011            len += (NumInClusters + NumOutClusters) * sizeof ( uint16 );
   \   00003A   7415         MOV     A,#0x15
   \   00003C   12....       LCALL   ?XSTACK_DISP0_8
   \   00003F   E0           MOVX    A,@DPTR
   \   000040   25..         ADD     A,?V0 + 7
   \   000042   C3           CLR     C
   \   000043   33           RLC     A
   \   000044   240F         ADD     A,#0xf
   \   000046   F5..         MOV     ?V0 + 6,A
   1012          
   1013            if ( len >= ZDP_BUF_SZ-1 )
   \   000048   C3           CLR     C
   \   000049   944F         SUBB    A,#0x4f
   \   00004B   4005         JC      ??ZDP_EndDeviceBindReq_0
   1014            {
   1015              return afStatus_MEM_FAIL;
   \   00004D   7981         MOV     R1,#-0x7f
   \   00004F   02....       LJMP    ??ZDP_EndDeviceBindReq_1 & 0xFFFF
   1016            }
   1017          
   1018            if ( LocalCoordinator != NLME_GetShortAddr() )
   \                     ??ZDP_EndDeviceBindReq_0:
   \   000052                ; Setup parameters for call to function NLME_GetShortAddr
   \   000052   12....       LCALL   ??NLME_GetShortAddr?relay
   \   000055   EA           MOV     A,R2
   \   000056   6E           XRL     A,R6
   \   000057   7002         JNZ     ??ZDP_EndDeviceBindReq_2
   \   000059   EB           MOV     A,R3
   \   00005A   6F           XRL     A,R7
   \                     ??ZDP_EndDeviceBindReq_2:
   \   00005B   6005         JZ      ??ZDP_EndDeviceBindReq_3
   1019            {
   1020              return afStatus_INVALID_PARAMETER;
   \   00005D   7982         MOV     R1,#-0x7e
   \   00005F   02....       LJMP    ??ZDP_EndDeviceBindReq_1 & 0xFFFF
   1021            }
   1022          
   1023            *pBuf++ = LO_UINT16( LocalCoordinator );
   \                     ??ZDP_EndDeviceBindReq_3:
   \   000062   EE           MOV     A,R6
   \   000063   85..82       MOV     DPL,?V0 + 2
   \   000066   85..83       MOV     DPH,?V0 + 3
   \   000069   F0           MOVX    @DPTR,A
   \   00006A   A3           INC     DPTR
   1024            *pBuf++ = HI_UINT16( LocalCoordinator );
   \   00006B   EF           MOV     A,R7
   \   00006C   12....       LCALL   ?Subroutine25 & 0xFFFF
   1025          
   1026            ieeeAddr = NLME_GetExtAddr();
   1027            pBuf = osal_cpyExtAddr( pBuf, ieeeAddr );
   \                     ??CrossCallReturnLabel_66:
   \   00006F                ; Setup parameters for call to function osal_cpyExtAddr
   \   00006F                ; Setup parameters for call to function NLME_GetExtAddr
   \   00006F   12....       LCALL   ??NLME_GetExtAddr?relay
   \   000072   EA           MOV     A,R2
   \   000073   FC           MOV     R4,A
   \   000074   EB           MOV     A,R3
   \   000075   FD           MOV     R5,A
   \   000076   AA..         MOV     R2,?V0 + 2
   \   000078   AB..         MOV     R3,?V0 + 3
   \   00007A   12....       LCALL   ??osal_cpyExtAddr?relay
   1028          
   1029            *pBuf++ = endPoint;
   \   00007D   85..82       MOV     DPL,?XSP + 0
   \   000080   85..83       MOV     DPH,?XSP + 1
   \   000083   12....       LCALL   ?Subroutine36 & 0xFFFF
   \                     ??CrossCallReturnLabel_98:
   \   000086   A3           INC     DPTR
   1030          
   1031            *pBuf++ = LO_UINT16( ProfileID );   // Profile ID
   \   000087   E5..         MOV     A,?V0 + 0
   \   000089   F0           MOVX    @DPTR,A
   \   00008A   A3           INC     DPTR
   1032            *pBuf++ = HI_UINT16( ProfileID );
   \   00008B   E5..         MOV     A,?V0 + 1
   \   00008D   12....       LCALL   ?Subroutine25 & 0xFFFF
   1033          
   1034            *pBuf++ = NumInClusters; // Input cluster list
   \                     ??CrossCallReturnLabel_67:
   \   000090   7415         MOV     A,#0x15
   \   000092   12....       LCALL   ?XSTACK_DISP0_8
   \   000095   E0           MOVX    A,@DPTR
   \   000096   85..82       MOV     DPL,?V0 + 2
   \   000099   85..83       MOV     DPH,?V0 + 3
   \   00009C   12....       LCALL   ?Subroutine22 & 0xFFFF
   1035            for ( i = 0; i < NumInClusters; ++i )
   \                     ??CrossCallReturnLabel_62:
   \   00009F   800F         SJMP    ??CrossCallReturnLabel_2
   1036            {
   1037              *pBuf++ = LO_UINT16(InClusterList[i]);
   \                     ??ZDP_EndDeviceBindReq_4:
   \   0000A1   EA           MOV     A,R2
   \   0000A2   C3           CLR     C
   \   0000A3   33           RLC     A
   \   0000A4   F8           MOV     R0,A
   \   0000A5   E4           CLR     A
   \   0000A6   33           RLC     A
   \   0000A7   F9           MOV     R1,A
   \   0000A8   7416         MOV     A,#0x16
   \   0000AA   12....       LCALL   ?XSTACK_DISP0_8
   \   0000AD   12....       LCALL   ?Subroutine1 & 0xFFFF
   1038              *pBuf++ = HI_UINT16(InClusterList[i]);
   1039            }
   \                     ??CrossCallReturnLabel_2:
   \   0000B0   7415         MOV     A,#0x15
   \   0000B2   12....       LCALL   ?XSTACK_DISP0_8
   \   0000B5   E0           MOVX    A,@DPTR
   \   0000B6   FB           MOV     R3,A
   \   0000B7   EA           MOV     A,R2
   \   0000B8   C3           CLR     C
   \   0000B9   9B           SUBB    A,R3
   \   0000BA   40E5         JC      ??ZDP_EndDeviceBindReq_4
   1040          
   1041            *pBuf++ = NumOutClusters; // Output cluster list
   \   0000BC   85..82       MOV     DPL,?V0 + 2
   \   0000BF   85..83       MOV     DPH,?V0 + 3
   \   0000C2   E5..         MOV     A,?V0 + 7
   \   0000C4   12....       LCALL   ?Subroutine22 & 0xFFFF
   1042            for ( i = 0; i < NumOutClusters; ++i )
   \                     ??CrossCallReturnLabel_63:
   \   0000C7   800F         SJMP    ??CrossCallReturnLabel_3
   1043            {
   1044              *pBuf++ = LO_UINT16(OutClusterList[i]);
   \                     ??ZDP_EndDeviceBindReq_5:
   \   0000C9   EA           MOV     A,R2
   \   0000CA   C3           CLR     C
   \   0000CB   33           RLC     A
   \   0000CC   F8           MOV     R0,A
   \   0000CD   E4           CLR     A
   \   0000CE   33           RLC     A
   \   0000CF   F9           MOV     R1,A
   \   0000D0   7419         MOV     A,#0x19
   \   0000D2   12....       LCALL   ?XSTACK_DISP0_8
   \   0000D5   12....       LCALL   ?Subroutine1 & 0xFFFF
   1045              *pBuf++ = HI_UINT16(OutClusterList[i]);
   1046            }
   \                     ??CrossCallReturnLabel_3:
   \   0000D8   EA           MOV     A,R2
   \   0000D9   C3           CLR     C
   \   0000DA   95..         SUBB    A,?V0 + 7
   \   0000DC   40EB         JC      ??ZDP_EndDeviceBindReq_5
   1047          
   1048            return fillAndSend( &ZDP_TransID, dstAddr, End_Device_Bind_req, len );
   \   0000DE                ; Setup parameters for call to function fillAndSend
   \   0000DE   75..20       MOV     ?V0 + 0,#0x20
   \   0000E1   75..00       MOV     ?V0 + 1,#0x0
   \   0000E4   78..         MOV     R0,#?V0 + 0
   \   0000E6   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000E9   A9..         MOV     R1,?V0 + 6
   \   0000EB   7403         MOV     A,#0x3
   \   0000ED   12....       LCALL   ?XSTACK_DISP0_8
   \   0000F0   12....       LCALL   ?Subroutine14 & 0xFFFF
   \                     ??CrossCallReturnLabel_124:
   \   0000F3   12....       LCALL   ?DEALLOC_XSTACK8
   \                     ??ZDP_EndDeviceBindReq_1:
   \   0000F6   7403         MOV     A,#0x3
   \   0000F8   02....       LJMP    ??Subroutine44_0 & 0xFFFF
   1049          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine25:
   \   000000   12....       LCALL   ?Subroutine38 & 0xFFFF
   \                     ??CrossCallReturnLabel_104:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine38:
   \   000000   12....       LCALL   ?Subroutine41 & 0xFFFF
   \                     ??CrossCallReturnLabel_111:
   \   000003   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine22:
   \   000000   12....       LCALL   ?Subroutine38 & 0xFFFF
   \                     ??CrossCallReturnLabel_103:
   \   000003   7A00         MOV     R2,#0x0
   \   000005   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine1:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   28           ADD     A,R0
   \   000002   F8           MOV     R0,A
   \   000003   A3           INC     DPTR
   \   000004   E0           MOVX    A,@DPTR
   \   000005   39           ADDC    A,R1
   \   000006   F9           MOV     R1,A
   \   000007   8882         MOV     DPL,R0
   \   000009   8983         MOV     DPH,R1
   \   00000B   12....       LCALL   ?Subroutine33 & 0xFFFF
   \                     ??CrossCallReturnLabel_94:
   \   00000E   8882         MOV     DPL,R0
   \   000010   8983         MOV     DPH,R1
   \   000012   A3           INC     DPTR
   \   000013   12....       LCALL   ?Subroutine33 & 0xFFFF
   \                     ??CrossCallReturnLabel_95:
   \   000016   0A           INC     R2
   \   000017   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine33:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   85..82       MOV     DPL,?V0 + 2
   \   000004   85..83       MOV     DPH,?V0 + 3
   \   000007   12....       LCALL   ?Subroutine41 & 0xFFFF
   \                     ??CrossCallReturnLabel_110:
   \   00000A   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine41:
   \   000000   F0           MOVX    @DPTR,A
   \   000001   A3           INC     DPTR
   \   000002   8582..       MOV     ?V0 + 2,DPL
   \   000005   8583..       MOV     ?V0 + 3,DPH
   \   000008   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine36:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   8A82         MOV     DPL,R2
   \   000003   8B83         MOV     DPH,R3
   \   000005   F0           MOVX    @DPTR,A
   \   000006   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine14:
   \   000000   E0           MOVX    A,@DPTR
   \   000001   FC           MOV     R4,A
   \   000002   A3           INC     DPTR
   \   000003   E0           MOVX    A,@DPTR
   \   000004   FD           MOV     R5,A
   \   000005   7A..         MOV     R2,#(ZDP_TransID & 0xff)
   \   000007   7B..         MOV     R3,#((ZDP_TransID >> 8) & 0xff)
   \   000009   02....       LJMP    ?Subroutine47 & 0xFFFF
   1050          #endif // ZDO_ENDDEVICEBIND_REQUEST
   1051          
   1052          #if defined ( ZDO_BIND_UNBIND_REQUEST ) || defined ( ZDO_COORDINATOR )
   1053          /*********************************************************************
   1054           * @fn          ZDP_BindUnbindReq
   1055           *
   1056           * @brief       This builds and send a Bind_req or Unbind_req message
   1057           *              Depending on the ClusterID. This function
   1058           *              sends a unicast message to the local coordinator.
   1059           *
   1060           * @param       BindOrUnbind - either Bind_req or Unbind_req
   1061           * @param       dstAddr - destination address of the message
   1062           * @param       SourceAddr - source 64 bit address of the binding
   1063           * @param       SrcEPIntf - Source endpoint/interface
   1064           * @param       ClusterID - Binding cluster ID
   1065           * @param       DestinationAddr - destination 64 bit addr of binding
   1066           * @param       DstEPIntf - destination endpoint/interface
   1067           * @param       SecurityEnable - Security Options
   1068           *
   1069           * @return      afStatus_t
   1070           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   1071          afStatus_t ZDP_BindUnbindReq( uint16 BindOrUnbind, zAddrType_t *dstAddr,
   \                     ZDP_BindUnbindReq:
   1072                                        byte *SourceAddr, byte SrcEndPoint,
   1073                                        cId_t ClusterID,
   1074                                        zAddrType_t *destinationAddr, byte DstEndPoint,
   1075                                        byte SecurityEnable )
   1076          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 2
   \   000005   74FE         MOV     A,#-0x2
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   85..82       MOV     DPL,?XSP + 0
   \   00000D   85..83       MOV     DPH,?XSP + 1
   \   000010   EC           MOV     A,R4
   \   000011   F0           MOVX    @DPTR,A
   \   000012   A3           INC     DPTR
   \   000013   ED           MOV     A,R5
   \   000014   F0           MOVX    @DPTR,A
   \   000015   8A..         MOV     ?V0 + 2,R2
   \   000017   8B..         MOV     ?V0 + 3,R3
   \   000019   89..         MOV     ?V0 + 1,R1
   \   00001B   7412         MOV     A,#0x12
   \   00001D   12....       LCALL   ?XSTACK_DISP0_8
   \   000020   E0           MOVX    A,@DPTR
   \   000021   FC           MOV     R4,A
   \   000022   A3           INC     DPTR
   \   000023   E0           MOVX    A,@DPTR
   \   000024   FD           MOV     R5,A
   \   000025   7414         MOV     A,#0x14
   \   000027   12....       LCALL   ?XSTACK_DISP0_8
   \   00002A   E0           MOVX    A,@DPTR
   \   00002B   FE           MOV     R6,A
   \   00002C   A3           INC     DPTR
   \   00002D   E0           MOVX    A,@DPTR
   \   00002E   FF           MOV     R7,A
   \   00002F   7416         MOV     A,#0x16
   \   000031   12....       LCALL   ?XSTACK_DISP0_8
   \   000034   E0           MOVX    A,@DPTR
   \   000035   F5..         MOV     ?V0 + 6,A
   \   000037   A3           INC     DPTR
   \   000038   E0           MOVX    A,@DPTR
   \   000039   F5..         MOV     ?V0 + 7,A
   1077            uint8 *pBuf = ZDP_TmpBuf;
   \   00003B   12....       LCALL   ?Subroutine15 & 0xFFFF
   1078            byte len;
   1079          
   1080            // SourceAddr + SrcEPIntf + ClusterID +  addrMode.
   1081            len = Z_EXTADDR_LEN + 1 + sizeof( cId_t ) + sizeof( uint8 );
   \                     ??CrossCallReturnLabel_47:
   \   00003E   75..0C       MOV     ?V0 + 0,#0xc
   1082            if ( destinationAddr->addrMode == Addr64Bit )
   \   000041   85..82       MOV     DPL,?V0 + 6
   \   000044   85..83       MOV     DPH,?V0 + 7
   \   000047   A3           INC     DPTR
   \   000048   A3           INC     DPTR
   \   000049   A3           INC     DPTR
   \   00004A   A3           INC     DPTR
   \   00004B   A3           INC     DPTR
   \   00004C   A3           INC     DPTR
   \   00004D   A3           INC     DPTR
   \   00004E   A3           INC     DPTR
   \   00004F   E0           MOVX    A,@DPTR
   \   000050   6403         XRL     A,#0x3
   \   000052   7005         JNZ     ??ZDP_BindUnbindReq_0
   1083              len += Z_EXTADDR_LEN + 1;     // +1 for DstEPIntf
   \   000054   75..15       MOV     ?V0 + 0,#0x15
   \   000057   8016         SJMP    ??ZDP_BindUnbindReq_1
   1084            else if ( destinationAddr->addrMode == AddrGroup )
   \                     ??ZDP_BindUnbindReq_0:
   \   000059   85..82       MOV     DPL,?V0 + 6
   \   00005C   85..83       MOV     DPH,?V0 + 7
   \   00005F   A3           INC     DPTR
   \   000060   A3           INC     DPTR
   \   000061   A3           INC     DPTR
   \   000062   A3           INC     DPTR
   \   000063   A3           INC     DPTR
   \   000064   A3           INC     DPTR
   \   000065   A3           INC     DPTR
   \   000066   A3           INC     DPTR
   \   000067   E0           MOVX    A,@DPTR
   \   000068   6401         XRL     A,#0x1
   \   00006A   7003         JNZ     ??ZDP_BindUnbindReq_1
   1085              len += sizeof ( uint16 );
   \   00006C   75..0E       MOV     ?V0 + 0,#0xe
   1086          
   1087            pBuf = osal_cpyExtAddr( pBuf, SourceAddr );
   \                     ??ZDP_BindUnbindReq_1:
   \   00006F                ; Setup parameters for call to function osal_cpyExtAddr
   \   00006F   12....       LCALL   ??osal_cpyExtAddr?relay
   1088            *pBuf++ = SrcEndPoint;
   \   000072   8A82         MOV     DPL,R2
   \   000074   8B83         MOV     DPH,R3
   \   000076   E5..         MOV     A,?V0 + 1
   \   000078   F0           MOVX    @DPTR,A
   \   000079   A3           INC     DPTR
   1089          
   1090            *pBuf++ = LO_UINT16( ClusterID );
   \   00007A   EE           MOV     A,R6
   \   00007B   F0           MOVX    @DPTR,A
   \   00007C   A3           INC     DPTR
   1091          
   1092            *pBuf++ = HI_UINT16( ClusterID );
   \   00007D   EF           MOV     A,R7
   \   00007E   F0           MOVX    @DPTR,A
   \   00007F   A3           INC     DPTR
   \   000080   AA82         MOV     R2,DPL
   \   000082   AB83         MOV     R3,DPH
   1093            *pBuf++ = destinationAddr->addrMode;
   \   000084   E5..         MOV     A,?V0 + 6
   \   000086   2408         ADD     A,#0x8
   \   000088   F8           MOV     R0,A
   \   000089   E5..         MOV     A,?V0 + 7
   \   00008B   3400         ADDC    A,#0x0
   \   00008D   F9           MOV     R1,A
   \   00008E   8882         MOV     DPL,R0
   \   000090   8983         MOV     DPH,R1
   \   000092   12....       LCALL   ?Subroutine18 & 0xFFFF
   1094            if ( destinationAddr->addrMode == Addr64Bit )
   \                     ??CrossCallReturnLabel_56:
   \   000095   8882         MOV     DPL,R0
   \   000097   8983         MOV     DPH,R1
   \   000099   E0           MOVX    A,@DPTR
   \   00009A   6403         XRL     A,#0x3
   \   00009C   700E         JNZ     ??ZDP_BindUnbindReq_2
   1095            {
   1096              pBuf = osal_cpyExtAddr( pBuf, destinationAddr->addr.extAddr );
   \   00009E                ; Setup parameters for call to function osal_cpyExtAddr
   \   00009E   AC..         MOV     R4,?V0 + 6
   \   0000A0   AD..         MOV     R5,?V0 + 7
   \   0000A2   12....       LCALL   ??osal_cpyExtAddr?relay
   1097              *pBuf = DstEndPoint;
   \   0000A5   7418         MOV     A,#0x18
   \   0000A7   12....       LCALL   ?XSTACK_DISP0_8
   \   0000AA   8023         SJMP    ??ZDP_BindUnbindReq_3
   1098            }
   1099            else if ( destinationAddr->addrMode == AddrGroup )
   \                     ??ZDP_BindUnbindReq_2:
   \   0000AC   85..82       MOV     DPL,?V0 + 6
   \   0000AF   85..83       MOV     DPH,?V0 + 7
   \   0000B2   A3           INC     DPTR
   \   0000B3   A3           INC     DPTR
   \   0000B4   A3           INC     DPTR
   \   0000B5   A3           INC     DPTR
   \   0000B6   A3           INC     DPTR
   \   0000B7   A3           INC     DPTR
   \   0000B8   A3           INC     DPTR
   \   0000B9   A3           INC     DPTR
   \   0000BA   E0           MOVX    A,@DPTR
   \   0000BB   6401         XRL     A,#0x1
   \   0000BD   7013         JNZ     ??CrossCallReturnLabel_99
   1100            {
   1101              *pBuf++ = LO_UINT16( destinationAddr->addr.shortAddr );
   \   0000BF   85..82       MOV     DPL,?V0 + 6
   \   0000C2   85..83       MOV     DPH,?V0 + 7
   \   0000C5   12....       LCALL   ?Subroutine18 & 0xFFFF
   1102              *pBuf++ = HI_UINT16( destinationAddr->addr.shortAddr );
   \                     ??CrossCallReturnLabel_57:
   \   0000C8   85..82       MOV     DPL,?V0 + 6
   \   0000CB   85..83       MOV     DPH,?V0 + 7
   \   0000CE   A3           INC     DPTR
   \                     ??ZDP_BindUnbindReq_3:
   \   0000CF   12....       LCALL   ?Subroutine36 & 0xFFFF
   1103            }
   1104          
   1105            FillAndSendTxOptions( &ZDP_TransID, dstAddr, BindOrUnbind, len, AF_MSG_ACK_REQUEST );
   \                     ??CrossCallReturnLabel_99:
   \   0000D2   7410         MOV     A,#0x10
   \   0000D4   90....       MOV     DPTR,#ZDP_TxOptions
   \   0000D7   F0           MOVX    @DPTR,A
   \   0000D8                ; Setup parameters for call to function fillAndSend
   \   0000D8   78..         MOV     R0,#?V0 + 2
   \   0000DA   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000DD   A9..         MOV     R1,?V0 + 0
   \   0000DF   7402         MOV     A,#0x2
   \   0000E1   12....       LCALL   ?XSTACK_DISP0_8
   \   0000E4   12....       LCALL   ?Subroutine14 & 0xFFFF
   \                     ??CrossCallReturnLabel_125:
   \   0000E7   12....       LCALL   ?DEALLOC_XSTACK8
   \   0000EA   E4           CLR     A
   \   0000EB   90....       MOV     DPTR,#ZDP_TxOptions
   \   0000EE   F0           MOVX    @DPTR,A
   \   0000EF   7402         MOV     A,#0x2
   \   0000F1   80..         SJMP    ??Subroutine44_0
   1106          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine18:
   \   000000   12....       LCALL   ?Subroutine36 & 0xFFFF
   \                     ??CrossCallReturnLabel_100:
   \   000003   A3           INC     DPTR
   \   000004   0A           INC     R2
   \   000005   AB83         MOV     R3,DPH
   \   000007   22           RET
   1107          #endif // ZDO_BIND_UNBIND_REQUEST
   1108          
   1109          /*********************************************************************
   1110           * Network Management
   1111           */
   1112          
   1113          #if defined ( ZDO_MGMT_NWKDISC_REQUEST )
   1114          /*********************************************************************
   1115           * @fn          ZDP_MgmtNwkDiscReq
   1116           *
   1117           * @brief       This builds and send a Mgmt_NWK_Disc_req message. This
   1118           *              function sends a unicast message.
   1119           *
   1120           * @param       dstAddr - destination address of the message
   1121           * @param       ScanChannels - 32 bit address bit map
   1122           * @param       StartIndex - Starting index within the reporting network
   1123           *                           list
   1124           * @param       SecurityEnable - Security Options
   1125           *
   1126           * @return      afStatus_t
   1127           */
   1128          afStatus_t ZDP_MgmtNwkDiscReq( zAddrType_t *dstAddr,
   1129                                         uint32 ScanChannels,
   1130                                         byte ScanDuration,
   1131                                         byte StartIndex,
   1132                                         byte SecurityEnable )
   1133          {
   1134            byte *pBuf = ZDP_TmpBuf;
   1135            byte len = sizeof( uint32 )+1+1;  // ScanChannels + ScanDuration + StartIndex.
   1136          
   1137            *pBuf++ = BREAK_UINT32( ScanChannels, 0 );
   1138            *pBuf++ = BREAK_UINT32( ScanChannels, 1 );
   1139            *pBuf++ = BREAK_UINT32( ScanChannels, 2 );
   1140            *pBuf++ = BREAK_UINT32( ScanChannels, 3 );
   1141          
   1142            *pBuf++ = ScanDuration;
   1143            *pBuf = StartIndex;
   1144          
   1145            return fillAndSend( &ZDP_TransID, dstAddr, Mgmt_NWK_Disc_req, len );
   1146          }
   1147          #endif // ZDO_MGMT_NWKDISC_REQUEST
   1148          
   1149          #if defined ( ZDO_MGMT_JOINDIRECT_REQUEST )
   1150          /*********************************************************************
   1151           * @fn          ZDP_MgmtDirectJoinReq
   1152           *
   1153           * @brief       This builds and send a Mgmt_Direct_Join_req message. This
   1154           *              function sends a unicast message.
   1155           *
   1156           * @param       dstAddr - destination address of the message
   1157           * @param       deviceAddr - 64 bit IEEE Address
   1158           * @param       SecurityEnable - Security Options
   1159           *
   1160           * @return      afStatus_t
   1161           */
   1162          afStatus_t ZDP_MgmtDirectJoinReq( zAddrType_t *dstAddr,
   1163                                         byte *deviceAddr,
   1164                                         byte capInfo,
   1165                                         byte SecurityEnable )
   1166          {
   1167            osal_cpyExtAddr( ZDP_TmpBuf, deviceAddr );
   1168            ZDP_TmpBuf[Z_EXTADDR_LEN] = capInfo;
   1169          
   1170            return fillAndSend( &ZDP_TransID, dstAddr, Mgmt_Direct_Join_req, (Z_EXTADDR_LEN + 1) );
   1171          }
   1172          #endif // ZDO_MGMT_JOINDIRECT_REQUEST
   1173          
   1174          #if defined ( ZDO_MGMT_PERMIT_JOIN_REQUEST )
   1175          /*********************************************************************
   1176           * @fn          ZDP_MgmtPermitJoinReq
   1177           *
   1178           * @brief       This builds and send a Mgmt_Permit_Join_req message.
   1179           *
   1180           * @param       dstAddr - destination address of the message
   1181           * @param       duration - Permit duration
   1182           * @param       TcSignificance - Trust Center Significance
   1183           *
   1184           * @return      afStatus_t
   1185           */
   1186          afStatus_t ZDP_MgmtPermitJoinReq( zAddrType_t *dstAddr, byte duration,
   1187                                            byte TcSignificance, byte SecurityEnable )
   1188          {
   1189            // Build buffer
   1190            ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_DURATION] = duration;
   1191            ZDP_TmpBuf[ZDP_MGMT_PERMIT_JOIN_REQ_TC_SIG]   = TcSignificance;
   1192          
   1193            // Send the message
   1194            return fillAndSend( &ZDP_TransID, dstAddr, Mgmt_Permit_Join_req,
   1195                                ZDP_MGMT_PERMIT_JOIN_REQ_SIZE );
   1196          }
   1197          #endif // ZDO_MGMT_PERMIT_JOIN_REQUEST
   1198          
   1199          /*********************************************************************
   1200           * Network Management Responses
   1201           */
   1202          
   1203          #if defined ( ZDO_MGMT_NWKDISC_RESPONSE )
   1204          /*********************************************************************
   1205           * @fn          ZDP_MgmtNwkDiscRsp
   1206           *
   1207           * @brief       This builds and send a Mgmt_NWK_Disc_rsp message. This
   1208           *              function sends a unicast message.
   1209           *
   1210           * @param       dstAddr - destination address of the message
   1211           * @param       Status - message status (ZDP_SUCCESS or other)
   1212           * @param       NetworkCount - Total number of networks found
   1213           * @param       StartIndex - Starting index within the reporting network
   1214           *                           list
   1215           * @param       NetworkListCount - number of network lists included
   1216           *                                 in this message
   1217           * @param       NetworkList - List of network descriptors
   1218           * @param       SecurityEnable - Security Options
   1219           *
   1220           * @return      afStatus_t
   1221           */
   1222          afStatus_t ZDP_MgmtNwkDiscRsp( byte TransSeq, zAddrType_t *dstAddr,
   1223                                      byte Status,
   1224                                      byte NetworkCount,
   1225                                      byte StartIndex,
   1226                                      byte NetworkListCount,
   1227                                      networkDesc_t *NetworkList,
   1228                                      byte SecurityEnable )
   1229          {
   1230            byte *buf;
   1231            byte *pBuf;
   1232            byte len = 1+1+1+1;  // Status + NetworkCount + StartIndex + NetworkCountList.
   1233            byte idx;
   1234          
   1235            len += ((NetworkListCount - StartIndex) * ( ZDP_NETWORK_EXTENDED_DISCRIPTOR_SIZE - 2 ));
   1236          
   1237            buf = osal_mem_alloc( len+1 );
   1238            if ( buf == NULL )
   1239            {
   1240              return afStatus_MEM_FAIL;
   1241            }
   1242          
   1243            pBuf = buf+1;
   1244          
   1245            *pBuf++ = Status;
   1246            *pBuf++ = NetworkCount;
   1247            *pBuf++ = StartIndex;
   1248            *pBuf++ = NetworkListCount;
   1249          
   1250            for ( idx = StartIndex; idx < (NetworkListCount - StartIndex); idx++ )
   1251            {
   1252              osal_cpyExtAddr( pBuf, NetworkList->extendedPANID);
   1253              pBuf += Z_EXTADDR_LEN;
   1254          
   1255              *pBuf++  = NetworkList->logicalChannel;                // LogicalChannel
   1256              *pBuf    = NetworkList->stackProfile;                  // Stack profile
   1257              *pBuf++ |= (byte)(NetworkList->version << 4);          // ZigBee Version
   1258              *pBuf    = NetworkList->beaconOrder;                   // Beacon Order
   1259              *pBuf++ |= (byte)(NetworkList->superFrameOrder << 4);  // Superframe Order
   1260          
   1261              if ( NetworkList->chosenRouter != INVALID_NODE_ADDR )
   1262              {
   1263                *pBuf++ = TRUE;                         // Permit Joining
   1264              }
   1265              else
   1266              {
   1267                *pBuf++ = FALSE;
   1268              }
   1269          
   1270              NetworkList = NetworkList->nextDesc;    // Move to next list entry
   1271            }
   1272          
   1273            FillAndSendBuffer( &TransSeq, dstAddr, Mgmt_NWK_Disc_rsp, len, buf );
   1274          }
   1275          #endif // ZDO_MGMT_NWKDISC_RESPONSE
   1276          
   1277          #if defined ( ZDO_MGMT_LQI_RESPONSE ) && defined ( RTR_NWK )
   1278          /*********************************************************************
   1279           * @fn          ZDP_MgmtLqiRsp
   1280           *
   1281           * @brief       This builds and send a Mgmt_Lqi_rsp message. This
   1282           *              function sends a unicast message.
   1283           *
   1284           * @param       dstAddr - destination address of the message
   1285           * @param       Status - message status (ZDP_SUCCESS or other)
   1286           * @param       NeighborLqiEntries - Total number of entries found
   1287           * @param       StartIndex - Starting index within the reporting list
   1288           * @param       NeighborLqiCount - number of lists included
   1289           *                                 in this message
   1290           * @param       NeighborLqiList - List of NeighborLqiItems.  This list
   1291           *                is the list to be sent, not the entire list
   1292           * @param       SecurityEnable - true if secure
   1293           *
   1294           * @return      ZStatus_t
   1295           */
   1296          ZStatus_t ZDP_MgmtLqiRsp( byte TransSeq, zAddrType_t *dstAddr,
   1297                                    byte Status,
   1298                                    byte NeighborLqiEntries,
   1299                                    byte StartIndex,
   1300                                    byte NeighborLqiCount,
   1301                                    ZDP_MgmtLqiItem_t* NeighborList,
   1302                                    byte SecurityEnable )
   1303          {
   1304            ZDP_MgmtLqiItem_t* list = NeighborList;
   1305            byte *buf, *pBuf;
   1306            byte len, x;
   1307          
   1308            if ( ZSuccess != Status )
   1309            {
   1310              ZDP_TmpBuf[0] = Status;
   1311              return fillAndSend( &TransSeq, dstAddr, Mgmt_Lqi_rsp, 1 );
   1312            }
   1313          
   1314            // (Status + NeighborLqiEntries + StartIndex + NeighborLqiCount) +
   1315            //  neighbor LQI data.
   1316            len = (1 + 1 + 1 + 1) + (NeighborLqiCount * ZDP_MGMTLQI_EXTENDED_SIZE);
   1317          
   1318            buf = osal_mem_alloc( len+1 );
   1319            if ( buf == NULL )
   1320            {
   1321              return afStatus_MEM_FAIL;
   1322            }
   1323          
   1324            pBuf = buf+1;
   1325          
   1326            *pBuf++ = Status;
   1327            *pBuf++ = NeighborLqiEntries;
   1328            *pBuf++ = StartIndex;
   1329            *pBuf++ = NeighborLqiCount;
   1330          
   1331            for ( x = 0; x < NeighborLqiCount; x++ )
   1332            {
   1333              osal_cpyExtAddr( pBuf, list->extPanID);         // Extended PanID
   1334              pBuf += Z_EXTADDR_LEN;
   1335          
   1336              // EXTADDR
   1337              pBuf = osal_cpyExtAddr( pBuf, list->extAddr );
   1338          
   1339              // NWKADDR
   1340              *pBuf++ = LO_UINT16( list->nwkAddr );
   1341              *pBuf++ = HI_UINT16( list->nwkAddr );
   1342          
   1343              // DEVICETYPE
   1344              *pBuf = list->devType;
   1345          
   1346              // RXONIDLE
   1347              *pBuf |= (uint8)(list->rxOnIdle << 2);
   1348          
   1349              // RELATIONSHIP
   1350              *pBuf++ |= (uint8)(list->relation << 4);
   1351          
   1352              // PERMITJOINING
   1353              *pBuf++ = (uint8)(list->permit);
   1354          
   1355              // DEPTH
   1356              *pBuf++ = list->depth;
   1357          
   1358              // LQI
   1359              *pBuf++ = list->lqi;
   1360          
   1361              list++; // next list entry
   1362            }
   1363          
   1364            FillAndSendBuffer( &TransSeq, dstAddr, Mgmt_Lqi_rsp, len, buf );
   1365          }
   1366          #endif // ZDO_MGMT_LQI_RESPONSE && RTR_NWK
   1367          
   1368          #if defined ( ZDO_MGMT_RTG_RESPONSE )
   1369          /*********************************************************************
   1370           * @fn          ZDP_MgmtRtgRsp
   1371           *
   1372           * @brief       This builds and send a Mgmt_Rtg_rsp message. This
   1373           *              function sends a unicast message.
   1374           *
   1375           * @param       dstAddr - destination address of the message
   1376           * @param       Status - message status (ZDP_SUCCESS or other)
   1377           * @param       RoutingTableEntries - Total number of entries
   1378           * @param       StartIndex - Starting index within the reporting list
   1379           * @param       RoutingTableListCount - number of entries included
   1380           *                                      in this message
   1381           * @param       RoutingTableList - List of Routing Table entries
   1382           * @param       SecurityEnable - true to enable security for this message
   1383           *
   1384           * @return      ZStatus_t
   1385           */
   1386          ZStatus_t ZDP_MgmtRtgRsp( byte TransSeq, zAddrType_t *dstAddr,
   1387                                      byte Status,
   1388                                      byte RoutingTableEntries,
   1389                                      byte StartIndex,
   1390                                      byte RoutingListCount,
   1391                                      rtgItem_t *RoutingTableList,
   1392                                      byte SecurityEnable )
   1393          {
   1394            byte *buf;
   1395            byte *pBuf;
   1396            // Status + RoutingTableEntries + StartIndex + RoutingListCount.
   1397            byte len = 1 + 1 + 1 + 1;
   1398            byte x;
   1399          
   1400            // Add an array for Routing List data
   1401            len += (RoutingListCount * ZDP_ROUTINGENTRY_SIZE);
   1402          
   1403            buf = osal_mem_alloc( (short)(len+1) );
   1404            if ( buf == NULL )
   1405            {
   1406              return afStatus_MEM_FAIL;
   1407            }
   1408          
   1409            pBuf = buf+1;
   1410          
   1411            *pBuf++ = Status;
   1412            *pBuf++ = RoutingTableEntries;
   1413            *pBuf++ = StartIndex;
   1414            *pBuf++ = RoutingListCount;
   1415          
   1416            for ( x = 0; x < RoutingListCount; x++ )
   1417            {
   1418              *pBuf++ = LO_UINT16( RoutingTableList->dstAddress );  // Destination Address
   1419              *pBuf++ = HI_UINT16( RoutingTableList->dstAddress );
   1420              *pBuf++ = RoutingTableList->status;
   1421              *pBuf++ = LO_UINT16( RoutingTableList->nextHopAddress );  // Next hop
   1422              *pBuf++ = HI_UINT16( RoutingTableList->nextHopAddress );
   1423              RoutingTableList++;    // Move to next list entry
   1424            }
   1425          
   1426            FillAndSendBuffer( &TransSeq, dstAddr, Mgmt_Rtg_rsp, len, buf );
   1427          }
   1428          #endif // ZDO_MGMT_RTG_RESPONSE
   1429          
   1430          #if defined ( ZDO_MGMT_BIND_RESPONSE ) && defined ( REFLECTOR )
   1431          /*********************************************************************
   1432           * @fn          ZDP_MgmtBindRsp
   1433           *
   1434           * @brief       This builds and send a Mgmt_Bind_rsp message. This
   1435           *              function sends a unicast message.
   1436           *
   1437           * @param       dstAddr - destination address of the message
   1438           * @param       Status - message status (ZDP_SUCCESS or other)
   1439           * @param       BindingTableEntries - Total number of entries
   1440           * @param       StartIndex - Starting index within the reporting list
   1441           * @param       BindingTableListCount - number of entries included
   1442           *                                 in this message
   1443           * @param       BindingTableList - List of Binding Table entries
   1444           * @param       SecurityEnable - Security Options
   1445           *
   1446           * @return      ZStatus_t
   1447           */
   1448          ZStatus_t ZDP_MgmtBindRsp( byte TransSeq, zAddrType_t *dstAddr,
   1449                                      byte Status,
   1450                                      byte BindingTableEntries,
   1451                                      byte StartIndex,
   1452                                      byte BindingTableListCount,
   1453                                      apsBindingItem_t *BindingTableList,
   1454                                      byte SecurityEnable )
   1455          {
   1456            uint8 *buf;
   1457            uint8 *pBuf;
   1458            uint8 maxLen; // maxLen is the maximum packet length to allocate enough memory space
   1459            uint8 len;    // Actual length varies due to different addrMode
   1460            uint8 x;
   1461            byte extZdpBindEntrySize = ZDP_BINDINGENTRY_SIZE + 1 + 1; // One more byte for cluserID and DstAddrMode
   1462            byte shortZdpBindEntrySize = ZDP_BINDINGENTRY_SIZE + 1 + 1 + 2 - 8 - 1; // clusterID + DstAddrMode + shortAddr - ExtAddr - DstEndpoint
   1463          
   1464            // Status + BindingTableEntries + StartIndex + BindingTableListCount.
   1465            maxLen = 1 + 1 + 1 + 1;
   1466            maxLen += (BindingTableListCount * extZdpBindEntrySize );  //max length
   1467            buf = osal_mem_alloc( maxLen + 1 );  // +1 for transaction ID
   1468          
   1469            if ( buf == NULL )
   1470            {
   1471              return afStatus_MEM_FAIL;
   1472            }
   1473          
   1474            pBuf = buf+1;
   1475          
   1476            *pBuf++ = Status;
   1477            *pBuf++ = BindingTableEntries;
   1478            *pBuf++ = StartIndex;
   1479            *pBuf++ = BindingTableListCount;
   1480          
   1481            // Initial length = Status + BindingTableEntries + StartIndex + BindingTableListCount.
   1482            // length += ZDP_BINDINGENTRY_SIZE   -- Version 1.0
   1483            //           extZdpBindEntrySize     -- Version 1.1 extended address mode
   1484            //           shortZdpBindEntrySize   -- Version 1.1 group address mode
   1485          
   1486            len = 1 + 1 + 1 + 1;
   1487            for ( x = 0; x < BindingTableListCount; x++ )
   1488            {
   1489              pBuf = osal_cpyExtAddr( pBuf, BindingTableList->srcAddr );
   1490              *pBuf++ = BindingTableList->srcEP;
   1491          
   1492              // Cluster ID
   1493              *pBuf++ = LO_UINT16( BindingTableList->clusterID );
   1494              *pBuf++ = HI_UINT16( BindingTableList->clusterID );
   1495          
   1496              *pBuf++ = BindingTableList->dstAddr.addrMode;
   1497              if ( BindingTableList->dstAddr.addrMode == Addr64Bit )
   1498              {
   1499                len += extZdpBindEntrySize;
   1500                pBuf = osal_cpyExtAddr( pBuf, BindingTableList->dstAddr.addr.extAddr );
   1501                *pBuf++ = BindingTableList->dstEP;
   1502              }
   1503              else
   1504              {
   1505                len += shortZdpBindEntrySize;
   1506                *pBuf++ = LO_UINT16( BindingTableList->dstAddr.addr.shortAddr );
   1507                *pBuf++ = HI_UINT16( BindingTableList->dstAddr.addr.shortAddr );
   1508              }
   1509              BindingTableList++;    // Move to next list entry
   1510            }
   1511          
   1512            FillAndSendBuffer( &TransSeq, dstAddr, Mgmt_Bind_rsp, len, buf );
   1513          }
   1514          #endif // ZDO_MGMT_BIND_RESPONSE && REFLECTOR
   1515          
   1516          /*********************************************************************
   1517           * Functions to register for ZDO Over-the-air messages
   1518           */
   1519          
   1520          /*********************************************************************
   1521           * @fn          ZDO_RegisterForZDOMsg
   1522           *
   1523           * @brief       Call this function to register of an incoming over
   1524           *              the air ZDO message - probably a response message
   1525           *              but requests can also be received.
   1526           *              Messages are delivered to the task with ZDO_CB_MSG
   1527           *              as the message ID.
   1528           *
   1529           * @param       taskID - Where you would like the message delivered
   1530           * @param       clusterID - What message?
   1531           *
   1532           * @return      ZSuccess - successful, ZMemError if not
   1533           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   1534          ZStatus_t ZDO_RegisterForZDOMsg( uint8 taskID, uint16 clusterID )
   \                     ZDO_RegisterForZDOMsg:
   1535          {
   \   000000   74F2         MOV     A,#-0xe
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 14
   \   000005                ; Auto size: 0
   \   000005   89..         MOV     ?V0 + 2,R1
   \   000007   EA           MOV     A,R2
   \   000008   FE           MOV     R6,A
   \   000009   EB           MOV     A,R3
   \   00000A   FF           MOV     R7,A
   1536            ZDO_MsgCB_t *pList;
   1537            ZDO_MsgCB_t *pLast;
   1538            ZDO_MsgCB_t *pNew;
   1539          
   1540            // Look for duplicate
   1541            pList = zdoMsgCBs;
   \   00000B   90....       MOV     DPTR,#zdoMsgCBs
   \   00000E   8008         SJMP    ??ZDO_RegisterForZDOMsg_0
   1542            while ( pList )
   1543            {
   1544              if ( pList->taskID == taskID && pList->clusterID == clusterID )
   1545                return ( ZSuccess );
   1546              pLast = pList;
   \                     ??ZDO_RegisterForZDOMsg_1:
   \   000010   88..         MOV     ?V0 + 0,R0
   \   000012   89..         MOV     ?V0 + 1,R1
   1547              pList = (ZDO_MsgCB_t *)pList->next;
   \   000014   8882         MOV     DPL,R0
   \   000016   8983         MOV     DPH,R1
   \                     ??ZDO_RegisterForZDOMsg_0:
   \   000018   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_22:
   \   00001B   E8           MOV     A,R0
   \   00001C   7001         JNZ     ??ZDO_RegisterForZDOMsg_2
   \   00001E   E9           MOV     A,R1
   \                     ??ZDO_RegisterForZDOMsg_2:
   \   00001F   601F         JZ      ??ZDO_RegisterForZDOMsg_3
   \   000021   8882         MOV     DPL,R0
   \   000023   8983         MOV     DPH,R1
   \   000025   A3           INC     DPTR
   \   000026   A3           INC     DPTR
   \   000027   E0           MOVX    A,@DPTR
   \   000028   65..         XRL     A,?V0 + 2
   \   00002A   70E4         JNZ     ??ZDO_RegisterForZDOMsg_1
   \   00002C   8882         MOV     DPL,R0
   \   00002E   8983         MOV     DPH,R1
   \   000030   A3           INC     DPTR
   \   000031   A3           INC     DPTR
   \   000032   A3           INC     DPTR
   \   000033   E0           MOVX    A,@DPTR
   \   000034   6E           XRL     A,R6
   \   000035   7003         JNZ     ??ZDO_RegisterForZDOMsg_4
   \   000037   A3           INC     DPTR
   \   000038   E0           MOVX    A,@DPTR
   \   000039   6F           XRL     A,R7
   \                     ??ZDO_RegisterForZDOMsg_4:
   \   00003A   70D4         JNZ     ??ZDO_RegisterForZDOMsg_1
   \                     ??ZDO_RegisterForZDOMsg_5:
   \   00003C   7900         MOV     R1,#0x0
   \   00003E   8050         SJMP    ??ZDO_RegisterForZDOMsg_6
   1548            }
   1549          
   1550            // Add to the list
   1551            pNew = (ZDO_MsgCB_t *)osal_mem_alloc( sizeof ( ZDO_MsgCB_t ) );
   \                     ??ZDO_RegisterForZDOMsg_3:
   \   000040                ; Setup parameters for call to function osal_mem_alloc
   \   000040   7A05         MOV     R2,#0x5
   \   000042   7B00         MOV     R3,#0x0
   \   000044   12....       LCALL   ??osal_mem_alloc?relay
   \   000047   8A..         MOV     ?V0 + 4,R2
   \   000049   8B..         MOV     ?V0 + 5,R3
   \   00004B   A8..         MOV     R0,?V0 + 4
   \   00004D   A9..         MOV     R1,?V0 + 5
   1552            if ( pNew )
   \   00004F   E8           MOV     A,R0
   \   000050   7001         JNZ     ??ZDO_RegisterForZDOMsg_7
   \   000052   E9           MOV     A,R1
   \                     ??ZDO_RegisterForZDOMsg_7:
   \   000053   6039         JZ      ??ZDO_RegisterForZDOMsg_8
   1553            {
   1554              pNew->taskID = taskID;
   \   000055   8882         MOV     DPL,R0
   \   000057   8983         MOV     DPH,R1
   \   000059   A3           INC     DPTR
   \   00005A   A3           INC     DPTR
   \   00005B   E5..         MOV     A,?V0 + 2
   \   00005D   F0           MOVX    @DPTR,A
   1555              pNew->clusterID = clusterID;
   \   00005E   8882         MOV     DPL,R0
   \   000060   8983         MOV     DPH,R1
   \   000062   A3           INC     DPTR
   \   000063   A3           INC     DPTR
   \   000064   A3           INC     DPTR
   \   000065   EE           MOV     A,R6
   \   000066   F0           MOVX    @DPTR,A
   \   000067   A3           INC     DPTR
   \   000068   EF           MOV     A,R7
   \   000069   F0           MOVX    @DPTR,A
   1556              pNew->next = NULL;
   \   00006A   8882         MOV     DPL,R0
   \   00006C   8983         MOV     DPH,R1
   \   00006E   E4           CLR     A
   \   00006F   F0           MOVX    @DPTR,A
   \   000070   A3           INC     DPTR
   \   000071   F0           MOVX    @DPTR,A
   1557              if ( zdoMsgCBs )
   \   000072   90....       MOV     DPTR,#zdoMsgCBs
   \   000075   E0           MOVX    A,@DPTR
   \   000076   7002         JNZ     ??ZDO_RegisterForZDOMsg_9
   \   000078   A3           INC     DPTR
   \   000079   E0           MOVX    A,@DPTR
   \                     ??ZDO_RegisterForZDOMsg_9:
   \   00007A   600D         JZ      ??ZDO_RegisterForZDOMsg_10
   1558              {
   1559                pLast->next = pNew;
   \   00007C   85..82       MOV     DPL,?V0 + 0
   \   00007F   85..83       MOV     DPH,?V0 + 1
   \                     ??ZDO_RegisterForZDOMsg_11:
   \   000082   E8           MOV     A,R0
   \   000083   F0           MOVX    @DPTR,A
   \   000084   A3           INC     DPTR
   \   000085   E9           MOV     A,R1
   \   000086   F0           MOVX    @DPTR,A
   \   000087   80B3         SJMP    ??ZDO_RegisterForZDOMsg_5
   1560              }
   1561              else
   1562                zdoMsgCBs = pNew;
   \                     ??ZDO_RegisterForZDOMsg_10:
   \   000089   90....       MOV     DPTR,#zdoMsgCBs
   \   00008C   80F4         SJMP    ??ZDO_RegisterForZDOMsg_11
   1563              return ( ZSuccess );
   1564            }
   1565            else
   1566              return ( ZMemError );
   \                     ??ZDO_RegisterForZDOMsg_8:
   \   00008E   7910         MOV     R1,#0x10
   \                     ??ZDO_RegisterForZDOMsg_6:
   \   000090   02....       LJMP    ?Subroutine43 & 0xFFFF
   1567          }
   1568          
   1569          /*********************************************************************
   1570           * @fn          ZDO_RemoveRegisteredCB
   1571           *
   1572           * @brief       Call this function if you don't want to receive the
   1573           *              incoming message.
   1574           *
   1575           * @param       taskID - Where the messages are being delivered.
   1576           * @param       clusterID - What message?
   1577           *
   1578           * @return      ZSuccess - successful, ZFailure if not found
   1579           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   1580          ZStatus_t ZDO_RemoveRegisteredCB( uint8 taskID, uint16 clusterID )
   \                     ZDO_RemoveRegisteredCB:
   1581          {
   \   000000   74F7         MOV     A,#-0x9
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 9
   \   000005                ; Auto size: 0
   \   000005   E9           MOV     A,R1
   \   000006   FE           MOV     R6,A
   1582            ZDO_MsgCB_t *pList;
   1583            ZDO_MsgCB_t *pLast = NULL;
   \   000007   7C00         MOV     R4,#0x0
   \   000009   7D00         MOV     R5,#0x0
   1584          
   1585            pList = zdoMsgCBs;
   \   00000B   90....       MOV     DPTR,#zdoMsgCBs
   \   00000E   8008         SJMP    ??ZDO_RemoveRegisteredCB_0
   1586            while ( pList )
   1587            {
   1588              if ( pList->taskID == taskID && pList->clusterID == clusterID )
   1589              {
   1590                if ( pLast )
   1591                {
   1592                  // remove this one from the linked list
   1593                  pLast->next = pList->next;
   1594                }
   1595                else if ( pList->next )
   1596                {
   1597                  // remove the first one from the linked list
   1598                  zdoMsgCBs = pList->next;
   1599                }
   1600                else
   1601                {
   1602                  // remove the only item from the list
   1603                  zdoMsgCBs = (ZDO_MsgCB_t *)NULL;
   1604                }
   1605                osal_mem_free( pList );
   1606                return ( ZSuccess );
   1607              }
   1608              pLast = pList;
   \                     ??ZDO_RemoveRegisteredCB_1:
   \   000010   E8           MOV     A,R0
   \   000011   FC           MOV     R4,A
   \   000012   E9           MOV     A,R1
   \   000013   FD           MOV     R5,A
   1609              pList = pList->next;
   \   000014   8882         MOV     DPL,R0
   \   000016   8983         MOV     DPH,R1
   \                     ??ZDO_RemoveRegisteredCB_0:
   \   000018   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_23:
   \   00001B   E8           MOV     A,R0
   \   00001C   7001         JNZ     ??ZDO_RemoveRegisteredCB_2
   \   00001E   E9           MOV     A,R1
   \                     ??ZDO_RemoveRegisteredCB_2:
   \   00001F   6056         JZ      ??ZDO_RemoveRegisteredCB_3
   \   000021   8882         MOV     DPL,R0
   \   000023   8983         MOV     DPH,R1
   \   000025   A3           INC     DPTR
   \   000026   A3           INC     DPTR
   \   000027   E0           MOVX    A,@DPTR
   \   000028   6E           XRL     A,R6
   \   000029   70E5         JNZ     ??ZDO_RemoveRegisteredCB_1
   \   00002B   8882         MOV     DPL,R0
   \   00002D   8983         MOV     DPH,R1
   \   00002F   A3           INC     DPTR
   \   000030   A3           INC     DPTR
   \   000031   A3           INC     DPTR
   \   000032   E0           MOVX    A,@DPTR
   \   000033   6A           XRL     A,R2
   \   000034   7003         JNZ     ??ZDO_RemoveRegisteredCB_4
   \   000036   A3           INC     DPTR
   \   000037   E0           MOVX    A,@DPTR
   \   000038   6B           XRL     A,R3
   \                     ??ZDO_RemoveRegisteredCB_4:
   \   000039   70D5         JNZ     ??ZDO_RemoveRegisteredCB_1
   \   00003B   EC           MOV     A,R4
   \   00003C   7001         JNZ     ??ZDO_RemoveRegisteredCB_5
   \   00003E   ED           MOV     A,R5
   \                     ??ZDO_RemoveRegisteredCB_5:
   \   00003F   8882         MOV     DPL,R0
   \   000041   8983         MOV     DPH,R1
   \   000043   600D         JZ      ??ZDO_RemoveRegisteredCB_6
   \   000045   12....       LCALL   ??Subroutine15_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_48:
   \   000048   8C82         MOV     DPL,R4
   \   00004A   8D83         MOV     DPH,R5
   \                     ??ZDO_RemoveRegisteredCB_7:
   \   00004C   EA           MOV     A,R2
   \   00004D   F0           MOVX    @DPTR,A
   \   00004E   A3           INC     DPTR
   \   00004F   EB           MOV     A,R3
   \   000050   8019         SJMP    ??ZDO_RemoveRegisteredCB_8
   \                     ??ZDO_RemoveRegisteredCB_6:
   \   000052   E0           MOVX    A,@DPTR
   \   000053   7002         JNZ     ??ZDO_RemoveRegisteredCB_9
   \   000055   A3           INC     DPTR
   \   000056   E0           MOVX    A,@DPTR
   \                     ??ZDO_RemoveRegisteredCB_9:
   \   000057   600C         JZ      ??ZDO_RemoveRegisteredCB_10
   \   000059   8882         MOV     DPL,R0
   \   00005B   8983         MOV     DPH,R1
   \   00005D   12....       LCALL   ??Subroutine15_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_49:
   \   000060   90....       MOV     DPTR,#zdoMsgCBs
   \   000063   80E7         SJMP    ??ZDO_RemoveRegisteredCB_7
   \                     ??ZDO_RemoveRegisteredCB_10:
   \   000065   90....       MOV     DPTR,#zdoMsgCBs
   \   000068   E4           CLR     A
   \   000069   F0           MOVX    @DPTR,A
   \   00006A   A3           INC     DPTR
   \                     ??ZDO_RemoveRegisteredCB_8:
   \   00006B   F0           MOVX    @DPTR,A
   \   00006C                ; Setup parameters for call to function osal_mem_free
   \   00006C   E8           MOV     A,R0
   \   00006D   FA           MOV     R2,A
   \   00006E   E9           MOV     A,R1
   \   00006F   FB           MOV     R3,A
   \   000070   12....       LCALL   ??osal_mem_free?relay
   \   000073   7900         MOV     R1,#0x0
   \   000075   8002         SJMP    ??ZDO_RemoveRegisteredCB_11
   1610            }
   1611          
   1612            return ( ZFailure );
   \                     ??ZDO_RemoveRegisteredCB_3:
   \   000077   7901         MOV     R1,#0x1
   \                     ??ZDO_RemoveRegisteredCB_11:
   \   000079   7F01         MOV     R7,#0x1
   \   00007B   02....       LJMP    ?BANKED_LEAVE_XDATA
   1613          }
   1614          
   1615          /*********************************************************************
   1616           * @fn          ZDO_SendMsgCBs
   1617           *
   1618           * @brief       This function sends messages to registered tasks.
   1619           *              Local to ZDO and shouldn't be called outside of ZDO.
   1620           *
   1621           * @param       inMsg - incoming message
   1622           *
   1623           * @return      TRUE if sent to at least 1 task, FALSE if not
   1624           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   1625          uint8 ZDO_SendMsgCBs( zdoIncomingMsg_t *inMsg )
   \                     ZDO_SendMsgCBs:
   1626          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 0
   \   000005   8A..         MOV     ?V0 + 6,R2
   \   000007   8B..         MOV     ?V0 + 7,R3
   1627            uint8 ret = FALSE;
   \   000009   75..00       MOV     ?V0 + 0,#0x0
   1628            ZDO_MsgCB_t *pList = zdoMsgCBs;
   \   00000C   90....       MOV     DPTR,#zdoMsgCBs
   \   00000F   02....       LJMP    ??ZDO_SendMsgCBs_0 & 0xFFFF
   1629            while ( pList )
   1630            {
   1631              if ( pList->clusterID == inMsg->clusterID )
   \                     ??ZDO_SendMsgCBs_1:
   \   000012   85..82       MOV     DPL,?V0 + 4
   \   000015   85..83       MOV     DPH,?V0 + 5
   \   000018   A3           INC     DPTR
   \   000019   A3           INC     DPTR
   \   00001A   A3           INC     DPTR
   \   00001B   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_24:
   \   00001E   12....       LCALL   ?Subroutine26 & 0xFFFF
   \                     ??CrossCallReturnLabel_76:
   \   000021   68           XRL     A,R0
   \   000022   7003         JNZ     ??ZDO_SendMsgCBs_2
   \   000024   A3           INC     DPTR
   \   000025   E0           MOVX    A,@DPTR
   \   000026   69           XRL     A,R1
   \                     ??ZDO_SendMsgCBs_2:
   \   000027   6003         JZ      $+5
   \   000029   02....       LJMP    ??ZDO_SendMsgCBs_3 & 0xFFFF
   1632              {
   1633                zdoIncomingMsg_t *msgPtr;
   1634          
   1635                // Send the address to the task
   1636                msgPtr = (zdoIncomingMsg_t *)osal_msg_allocate( sizeof( zdoIncomingMsg_t ) + inMsg->asduLen );
   \   00002C                ; Setup parameters for call to function osal_msg_allocate
   \   00002C   E5..         MOV     A,?V0 + 6
   \   00002E   2410         ADD     A,#0x10
   \   000030   12....       LCALL   ??Subroutine26_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_77:
   \   000033   F8           MOV     R0,A
   \   000034   7413         MOV     A,#0x13
   \   000036   28           ADD     A,R0
   \   000037   FA           MOV     R2,A
   \   000038   E4           CLR     A
   \   000039   3400         ADDC    A,#0x0
   \   00003B   FB           MOV     R3,A
   \   00003C   12....       LCALL   ??osal_msg_allocate?relay
   \   00003F   8A..         MOV     ?V0 + 2,R2
   \   000041   8B..         MOV     ?V0 + 3,R3
   \   000043   AE..         MOV     R6,?V0 + 2
   \   000045   AF..         MOV     R7,?V0 + 3
   1637                if ( msgPtr )
   \   000047   EE           MOV     A,R6
   \   000048   7001         JNZ     ??ZDO_SendMsgCBs_4
   \   00004A   EF           MOV     A,R7
   \                     ??ZDO_SendMsgCBs_4:
   \   00004B   607B         JZ      ??ZDO_SendMsgCBs_3
   1638                {
   1639                  // copy struct
   1640                  osal_memcpy( msgPtr, inMsg, sizeof( zdoIncomingMsg_t ));
   \   00004D                ; Setup parameters for call to function osal_memcpy
   \   00004D   85....       MOV     ?V0 + 0,?V0 + 6
   \   000050   85....       MOV     ?V0 + 1,?V0 + 7
   \   000053   75..00       MOV     ?V0 + 2,#0x0
   \   000056   78..         MOV     R0,#?V0 + 0
   \   000058   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   00005B   7C13         MOV     R4,#0x13
   \   00005D   7D00         MOV     R5,#0x0
   \   00005F   12....       LCALL   ??osal_memcpy?relay
   \   000062   7403         MOV     A,#0x3
   \   000064   12....       LCALL   ?DEALLOC_XSTACK8
   1641          
   1642                  if ( inMsg->asduLen )
   \   000067   E5..         MOV     A,?V0 + 6
   \   000069   2410         ADD     A,#0x10
   \   00006B   12....       LCALL   ??Subroutine26_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_78:
   \   00006E   603D         JZ      ??ZDO_SendMsgCBs_5
   1643                  {
   1644                    msgPtr->asdu = (byte*)(((byte*)msgPtr) + sizeof( zdoIncomingMsg_t ));
   \   000070   EE           MOV     A,R6
   \   000071   2413         ADD     A,#0x13
   \   000073   FA           MOV     R2,A
   \   000074   EF           MOV     A,R7
   \   000075   3400         ADDC    A,#0x0
   \   000077   FB           MOV     R3,A
   \   000078   EE           MOV     A,R6
   \   000079   2411         ADD     A,#0x11
   \   00007B   F582         MOV     DPL,A
   \   00007D   EF           MOV     A,R7
   \   00007E   3400         ADDC    A,#0x0
   \   000080   F583         MOV     DPH,A
   \   000082   EA           MOV     A,R2
   \   000083   F0           MOVX    @DPTR,A
   \   000084   A3           INC     DPTR
   \   000085   EB           MOV     A,R3
   \   000086   F0           MOVX    @DPTR,A
   1645                    osal_memcpy( msgPtr->asdu, inMsg->asdu, inMsg->asduLen );
   \   000087                ; Setup parameters for call to function osal_memcpy
   \   000087   E5..         MOV     A,?V0 + 6
   \   000089   2411         ADD     A,#0x11
   \   00008B   F582         MOV     DPL,A
   \   00008D   E5..         MOV     A,?V0 + 7
   \   00008F   3400         ADDC    A,#0x0
   \   000091   F583         MOV     DPH,A
   \   000093   12....       LCALL   ?Subroutine3 & 0xFFFF
   \                     ??CrossCallReturnLabel_12:
   \   000096   78..         MOV     R0,#?V0 + 0
   \   000098   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   00009B   E5..         MOV     A,?V0 + 6
   \   00009D   2410         ADD     A,#0x10
   \   00009F   12....       LCALL   ??Subroutine26_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_79:
   \   0000A2   FC           MOV     R4,A
   \   0000A3   7D00         MOV     R5,#0x0
   \   0000A5   12....       LCALL   ??osal_memcpy?relay
   \   0000A8   7403         MOV     A,#0x3
   \   0000AA   12....       LCALL   ?DEALLOC_XSTACK8
   1646                  }
   1647          
   1648                  msgPtr->hdr.event = ZDO_CB_MSG;
   \                     ??ZDO_SendMsgCBs_5:
   \   0000AD   74D3         MOV     A,#-0x2d
   \   0000AF   8E82         MOV     DPL,R6
   \   0000B1   8F83         MOV     DPH,R7
   \   0000B3   F0           MOVX    @DPTR,A
   1649                  osal_msg_send( pList->taskID, (uint8 *)msgPtr );
   \   0000B4                ; Setup parameters for call to function osal_msg_send
   \   0000B4   EE           MOV     A,R6
   \   0000B5   FA           MOV     R2,A
   \   0000B6   EF           MOV     A,R7
   \   0000B7   FB           MOV     R3,A
   \   0000B8   85..82       MOV     DPL,?V0 + 4
   \   0000BB   85..83       MOV     DPH,?V0 + 5
   \   0000BE   A3           INC     DPTR
   \   0000BF   A3           INC     DPTR
   \   0000C0   E0           MOVX    A,@DPTR
   \   0000C1   F9           MOV     R1,A
   \   0000C2   12....       LCALL   ??osal_msg_send?relay
   1650                  ret = TRUE;
   \   0000C5   75..01       MOV     ?V0 + 0,#0x1
   1651                }
   1652              }
   1653              pList = (ZDO_MsgCB_t *)pList->next;
   \                     ??ZDO_SendMsgCBs_3:
   \   0000C8   85..82       MOV     DPL,?V0 + 4
   \   0000CB   85..83       MOV     DPH,?V0 + 5
   \                     ??ZDO_SendMsgCBs_0:
   \   0000CE   E0           MOVX    A,@DPTR
   \   0000CF   F5..         MOV     ?V0 + 4,A
   \   0000D1   A3           INC     DPTR
   \   0000D2   E0           MOVX    A,@DPTR
   \   0000D3   F5..         MOV     ?V0 + 5,A
   1654            }
   \   0000D5   E5..         MOV     A,?V0 + 4
   \   0000D7   7002         JNZ     ??ZDO_SendMsgCBs_6
   \   0000D9   E5..         MOV     A,?V0 + 5
   \                     ??ZDO_SendMsgCBs_6:
   \   0000DB   6003         JZ      $+5
   \   0000DD   02....       LJMP    ??ZDO_SendMsgCBs_1 & 0xFFFF
   1655            return ( ret );
   \   0000E0   A9..         MOV     R1,?V0 + 0
   \   0000E2   02....       LJMP    ??Subroutine44_1 & 0xFFFF
   1656          }
   1657          
   1658          /*********************************************************************
   1659           * Incoming message processor
   1660           */
   1661          
   1662          /*********************************************************************
   1663           * @fn          ZDP_IncomingData
   1664           *
   1665           * @brief       This function indicates the transfer of a data PDU (ASDU)
   1666           *              from the APS sub-layer to the ZDO.
   1667           *
   1668           * @param       pData - Incoming Message
   1669           *
   1670           * @return      none
   1671           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   1672          void ZDP_IncomingData( afIncomingMSGPacket_t *pData )
   \                     ZDP_IncomingData:
   1673          {
   \   000000   74F4         MOV     A,#-0xc
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 12
   \   000005                ; Auto size: 19
   \   000005   74ED         MOV     A,#-0x13
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   1674            uint8 x = 0;
   \   00000A   75..00       MOV     ?V0 + 0,#0x0
   1675            uint8 handled;
   1676            zdoIncomingMsg_t inMsg;
   1677          
   1678            inMsg.srcAddr.addrMode = Addr16Bit;
   \   00000D   740A         MOV     A,#0xa
   \   00000F   12....       LCALL   ?XSTACK_DISP0_8
   \   000012   7402         MOV     A,#0x2
   \   000014   12....       LCALL   ?Subroutine24 & 0xFFFF
   1679            inMsg.srcAddr.addr.shortAddr = pData->srcAddr.addr.shortAddr;
   \                     ??CrossCallReturnLabel_64:
   \   000017   A3           INC     DPTR
   \   000018   A3           INC     DPTR
   \   000019   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_25:
   \   00001C   7402         MOV     A,#0x2
   \   00001E   12....       LCALL   ?XSTACK_DISP0_8
   \   000021   E8           MOV     A,R0
   \   000022   F0           MOVX    @DPTR,A
   \   000023   A3           INC     DPTR
   \   000024   E9           MOV     A,R1
   \   000025   F0           MOVX    @DPTR,A
   1680            inMsg.wasBroadcast = pData->wasBroadcast;
   \   000026   EA           MOV     A,R2
   \   000027   240B         ADD     A,#0xb
   \   000029   F582         MOV     DPL,A
   \   00002B   EB           MOV     A,R3
   \   00002C   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_80:
   \   00002F   C0E0         PUSH    A
   \   000031   740B         MOV     A,#0xb
   \   000033   12....       LCALL   ?XSTACK_DISP0_8
   \   000036   D0E0         POP     A
   \   000038   12....       LCALL   ?Subroutine24 & 0xFFFF
   1681            inMsg.clusterID = pData->clusterId;
   \                     ??CrossCallReturnLabel_65:
   \   00003B   12....       LCALL   ??Subroutine5_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_26:
   \   00003E   740C         MOV     A,#0xc
   \   000040   12....       LCALL   ?XSTACK_DISP0_8
   \   000043   E8           MOV     A,R0
   \   000044   F0           MOVX    @DPTR,A
   \   000045   A3           INC     DPTR
   \   000046   E9           MOV     A,R1
   \   000047   F0           MOVX    @DPTR,A
   1682            inMsg.SecurityUse = pData->SecurityUse;
   \   000048   EA           MOV     A,R2
   \   000049   240D         ADD     A,#0xd
   \   00004B   F582         MOV     DPL,A
   \   00004D   EB           MOV     A,R3
   \   00004E   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_81:
   \   000051   C0E0         PUSH    A
   \   000053   740E         MOV     A,#0xe
   \   000055   12....       LCALL   ?XSTACK_DISP0_8
   \   000058   D0E0         POP     A
   \   00005A   F0           MOVX    @DPTR,A
   1683          
   1684            inMsg.asduLen = pData->cmd.DataLength-1;
   \   00005B   EA           MOV     A,R2
   \   00005C   2413         ADD     A,#0x13
   \   00005E   F582         MOV     DPL,A
   \   000060   EB           MOV     A,R3
   \   000061   12....       LCALL   ??Subroutine26_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_82:
   \   000064   14           DEC     A
   \   000065   C0E0         PUSH    A
   \   000067   7410         MOV     A,#0x10
   \   000069   12....       LCALL   ?XSTACK_DISP0_8
   \   00006C   D0E0         POP     A
   \   00006E   F0           MOVX    @DPTR,A
   1685            inMsg.asdu = pData->cmd.Data+1;
   \   00006F   EA           MOV     A,R2
   \   000070   2415         ADD     A,#0x15
   \   000072   F8           MOV     R0,A
   \   000073   EB           MOV     A,R3
   \   000074   3400         ADDC    A,#0x0
   \   000076   F9           MOV     R1,A
   \   000077   8882         MOV     DPL,R0
   \   000079   8983         MOV     DPH,R1
   \   00007B   E0           MOVX    A,@DPTR
   \   00007C   2401         ADD     A,#0x1
   \   00007E   FA           MOV     R2,A
   \   00007F   A3           INC     DPTR
   \   000080   E0           MOVX    A,@DPTR
   \   000081   3400         ADDC    A,#0x0
   \   000083   FB           MOV     R3,A
   \   000084   7411         MOV     A,#0x11
   \   000086   12....       LCALL   ?XSTACK_DISP0_8
   \   000089   EA           MOV     A,R2
   \   00008A   F0           MOVX    @DPTR,A
   \   00008B   A3           INC     DPTR
   \   00008C   EB           MOV     A,R3
   \   00008D   F0           MOVX    @DPTR,A
   1686            inMsg.TransSeq = pData->cmd.Data[0];
   \   00008E   8882         MOV     DPL,R0
   \   000090   8983         MOV     DPH,R1
   \   000092   12....       LCALL   ?Subroutine37 & 0xFFFF
   \                     ??CrossCallReturnLabel_101:
   \   000095   E0           MOVX    A,@DPTR
   \   000096   C0E0         PUSH    A
   \   000098   740F         MOV     A,#0xf
   \   00009A   12....       LCALL   ?XSTACK_DISP0_8
   \   00009D   D0E0         POP     A
   \   00009F   F0           MOVX    @DPTR,A
   1687          
   1688            handled = ZDO_SendMsgCBs( &inMsg );
   \   0000A0                ; Setup parameters for call to function ZDO_SendMsgCBs
   \   0000A0   85..82       MOV     DPL,?XSP + 0
   \   0000A3   85..83       MOV     DPH,?XSP + 1
   \   0000A6   AA82         MOV     R2,DPL
   \   0000A8   AB83         MOV     R3,DPH
   \   0000AA   12....       LCALL   ??ZDO_SendMsgCBs?relay
   \   0000AD   E9           MOV     A,R1
   \   0000AE   FA           MOV     R2,A
   \   0000AF   8002         SJMP    ??ZDP_IncomingData_0
   1689          
   1690          #if defined( MT_ZDO_FUNC )
   1691            MT_ZdoRsp( &inMsg );
   1692          #endif
   1693          
   1694            while ( zdpMsgProcs[x].clusterID != 0xFFFF )
   1695            {
   1696              if ( zdpMsgProcs[x].clusterID == inMsg.clusterID )
   1697              {
   1698                zdpMsgProcs[x].pFn( &inMsg );
   1699                return;
   1700              }
   1701              x++;
   \                     ??ZDP_IncomingData_1:
   \   0000B1   05..         INC     ?V0 + 0
   \                     ??ZDP_IncomingData_0:
   \   0000B3   85....       MOV     ?V0 + 2,?V0 + 0
   \   0000B6   75..00       MOV     ?V0 + 3,#0x0
   \   0000B9   7402         MOV     A,#0x2
   \   0000BB   78..         MOV     R0,#?V0 + 2
   \   0000BD   12....       LCALL   ?S_SHL
   \   0000C0   E5..         MOV     A,?V0 + 2
   \   0000C2   24..         ADD     A,#(zdpMsgProcs & 0xff)
   \   0000C4   F582         MOV     DPL,A
   \   0000C6   E5..         MOV     A,?V0 + 3
   \   0000C8   34..         ADDC    A,#((zdpMsgProcs >> 8) & 0xff)
   \   0000CA   F583         MOV     DPH,A
   \   0000CC   E4           CLR     A
   \   0000CD   93           MOVC    A,@A+DPTR
   \   0000CE   F8           MOV     R0,A
   \   0000CF   7401         MOV     A,#0x1
   \   0000D1   93           MOVC    A,@A+DPTR
   \   0000D2   F9           MOV     R1,A
   \   0000D3   74FF         MOV     A,#-0x1
   \   0000D5   68           XRL     A,R0
   \   0000D6   7003         JNZ     ??ZDP_IncomingData_2
   \   0000D8   74FF         MOV     A,#-0x1
   \   0000DA   69           XRL     A,R1
   \                     ??ZDP_IncomingData_2:
   \   0000DB   6045         JZ      ??ZDP_IncomingData_3
   \   0000DD   E4           CLR     A
   \   0000DE   93           MOVC    A,@A+DPTR
   \   0000DF   F8           MOV     R0,A
   \   0000E0   7401         MOV     A,#0x1
   \   0000E2   93           MOVC    A,@A+DPTR
   \   0000E3   F9           MOV     R1,A
   \   0000E4   740C         MOV     A,#0xc
   \   0000E6   12....       LCALL   ?XSTACK_DISP0_8
   \   0000E9   E0           MOVX    A,@DPTR
   \   0000EA   68           XRL     A,R0
   \   0000EB   7003         JNZ     ??ZDP_IncomingData_4
   \   0000ED   A3           INC     DPTR
   \   0000EE   E0           MOVX    A,@DPTR
   \   0000EF   69           XRL     A,R1
   \                     ??ZDP_IncomingData_4:
   \   0000F0   70BF         JNZ     ??ZDP_IncomingData_1
   \   0000F2                ; Setup parameters for indirect call
   \   0000F2   85..82       MOV     DPL,?XSP + 0
   \   0000F5   85..83       MOV     DPH,?XSP + 1
   \   0000F8   AA82         MOV     R2,DPL
   \   0000FA   AB83         MOV     R3,DPH
   \   0000FC   75..00       MOV     ?V0 + 1,#0x0
   \   0000FF   7402         MOV     A,#0x2
   \   000101   78..         MOV     R0,#?V0 + 0
   \   000103   12....       LCALL   ?S_SHL
   \   000106   E5..         MOV     A,?V0 + 0
   \   000108   24..         ADD     A,#((zdpMsgProcs + 2) & 0xff)
   \   00010A   F582         MOV     DPL,A
   \   00010C   E5..         MOV     A,?V0 + 1
   \   00010E   34..         ADDC    A,#(((zdpMsgProcs + 2) >> 8) & 0xff)
   \   000110   F583         MOV     DPH,A
   \   000112   E4           CLR     A
   \   000113   93           MOVC    A,@A+DPTR
   \   000114   C0E0         PUSH    A
   \   000116   7401         MOV     A,#0x1
   \   000118   93           MOVC    A,@A+DPTR
   \   000119   F583         MOV     DPH,A
   \   00011B   D082         POP     DPL
   \   00011D   12....       LCALL   ?CALL_IND
   \   000120   8010         SJMP    ??ZDP_IncomingData_5
   1702            }
   1703          
   1704            // Handle unhandled messages
   1705            if ( !handled )
   \                     ??ZDP_IncomingData_3:
   \   000122   EA           MOV     A,R2
   \   000123   700D         JNZ     ??ZDP_IncomingData_5
   1706              ZDApp_InMsgCB( &inMsg );
   \   000125                ; Setup parameters for call to function ZDApp_InMsgCB
   \   000125   85..82       MOV     DPL,?XSP + 0
   \   000128   85..83       MOV     DPH,?XSP + 1
   \   00012B   AA82         MOV     R2,DPL
   \   00012D   AB83         MOV     R3,DPH
   \   00012F   12....       LCALL   ??ZDApp_InMsgCB?relay
   \                     ??ZDP_IncomingData_5:
   \   000132   7413         MOV     A,#0x13
   \   000134   12....       LCALL   ?DEALLOC_XSTACK8
   \   000137   7F04         MOV     R7,#0x4
   \   000139   02....       LJMP    ?BANKED_LEAVE_XDATA
   1707          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine24:
   \   000000   F0           MOVX    @DPTR,A
   \   000001   8A82         MOV     DPL,R2
   \   000003   8B83         MOV     DPH,R3
   \   000005   A3           INC     DPTR
   \   000006   A3           INC     DPTR
   \   000007   A3           INC     DPTR
   \   000008   A3           INC     DPTR
   \   000009   22           RET

   \                                 In  segment XDATA_ID, align 1, keep-with-next
   \                     `?<Initializer for ZDP_TmpBuf>`:
   \   000000   ....         DW ZDP_Buf + 1H

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??fillAndSend?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    fillAndSend

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_SendData?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_SendData

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_MatchDescReq?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_MatchDescReq

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??zdpProcessAddrReq?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    zdpProcessAddrReq

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_NodeDescMsg?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_NodeDescMsg

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_PowerDescMsg?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_PowerDescMsg

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_SimpleDescMsg?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_SimpleDescMsg

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_EPRsp?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_EPRsp

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_GenericRsp?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_GenericRsp

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_EndDeviceBindReq?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_EndDeviceBindReq

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_BindUnbindReq?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_BindUnbindReq

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDO_RegisterForZDOMsg?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDO_RegisterForZDOMsg

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDO_RemoveRegisteredCB?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDO_RemoveRegisteredCB

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDO_SendMsgCBs?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDO_SendMsgCBs

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??ZDP_IncomingData?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    ZDP_IncomingData
   1708          
   1709          /*********************************************************************
   1710          *********************************************************************/
   1711          

   Maximum stack usage in bytes:

     Function               ISTACK PSTACK XSTACK
     --------               ------ ------ ------
     ZDO_RegisterForZDOMsg      1      0     14
       -> osal_mem_alloc        0      0     28
     ZDO_RemoveRegisteredCB     0      0      9
       -> osal_mem_free         0      0     18
     ZDO_SendMsgCBs             1      0     50
       -> osal_msg_allocate     0      0     32
       -> osal_memcpy           0      0     38
       -> osal_memcpy           0      0     38
       -> osal_msg_send         0      0     32
     ZDP_BindUnbindReq          1      0     28
       -> osal_cpyExtAddr       0      0     36
       -> osal_cpyExtAddr       0      0     36
       -> fillAndSend           0      0     40
     ZDP_EPRsp                  1      0     27
       -> osal_memcpy           0      0     40
       -> fillAndSend           0      0     38
     ZDP_EndDeviceBindReq       1      0     30
       -> NLME_GetShortAddr     0      0     38
       -> NLME_GetExtAddr       0      0     38
       -> osal_cpyExtAddr       0      0     38
       -> fillAndSend           0      0     42
     ZDP_GenericRsp             1      0     17
       -> fillAndSend           0      0     26
     ZDP_IncomingData           1      0     31
       -> ZDO_SendMsgCBs        0      0     62
       -> ZDApp_InMsgCB         0      0     62
     ZDP_MatchDescReq           1      0     26
       -> fillAndSend           0      0     36
     ZDP_NodeDescMsg            1      0     14
       -> fillAndSend           0      0     24
     ZDP_PowerDescMsg           1      0     14
       -> fillAndSend           0      0     24
     ZDP_SendData               1      0     21
       -> fillAndSend           0      0     32
     ZDP_SimpleDescMsg          1      0     16
       -> fillAndSend           0      0     32
     fillAndSend                1      0     49
       -> AF_DataRequest        0      0     56
     zdpProcessAddrReq          1      0     19
       -> osal_ExtAddrEqual     0      0     34
       -> osal_cpyExtAddr       0      0     34
       -> AssocMakeList         0      0     34
       -> osal_mem_free         0      0     34
       -> fillAndSend           0      0     38


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     ZDP_AF_ENDPOINT                   1
     ZDP_TransID                       1
     ZDP_Buf                          80
     ZDP_TmpBuf                        2
     ZDP_TxOptions                     1
     zdoMsgCBs                         2
     zdpMsgProcs                      32
     fillAndSend                     179
     ?Subroutine15                     9
     ZDP_SendData                    111
     ?Subroutine43                     5
     ?Subroutine47                     6
     ?Subroutine16                     4
     ?Subroutine40                     7
     ?Subroutine3                      8
     ?Subroutine5                     12
     ZDP_MatchDescReq                201
     ?Subroutine10                     9
     ?Subroutine32                     9
     ?Subroutine23                     1
     ?Subroutine46                     6
     ?Subroutine7                      4
     ?Subroutine34                     5
     ?Subroutine44                    10
     zdpProcessAddrReq               513
     ?Subroutine20                     2
     ?Subroutine45                     7
     ?Subroutine13                     5
     ?Subroutine35                    10
     ?Subroutine26                    14
     ZDP_NodeDescMsg                  69
     ?Subroutine48                    11
     ?Subroutine9                      5
     ?Subroutine8                      4
     ?Subroutine30                     7
     ?Subroutine6                      6
     ?Subroutine4                     13
     ?Subroutine27                    19
     ?Subroutine21                     4
     ?Subroutine2                     40
     ?Subroutine12                     4
     ?Subroutine31                     4
     ?Subroutine39                     5
     ?Subroutine42                    15
     ZDP_PowerDescMsg                 34
     ZDP_SimpleDescMsg               284
     ?Subroutine28                    10
     ?Subroutine11                     4
     ?Subroutine0                     51
     ?Subroutine29                     4
     ZDP_EPRsp                       165
     ZDP_GenericRsp                   85
     ?Subroutine19                    12
     ?Subroutine17                    10
     ?Subroutine37                     9
     ZDP_EndDeviceBindReq            251
     ?Subroutine25                     4
     ?Subroutine38                     4
     ?Subroutine22                     6
     ?Subroutine1                     24
     ?Subroutine33                    11
     ?Subroutine41                     9
     ?Subroutine36                     7
     ?Subroutine14                    12
     ZDP_BindUnbindReq               243
     ?Subroutine18                     8
     ZDO_RegisterForZDOMsg           147
     ZDO_RemoveRegisteredCB          126
     ZDO_SendMsgCBs                  229
     ZDP_IncomingData                316
     ?Subroutine24                    10
     ?<Initializer for ZDP_TmpBuf>     2
     ??fillAndSend?relay               6
     ??ZDP_SendData?relay              6
     ??ZDP_MatchDescReq?relay          6
     ??zdpProcessAddrReq?relay         6
     ??ZDP_NodeDescMsg?relay           6
     ??ZDP_PowerDescMsg?relay          6
     ??ZDP_SimpleDescMsg?relay         6
     ??ZDP_EPRsp?relay                 6
     ??ZDP_GenericRsp?relay            6
     ??ZDP_EndDeviceBindReq?relay      6
     ??ZDP_BindUnbindReq?relay         6
     ??ZDO_RegisterForZDOMsg?relay     6
     ??ZDO_RemoveRegisteredCB?relay    6
     ??ZDO_SendMsgCBs?relay            6
     ??ZDP_IncomingData?relay          6

 
 3 418 bytes in segment BANKED_CODE
    90 bytes in segment BANK_RELAYS
    33 bytes in segment CODE_C
     2 bytes in segment XDATA_I
     2 bytes in segment XDATA_ID
    84 bytes in segment XDATA_Z
 
 3 543 bytes of CODE  memory
    86 bytes of XDATA memory

Errors: none
Warnings: none
