###############################################################################
#                                                                             #
# IAR 8051 C/C++ Compiler V7.30B/W32                    13/May/2010  22:05:38 #
# 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\Projects\z #
#                          stack\Samples\Location\Source\LocDongle.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\Projects\zstack\Sam #
#                          ples\Location\Source\LocDongle.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\Loc #
#                          Dongle.lst                                         #
#    Object file        =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\CC2430DB\LocDongle\Obj\LocD #
#                          ongle.r51                                          #
#                                                                             #
#                                                                             #
###############################################################################

C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Samples\Location\Source\LocDongle.c
      1          /**************************************************************************************************
      2            Filename:       LocDongle.c
      3            Revised:        $Date: 2007-10-27 17:16:54 -0700 (Sat, 27 Oct 2007) $
      4            Revision:       $Revision: 15793 $
      5          
      6            Description:    This application resides in a dongle and enables a PC GUI or
      7                            other application to send and recieve OTA location messages.
      8          
      9          
     10            Copyright 2007 Texas Instruments Incorporated. All rights reserved.
     11          
     12            IMPORTANT: Your use of this Software is limited to those specific rights
     13            granted under the terms of a software license agreement between the user
     14            who downloaded the software, his/her employer (which must be your employer)
     15            and Texas Instruments Incorporated (the "License").  You may not use this
     16            Software unless you agree to abide by the terms of the License. The License
     17            limits your use, and you acknowledge, that the Software may not be modified,
     18            copied or distributed unless embedded on a Texas Instruments microcontroller
     19            or used solely and exclusively in conjunction with a Texas Instruments radio
     20            frequency transceiver, which is integrated into your product.  Other than for
     21            the foregoing purpose, you may not use, reproduce, copy, prepare derivative
     22            works of, modify, distribute, perform, display or sell this Software and/or
     23            its documentation for any purpose.
     24          
     25            YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
     26            PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
     27            INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
     28            NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
     29            TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
     30            NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
     31            LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
     32            INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
     33            OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
     34            OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
     35            (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
     36          
     37            Should you have any questions regarding your right to use this Software,
     38            contact Texas Instruments Incorporated at www.TI.com.
     39          **************************************************************************************************/
     40          
     41          /*********************************************************************
     42           * INCLUDES
     43           */
     44          #include "OSAL.h"
     45          #include "MTEL.h"
     46          #include "AF.h"
     47          #include "ZDApp.h"
     48          
     49          #include "OnBoard.h"
     50          #include "hal_key.h"
     51          #if defined ( LCD_SUPPORTED )
     52          #include "hal_lcd.h"
     53          #endif
     54          
     55          #include "LocationProfile.h"
     56          #include "LocDongle.h"
     57          
     58          #if !defined ( MT_TASK )
     59            #error      // No need for this module if MT_TASK isn't defined
     60          #endif
     61          
     62          /*********************************************************************
     63           * MACROS
     64           */
     65          
     66          /*********************************************************************
     67           * CONSTANTS
     68           */
     69          
     70          //#define ZBIT  //ggg
     71           // #define DONGLE_TIMER_EVT  0x0001
     72          
     73          #define LOCDONGLE_TX_OPTIONS          AF_MSG_ACK_REQUEST
     74          
     75          #if defined ( ZBIT )
     76            #define DONGLE_TIMER_DLY  1000
     77          #endif
     78          
     79          

   \                                 In  segment XDATA_I, align 1, keep-with-next
     80          static const cId_t LocDongle_InputClusterList[] =
   \                     LocDongle_InputClusterList:
   \   000000                DS 8
   \   000008                REQUIRE `?<Initializer for LocDongle_InputClusterList>`
   \   000008                REQUIRE __INIT_XDATA_I
     81          {
     82            LOCATION_XY_RSSI_RESPONSE,
     83            LOCATION_BLINDNODE_FIND_RESPONSE,
     84            LOCATION_BLINDNODE_CONFIG,
     85            LOCATION_REFNODE_CONFIG
     86          };
     87          

   \                                 In  segment XDATA_I, align 1, keep-with-next
     88          static const cId_t LocDongle_OutputClusterList[] =
   \                     LocDongle_OutputClusterList:
   \   000000                DS 12
   \   00000C                REQUIRE `?<Initializer for LocDongle_OutputClusterList>`
   \   00000C                REQUIRE __INIT_XDATA_I
     89          {
     90            LOCATION_XY_RSSI_REQUEST,
     91            LOCATION_BLINDNODE_FIND_REQUEST,
     92            LOCATION_REFNODE_CONFIG,
     93            LOCATION_BLINDNODE_CONFIG,
     94            LOCATION_REFNODE_REQUEST_CONFIG,
     95            LOCATION_BLINDNODE_REQUEST_CONFIG
     96          };
     97          

   \                                 In  segment XDATA_I, align 1, keep-with-next
     98          static const SimpleDescriptionFormat_t LocDongle_SimpleDesc =
   \                     LocDongle_SimpleDesc:
   \   000000                DS 12
   \   00000C                REQUIRE `?<Initializer for LocDongle_SimpleDesc>`
   \   00000C                REQUIRE __INIT_XDATA_I
     99          {
    100            LOCATION_DONGLE_ENDPOINT,
    101            LOCATION_PROFID,
    102          
    103            LOCATION_DONGLE_DEVICEID,
    104          
    105            LOCATION_DEVICE_VERSION,
    106            LOCATION_FLAGS,
    107          
    108            sizeof(LocDongle_InputClusterList),
    109            (cId_t *)LocDongle_InputClusterList,
    110          
    111            sizeof(LocDongle_OutputClusterList),
    112            (cId_t *)LocDongle_OutputClusterList
    113          };
    114          

   \                                 In  segment XDATA_I, align 1, keep-with-next
    115          static const endPointDesc_t epDesc =
   \                     epDesc:
   \   000000                DS 6
   \   000006                REQUIRE `?<Initializer for epDesc>`
   \   000006                REQUIRE __INIT_XDATA_I
    116          {
    117            LOCATION_DONGLE_ENDPOINT,
    118            &LocDongle_TaskID,
    119            (SimpleDescriptionFormat_t *)&LocDongle_SimpleDesc,
    120            noLatencyReqs
    121          };
    122          
    123          /*********************************************************************
    124           * TYPEDEFS
    125           */
    126          
    127          #if defined ( ZBIT )
    128            typedef struct
    129            {
    130              uint16 addr;
    131              uint8  ep;
    132            } Node_t;
    133          #endif
    134          
    135          /*********************************************************************
    136           * GLOBAL VARIABLES
    137           */
    138          

   \                                 In  segment XDATA_Z, align 1, keep-with-next
    139          uint8 LocDongle_TaskID;
   \                     LocDongle_TaskID:
   \   000000                DS 1
   \   000001                REQUIRE __INIT_XDATA_Z
    140          
    141          /*********************************************************************
    142           * LOCAL VARIABLES
    143           */
    144          

   \                                 In  segment XDATA_Z, align 1, keep-with-next
    145          uint8 LocDongle_TransID;  // This is the unique message ID (counter)
   \                     LocDongle_TransID:
   \   000000                DS 1
   \   000001                REQUIRE __INIT_XDATA_Z
    146          
    147          #if defined ( ZBIT )
    148            static Node_t blindNodes[1];
    149          #endif
    150          
    151          /*********************************************************************
    152           * LOCAL FUNCTIONS
    153           */
    154          
    155          static void LocDongle_ProcessMSGCmd( afIncomingMSGPacket_t *pckt );
    156          static void LocDongle_MTMsg( uint8 len, uint8 *msg );
    157          
    158          #if defined ( ZBIT )
    159            static void processTimerEvt( void );
    160          #endif
    161          
    162          /*********************************************************************
    163           * @fn      LocDongle_Init
    164           *
    165           * @brief   Initialization function for the Generic App Task.
    166           *          This is called during initialization and should contain
    167           *          any application specific initialization (ie. hardware
    168           *          initialization/setup, table initialization, power up
    169           *          notificaiton ... ).
    170           *
    171           * @param   task_id - the ID assigned by OSAL.  This ID should be
    172           *                    used to send messages and set timers.
    173           *
    174           * @return  none
    175           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    176          void LocDongle_Init( uint8 task_id )
   \                     LocDongle_Init:
    177          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    178            LocDongle_TaskID = task_id;
   \   000004   E9           MOV     A,R1
   \   000005   90....       MOV     DPTR,#LocDongle_TaskID
   \   000008   F0           MOVX    @DPTR,A
    179            LocDongle_TransID = 0;
   \   000009   E4           CLR     A
   \   00000A   90....       MOV     DPTR,#LocDongle_TransID
   \   00000D   F0           MOVX    @DPTR,A
    180          
    181            // Register the endpoint/interface description with the AF
    182            afRegister( (endPointDesc_t *)&epDesc );
   \   00000E                ; Setup parameters for call to function afRegister
   \   00000E   7A..         MOV     R2,#(epDesc & 0xff)
   \   000010   7B..         MOV     R3,#((epDesc >> 8) & 0xff)
   \   000012   12....       LCALL   ??afRegister?relay
    183          
    184            // Register for all key events - This app will handle all key events
    185            // RegisterForKeys( LocDongle_TaskID );
    186          
    187            // Update the display
    188          #if defined ( LCD_SUPPORTED )
    189            //HalLcdWriteString( "Location-Dongle", HAL_LCD_LINE_2 );
    190             Print8(HAL_LCD_LINE_2,0,"                ",1) ;
    191             Print8(HAL_LCD_LINE_2,0,"Location-Dongle",1) ;
    192          #endif
    193          }
   \   000015   D083         POP     DPH
   \   000017   D082         POP     DPL
   \   000019   02....       LJMP    ?BRET
    194          
    195          /*********************************************************************
    196           * @fn      LocDongle_ProcessEvent
    197           *
    198           * @brief   Generic Application Task event processor.  This function
    199           *          is called to process all events for the task.  Events
    200           *          include timers, messages and any other user defined events.
    201           *
    202           * @param   task_id  - The OSAL assigned task ID.
    203           * @param   events - events to process.  This is a bit map and can
    204           *                   contain more than one event.
    205           *
    206           * @return  none
    207           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    208          UINT16 LocDongle_ProcessEvent( uint8 task_id, UINT16 events )
   \                     LocDongle_ProcessEvent:
    209          {
   \   000000   74F4         MOV     A,#-0xc
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 12
   \   000005                ; Auto size: 0
   \   000005   8A..         MOV     ?V0 + 0,R2
   \   000007   8B..         MOV     ?V0 + 1,R3
    210            afIncomingMSGPacket_t *MSGpkt;
    211          
    212            if ( events & SYS_EVENT_MSG )
   \   000009   7480         MOV     A,#-0x80
   \   00000B   55..         ANL     A,?V0 + 1
   \   00000D   F9           MOV     R1,A
   \   00000E   E4           CLR     A
   \   00000F   7001         JNZ     ??LocDongle_ProcessEvent_0
   \   000011   E9           MOV     A,R1
   \                     ??LocDongle_ProcessEvent_0:
   \   000012   605C         JZ      ??LocDongle_ProcessEvent_1
    213            {
    214              MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( LocDongle_TaskID );
   \   000014                ; Setup parameters for call to function osal_msg_receive
   \   000014   800E         SJMP    ??LocDongle_ProcessEvent_2
    215              while ( MSGpkt )
    216              {
    217                switch ( MSGpkt->hdr.event )
    218                {
    219                case MT_SYS_APP_MSG:  // Z-Architect Messages
    220                    LocDongle_MTMsg( ((mtSysAppMsg_t *)MSGpkt)->appDataLen, ((mtSysAppMsg_t *)MSGpkt)->appData );
    221                    break;
    222          
    223                  case KEY_CHANGE:
    224                    //keyChange( ((keyChange_t *)MSGpkt)->state, ((keyChange_t *)MSGpkt)->keys );
    225                    break;
    226          
    227                  case AF_INCOMING_MSG_CMD:
    228                    LocDongle_ProcessMSGCmd( MSGpkt );
   \                     ??LocDongle_ProcessEvent_3:
   \   000016                ; Setup parameters for call to function LocDongle_ProcessMSGCmd
   \   000016   EE           MOV     A,R6
   \   000017   FA           MOV     R2,A
   \   000018   EF           MOV     A,R7
   \   000019   FB           MOV     R3,A
   \   00001A   12....       LCALL   ??LocDongle_ProcessMSGCmd?relay
    229                    break;
    230          
    231                  default:
    232                    break;
    233                }
    234          
    235                osal_msg_deallocate( (uint8 *)MSGpkt );
   \                     ??LocDongle_ProcessEvent_4:
   \   00001D                ; Setup parameters for call to function osal_msg_deallocate
   \   00001D   EE           MOV     A,R6
   \   00001E   FA           MOV     R2,A
   \   00001F   EF           MOV     A,R7
   \   000020   FB           MOV     R3,A
   \   000021   12....       LCALL   ??osal_msg_deallocate?relay
    236                MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( LocDongle_TaskID );
   \   000024                ; Setup parameters for call to function osal_msg_receive
   \                     ??LocDongle_ProcessEvent_2:
   \   000024   90....       MOV     DPTR,#LocDongle_TaskID
   \   000027   E0           MOVX    A,@DPTR
   \   000028   F9           MOV     R1,A
   \   000029   12....       LCALL   ??osal_msg_receive?relay
   \   00002C   8A..         MOV     ?V0 + 2,R2
   \   00002E   8B..         MOV     ?V0 + 3,R3
   \   000030   AE..         MOV     R6,?V0 + 2
   \   000032   AF..         MOV     R7,?V0 + 3
   \   000034   EE           MOV     A,R6
   \   000035   7001         JNZ     ??LocDongle_ProcessEvent_5
   \   000037   EF           MOV     A,R7
   \                     ??LocDongle_ProcessEvent_5:
   \   000038   602D         JZ      ??LocDongle_ProcessEvent_6
   \   00003A   8E82         MOV     DPL,R6
   \   00003C   8F83         MOV     DPH,R7
   \   00003E   E0           MOVX    A,@DPTR
   \   00003F   12....       LCALL   ?UC_SWITCH_SPARSE
   \                     `?<Jumptable for LocDongle_ProcessEvent>_0`:
   \   000042   00           DB        0
   \   000043   02           DB        2
   \   000044   1A           DB        26
   \   000045   ....         DW        ??LocDongle_ProcessEvent_3
   \   000047   23           DB        35
   \   000048   ....         DW        ??LocDongle_ProcessEvent_7
   \   00004A   ....         DW        ??LocDongle_ProcessEvent_4
   \                     ??LocDongle_ProcessEvent_7:
   \   00004C                ; Setup parameters for call to function LocDongle_MTMsg
   \   00004C   8E82         MOV     DPL,R6
   \   00004E   8F83         MOV     DPH,R7
   \   000050   A3           INC     DPTR
   \   000051   A3           INC     DPTR
   \   000052   A3           INC     DPTR
   \   000053   A3           INC     DPTR
   \   000054   E0           MOVX    A,@DPTR
   \   000055   FA           MOV     R2,A
   \   000056   A3           INC     DPTR
   \   000057   E0           MOVX    A,@DPTR
   \   000058   FB           MOV     R3,A
   \   000059   8E82         MOV     DPL,R6
   \   00005B   8F83         MOV     DPH,R7
   \   00005D   A3           INC     DPTR
   \   00005E   A3           INC     DPTR
   \   00005F   A3           INC     DPTR
   \   000060   E0           MOVX    A,@DPTR
   \   000061   F9           MOV     R1,A
   \   000062   12....       LCALL   ??LocDongle_MTMsg?relay
   \   000065   80B6         SJMP    ??LocDongle_ProcessEvent_4
    237              }
    238          
    239              // Return unprocessed events
    240              return ( events ^ SYS_EVENT_MSG );
   \                     ??LocDongle_ProcessEvent_6:
   \   000067   AA..         MOV     R2,?V0 + 0
   \   000069   7480         MOV     A,#-0x80
   \   00006B   65..         XRL     A,?V0 + 1
   \   00006D   FB           MOV     R3,A
   \   00006E   8004         SJMP    ??LocDongle_ProcessEvent_8
    241            }
    242          
    243          #if defined ( ZBIT )
    244            if ( events & DONGLE_TIMER_EVT )
    245            {
    246              processTimerEvt();
    247          
    248              // Return unprocessed events.
    249              return ( events ^ DONGLE_TIMER_EVT );
    250            }
    251          #endif
    252          
    253            // Discard unknown events
    254            return 0;
   \                     ??LocDongle_ProcessEvent_1:
   \   000070   7A00         MOV     R2,#0x0
   \   000072   7B00         MOV     R3,#0x0
   \                     ??LocDongle_ProcessEvent_8:
   \   000074   7F04         MOV     R7,#0x4
   \   000076   02....       LJMP    ?BANKED_LEAVE_XDATA
    255          }
    256          
    257          /*********************************************************************
    258           * Event Generation Functions
    259           */
    260          /*********************************************************************
    261           * @fn      keyChange
    262           *
    263           * @brief   Handles all key events for this device.
    264           *
    265           * @param   keys - bit field for key events. Valid entries:
    266           *                 EVAL_SW4
    267           *                 EVAL_SW3
    268           *                 EVAL_SW2
    269           *                 EVAL_SW1
    270           *
    271           * @return  none
    272           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    273          void LocationHandleKeys( uint8 keys )
   \                     LocationHandleKeys:
    274          {
   \   000000                ; Saved register size: 0
   \   000000                ; Auto size: 0
    275            if ( keys & HAL_KEY_SW_1 )
    276            {
    277          #if defined ( ZBIT )
    278              osal_start_timerEx(LocDongle_TaskID, DONGLE_TIMER_EVT, DONGLE_TIMER_DLY);
    279          #endif
    280            }
    281          
    282            if ( keys & HAL_KEY_SW_2 )
    283            {
    284            }
    285          
    286            if ( keys & HAL_KEY_SW_3 )
    287            {
    288            }
    289          
    290            if ( keys & HAL_KEY_SW_4 )
    291            {
    292            }
    293          }
   \   000000   02....       LJMP    ?BRET
    294          
    295          /*********************************************************************
    296           * @fn      LocDongle_ProcessMSGCmd
    297           *
    298           * @brief   All incoming messages are sent out the serial port
    299           *          as an MT SYS_APP_MSG.
    300           *
    301           * @param   Raw incoming MSG packet structure pointer.
    302           *
    303           * @return  none
    304           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    305          static void LocDongle_ProcessMSGCmd( afIncomingMSGPacket_t *pkt )
   \                     LocDongle_ProcessMSGCmd:
    306          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 14
   \   000005   74F2         MOV     A,#-0xe
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   EA           MOV     A,R2
   \   00000B   FE           MOV     R6,A
   \   00000C   EB           MOV     A,R3
   \   00000D   FF           MOV     R7,A
    307          #if defined ( ZBIT )
    308            switch ( pkt->clusterId )
    309            {
    310              case LOCATION_BLINDNODE_RESPONSE:
    311              case LOCATION_BLINDNODE_CONFIG:
    312                blindNodes[0].addr = pkt->srcAddr.addr.shortAddr;
    313                blindNodes[0].ep = pkt->srcAddr.endPoint;
    314                break;
    315          
    316              default:
    317                break;
    318            }
    319          #else
    320            #include "SPIMgr.h"
    321            // All incoming messages are sent out the serial port as a SYS_APP_MSG.
    322            uint16 cmd = SPI_RESPONSE_BIT | SPI_CMD_SYS_APP_MSG;
   \   00000E   85..82       MOV     DPL,?XSP + 0
   \   000011   85..83       MOV     DPH,?XSP + 1
   \   000014   7418         MOV     A,#0x18
   \   000016   F0           MOVX    @DPTR,A
   \   000017   A3           INC     DPTR
   \   000018   7410         MOV     A,#0x10
   \   00001A   F0           MOVX    @DPTR,A
    323            // DstEP + SrcAddr + SrcEP + cId + len = 1+2+1+2+1
    324            uint8 buf[SPI_0DATA_MSG_LEN + 7];
    325            uint8 *pBuf = buf;
    326            uint8 succ = FALSE;
    327          
    328            *pBuf++ = SOP_VALUE;
   \   00001B   7402         MOV     A,#0x2
   \   00001D   12....       LCALL   ?XSTACK_DISP0_8
   \   000020   7402         MOV     A,#0x2
   \   000022   F0           MOVX    @DPTR,A
    329            *pBuf++ = (uint8)(HI_UINT16( cmd ));
   \   000023   7403         MOV     A,#0x3
   \   000025   12....       LCALL   ?XSTACK_DISP0_8
   \   000028   7410         MOV     A,#0x10
   \   00002A   F0           MOVX    @DPTR,A
    330            *pBuf++ = (uint8)(LO_UINT16( cmd ));
   \   00002B   7404         MOV     A,#0x4
   \   00002D   12....       LCALL   ?XSTACK_DISP0_8
   \   000030   7418         MOV     A,#0x18
   \   000032   F0           MOVX    @DPTR,A
    331            *pBuf++ = pkt->cmd.DataLength + 7;
   \   000033   EE           MOV     A,R6
   \   000034   2413         ADD     A,#0x13
   \   000036   F8           MOV     R0,A
   \   000037   EF           MOV     A,R7
   \   000038   3400         ADDC    A,#0x0
   \   00003A   F9           MOV     R1,A
   \   00003B   8882         MOV     DPL,R0
   \   00003D   8983         MOV     DPH,R1
   \   00003F   E0           MOVX    A,@DPTR
   \   000040   2407         ADD     A,#0x7
   \   000042   C0E0         PUSH    A
   \   000044   7405         MOV     A,#0x5
   \   000046   12....       LCALL   ?XSTACK_DISP0_8
   \   000049   D0E0         POP     A
   \   00004B   F0           MOVX    @DPTR,A
    332          
    333            *pBuf++ = LOCATION_DONGLE_ENDPOINT;
   \   00004C   7406         MOV     A,#0x6
   \   00004E   12....       LCALL   ?XSTACK_DISP0_8
   \   000051   74CB         MOV     A,#-0x35
   \   000053   F0           MOVX    @DPTR,A
    334            *pBuf++ = LO_UINT16( pkt->srcAddr.addr.shortAddr );
   \   000054   EE           MOV     A,R6
   \   000055   2406         ADD     A,#0x6
   \   000057   FA           MOV     R2,A
   \   000058   12....       LCALL   ?Subroutine2 & 0xFFFF
   \                     ??CrossCallReturnLabel_4:
   \   00005B   C0E0         PUSH    A
   \   00005D   7407         MOV     A,#0x7
   \   00005F   12....       LCALL   ?XSTACK_DISP0_8
   \   000062   D0E0         POP     A
   \   000064   F0           MOVX    @DPTR,A
    335            *pBuf++ = HI_UINT16( pkt->srcAddr.addr.shortAddr );
   \   000065   8A82         MOV     DPL,R2
   \   000067   8B83         MOV     DPH,R3
   \   000069   A3           INC     DPTR
   \   00006A   E0           MOVX    A,@DPTR
   \   00006B   C0E0         PUSH    A
   \   00006D   7408         MOV     A,#0x8
   \   00006F   12....       LCALL   ?XSTACK_DISP0_8
   \   000072   D0E0         POP     A
   \   000074   F0           MOVX    @DPTR,A
    336            *pBuf++ = pkt->srcAddr.endPoint;
   \   000075   8E82         MOV     DPL,R6
   \   000077   8F83         MOV     DPH,R7
   \   000079   A3           INC     DPTR
   \   00007A   A3           INC     DPTR
   \   00007B   A3           INC     DPTR
   \   00007C   A3           INC     DPTR
   \   00007D   A3           INC     DPTR
   \   00007E   A3           INC     DPTR
   \   00007F   A3           INC     DPTR
   \   000080   A3           INC     DPTR
   \   000081   A3           INC     DPTR
   \   000082   E0           MOVX    A,@DPTR
   \   000083   C0E0         PUSH    A
   \   000085   7409         MOV     A,#0x9
   \   000087   12....       LCALL   ?XSTACK_DISP0_8
   \   00008A   D0E0         POP     A
   \   00008C   F0           MOVX    @DPTR,A
    337            *pBuf++ = LO_UINT16( pkt->clusterId );
   \   00008D   EE           MOV     A,R6
   \   00008E   2404         ADD     A,#0x4
   \   000090   1A           DEC     R2
   \   000091   1A           DEC     R2
   \   000092   12....       LCALL   ?Subroutine2 & 0xFFFF
   \                     ??CrossCallReturnLabel_5:
   \   000095   C0E0         PUSH    A
   \   000097   740A         MOV     A,#0xa
   \   000099   12....       LCALL   ?XSTACK_DISP0_8
   \   00009C   D0E0         POP     A
   \   00009E   F0           MOVX    @DPTR,A
    338            *pBuf++ = HI_UINT16( pkt->clusterId );
   \   00009F   8A82         MOV     DPL,R2
   \   0000A1   8B83         MOV     DPH,R3
   \   0000A3   A3           INC     DPTR
   \   0000A4   E0           MOVX    A,@DPTR
   \   0000A5   C0E0         PUSH    A
   \   0000A7   740B         MOV     A,#0xb
   \   0000A9   12....       LCALL   ?XSTACK_DISP0_8
   \   0000AC   D0E0         POP     A
   \   0000AE   F0           MOVX    @DPTR,A
    339            *pBuf++ = pkt->cmd.DataLength;
   \   0000AF   8882         MOV     DPL,R0
   \   0000B1   8983         MOV     DPH,R1
   \   0000B3   E0           MOVX    A,@DPTR
   \   0000B4   C0E0         PUSH    A
   \   0000B6   740C         MOV     A,#0xc
   \   0000B8   12....       LCALL   ?XSTACK_DISP0_8
   \   0000BB   D0E0         POP     A
   \   0000BD   F0           MOVX    @DPTR,A
    340          
    341            //(void)HalUARTWrite( SPI_MGR_DEFAULT_PORT, buf, 11 );
    342            if ( HalUARTWrite( SPI_MGR_DEFAULT_PORT, buf, 11 ) )
   \   0000BE                ; Setup parameters for call to function HalUARTWrite
   \   0000BE   7C0B         MOV     R4,#0xb
   \   0000C0   7D00         MOV     R5,#0x0
   \   0000C2   7402         MOV     A,#0x2
   \   0000C4   12....       LCALL   ?XSTACK_DISP0_8
   \   0000C7   AA82         MOV     R2,DPL
   \   0000C9   AB83         MOV     R3,DPH
   \   0000CB   7900         MOV     R1,#0x0
   \   0000CD   12....       LCALL   ??HalUARTWrite?relay
   \   0000D0   EA           MOV     A,R2
   \   0000D1   7001         JNZ     ??LocDongle_ProcessMSGCmd_0
   \   0000D3   EB           MOV     A,R3
   \                     ??LocDongle_ProcessMSGCmd_0:
   \   0000D4   604F         JZ      ??LocDongle_ProcessMSGCmd_1
    343            {
    344              //(void)HalUARTWrite( SPI_MGR_DEFAULT_PORT, pkt->cmd.Data, pkt->cmd.DataLength);
    345              if ( HalUARTWrite( SPI_MGR_DEFAULT_PORT, pkt->cmd.Data, pkt->cmd.DataLength) )
   \   0000D6                ; Setup parameters for call to function HalUARTWrite
   \   0000D6   12....       LCALL   ?Subroutine1 & 0xFFFF
   \                     ??CrossCallReturnLabel_2:
   \   0000D9   FC           MOV     R4,A
   \   0000DA   A3           INC     DPTR
   \   0000DB   E0           MOVX    A,@DPTR
   \   0000DC   FD           MOV     R5,A
   \   0000DD   12....       LCALL   ?Subroutine0 & 0xFFFF
   \                     ??CrossCallReturnLabel_0:
   \   0000E0   7900         MOV     R1,#0x0
   \   0000E2   12....       LCALL   ??HalUARTWrite?relay
   \   0000E5   EA           MOV     A,R2
   \   0000E6   7001         JNZ     ??LocDongle_ProcessMSGCmd_2
   \   0000E8   EB           MOV     A,R3
   \                     ??LocDongle_ProcessMSGCmd_2:
   \   0000E9   603A         JZ      ??LocDongle_ProcessMSGCmd_1
    346              {
    347                cmd = SPIMgr_CalcFCS( buf+1, 10 ) ^
    348                      SPIMgr_CalcFCS( pkt->cmd.Data, pkt->cmd.DataLength );
   \   0000EB                ; Setup parameters for call to function SPIMgr_CalcFCS
   \   0000EB   790A         MOV     R1,#0xa
   \   0000ED   7403         MOV     A,#0x3
   \   0000EF   12....       LCALL   ?XSTACK_DISP0_8
   \   0000F2   AA82         MOV     R2,DPL
   \   0000F4   AB83         MOV     R3,DPH
   \   0000F6   12....       LCALL   ??SPIMgr_CalcFCS?relay
   \   0000F9   E9           MOV     A,R1
   \   0000FA   F5..         MOV     ?V0 + 0,A
   \   0000FC                ; Setup parameters for call to function SPIMgr_CalcFCS
   \   0000FC   12....       LCALL   ?Subroutine1 & 0xFFFF
   \                     ??CrossCallReturnLabel_3:
   \   0000FF   F9           MOV     R1,A
   \   000100   12....       LCALL   ?Subroutine0 & 0xFFFF
   \                     ??CrossCallReturnLabel_1:
   \   000103   12....       LCALL   ??SPIMgr_CalcFCS?relay
   \   000106   E9           MOV     A,R1
   \   000107   65..         XRL     A,?V0 + 0
   \   000109   7900         MOV     R1,#0x0
   \   00010B   85..82       MOV     DPL,?XSP + 0
   \   00010E   85..83       MOV     DPH,?XSP + 1
   \   000111   F0           MOVX    @DPTR,A
   \   000112   A3           INC     DPTR
   \   000113   E4           CLR     A
   \   000114   F0           MOVX    @DPTR,A
    349                //(void)HalUARTWrite( SPI_MGR_DEFAULT_PORT, (uint8 *)(&cmd), 1 );
    350                if ( HalUARTWrite( SPI_MGR_DEFAULT_PORT, (uint8 *)(&cmd), 1 ) )
   \   000115                ; Setup parameters for call to function HalUARTWrite
   \   000115   7C01         MOV     R4,#0x1
   \   000117   FD           MOV     R5,A
   \   000118   85..82       MOV     DPL,?XSP + 0
   \   00011B   85..83       MOV     DPH,?XSP + 1
   \   00011E   AA82         MOV     R2,DPL
   \   000120   AB83         MOV     R3,DPH
   \   000122   12....       LCALL   ??HalUARTWrite?relay
    351                {
    352                  succ = TRUE;
    353                }
    354              }
    355            }
    356          #endif
    357          }
   \                     ??LocDongle_ProcessMSGCmd_1:
   \   000125   740E         MOV     A,#0xe
   \   000127   12....       LCALL   ?DEALLOC_XSTACK8
   \   00012A   7F02         MOV     R7,#0x2
   \   00012C   02....       LJMP    ?BANKED_LEAVE_XDATA

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine2:
   \   000000   EF           MOV     A,R7
   \   000001   3400         ADDC    A,#0x0
   \   000003   FB           MOV     R3,A
   \   000004   8A82         MOV     DPL,R2
   \   000006   8B83         MOV     DPH,R3
   \   000008   E0           MOVX    A,@DPTR
   \   000009   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine1:
   \   000000   EE           MOV     A,R6
   \   000001   2413         ADD     A,#0x13
   \   000003   F582         MOV     DPL,A
   \   000005   EF           MOV     A,R7
   \   000006   3400         ADDC    A,#0x0
   \   000008   F583         MOV     DPH,A
   \   00000A   E0           MOVX    A,@DPTR
   \   00000B   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine0:
   \   000000   EE           MOV     A,R6
   \   000001   2415         ADD     A,#0x15
   \   000003   F582         MOV     DPL,A
   \   000005   EF           MOV     A,R7
   \   000006   3400         ADDC    A,#0x0
   \   000008   F583         MOV     DPH,A
   \   00000A   E0           MOVX    A,@DPTR
   \   00000B   FA           MOV     R2,A
   \   00000C   A3           INC     DPTR
   \   00000D   E0           MOVX    A,@DPTR
   \   00000E   FB           MOV     R3,A
   \   00000F   22           RET
    358          
    359          /*********************************************************************
    360           * @fn      LocDongle_MTMsg
    361           *
    362           * @brief   Process Monitor and Test messages
    363           *
    364           * @param   len - number of bytes
    365           * @param   msg - pointer to message
    366           *          0 - Lo byte destination address
    367           *          1 - Hi byte destination address
    368           *          2 - endpoint
    369           *          3 - lo byte cluster ID
    370           *          4 - hi byte cluster ID
    371           *          5 - data length
    372           *          6 - first byte of data
    373           *
    374           * @return  none
    375           */

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    376          static void LocDongle_MTMsg( uint8 len, uint8 *msg )
   \                     LocDongle_MTMsg:
    377          {
   \   000000   74F2         MOV     A,#-0xe
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 14
   \   000005                ; Auto size: 4
   \   000005   74FC         MOV     A,#-0x4
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   8A..         MOV     ?V0 + 0,R2
    378            afAddrType_t dstAddr;
    379            cId_t clusterID;
    380            uint8 dataLen;
    381          
    382            dstAddr.addrMode = afAddr16Bit;
   \   00000C   7402         MOV     A,#0x2
   \   00000E   12....       LCALL   ?XSTACK_DISP0_8
   \   000011   7402         MOV     A,#0x2
   \   000013   F0           MOVX    @DPTR,A
    383            dstAddr.addr.shortAddr = BUILD_UINT16( msg[0], msg[1] );
   \   000014   8A82         MOV     DPL,R2
   \   000016   8B83         MOV     DPH,R3
   \   000018   E0           MOVX    A,@DPTR
   \   000019   FA           MOV     R2,A
   \   00001A   A3           INC     DPTR
   \   00001B   E0           MOVX    A,@DPTR
   \   00001C   F9           MOV     R1,A
   \   00001D   EA           MOV     A,R2
   \   00001E   85..82       MOV     DPL,?XSP + 0
   \   000021   85..83       MOV     DPH,?XSP + 1
   \   000024   F0           MOVX    @DPTR,A
   \   000025   A3           INC     DPTR
   \   000026   E9           MOV     A,R1
   \   000027   F0           MOVX    @DPTR,A
    384            msg += 2;
   \   000028   E5..         MOV     A,?V0 + 0
   \   00002A   2402         ADD     A,#0x2
   \   00002C   F5..         MOV     ?V0 + 0,A
   \   00002E   EB           MOV     A,R3
   \   00002F   3400         ADDC    A,#0x0
   \   000031   F5..         MOV     ?V0 + 1,A
    385            dstAddr.endPoint = *msg++;
   \   000033   85..82       MOV     DPL,?V0 + 0
   \   000036   F583         MOV     DPH,A
   \   000038   E0           MOVX    A,@DPTR
   \   000039   C0E0         PUSH    A
   \   00003B   7403         MOV     A,#0x3
   \   00003D   12....       LCALL   ?XSTACK_DISP0_8
   \   000040   D0E0         POP     A
   \   000042   F0           MOVX    @DPTR,A
   \   000043   85..82       MOV     DPL,?V0 + 0
   \   000046   85..83       MOV     DPH,?V0 + 1
   \   000049   A3           INC     DPTR
   \   00004A   8582..       MOV     ?V0 + 0,DPL
   \   00004D   8583..       MOV     ?V0 + 1,DPH
    386            clusterID = BUILD_UINT16( msg[0], msg[1] );
   \   000050   E0           MOVX    A,@DPTR
   \   000051   FA           MOV     R2,A
   \   000052   A3           INC     DPTR
   \   000053   E0           MOVX    A,@DPTR
   \   000054   F9           MOV     R1,A
   \   000055   EA           MOV     A,R2
   \   000056   F5..         MOV     ?V0 + 2,A
   \   000058   E9           MOV     A,R1
   \   000059   F5..         MOV     ?V0 + 3,A
    387            msg += 2;
   \   00005B   E5..         MOV     A,?V0 + 0
   \   00005D   2402         ADD     A,#0x2
   \   00005F   F5..         MOV     ?V0 + 0,A
   \   000061   E5..         MOV     A,?V0 + 1
   \   000063   3400         ADDC    A,#0x0
    388            dataLen = *msg++;
   \   000065   85..82       MOV     DPL,?V0 + 0
   \   000068   F583         MOV     DPH,A
   \   00006A   E0           MOVX    A,@DPTR
   \   00006B   FA           MOV     R2,A
   \   00006C   A3           INC     DPTR
   \   00006D   8582..       MOV     ?V0 + 0,DPL
   \   000070   8583..       MOV     ?V0 + 1,DPH
    389          
    390            if ( (clusterID == LOCATION_XY_RSSI_REQUEST) ||
    391                 (clusterID == LOCATION_REFNODE_CONFIG)  ||
    392                 (clusterID == LOCATION_REFNODE_REQUEST_CONFIG) )
   \   000073   7411         MOV     A,#0x11
   \   000075   65..         XRL     A,?V0 + 2
   \   000077   7001         JNZ     ??LocDongle_MTMsg_0
   \   000079   E9           MOV     A,R1
   \                     ??LocDongle_MTMsg_0:
   \   00007A   6012         JZ      ??LocDongle_MTMsg_1
   \   00007C   7415         MOV     A,#0x15
   \   00007E   65..         XRL     A,?V0 + 2
   \   000080   7001         JNZ     ??LocDongle_MTMsg_2
   \   000082   E9           MOV     A,R1
   \                     ??LocDongle_MTMsg_2:
   \   000083   6009         JZ      ??LocDongle_MTMsg_1
   \   000085   7417         MOV     A,#0x17
   \   000087   65..         XRL     A,?V0 + 2
   \   000089   7001         JNZ     ??LocDongle_MTMsg_3
   \   00008B   E9           MOV     A,R1
   \                     ??LocDongle_MTMsg_3:
   \   00008C   7009         JNZ     ??LocDongle_MTMsg_4
    393            {
    394              dstAddr.endPoint = LOCATION_REFNODE_ENDPOINT;
   \                     ??LocDongle_MTMsg_1:
   \   00008E   7403         MOV     A,#0x3
   \   000090   12....       LCALL   ?XSTACK_DISP0_8
   \   000093   74D2         MOV     A,#-0x2e
   \   000095   8007         SJMP    ??LocDongle_MTMsg_5
    395            }
    396            else
    397            {
    398              dstAddr.endPoint = LOCATION_BLINDNODE_ENDPOINT;
   \                     ??LocDongle_MTMsg_4:
   \   000097   7403         MOV     A,#0x3
   \   000099   12....       LCALL   ?XSTACK_DISP0_8
   \   00009C   74D3         MOV     A,#-0x2d
   \                     ??LocDongle_MTMsg_5:
   \   00009E   F0           MOVX    @DPTR,A
    399            }
    400          
    401            (void)AF_DataRequest( &dstAddr, (endPointDesc_t*)&epDesc, clusterID,
    402                                   dataLen, msg,
    403                                  &LocDongle_TransID, 0, AF_DEFAULT_RADIUS );
   \   00009F                ; Setup parameters for call to function AF_DataRequest
   \   00009F   75..0A       MOV     ?V0 + 4,#0xa
   \   0000A2   78..         MOV     R0,#?V0 + 4
   \   0000A4   12....       LCALL   ?PUSH_XSTACK_I_ONE
   \   0000A7   75....       MOV     ?V0 + 4,#(LocDongle_TransID & 0xff)
   \   0000AA   75....       MOV     ?V0 + 5,#((LocDongle_TransID >> 8) & 0xff)
   \   0000AD   78..         MOV     R0,#?V0 + 4
   \   0000AF   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000B2   78..         MOV     R0,#?V0 + 0
   \   0000B4   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000B7   8A..         MOV     ?V0 + 0,R2
   \   0000B9   75..00       MOV     ?V0 + 1,#0x0
   \   0000BC   78..         MOV     R0,#?V0 + 0
   \   0000BE   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000C1   78..         MOV     R0,#?V0 + 2
   \   0000C3   12....       LCALL   ?PUSH_XSTACK_I_TWO
   \   0000C6   7900         MOV     R1,#0x0
   \   0000C8   7C..         MOV     R4,#(epDesc & 0xff)
   \   0000CA   7D..         MOV     R5,#((epDesc >> 8) & 0xff)
   \   0000CC   7409         MOV     A,#0x9
   \   0000CE   12....       LCALL   ?XSTACK_DISP0_8
   \   0000D1   AA82         MOV     R2,DPL
   \   0000D3   AB83         MOV     R3,DPH
   \   0000D5   12....       LCALL   ??AF_DataRequest?relay
   \   0000D8   7409         MOV     A,#0x9
   \   0000DA   12....       LCALL   ?DEALLOC_XSTACK8
    404          }
   \   0000DD   7404         MOV     A,#0x4
   \   0000DF   12....       LCALL   ?DEALLOC_XSTACK8
   \   0000E2   7F06         MOV     R7,#0x6
   \   0000E4   02....       LJMP    ?BANKED_LEAVE_XDATA

   \                                 In  segment XDATA_ID, align 1, keep-with-next
   \                     `?<Initializer for LocDongle_InputClusterList>`:
   \   000000   12001400     DW 18, 20, 22, 21
   \            16001500

   \                                 In  segment XDATA_ID, align 1, keep-with-next
   \                     `?<Initializer for LocDongle_OutputClusterList>`:
   \   000000   11001300     DW 17, 19, 21, 22, 23, 24
   \            15001600
   \            17001800

   \                                 In  segment XDATA_ID, align 1, keep-with-next
   \                     `?<Initializer for LocDongle_SimpleDesc>`:
   \   000000   CB           DB 203
   \   000001   03C01200     DW 49155, 18
   \   000005   0008         DB 0, 8
   \   000007   ....         DW LocDongle_InputClusterList
   \   000009   0C           DB 12
   \   00000A   ....         DW LocDongle_OutputClusterList

   \                                 In  segment XDATA_ID, align 1, keep-with-next
   \                     `?<Initializer for epDesc>`:
   \   000000   CB           DB 203
   \   000001   ........     DW LocDongle_TaskID, LocDongle_SimpleDesc
   \   000005   00           DB 0

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

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

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

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

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??LocDongle_MTMsg?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    LocDongle_MTMsg
    405          
    406          #if defined ( ZBIT )
    407          /*********************************************************************
    408           * @fn      processTimerEvt
    409           *
    410           * @brief   Process the timer event to simulate OTA traffic normally driven by
    411           *          the Location PC App.
    412           *
    413           * @param   none
    414           *
    415           * @return  none
    416           */
    417          static void processTimerEvt( void )
    418          {
    419            static uint8 state = 0;
    420          
    421            const uint16 delay1 = 1000;  // Delay after broadcast request for node info.
    422            const uint16 delay2 = 3000;  // Delay after unicast request for position.
    423          
    424            uint16 delay = delay1;
    425            afAddrType_t dstAddr;
    426            cId_t cId;
    427          
    428            dstAddr.endPoint = LOCATION_ENDPOINT;
    429            dstAddr.addrMode = afAddrBroadcast;
    430            dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR;
    431          
    432            switch ( state )
    433            {
    434            case 0:
    435              cId = LOCATION_BLINDNODE_REQUEST_CONFIG;
    436              break;
    437          
    438            case 1:
    439              cId = LOCATION_REFNODE_REQUEST_CONFIG;
    440              break;
    441          
    442            case 2:
    443              cId = LOCATION_BLINDNODE_REQUEST;
    444              delay = delay2;
    445              dstAddr.addrMode = afAddr16Bit;
    446              dstAddr.addr.shortAddr = blindNodes[0].addr;
    447              dstAddr.endPoint = blindNodes[0].ep;
    448              break;
    449          
    450            default:
    451              break;
    452            }
    453          
    454            if ( afStatus_SUCCESS == AF_DataRequest( &dstAddr, (endPointDesc_t *)&epDesc,
    455                                                      cId, 0, NULL, &LocDongle_TransID,
    456                                                      AF_TX_OPTIONS_NONE,
    457                                                      AF_DEFAULT_RADIUS ) )
    458            {
    459              if ( ++state >= 3 )
    460              {
    461                state = 0;
    462              }
    463            }
    464          
    465            osal_start_timerEx( LocDongle_TaskID, DONGLE_TIMER_EVT, delay );
    466          }
    467          #endif
    468          
    469          //#undef ZBIT  //ggg
    470          /*********************************************************************
    471          *********************************************************************/

   Maximum stack usage in bytes:

     Function                     ISTACK PSTACK XSTACK
     --------                     ------ ------ ------
     LocDongle_Init                   2      0      0
       -> afRegister                  4      0      0
     LocDongle_MTMsg                  1      0     39
       -> AF_DataRequest              0      0     54
     LocDongle_ProcessEvent           0      0     12
       -> osal_msg_receive            0      0     24
       -> LocDongle_ProcessMSGCmd     0      0     24
       -> osal_msg_deallocate         0      0     24
       -> osal_msg_receive            0      0     24
       -> LocDongle_MTMsg             0      0     24
     LocDongle_ProcessMSGCmd          1      0     36
       -> HalUARTWrite                0      0     48
       -> HalUARTWrite                0      0     48
       -> SPIMgr_CalcFCS              0      0     48
       -> SPIMgr_CalcFCS              0      0     48
       -> HalUARTWrite                0      0     48
     LocationHandleKeys               0      0      0


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     LocDongle_InputClusterList        8
     LocDongle_OutputClusterList      12
     LocDongle_SimpleDesc             12
     epDesc                            6
     LocDongle_TaskID                  1
     LocDongle_TransID                 1
     LocDongle_Init                   28
     LocDongle_ProcessEvent          121
     LocationHandleKeys                3
     LocDongle_ProcessMSGCmd         303
     ?Subroutine2                     10
     ?Subroutine1                     12
     ?Subroutine0                     16
     LocDongle_MTMsg                 231
     ?<Initializer for LocDongle_InputClusterList>
                                       8
     ?<Initializer for LocDongle_OutputClusterList>
                                      12
     ?<Initializer for LocDongle_SimpleDesc>
                                      12
     ?<Initializer for epDesc>         6
     ??LocDongle_Init?relay            6
     ??LocDongle_ProcessEvent?relay    6
     ??LocationHandleKeys?relay        6
     ??LocDongle_ProcessMSGCmd?relay
                                       6
     ??LocDongle_MTMsg?relay           6

 
 724 bytes in segment BANKED_CODE
  30 bytes in segment BANK_RELAYS
  38 bytes in segment XDATA_I
  38 bytes in segment XDATA_ID
   2 bytes in segment XDATA_Z
 
 792 bytes of CODE  memory
  40 bytes of XDATA memory

Errors: none
Warnings: none
