###############################################################################
#                                                                             #
# IAR 8051 C/C++ Compiler V7.30B/W32                    19/May/2010  09:38:39 #
# 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 #
#                          \zmac\f8w\zmac_cb.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\zmac\f8w #
#                          \zmac_cb.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\zma #
#                          c_cb.lst                                           #
#    Object file        =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\z #
#                          stack\Samples\Location\CC2430DB\LocDongle\Obj\zmac #
#                          _cb.r51                                            #
#                                                                             #
#                                                                             #
###############################################################################

C:\Texas Instruments\ZStack-1.4.3-1.2.1\Components\zmac\f8w\zmac_cb.c
      1          /**************************************************************************************************
      2            Filename:       zmac_cb.c
      3            Revised:        $Date: 2007-10-28 18:43:04 -0700 (Sun, 28 Oct 2007) $
      4            Revision:       $Revision: 15800 $
      5          
      6            Description:    This file contains the NWK functions that the ZMAC calls
      7          
      8          
      9            Copyright 2005-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 "ZMAC.h"
     46          #include "MT_MAC.h"
     47          
     48          #if !defined NONWK
     49          #include "nwk.h"
     50          #include "nwk_bufs.h"
     51          #endif
     52          
     53          #if defined( MACSIM )
     54            #include "mac_sim.h"
     55          #endif
     56          
     57          extern void *ZMac_ScanBuf;
     58          
     59          /********************************************************************************************************
     60           *                                                 MACROS
     61           ********************************************************************************************************/
     62          
     63          #define ZMAC_EVENT_ID           0x00
     64          #define ZMAC_EVENT_STATUS       0x01
     65          
     66          /********************************************************************************************************
     67           *                                               CONSTANTS
     68           ********************************************************************************************************/
     69          
     70          #if !defined NONWK
     71          
     72          #define INVALID_SHORT_ADDR    0xFFFE
     73          #define BROADCAST_ADDR        0xFFFF
     74          
     75          /* Lookup table for size of structures. Must match with the order of MAC callback events */

   \                                 In  segment CODE_C, align 1
     76          const uint8 CODE zmacCBSizeTable [] = {
   \                     zmacCBSizeTable:
   \   000000   00160F16     DB 0, 22, 15, 22, 13, 11, 21, 11, 2, 17, 2, 34, 11, 48, 3, 0, 6
   \            0D0B150B
   \            02110222
   \            0B300300
   \            06      
     77            0,
     78            sizeof (ZMacAssociateInd_t),
     79            sizeof (ZMacAssociateCnf_t),
     80            sizeof (ZMacDisassociateInd_t),
     81            sizeof (ZMacDisassociateCnf_t),
     82            sizeof (ZMacBeaconNotifyInd_t) ,
     83            /*  0, // sizeof (ZMacGTSInd_t), */
     84            /*  0, // sizeof (ZMacGTSCnf_t), */
     85            sizeof (ZMacOrphanInd_t),
     86            sizeof (ZMacScanCnf_t),
     87            sizeof (ZMacStartCnf_t),
     88            sizeof (ZMacSyncLossInd_t),
     89            sizeof (ZMacPollCnf_t),
     90            sizeof (ZMacCommStatusInd_t),
     91            /*  0, // sizeof (ZMacRxEnableCnf_t), */
     92            sizeof (ZMacDataCnf_t),
     93            sizeof (ZMacDataInd_t),
     94            sizeof (ZMacPurgeCnf_t),
     95            0,
     96            sizeof (ZMacPollInd_t)
     97          };
     98          
     99          uint16 getZMacDynamicSize(uint8 event, macCbackEvent_t *pData);

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    100          uint16 getZMacDynamicSize(uint8 event, macCbackEvent_t *pData)
   \                     getZMacDynamicSize:
    101          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    102            switch(event)
   \   000004   E9           MOV     A,R1
   \   000005   12....       LCALL   ?UC_SWITCH_DENSE
   \                     `?<Jumptable for getZMacDynamicSize>_0`:
   \   000008   05           DB        5
   \   000009   02           DB        2
   \   00000A   ....         DW        ??getZMacDynamicSize_0
   \   00000C   ....         DW        ??getZMacDynamicSize_1
   \   00000E   ....         DW        ??getZMacDynamicSize_0
   \   000010   ....         DW        ??getZMacDynamicSize_2
    103            {
    104            case MAC_MLME_BEACON_NOTIFY_IND:
    105              return sizeof(macPanDesc_t) + pData->beaconNotifyInd.sduLength;
   \                     ??getZMacDynamicSize_1:
   \   000012   8A82         MOV     DPL,R2
   \   000014   8B83         MOV     DPH,R3
   \   000016   A3           INC     DPTR
   \   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   E0           MOVX    A,@DPTR
   \   00001F   F8           MOV     R0,A
   \   000020   7421         MOV     A,#0x21
   \   000022   28           ADD     A,R0
   \   000023   FA           MOV     R2,A
   \   000024   E4           CLR     A
   \   000025   3400         ADDC    A,#0x0
   \   000027   FB           MOV     R3,A
   \   000028   8027         SJMP    ??getZMacDynamicSize_3
    106            case MAC_MLME_SCAN_CNF:
    107              if (pData->scanCnf.scanType == ZMAC_ED_SCAN)
   \                     ??getZMacDynamicSize_2:
   \   00002A   8A82         MOV     DPL,R2
   \   00002C   8B83         MOV     DPH,R3
   \   00002E   A3           INC     DPTR
   \   00002F   A3           INC     DPTR
   \   000030   E0           MOVX    A,@DPTR
   \   000031   7004         JNZ     ??getZMacDynamicSize_4
    108                return ZMAC_ED_SCAN_MAXCHANNELS;
   \   000033   7A1B         MOV     R2,#0x1b
   \   000035   8018         SJMP    ??getZMacDynamicSize_5
    109              else
    110                return sizeof( ZMacPanDesc_t ) * pData->scanCnf.resultListSize;
   \                     ??getZMacDynamicSize_4:
   \   000037   8A82         MOV     DPL,R2
   \   000039   8B83         MOV     DPH,R3
   \   00003B   A3           INC     DPTR
   \   00003C   A3           INC     DPTR
   \   00003D   A3           INC     DPTR
   \   00003E   A3           INC     DPTR
   \   00003F   A3           INC     DPTR
   \   000040   A3           INC     DPTR
   \   000041   A3           INC     DPTR
   \   000042   A3           INC     DPTR
   \   000043   E0           MOVX    A,@DPTR
   \   000044   75F021       MOV     B,#0x21
   \   000047   A4           MUL     AB
   \   000048   FA           MOV     R2,A
   \   000049   ABF0         MOV     R3,B
   \   00004B   8004         SJMP    ??getZMacDynamicSize_3
    111            }
    112          
    113            return 0;
   \                     ??getZMacDynamicSize_0:
   \   00004D   7A00         MOV     R2,#0x0
   \                     ??getZMacDynamicSize_5:
   \   00004F   7B00         MOV     R3,#0x0
   \                     ??getZMacDynamicSize_3:
   \   000051                REQUIRE ?Subroutine8
   \   000051                ; // Fall through to label ?Subroutine8
    114          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine8:
   \   000000   D083         POP     DPH
   \   000002   D082         POP     DPL
   \   000004   02....       LJMP    ?BRET
    115          

   \                                 In  segment CODE_C, align 1
    116          const uint8 CODE zmacCBEventTable [] = {
   \                     zmacCBEventTable:
   \   000000   FF222324     DB 255, 34, 35, 36, 42, 38, 41, 37, 49, 50, 51, 55, 32, 33, 54, 255, 65
   \            2A262925
   \            31323337
   \            202136FF
   \            41      
    117            0xff,                         /* Unused */
    118            MACCB_ASSOCIATE_IND_CMD,      /* MAC_MLME_ASSOCIATE_IND */
    119            MACCB_ASSOCIATE_CNF_CMD,      /* MAC_MLME_ASSOCIATE_CNF */
    120            MACCB_DISASSOCIATE_IND_CMD,   /* MAC_MLME_DISASSOCIATE_IND */
    121            MACCB_DISASSOCIATE_CNF_CMD,   /* MAC_MLME_DISASSOCIATE_CNF */
    122            MACCB_BEACON_NOTIFY_IND_CMD,  /* MAC_MLME_BEACON_NOTIFY_IND */
    123            /*  0xff,  */                 /* MAC_MLME_GTS_IND */
    124            /*  0xff,  */                 /* MAC_MLME_GTS_CNF */
    125            MACCB_ORPHAN_IND_CMD,         /* MAC_MLME_ORPHAN_IND */
    126            MACCB_SCAN_CNF_CMD,           /* MAC_MLME_SCAN_CNF */
    127            MACCB_START_CNF_CMD,          /* MAC_MLME_START_CNF */
    128            MACCB_SYNC_LOSS_IND_CMD,      /* MAC_MLME_SYNC_LOSS_IND */
    129            MACCB_POLL_CNF_CMD,           /* MAC_MLME_POLL_CNF */
    130            MACCB_COMM_STATUS_IND_CMD,    /* MAC_MLME_COMM_STATUS_IND */
    131            /*  0xff,  */                 /* MAC_MLME_RX_ENABLE_CNF */
    132            MACCB_DATA_CNF_CMD,           /* MAC_MCPS_DATA_CNF */
    133            MACCB_DATA_IND_CMD,           /* MAC_MCPS_DATA_IND */
    134            MACCB_PURGE_CNF_CMD,          /* MAC_MCPS_PURGE_CNF */
    135            0xff,                         /* MAC_PWR_ON_CNF */
    136            MACCB_POLL_IND_CMD            /* MAC_MLME_POLL_IND */
    137          };
    138          
    139          #endif /* !defined NONWK */
    140          
    141          /********************************************************************************************************
    142           *                                                TYPEDEFS
    143           ********************************************************************************************************/
    144          
    145          /********************************************************************************************************
    146           *                                               GLOBALS
    147           ********************************************************************************************************/
    148          /* Send Callbacks to MT */
    149          void zmacSendMTCallback( macCbackEvent_t *pData );
    150          
    151          
    152          /********************************************************************************************************
    153           * @fn       MAC_CbackEvent()
    154           *
    155           * @brief    convert MAC data confirm and indication to ZMac and send to NWK
    156           *
    157           * @param    pData - pointer to macCbackEvent_t
    158           *
    159           * @return   none
    160           ********************************************************************************************************/

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    161          void  MAC_CbackEvent(macCbackEvent_t *pData)
   \                     MAC_CbackEvent:
    162          {
   \   000000   74F0         MOV     A,#-0x10
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 16
   \   000005                ; Auto size: 5
   \   000005   74FB         MOV     A,#-0x5
   \   000007   12....       LCALL   ?ALLOC_XSTACK8
   \   00000A   8A..         MOV     ?V0 + 4,R2
   \   00000C   8B..         MOV     ?V0 + 5,R3
    163          #ifdef MT_MAC_CB_FUNC
    164            zmacSendMTCallback ( pData );
    165          #elif !defined NONWK
    166          
    167            uint8 macEvent = pData->hdr.event;
   \   00000E   8A82         MOV     DPL,R2
   \   000010   8B83         MOV     DPH,R3
   \   000012   E0           MOVX    A,@DPTR
   \   000013   F5..         MOV     ?V0 + 6,A
    168            uint16 msgLen = zmacCBSizeTable[macEvent] + getZMacDynamicSize(macEvent, pData);
   \   000015                ; Setup parameters for call to function getZMacDynamicSize
   \   000015   F9           MOV     R1,A
   \   000016   12....       LCALL   ??getZMacDynamicSize?relay
   \   000019   8A..         MOV     ?V0 + 0,R2
   \   00001B   A8..         MOV     R0,?V0 + 0
   \   00001D   12....       LCALL   ?Subroutine2 & 0xFFFF
   \                     ??CrossCallReturnLabel_5:
   \   000020   FA           MOV     R2,A
   \   000021   E8           MOV     A,R0
   \   000022   2A           ADD     A,R2
   \   000023   FE           MOV     R6,A
   \   000024   EB           MOV     A,R3
   \   000025   3400         ADDC    A,#0x0
   \   000027   FF           MOV     R7,A
    169            macCbackEvent_t *msgPtr;
    170          
    171            /* Allocate osal msg buffer */
    172            if (msgLen > 0)
   \   000028   EE           MOV     A,R6
   \   000029   7001         JNZ     ??MAC_CbackEvent_0
   \   00002B   EF           MOV     A,R7
   \                     ??MAC_CbackEvent_0:
   \   00002C   7003         JNZ     $+5
   \   00002E   02....       LJMP    ??MAC_CbackEvent_1 & 0xFFFF
    173            {
    174              if (macEvent == MAC_MCPS_DATA_IND)
   \   000031   740D         MOV     A,#0xd
   \   000033   65..         XRL     A,?V0 + 6
   \   000035   7006         JNZ     ??MAC_CbackEvent_2
    175                msgPtr = pData;
   \   000037   AE..         MOV     R6,?V0 + 4
   \   000039   AF..         MOV     R7,?V0 + 5
   \   00003B   8026         SJMP    ??MAC_CbackEvent_3
    176              else
    177              {
    178                if ( macEvent == MAC_MCPS_DATA_CNF )
   \                     ??MAC_CbackEvent_2:
   \   00003D   740C         MOV     A,#0xc
   \   00003F   65..         XRL     A,?V0 + 6
   \   000041   7011         JNZ     ??MAC_CbackEvent_4
    179                {
    180                  osal_msg_deallocate( (uint8*)pData->dataCnf.pDataReq );
   \   000043                ; Setup parameters for call to function osal_msg_deallocate
   \   000043   85..82       MOV     DPL,?V0 + 4
   \   000046   85..83       MOV     DPH,?V0 + 5
   \   000049   A3           INC     DPTR
   \   00004A   A3           INC     DPTR
   \   00004B   A3           INC     DPTR
   \   00004C   E0           MOVX    A,@DPTR
   \   00004D   FA           MOV     R2,A
   \   00004E   A3           INC     DPTR
   \   00004F   E0           MOVX    A,@DPTR
   \   000050   FB           MOV     R3,A
   \   000051   12....       LCALL   ??osal_msg_deallocate?relay
    181                }
    182                msgPtr = (macCbackEvent_t *)osal_msg_allocate(msgLen);
   \                     ??MAC_CbackEvent_4:
   \   000054                ; Setup parameters for call to function osal_msg_allocate
   \   000054   EE           MOV     A,R6
   \   000055   FA           MOV     R2,A
   \   000056   EF           MOV     A,R7
   \   000057   FB           MOV     R3,A
   \   000058   12....       LCALL   ??osal_msg_allocate?relay
   \   00005B   8A..         MOV     ?V0 + 0,R2
   \   00005D   8B..         MOV     ?V0 + 1,R3
   \   00005F   AE..         MOV     R6,?V0 + 0
   \   000061   AF..         MOV     R7,?V0 + 1
    183              }
    184          
    185              if (msgPtr)
   \                     ??MAC_CbackEvent_3:
   \   000063   EE           MOV     A,R6
   \   000064   7001         JNZ     ??MAC_CbackEvent_5
   \   000066   EF           MOV     A,R7
   \                     ??MAC_CbackEvent_5:
   \   000067   7003         JNZ     $+5
   \   000069   02....       LJMP    ??MAC_CbackEvent_1 & 0xFFFF
    186              {
    187                if (macEvent != MAC_MCPS_DATA_IND)
   \   00006C   740D         MOV     A,#0xd
   \   00006E   65..         XRL     A,?V0 + 6
   \   000070   601D         JZ      ??MAC_CbackEvent_6
    188                  osal_memcpy(msgPtr, pData, zmacCBSizeTable[macEvent]);
   \   000072                ; Setup parameters for call to function osal_memcpy
   \   000072   85....       MOV     ?V0 + 0,?V0 + 4
   \   000075   85....       MOV     ?V0 + 1,?V0 + 5
   \   000078   75..00       MOV     ?V0 + 2,#0x0
   \   00007B   78..         MOV     R0,#?V0 + 0
   \   00007D   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   000080   12....       LCALL   ?Subroutine2 & 0xFFFF
   \                     ??CrossCallReturnLabel_6:
   \   000083   FC           MOV     R4,A
   \   000084   7D00         MOV     R5,#0x0
   \   000086   EE           MOV     A,R6
   \   000087   FA           MOV     R2,A
   \   000088   EF           MOV     A,R7
   \   000089   12....       LCALL   ??Subroutine3_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_9:
   \   00008C   12....       LCALL   ?DEALLOC_XSTACK8
    189          
    190                switch (macEvent) {
   \                     ??MAC_CbackEvent_6:
   \   00008F   E5..         MOV     A,?V0 + 6
   \   000091   12....       LCALL   ?UC_SWITCH_SPARSE
   \                     `?<Jumptable for MAC_CbackEvent>_0`:
   \   000094   00           DB        0
   \   000095   04           DB        4
   \   000096   05           DB        5
   \   000097   ....         DW        ??MAC_CbackEvent_7
   \   000099   07           DB        7
   \   00009A   ....         DW        ??MAC_CbackEvent_8
   \   00009C   08           DB        8
   \   00009D   ....         DW        ??MAC_CbackEvent_9
   \   00009F   0D           DB        13
   \   0000A0   ....         DW        ??MAC_CbackEvent_10
   \   0000A2   ....         DW        ??MAC_CbackEvent_11
   \                     ??MAC_CbackEvent_7:
   \   0000A4   12....       LCALL   ?Subroutine1 & 0xFFFF
   \                     ??CrossCallReturnLabel_3:
   \   0000A7   12....       LCALL   ??Subroutine0_0 & 0xFFFF
   \                     ??CrossCallReturnLabel_2:
   \   0000AA   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   0000AD   7C21         MOV     R4,#0x21
   \   0000AF   7D00         MOV     R5,#0x0
   \   0000B1   AA..         MOV     R2,?V0 + 4
   \   0000B3   AB..         MOV     R3,?V0 + 5
   \   0000B5   12....       LCALL   ??Subroutine3_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_10:
   \   0000B8   12....       LCALL   ?DEALLOC_XSTACK8
    191                case MAC_MLME_BEACON_NOTIFY_IND:
    192                  {
    193                    macMlmeBeaconNotifyInd_t *pBeacon;
    194          
    195                    pBeacon = (macMlmeBeaconNotifyInd_t*)msgPtr;
    196          
    197                    osal_memcpy(pBeacon + 1, pBeacon->pPanDesc, sizeof(macPanDesc_t));
    198                    pBeacon->pPanDesc = (macPanDesc_t *) (pBeacon + 1);
   \   0000BB   8E82         MOV     DPL,R6
   \   0000BD   8F83         MOV     DPH,R7
   \   0000BF   A3           INC     DPTR
   \   0000C0   A3           INC     DPTR
   \   0000C1   A3           INC     DPTR
   \   0000C2   E5..         MOV     A,?V0 + 4
   \   0000C4   F0           MOVX    @DPTR,A
   \   0000C5   A3           INC     DPTR
   \   0000C6   E5..         MOV     A,?V0 + 5
   \   0000C8   F0           MOVX    @DPTR,A
    199                    osal_memcpy(pBeacon->pPanDesc + 1, pBeacon->pSdu, pBeacon->sduLength);
   \   0000C9   12....       LCALL   ?Subroutine5 & 0xFFFF
   \                     ??CrossCallReturnLabel_14:
   \   0000CC                ; Setup parameters for call to function osal_memcpy
   \   0000CC   85..82       MOV     DPL,?V0 + 4
   \   0000CF   F583         MOV     DPH,A
   \   0000D1   E0           MOVX    A,@DPTR
   \   0000D2   F5..         MOV     ?V0 + 0,A
   \   0000D4   A3           INC     DPTR
   \   0000D5   E0           MOVX    A,@DPTR
   \   0000D6   F5..         MOV     ?V0 + 1,A
   \   0000D8   78..         MOV     R0,#?V0 + 0
   \   0000DA   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   0000DD   8E82         MOV     DPL,R6
   \   0000DF   8F83         MOV     DPH,R7
   \   0000E1   A3           INC     DPTR
   \   0000E2   A3           INC     DPTR
   \   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   E0           MOVX    A,@DPTR
   \   0000EA   FC           MOV     R4,A
   \   0000EB   7D00         MOV     R5,#0x0
   \   0000ED   8E82         MOV     DPL,R6
   \   0000EF   8F83         MOV     DPH,R7
   \   0000F1   A3           INC     DPTR
   \   0000F2   A3           INC     DPTR
   \   0000F3   A3           INC     DPTR
   \   0000F4   E0           MOVX    A,@DPTR
   \   0000F5   2421         ADD     A,#0x21
   \   0000F7   FA           MOV     R2,A
   \   0000F8   A3           INC     DPTR
   \   0000F9   E0           MOVX    A,@DPTR
   \   0000FA   12....       LCALL   ?Subroutine3 & 0xFFFF
   \                     ??CrossCallReturnLabel_7:
   \   0000FD   12....       LCALL   ?DEALLOC_XSTACK8
    200                    pBeacon->pSdu = (uint8 *) (pBeacon->pPanDesc + 1);
   \   000100   8E82         MOV     DPL,R6
   \   000102   8F83         MOV     DPH,R7
   \   000104   A3           INC     DPTR
   \   000105   A3           INC     DPTR
   \   000106   A3           INC     DPTR
   \   000107   E0           MOVX    A,@DPTR
   \   000108   2421         ADD     A,#0x21
   \   00010A   F8           MOV     R0,A
   \   00010B   A3           INC     DPTR
   \   00010C   E0           MOVX    A,@DPTR
   \   00010D   12....       LCALL   ?Subroutine4 & 0xFFFF
   \                     ??CrossCallReturnLabel_12:
   \   000110   E8           MOV     A,R0
   \   000111   F0           MOVX    @DPTR,A
   \   000112   A3           INC     DPTR
   \   000113   E9           MOV     A,R1
   \   000114   02....       LJMP    ??MAC_CbackEvent_12 & 0xFFFF
    201                  }
    202                  break;
    203          
    204                case MAC_MLME_SCAN_CNF:
    205                  {
    206                    macMlmeScanCnf_t *pScan = (macMlmeScanCnf_t*)msgPtr;
    207          
    208                    if (ZMac_ScanBuf != NULL)
   \                     ??MAC_CbackEvent_8:
   \   000117   90....       MOV     DPTR,#ZMac_ScanBuf
   \   00011A   E0           MOVX    A,@DPTR
   \   00011B   7002         JNZ     ??MAC_CbackEvent_13
   \   00011D   A3           INC     DPTR
   \   00011E   E0           MOVX    A,@DPTR
   \                     ??MAC_CbackEvent_13:
   \   00011F   7003         JNZ     $+5
   \   000121   02....       LJMP    ??MAC_CbackEvent_11 & 0xFFFF
    209                    {
    210                      if (pScan->scanType == ZMAC_ED_SCAN)
   \   000124   8E82         MOV     DPL,R6
   \   000126   8F83         MOV     DPH,R7
   \   000128   A3           INC     DPTR
   \   000129   A3           INC     DPTR
   \   00012A   E0           MOVX    A,@DPTR
   \   00012B   7026         JNZ     ??MAC_CbackEvent_14
    211                      {
    212                        pScan->result.pEnergyDetect = (uint8*) (pScan + 1);
   \   00012D   12....       LCALL   ?Subroutine5 & 0xFFFF
   \                     ??CrossCallReturnLabel_15:
   \   000130   EE           MOV     A,R6
   \   000131   240B         ADD     A,#0xb
   \   000133   F8           MOV     R0,A
   \   000134   EF           MOV     A,R7
   \   000135   12....       LCALL   ?Subroutine4 & 0xFFFF
   \                     ??CrossCallReturnLabel_13:
   \   000138   E8           MOV     A,R0
   \   000139   F0           MOVX    @DPTR,A
   \   00013A   A3           INC     DPTR
   \   00013B   E9           MOV     A,R1
   \   00013C   12....       LCALL   ?Subroutine0 & 0xFFFF
    213                        osal_memcpy(pScan->result.pEnergyDetect, ZMac_ScanBuf, ZMAC_ED_SCAN_MAXCHANNELS);
   \                     ??CrossCallReturnLabel_0:
   \   00013F   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   000142   7C1B         MOV     R4,#0x1b
   \   000144   7D00         MOV     R5,#0x0
   \   000146   85..82       MOV     DPL,?V0 + 4
   \   000149   85..83       MOV     DPH,?V0 + 5
   \   00014C   E0           MOVX    A,@DPTR
   \   00014D   FA           MOV     R2,A
   \   00014E   A3           INC     DPTR
   \   00014F   E0           MOVX    A,@DPTR
   \   000150   FB           MOV     R3,A
   \   000151   802D         SJMP    ??MAC_CbackEvent_15
    214                      }
    215                      else
    216                      {
    217                        pScan->result.pPanDescriptor = (macPanDesc_t*) (pScan + 1);
   \                     ??MAC_CbackEvent_14:
   \   000153   12....       LCALL   ?Subroutine1 & 0xFFFF
   \                     ??CrossCallReturnLabel_4:
   \   000156   A3           INC     DPTR
   \   000157   A3           INC     DPTR
   \   000158   A3           INC     DPTR
   \   000159   A3           INC     DPTR
   \   00015A   A3           INC     DPTR
   \   00015B   A3           INC     DPTR
   \   00015C   E5..         MOV     A,?V0 + 4
   \   00015E   F0           MOVX    @DPTR,A
   \   00015F   A3           INC     DPTR
   \   000160   E5..         MOV     A,?V0 + 5
   \   000162   12....       LCALL   ?Subroutine0 & 0xFFFF
    218                        osal_memcpy(pScan + 1, ZMac_ScanBuf, sizeof( ZMacPanDesc_t ) * pScan->resultListSize);
   \                     ??CrossCallReturnLabel_1:
   \   000165   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   000168   8E82         MOV     DPL,R6
   \   00016A   8F83         MOV     DPH,R7
   \   00016C   A3           INC     DPTR
   \   00016D   A3           INC     DPTR
   \   00016E   A3           INC     DPTR
   \   00016F   A3           INC     DPTR
   \   000170   A3           INC     DPTR
   \   000171   A3           INC     DPTR
   \   000172   A3           INC     DPTR
   \   000173   A3           INC     DPTR
   \   000174   E0           MOVX    A,@DPTR
   \   000175   75F021       MOV     B,#0x21
   \   000178   A4           MUL     AB
   \   000179   FC           MOV     R4,A
   \   00017A   ADF0         MOV     R5,B
   \   00017C   AA..         MOV     R2,?V0 + 4
   \   00017E   AB..         MOV     R3,?V0 + 5
   \                     ??MAC_CbackEvent_15:
   \   000180   12....       LCALL   ??Subroutine3_1 & 0xFFFF
   \                     ??CrossCallReturnLabel_11:
   \   000183   12....       LCALL   ?DEALLOC_XSTACK8
    219                      }
    220          
    221                      osal_mem_free(ZMac_ScanBuf);
   \   000186                ; Setup parameters for call to function osal_mem_free
   \   000186   90....       MOV     DPTR,#ZMac_ScanBuf
   \   000189   E0           MOVX    A,@DPTR
   \   00018A   FA           MOV     R2,A
   \   00018B   A3           INC     DPTR
   \   00018C   E0           MOVX    A,@DPTR
   \   00018D   FB           MOV     R3,A
   \   00018E   12....       LCALL   ??osal_mem_free?relay
    222                      ZMac_ScanBuf = NULL;
   \   000191   90....       MOV     DPTR,#ZMac_ScanBuf
   \   000194   02....       LJMP    ??CrossCallReturnLabel_19 & 0xFFFF
    223                    }
    224                  }
    225                  break;
    226          
    227                case MAC_MLME_START_CNF:
    228                  msgPtr->hdr.status = pData->startCnf.hdr.status;
   \                     ??MAC_CbackEvent_9:
   \   000197   85..82       MOV     DPL,?V0 + 4
   \   00019A   85..83       MOV     DPH,?V0 + 5
   \   00019D   A3           INC     DPTR
   \   00019E   E0           MOVX    A,@DPTR
   \   00019F   8E82         MOV     DPL,R6
   \   0001A1   8F83         MOV     DPH,R7
   \   0001A3   02....       LJMP    ??MAC_CbackEvent_16 & 0xFFFF
    229                  break;
    230          
    231                case MAC_MCPS_DATA_IND:
    232                  {
    233                    /* Data Ind is unconventional: to save an alloc/copy, reuse the MAC
    234                       buffer and re-organize the contents into ZMAC format. */
    235                    uint16 shortAddr = INVALID_SHORT_ADDR;
   \                     ??MAC_CbackEvent_10:
   \   0001A6   85..82       MOV     DPL,?XSP + 0
   \   0001A9   85..83       MOV     DPH,?XSP + 1
   \   0001AC   74FE         MOV     A,#-0x2
   \   0001AE   F0           MOVX    @DPTR,A
   \   0001AF   A3           INC     DPTR
   \   0001B0   74FF         MOV     A,#-0x1
   \   0001B2   F0           MOVX    @DPTR,A
    236                    ZMacDataInd_t *pDataInd = (ZMacDataInd_t *) pData;
    237                    uint8 event, status, len, *msdu;
    238          
    239                    MAC_MlmeGetReq( MAC_SHORT_ADDRESS, &shortAddr );
   \   0001B3                ; Setup parameters for call to function MAC_MlmeGetReq
   \   0001B3   85..82       MOV     DPL,?XSP + 0
   \   0001B6   85..83       MOV     DPH,?XSP + 1
   \   0001B9   AA82         MOV     R2,DPL
   \   0001BB   AB83         MOV     R3,DPH
   \   0001BD   7953         MOV     R1,#0x53
   \   0001BF   12....       LCALL   ??MAC_MlmeGetReq?relay
    240                    if ( shortAddr == INVALID_SHORT_ADDR || shortAddr == BROADCAST_ADDR )
   \   0001C2   85..82       MOV     DPL,?XSP + 0
   \   0001C5   85..83       MOV     DPH,?XSP + 1
   \   0001C8   E0           MOVX    A,@DPTR
   \   0001C9   64FE         XRL     A,#0xfe
   \   0001CB   7004         JNZ     ??MAC_CbackEvent_17
   \   0001CD   A3           INC     DPTR
   \   0001CE   E0           MOVX    A,@DPTR
   \   0001CF   64FF         XRL     A,#0xff
   \                     ??MAC_CbackEvent_17:
   \   0001D1   6011         JZ      ??MAC_CbackEvent_18
   \   0001D3   85..82       MOV     DPL,?XSP + 0
   \   0001D6   85..83       MOV     DPH,?XSP + 1
   \   0001D9   E0           MOVX    A,@DPTR
   \   0001DA   64FF         XRL     A,#0xff
   \   0001DC   7004         JNZ     ??MAC_CbackEvent_19
   \   0001DE   A3           INC     DPTR
   \   0001DF   E0           MOVX    A,@DPTR
   \   0001E0   64FF         XRL     A,#0xff
   \                     ??MAC_CbackEvent_19:
   \   0001E2   700A         JNZ     ??MAC_CbackEvent_20
    241                    {
    242                      osal_msg_deallocate( (uint8 *)msgPtr );
   \                     ??MAC_CbackEvent_18:
   \   0001E4                ; Setup parameters for call to function osal_msg_deallocate
   \   0001E4   EE           MOV     A,R6
   \   0001E5   FA           MOV     R2,A
   \   0001E6   EF           MOV     A,R7
   \   0001E7   FB           MOV     R3,A
   \   0001E8   12....       LCALL   ??osal_msg_deallocate?relay
    243                      return;
   \   0001EB   02....       LJMP    ??MAC_CbackEvent_1 & 0xFFFF
    244                    }
    245          
    246                    /* Store parameters */
    247                    event = pData->hdr.event;
   \                     ??MAC_CbackEvent_20:
   \   0001EE   85..82       MOV     DPL,?V0 + 4
   \   0001F1   85..83       MOV     DPH,?V0 + 5
   \   0001F4   E0           MOVX    A,@DPTR
   \   0001F5   C0E0         PUSH    A
   \   0001F7   7402         MOV     A,#0x2
   \   0001F9   12....       LCALL   ?XSTACK_DISP0_8
   \   0001FC   D0E0         POP     A
   \   0001FE   12....       LCALL   ?Subroutine6 & 0xFFFF
    248                    status = pData->hdr.status;
   \                     ??CrossCallReturnLabel_16:
   \   000201   E0           MOVX    A,@DPTR
   \   000202   F5..         MOV     ?V0 + 7,A
    249                    len = pData->dataInd.msdu.len;
   \   000204   85..82       MOV     DPL,?V0 + 4
   \   000207   85..83       MOV     DPH,?V0 + 5
   \   00020A   A3           INC     DPTR
   \   00020B   A3           INC     DPTR
   \   00020C   A3           INC     DPTR
   \   00020D   A3           INC     DPTR
   \   00020E   E0           MOVX    A,@DPTR
   \   00020F   F5..         MOV     ?V0 + 3,A
    250                    msdu = pData->dataInd.msdu.p;
   \   000211   85..82       MOV     DPL,?V0 + 4
   \   000214   85..83       MOV     DPH,?V0 + 5
   \   000217   A3           INC     DPTR
   \   000218   A3           INC     DPTR
   \   000219   E0           MOVX    A,@DPTR
   \   00021A   F8           MOV     R0,A
   \   00021B   A3           INC     DPTR
   \   00021C   E0           MOVX    A,@DPTR
   \   00021D   F9           MOV     R1,A
   \   00021E   7403         MOV     A,#0x3
   \   000220   12....       LCALL   ?XSTACK_DISP0_8
   \   000223   E8           MOV     A,R0
   \   000224   F0           MOVX    @DPTR,A
   \   000225   A3           INC     DPTR
   \   000226   E9           MOV     A,R1
   \   000227   F0           MOVX    @DPTR,A
    251          
    252                    /* Copy header */
    253          #if defined ( ZBIT )
    254                    // ZBIT requires two copies to handle 32 bit alignment  
    255                    osal_memcpy(&pDataInd->SrcAddr, &pData->dataInd.mac, sizeof(zAddrType_t) * 2 );
    256                    osal_memcpy(&pDataInd->Timestamp, &pData->dataInd.mac.timestamp, sizeof(macDataInd_t) - sizeof(ZMacEventHdr_t) - sizeof(zAddrType_t) * 2);
    257          #else
    258                    osal_memcpy(&pDataInd->SrcAddr, &pData->dataInd.mac, sizeof(macDataInd_t) - sizeof(ZMacEventHdr_t));
   \   000228                ; Setup parameters for call to function osal_memcpy
   \   000228   E5..         MOV     A,?V0 + 4
   \   00022A   2412         ADD     A,#0x12
   \   00022C   F5..         MOV     ?V0 + 0,A
   \   00022E   E5..         MOV     A,?V0 + 5
   \   000230   3400         ADDC    A,#0x0
   \   000232   F5..         MOV     ?V0 + 1,A
   \   000234   75..00       MOV     ?V0 + 2,#0x0
   \   000237   78..         MOV     R0,#?V0 + 0
   \   000239   12....       LCALL   ?PUSH_XSTACK_I_THREE
   \   00023C   7C1E         MOV     R4,#0x1e
   \   00023E   7D00         MOV     R5,#0x0
   \   000240   E5..         MOV     A,?V0 + 4
   \   000242   2402         ADD     A,#0x2
   \   000244   FA           MOV     R2,A
   \   000245   E5..         MOV     A,?V0 + 5
   \   000247   12....       LCALL   ?Subroutine3 & 0xFFFF
   \                     ??CrossCallReturnLabel_8:
   \   00024A   12....       LCALL   ?DEALLOC_XSTACK8
    259          #endif
    260                    /* Security - set to zero for now */
    261                    pDataInd->Sec.SecurityLevel = false;
   \   00024D   E5..         MOV     A,?V0 + 4
   \   00024F   242A         ADD     A,#0x2a
   \   000251   F582         MOV     DPL,A
   \   000253   E5..         MOV     A,?V0 + 5
   \   000255   3400         ADDC    A,#0x0
   \   000257   F583         MOV     DPH,A
   \   000259   E4           CLR     A
   \   00025A   12....       LCALL   ?Subroutine6 & 0xFFFF
    262          
    263                    /* Restore parameters */
    264                    pDataInd->hdr.Status = status;
   \                     ??CrossCallReturnLabel_17:
   \   00025D   E5..         MOV     A,?V0 + 7
   \   00025F   F0           MOVX    @DPTR,A
    265                    pDataInd->hdr.Event = event;
   \   000260   7402         MOV     A,#0x2
   \   000262   12....       LCALL   ?XSTACK_DISP0_8
   \   000265   E0           MOVX    A,@DPTR
   \   000266   85..82       MOV     DPL,?V0 + 4
   \   000269   85..83       MOV     DPH,?V0 + 5
   \   00026C   F0           MOVX    @DPTR,A
    266                    pDataInd->msduLength = len;
   \   00026D   E5..         MOV     A,?V0 + 4
   \   00026F   242D         ADD     A,#0x2d
   \   000271   F582         MOV     DPL,A
   \   000273   E5..         MOV     A,?V0 + 5
   \   000275   3400         ADDC    A,#0x0
   \   000277   F583         MOV     DPH,A
   \   000279   E5..         MOV     A,?V0 + 3
   \   00027B   F0           MOVX    @DPTR,A
    267          
    268                    if (len)
   \   00027C   6010         JZ      ??MAC_CbackEvent_21
    269                      pDataInd->msdu = msdu;
   \   00027E   7403         MOV     A,#0x3
   \   000280   12....       LCALL   ?XSTACK_DISP0_8
   \   000283   E0           MOVX    A,@DPTR
   \   000284   F8           MOV     R0,A
   \   000285   A3           INC     DPTR
   \   000286   E0           MOVX    A,@DPTR
   \   000287   F9           MOV     R1,A
   \   000288   12....       LCALL   ?Subroutine7 & 0xFFFF
   \                     ??CrossCallReturnLabel_18:
   \   00028B   02....       LJMP    ??CrossCallReturnLabel_12 & 0xFFFF
    270                    else
    271                      pDataInd->msdu = NULL;
   \                     ??MAC_CbackEvent_21:
   \   00028E   12....       LCALL   ?Subroutine7 & 0xFFFF
   \                     ??CrossCallReturnLabel_19:
   \   000291   E4           CLR     A
   \   000292   F0           MOVX    @DPTR,A
   \                     ??MAC_CbackEvent_16:
   \   000293   A3           INC     DPTR
   \                     ??MAC_CbackEvent_12:
   \   000294   F0           MOVX    @DPTR,A
    272          
    273                    break;
    274                  }
    275                }
    276          
    277                msgPtr->hdr.event = zmacCBEventTable[macEvent];
   \                     ??MAC_CbackEvent_11:
   \   000295   E5..         MOV     A,?V0 + 6
   \   000297   24..         ADD     A,#(zmacCBEventTable & 0xff)
   \   000299   F582         MOV     DPL,A
   \   00029B   E4           CLR     A
   \   00029C   34..         ADDC    A,#((zmacCBEventTable >> 8) & 0xff)
   \   00029E   F583         MOV     DPH,A
   \   0002A0   E4           CLR     A
   \   0002A1   93           MOVC    A,@A+DPTR
   \   0002A2   8E82         MOV     DPL,R6
   \   0002A4   8F83         MOV     DPH,R7
   \   0002A6   F0           MOVX    @DPTR,A
    278                osal_msg_send( NWK_TaskID, (uint8 *)msgPtr );
   \   0002A7                ; Setup parameters for call to function osal_msg_send
   \   0002A7   EE           MOV     A,R6
   \   0002A8   FA           MOV     R2,A
   \   0002A9   EF           MOV     A,R7
   \   0002AA   FB           MOV     R3,A
   \   0002AB   90....       MOV     DPTR,#NWK_TaskID
   \   0002AE   E0           MOVX    A,@DPTR
   \   0002AF   F9           MOV     R1,A
   \   0002B0   12....       LCALL   ??osal_msg_send?relay
   \                     ??MAC_CbackEvent_1:
   \   0002B3   7405         MOV     A,#0x5
   \   0002B5   12....       LCALL   ?DEALLOC_XSTACK8
   \   0002B8   7F08         MOV     R7,#0x8
   \   0002BA   02....       LJMP    ?BANKED_LEAVE_XDATA
    279              }
    280            }
    281          #endif
    282          }

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine7:
   \   000000   E5..         MOV     A,?V0 + 4
   \   000002   242E         ADD     A,#0x2e
   \   000004   F582         MOV     DPL,A
   \   000006   E5..         MOV     A,?V0 + 5
   \   000008   3400         ADDC    A,#0x0
   \   00000A   F583         MOV     DPH,A
   \   00000C   22           RET

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

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine5:
   \   000000   EE           MOV     A,R6
   \   000001   2409         ADD     A,#0x9
   \   000003   F5..         MOV     ?V0 + 4,A
   \   000005   EF           MOV     A,R7
   \   000006   3400         ADDC    A,#0x0
   \   000008   F5..         MOV     ?V0 + 5,A
   \   00000A   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine4:
   \   000000   3400         ADDC    A,#0x0
   \   000002   F9           MOV     R1,A
   \   000003   85..82       MOV     DPL,?V0 + 4
   \   000006   85..83       MOV     DPH,?V0 + 5
   \   000009   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine3:
   \   000000   3400         ADDC    A,#0x0
   \                     ??Subroutine3_0:
   \   000002   FB           MOV     R3,A
   \                     ??Subroutine3_1:
   \   000003   12....       LCALL   ??osal_memcpy?relay
   \   000006   7403         MOV     A,#0x3
   \   000008   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine2:
   \   000000   85....       MOV     ?V0 + 0,?V0 + 6
   \   000003   E5..         MOV     A,?V0 + 0
   \   000005   24..         ADD     A,#(zmacCBSizeTable & 0xff)
   \   000007   F582         MOV     DPL,A
   \   000009   E4           CLR     A
   \   00000A   34..         ADDC    A,#((zmacCBSizeTable >> 8) & 0xff)
   \   00000C   F583         MOV     DPH,A
   \   00000E   E4           CLR     A
   \   00000F   93           MOVC    A,@A+DPTR
   \   000010   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine1:
   \   000000   EE           MOV     A,R6
   \   000001   240B         ADD     A,#0xb
   \   000003   F5..         MOV     ?V0 + 4,A
   \   000005   EF           MOV     A,R7
   \   000006   3400         ADDC    A,#0x0
   \   000008   F5..         MOV     ?V0 + 5,A
   \   00000A                ; Setup parameters for call to function osal_memcpy
   \   00000A   8E82         MOV     DPL,R6
   \   00000C   8F83         MOV     DPH,R7
   \   00000E   A3           INC     DPTR
   \   00000F   A3           INC     DPTR
   \   000010   A3           INC     DPTR
   \   000011   22           RET

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine0:
   \   000000   F0           MOVX    @DPTR,A
   \   000001                ; Setup parameters for call to function osal_memcpy
   \   000001                ; Setup parameters for call to function osal_memcpy
   \   000001   90....       MOV     DPTR,#ZMac_ScanBuf
   \                     ??Subroutine0_0:
   \   000004   E0           MOVX    A,@DPTR
   \   000005   F5..         MOV     ?V0 + 0,A
   \   000007   A3           INC     DPTR
   \   000008   E0           MOVX    A,@DPTR
   \   000009   F5..         MOV     ?V0 + 1,A
   \   00000B   75..00       MOV     ?V0 + 2,#0x0
   \   00000E   78..         MOV     R0,#?V0 + 0
   \   000010   22           RET
    283          
    284          /********************************************************************************************************
    285           * @fn       zmacSendMTCallback()
    286           *
    287           * @brief    convert MAC data confirm to ZMac and send to NWK
    288           *
    289           * @param    status -
    290           * @param    msduHandle -
    291           *
    292           * @return   none
    293           ********************************************************************************************************/
    294          

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    295          void zmacSendMTCallback ( macCbackEvent_t *pData )
   \                     zmacSendMTCallback:
    296          {
   \   000000                ; Saved register size: 0
   \   000000                ; Auto size: 0
    297          #ifdef MT_MAC_CB_FUNC
    298          
    299            /* Check if MT has subscribed for this callback If so, pass it as an event to MonitorTest */
    300            switch (pData->hdr.event)
    301            {
    302              case MAC_MLME_ASSOCIATE_IND:
    303                if ( _macCallbackSub & CB_ID_NWK_ASSOCIATE_IND )
    304                  nwk_MTCallbackSubNwkAssociateInd ( (ZMacAssociateInd_t *)pData );
    305                break;
    306          
    307              case MAC_MLME_ASSOCIATE_CNF:
    308                if ( _macCallbackSub & CB_ID_NWK_ASSOCIATE_CNF )
    309                  nwk_MTCallbackSubNwkAssociateCnf ( (ZMacAssociateCnf_t *)pData );
    310                break;
    311          
    312              case MAC_MLME_DISASSOCIATE_IND:
    313                if ( _macCallbackSub & CB_ID_NWK_DISASSOCIATE_IND )
    314                  nwk_MTCallbackSubNwkDisassociateInd ( (ZMacDisassociateInd_t *)pData );
    315                break;
    316          
    317              case MAC_MLME_DISASSOCIATE_CNF:
    318                if ( _macCallbackSub & CB_ID_NWK_DISASSOCIATE_CNF )
    319                  nwk_MTCallbackSubNwkDisassociateCnf ( (ZMacDisassociateCnf_t *)pData );
    320                break;
    321          
    322              case MAC_MLME_BEACON_NOTIFY_IND:
    323                if ( _macCallbackSub & CB_ID_NWK_BEACON_NOTIFY_IND )
    324                  nwk_MTCallbackSubNwkBeaconNotifyInd( (ZMacBeaconNotifyInd_t *)pData );
    325                break;
    326          
    327              case MAC_MLME_ORPHAN_IND:
    328                if ( _macCallbackSub & CB_ID_NWK_ORPHAN_IND )
    329                  nwk_MTCallbackSubNwkOrphanInd( (ZMacOrphanInd_t *) pData );
    330                break;
    331          
    332              case MAC_MLME_SCAN_CNF:
    333                if ( _macCallbackSub & CB_ID_NWK_SCAN_CNF )
    334                {
    335                  pData->scanCnf.result.pEnergyDetect = ZMac_ScanBuf;
    336                  nwk_MTCallbackSubNwkScanCnf ( (ZMacScanCnf_t *) pData );
    337                }
    338          
    339                if (ZMac_ScanBuf != NULL)
    340                {
    341                  osal_mem_free(ZMac_ScanBuf);
    342                  ZMac_ScanBuf = NULL;
    343                }
    344                break;
    345          
    346              case MAC_MLME_START_CNF:
    347                if ( _macCallbackSub & CB_ID_NWK_START_CNF )
    348                  nwk_MTCallbackSubNwkStartCnf ( pData->hdr.status );
    349                break;
    350          
    351              case MAC_MLME_SYNC_LOSS_IND:
    352                if ( _macCallbackSub & CB_ID_NWK_SYNC_LOSS_IND )
    353                 nwk_MTCallbackSubNwkSyncLossInd( (ZMacSyncLossInd_t *) pData );
    354                break;
    355          
    356              case MAC_MLME_POLL_CNF:
    357                if ( _macCallbackSub & CB_ID_NWK_POLL_CNF )
    358                   nwk_MTCallbackSubNwkPollCnf( pData->hdr.status );
    359                break;
    360          
    361              case MAC_MLME_COMM_STATUS_IND:
    362                if ( _macCallbackSub & CB_ID_NWK_COMM_STATUS_IND )
    363                  nwk_MTCallbackSubCommStatusInd ( (ZMacCommStatusInd_t *) pData );
    364                break;
    365          
    366              case MAC_MCPS_DATA_CNF:
    367                osal_msg_deallocate((uint8*)pData->dataCnf.pDataReq);
    368          
    369                if ( _macCallbackSub & CB_ID_NWK_DATA_CNF )
    370                  nwk_MTCallbackSubNwkDataCnf( (ZMacDataCnf_t *) pData );
    371                break;
    372          
    373              case MAC_MCPS_DATA_IND:
    374                  {
    375                    /*
    376                       Data Ind is unconventional: to save an alloc/copy, reuse the MAC
    377                       buffer and re-organize the contents into ZMAC format.
    378                    */
    379                    ZMacDataInd_t *pDataInd = (ZMacDataInd_t *) pData;
    380                    uint8 event, status, len, *msdu;
    381          
    382                    /* Store parameters */
    383                    event = pData->hdr.event;
    384                    status = pData->hdr.status;
    385                    len = pData->dataInd.msdu.len;
    386                    msdu = pData->dataInd.msdu.p;
    387          
    388                    /* Copy header */
    389                    osal_memcpy(&pDataInd->SrcAddr, &pData->dataInd.mac, sizeof(ZMacDataInd_t) - sizeof(ZMacEventHdr_t));
    390          
    391                    /* Security - set to zero for now*/
    392                    pDataInd->Sec.SecurityLevel = false;
    393          
    394                    /* Restore parameters */
    395                    pDataInd->hdr.Status = status;
    396                    pDataInd->hdr.Event = event;
    397                    pDataInd->msduLength = len;
    398          
    399                    if (len)
    400                      pDataInd->msdu = msdu;
    401                    else
    402                      pDataInd->msdu = NULL;
    403          
    404                    if ( _macCallbackSub & CB_ID_NWK_DATA_IND )
    405                      nwk_MTCallbackSubNwkDataInd ( pDataInd );
    406          
    407                    /* free buffer */
    408                    osal_msg_deallocate( (uint8 *) pData );
    409                  }
    410                  break;
    411          
    412              case MAC_MCPS_PURGE_CNF:
    413                if ( _macCallbackSub & CB_ID_NWK_PURGE_CNF )
    414                  nwk_MTCallbackSubNwkPurgeCnf( (ZMacPurgeCnf_t *) pData);
    415                break;
    416          
    417              default:
    418                break;
    419            }
    420          
    421          #endif
    422          }
   \   000000   02....       LJMP    ?BRET
    423          
    424          /********************************************************************************************************
    425           * @fn      MAC_CbackCheckPending
    426           *
    427           * @brief   Return number of pending indirect msg
    428           *
    429           * @param   None
    430           *
    431           * @return  Number of indirect msg holding
    432           ********************************************************************************************************/

   \                                 In  segment BANKED_CODE, align 1, keep-with-next
    433          uint8 MAC_CbackCheckPending(void)
   \                     MAC_CbackCheckPending:
    434          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    435          #if !defined (NONWK) && defined (RTR_NWK)
    436            return (nwkDB_ReturnIndirectHoldingCnt());
   \   000004                ; Setup parameters for call to function nwkDB_ReturnIndirectHoldingCnt
   \   000004   12....       LCALL   ??nwkDB_ReturnIndirectHoldingCnt?relay
   \   000007   02....       LJMP    ?Subroutine8 & 0xFFFF
    437          #else
    438            return (0);
    439          #endif
    440          }

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

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

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

   \                                 In  segment BANK_RELAYS, align 1
   \                     ??MAC_CbackCheckPending?relay:
   \   000000   12....       LCALL   ?BDISPATCH
   \   000003   ......       DC24    MAC_CbackCheckPending
    441          
    442          
    443          /********************************************************************************************************
    444           ********************************************************************************************************/
    445          
    446          

   Maximum stack usage in bytes:

     Function                       ISTACK PSTACK XSTACK
     --------                       ------ ------ ------
     MAC_CbackCheckPending              2      0      0
       -> nwkDB_ReturnIndirectHoldingCnt
                                        4      0      0
     MAC_CbackEvent                     1      0     24
       -> getZMacDynamicSize            0      0     42
       -> osal_msg_deallocate           0      0     42
       -> osal_msg_allocate             0      0     42
       -> osal_memcpy                   0      0     48
       -> osal_memcpy                   0      0     48
       -> osal_memcpy                   0      0     48
       -> osal_memcpy                   0      0     48
       -> osal_memcpy                   0      0     48
       -> osal_mem_free                 0      0     42
       -> MAC_MlmeGetReq                0      0     42
       -> osal_msg_deallocate           0      0     42
       -> osal_memcpy                   0      0     48
       -> osal_msg_send                 0      0     42
     getZMacDynamicSize                 2      0     21
     zmacSendMTCallback                 0      0      0


   Segment part sizes:

     Function/Label                Bytes
     --------------                -----
     zmacCBSizeTable                 17
     getZMacDynamicSize              81
     ?Subroutine8                     7
     zmacCBEventTable                17
     MAC_CbackEvent                 701
     ?Subroutine7                    13
     ?Subroutine6                     9
     ?Subroutine5                    11
     ?Subroutine4                    10
     ?Subroutine3                     9
     ?Subroutine2                    17
     ?Subroutine1                    18
     ?Subroutine0                    17
     zmacSendMTCallback               3
     MAC_CbackCheckPending           10
     ??getZMacDynamicSize?relay       6
     ??MAC_CbackEvent?relay           6
     ??zmacSendMTCallback?relay       6
     ??MAC_CbackCheckPending?relay    6

 
 906 bytes in segment BANKED_CODE
  24 bytes in segment BANK_RELAYS
  34 bytes in segment CODE_C
 
 964 bytes of CODE memory

Errors: none
Warnings: none
