///////////////////////////////////////////////////////////////////////////////
//                                                                            /
// IAR 8051 C/C++ Compiler V7.30B/W32                   12/Jun/2010  16:11:26 /
// 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\Component /
//                          s\zmac\f8w\zmac_cb.c                              /
//    Command line       =  -f "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Proje /
//                          cts\zstack\Samples\Location\CC2430DB\..\..\..\Too /
//                          ls\CC2430DB\f8wRouter.cfg" (-DCPU32MHZ            /
//                          -DFORCE_MAC_NEAR -DROOT=__near_func               /
//                          -DMAC_CFG_APP_PENDING_QUEUE=TRUE -DRTR_NWK        /
//                          -DBLINK_LEDS "-DCONST=const __code"               /
//                          -DGENERIC=__generic) -f "C:\Texas                 /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\Tools\CC2430DB\f /
//                          8wConfig.cfg" (-DSECURE=1                         /
//                          -DDEFAULT_CHANLIST=0x04000000                     /
//                          -DZDAPP_CONFIG_PAN_ID=0x00FF                      /
//                          -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_M /
//                          ASK=0x007F -DBEACON_REQUEST_DELAY=100             /
//                          -DBEACON_REQ_DELAY_MASK=0x00FF                    /
//                          -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_P /
//                          OLLED=3000 -DNWK_INDIRECT_MSG_TIMEOUT=7           /
//                          -DMAX_RREQ_ENTRIES=10 -DAPSC_MAX_FRAME_RETRIES=3  /
//                          -DNWK_MAX_DATA_RETRIES=2                          /
//                          -DMAX_POLL_FAILURE_RETRIES=2 -DMAX_BCAST=9        /
//                          -DAPS_MAX_GROUPS=16 -DMAX_RTG_ENTRIES=20          /
//                          -DNWK_MAX_BINDING_ENTRIES=10                      /
//                          -DMAX_BINDING_CLUSTER_IDS=5                       /
//                          "-DDEFAULT_KEY={0x02, 0x03, 0x05, 0x07, 0x09,     /
//                          0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08,   /
//                          0x0A, 0x0C, 0x0D}" -DRFD_RCVC_ALWAYS_ON=FALSE     /
//                          -DPOLL_RATE=1000 -DQUEUED_POLL_RATE=100           /
//                          -DRESPONSE_POLL_RATE=100) -DREJOIN_POLL_RATE=440  /
//                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Componen /
//                          ts\zmac\f8w\zmac_cb.c" -D CC2430EB -D             /
//                          LOCATION_REFNODE -D xNV_RESTORE -D ZTOOL_P1 -D    /
//                          MT_TASK -D POWER_SAVING -D HAL_UART_BIG_TX_BUF=1  /
//                          -D SPI_MGR_DEFAULT_MAX_TX_BUFF=1024 -D            /
//                          SPI_MGR_DEFAULT_OVERFLOW=1 -lC "C:\Texas          /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\RefNode\List\" -lA        /
//                          "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects /
//                          \zstack\Samples\Location\CC2430DB\RefNode\List\"  /
//                          --diag_suppress Pe001,Pa010 --diag_remark pe550   /
//                          -o "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Proje /
//                          cts\zstack\Samples\Location\CC2430DB\RefNode\Obj\ /
//                          " -e --require_prototypes -z9 --no_code_motion    /
//                          --debug --core=plain --dptr=16,1                  /
//                          --data_model=large --code_model=banked            /
//                          --calling_convention=xdata_reentrant              /
//                          --place_constants=data --nr_virtual_regs 8 -I     /
//                          "C:\Texas Instruments\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\Sa /
//                          mples\Location\CC2430DB\..\SOURCE\" -I "C:\Texas  /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\ZMAIN\TI2430DB\" /
//                           -I "C:\Texas Instruments\ZStack-1.4.3-1.2.1\Proj /
//                          ects\zstack\Samples\Location\CC2430DB\..\..\..\.. /
//                          \..\COMPONENTS\MT\" -I "C:\Texas                  /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \HAL\INCLUDE\" -I "C:\Texas                       /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \HAL\TARGET\CC2430BB\" -I "C:\Texas               /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \OSAL\MCU\CCSOC\" -I "C:\Texas                    /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \OSAL\INCLUDE\" -I "C:\Texas                      /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \STACK\AF\" -I "C:\Texas                          /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \STACK\NWK\" -I "C:\Texas                         /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \STACK\SEC\" -I "C:\Texas                         /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \STACK\SYS\" -I "C:\Texas                         /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \STACK\ZDO\" -I "C:\Texas                         /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \ZMAC\F8W\" -I "C:\Texas                          /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \ZMAC\" -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\Samples\Location\CC2430DB\..\..\..\..\..\ /
//                          COMPONENTS\SERVICES\SDATA\" -I "C:\Texas          /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \MAC\INCLUDE\" -I "C:\Texas                       /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \MAC\HIGH_LEVEL\" -I "C:\Texas                    /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \MAC\LOW_LEVEL\SRF03\" -I "C:\Texas               /
//                          Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Sa /
//                          mples\Location\CC2430DB\..\..\..\..\..\COMPONENTS /
//                          \MAC\LOW_LEVEL\SRF03\SINGLE_CHIP\" -I             /
//                          "C:\Program Files\IAR Systems\Embedded Workbench  /
//                          4.0 Evaluation version\8051\INC\" -I "C:\Program  /
//                          Files\IAR Systems\Embedded Workbench 4.0          /
//                          Evaluation version\8051\INC\CLIB\"                /
//    List file          =  C:\Texas Instruments\ZStack-1.4.3-1.2.1\Projects\ /
//                          zstack\Samples\Location\CC2430DB\RefNode\List\zma /
//                          c_cb.s51                                          /
//                                                                            /
//                                                                            /
///////////////////////////////////////////////////////////////////////////////

        NAME zmac_cb

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

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

        EXTERN ??getZMacDynamicSize?relay
        EXTERN ?ALLOC_XSTACK8
        EXTERN ?BANKED_ENTER_XDATA
        EXTERN ?BANKED_LEAVE_XDATA
        EXTERN ?BDISPATCH
        EXTERN ?BRET
        EXTERN ?DEALLOC_XSTACK8
        EXTERN ?PUSH_XSTACK_I_THREE
        EXTERN ?UC_SWITCH_DENSE
        EXTERN ?UC_SWITCH_SPARSE
        EXTERN ?V0
        EXTERN ?XSP
        EXTERN ?XSTACK_DISP0_8

        PUBLIC ??MAC_CbackCheckPending?relay
        FUNCTION ??MAC_CbackCheckPending?relay,0203H
        PUBLIC ??MAC_CbackEvent?relay
        FUNCTION ??MAC_CbackEvent?relay,0203H
        PUBLIC ??getZMacDynamicSize?relay
        FUNCTION ??getZMacDynamicSize?relay,0203H
        PUBLIC ??zmacSendMTCallback?relay
        FUNCTION ??zmacSendMTCallback?relay,0203H
        PUBLIC MAC_CbackCheckPending
        FUNCTION MAC_CbackCheckPending,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 2, STACK
        PUBLIC MAC_CbackEvent
        FUNCTION MAC_CbackEvent,0a1203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 1, STACK
        LOCFRAME XSTACK, 24, STACK
        PUBLIC getZMacDynamicSize
        FUNCTION getZMacDynamicSize,080203H
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        LOCFRAME ISTACK, 2, STACK
        PUBLIC zmacCBEventTable
        PUBLIC zmacCBSizeTable
        PUBLIC zmacSendMTCallback
        FUNCTION zmacSendMTCallback,0203H
        ARGFRAME XSTACK, 0, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA_SP SP DATA
        CFI StackFrame CFA_PSP16 PSP16 XDATA
        CFI StackFrame CFA_XSP16 XSP16 XDATA
        CFI StaticOverlayFrame CFA_IOVERLAY IOVERLAY
        CFI StaticOverlayFrame CFA_DOVERLAY DOVERLAY
        CFI Resource `PSW.CY`:1, `B.BR0`:1, `B.BR1`:1, `B.BR2`:1, `B.BR3`:1
        CFI Resource `B.BR4`:1, `B.BR5`:1, `B.BR6`:1, `B.BR7`:1, `VB.BR8`:1
        CFI Resource `VB.BR9`:1, `VB.BR10`:1, `VB.BR11`:1, `VB.BR12`:1
        CFI Resource `VB.BR13`:1, `VB.BR14`:1, `VB.BR15`:1, VB:8, B:8, A:8
        CFI Resource PSW:8, DPL0:8, DPH0:8, R0:8, R1:8, R2:8, R3:8, R4:8, R5:8
        CFI Resource R6:8, R7:8, V0:8, V1:8, V2:8, V3:8, V4:8, V5:8, V6:8, V7:8
        CFI Resource SP:8, PSPH:8, PSPL:8, PSP16:16, XSPH:8, XSPL:8, XSP16:16
        CFI VirtualResource ?RET:24
        CFI Resource ?BRET_EXT:8
        CFI VirtualResource ?RET_HIGH:8, ?RET_LOW:8
        CFI ResourceParts PSP16 PSPH, PSPL
        CFI ResourceParts XSP16 XSPH, XSPL
        CFI ResourceParts ?RET ?BRET_EXT, ?RET_HIGH, ?RET_LOW
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 1
        CFI DataAlign -1
        CFI ReturnAddress ?RET CODE
        CFI CFA_DOVERLAY Used
        CFI CFA_IOVERLAY Used
        CFI CFA_SP SP+-3
        CFI CFA_PSP16 PSP16+0
        CFI CFA_XSP16 XSP16+0
        CFI `PSW.CY` SameValue
        CFI `B.BR0` SameValue
        CFI `B.BR1` SameValue
        CFI `B.BR2` SameValue
        CFI `B.BR3` SameValue
        CFI `B.BR4` SameValue
        CFI `B.BR5` SameValue
        CFI `B.BR6` SameValue
        CFI `B.BR7` SameValue
        CFI `VB.BR8` SameValue
        CFI `VB.BR9` SameValue
        CFI `VB.BR10` SameValue
        CFI `VB.BR11` SameValue
        CFI `VB.BR12` SameValue
        CFI `VB.BR13` SameValue
        CFI `VB.BR14` SameValue
        CFI `VB.BR15` SameValue
        CFI VB SameValue
        CFI B Undefined
        CFI A Undefined
        CFI PSW SameValue
        CFI DPL0 SameValue
        CFI DPH0 SameValue
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 Undefined
        CFI R5 Undefined
        CFI R6 SameValue
        CFI R7 SameValue
        CFI V0 SameValue
        CFI V1 SameValue
        CFI V2 SameValue
        CFI V3 SameValue
        CFI V4 SameValue
        CFI V5 SameValue
        CFI V6 SameValue
        CFI V7 SameValue
        CFI PSPH Undefined
        CFI PSPL Undefined
        CFI XSPH Undefined
        CFI XSPL Undefined
        CFI ?RET Concat
        CFI ?BRET_EXT Frame(CFA_SP, 3)
        CFI ?RET_HIGH Frame(CFA_SP, 2)
        CFI ?RET_LOW Frame(CFA_SP, 1)
        CFI EndCommon cfiCommon0
        
        
        CFI Common cfiCommon1 Using cfiNames0
        CFI CodeAlign 1
        CFI DataAlign -1
        CFI ReturnAddress ?RET CODE
        CFI CFA_DOVERLAY Used
        CFI CFA_IOVERLAY Used
        CFI CFA_SP SP+-2
        CFI CFA_PSP16 PSP16+0
        CFI CFA_XSP16 XSP16+0
        CFI `PSW.CY` SameValue
        CFI `B.BR0` SameValue
        CFI `B.BR1` SameValue
        CFI `B.BR2` SameValue
        CFI `B.BR3` SameValue
        CFI `B.BR4` SameValue
        CFI `B.BR5` SameValue
        CFI `B.BR6` SameValue
        CFI `B.BR7` SameValue
        CFI `VB.BR8` SameValue
        CFI `VB.BR9` SameValue
        CFI `VB.BR10` SameValue
        CFI `VB.BR11` SameValue
        CFI `VB.BR12` SameValue
        CFI `VB.BR13` SameValue
        CFI `VB.BR14` SameValue
        CFI `VB.BR15` SameValue
        CFI VB SameValue
        CFI B SameValue
        CFI A SameValue
        CFI PSW SameValue
        CFI DPL0 SameValue
        CFI DPH0 SameValue
        CFI R0 SameValue
        CFI R1 SameValue
        CFI R2 SameValue
        CFI R3 SameValue
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI V0 SameValue
        CFI V1 SameValue
        CFI V2 SameValue
        CFI V3 SameValue
        CFI V4 SameValue
        CFI V5 SameValue
        CFI V6 SameValue
        CFI V7 SameValue
        CFI PSPH Undefined
        CFI PSPL Undefined
        CFI XSPH Undefined
        CFI XSPL Undefined
        CFI ?RET Concat
        CFI ?BRET_EXT SameValue
        CFI ?RET_HIGH Frame(CFA_SP, 2)
        CFI ?RET_LOW Frame(CFA_SP, 1)
        CFI EndCommon cfiCommon1
        
osal_msg_deallocate SYMBOL "osal_msg_deallocate"
osal_msg_allocate   SYMBOL "osal_msg_allocate"
osal_memcpy         SYMBOL "osal_memcpy"
osal_mem_free       SYMBOL "osal_mem_free"
MAC_MlmeGetReq      SYMBOL "MAC_MlmeGetReq"
osal_msg_send       SYMBOL "osal_msg_send"
nwkDB_ReturnIndirectHoldingCnt SYMBOL "nwkDB_ReturnIndirectHoldingCnt"
??MAC_MlmeGetReq?relay SYMBOL "?relay", MAC_MlmeGetReq
??nwkDB_ReturnIndirectHoldingCnt?relay SYMBOL "?relay", nwkDB_ReturnIndirectHoldingCnt
??osal_mem_free?relay SYMBOL "?relay", osal_mem_free
??osal_memcpy?relay SYMBOL "?relay", osal_memcpy
??osal_msg_allocate?relay SYMBOL "?relay", osal_msg_allocate
??osal_msg_deallocate?relay SYMBOL "?relay", osal_msg_deallocate
??osal_msg_send?relay SYMBOL "?relay", osal_msg_send
MAC_CbackCheckPending SYMBOL "MAC_CbackCheckPending"
??MAC_CbackCheckPending?relay SYMBOL "?relay", MAC_CbackCheckPending
MAC_CbackEvent      SYMBOL "MAC_CbackEvent"
??MAC_CbackEvent?relay SYMBOL "?relay", MAC_CbackEvent
getZMacDynamicSize  SYMBOL "getZMacDynamicSize"
??getZMacDynamicSize?relay SYMBOL "?relay", getZMacDynamicSize
zmacSendMTCallback  SYMBOL "zmacSendMTCallback"
??zmacSendMTCallback?relay SYMBOL "?relay", zmacSendMTCallback

        EXTERN osal_msg_deallocate
        FUNCTION osal_msg_deallocate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_msg_allocate
        FUNCTION osal_msg_allocate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_memcpy
        FUNCTION osal_memcpy,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_mem_free
        FUNCTION osal_mem_free,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN MAC_MlmeGetReq
        FUNCTION MAC_MlmeGetReq,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_msg_send
        FUNCTION osal_msg_send,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN nwkDB_ReturnIndirectHoldingCnt
        FUNCTION nwkDB_ReturnIndirectHoldingCnt,0202H
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ??MAC_MlmeGetReq?relay
        FUNCTION ??MAC_MlmeGetReq?relay,00H
        EXTERN ??nwkDB_ReturnIndirectHoldingCnt?relay
        FUNCTION ??nwkDB_ReturnIndirectHoldingCnt?relay,00H
        EXTERN ??osal_mem_free?relay
        FUNCTION ??osal_mem_free?relay,00H
        EXTERN ??osal_memcpy?relay
        FUNCTION ??osal_memcpy?relay,00H
        EXTERN ??osal_msg_allocate?relay
        FUNCTION ??osal_msg_allocate?relay,00H
        EXTERN ??osal_msg_deallocate?relay
        FUNCTION ??osal_msg_deallocate?relay,00H
        EXTERN ??osal_msg_send?relay
        FUNCTION ??osal_msg_send?relay,00H
        EXTERN NWK_TaskID
        EXTERN ZMac_ScanBuf

// 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 */

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
        DATA
//   76 const uint8 CODE zmacCBSizeTable [] = {
zmacCBSizeTable:
        DB 0, 22, 15, 22, 13, 11, 21, 11, 2, 17, 2, 34, 11, 48, 3, 0, 6
//   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);

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  100 uint16 getZMacDynamicSize(uint8 event, macCbackEvent_t *pData)
getZMacDynamicSize:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function getZMacDynamicSize
//  101 {
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  102   switch(event)
        MOV     A,R1
        LCALL   ?UC_SWITCH_DENSE
`?<Jumptable for getZMacDynamicSize>_0`:
        DATA
        DB        5
        DB        2
        DW        ??getZMacDynamicSize_0
        DW        ??getZMacDynamicSize_1
        DW        ??getZMacDynamicSize_0
        DW        ??getZMacDynamicSize_2
        CODE
//  103   {
//  104   case MAC_MLME_BEACON_NOTIFY_IND:
//  105     return sizeof(macPanDesc_t) + pData->beaconNotifyInd.sduLength;
??getZMacDynamicSize_1:
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R0,A
        MOV     A,#0x21
        ADD     A,R0
        MOV     R2,A
        CLR     A
        ADDC    A,#0x0
        MOV     R3,A
        SJMP    ??getZMacDynamicSize_3
//  106   case MAC_MLME_SCAN_CNF:
//  107     if (pData->scanCnf.scanType == ZMAC_ED_SCAN)
??getZMacDynamicSize_2:
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        JNZ     ??getZMacDynamicSize_4
//  108       return ZMAC_ED_SCAN_MAXCHANNELS;
        MOV     R2,#0x1b
        SJMP    ??getZMacDynamicSize_5
//  109     else
//  110       return sizeof( ZMacPanDesc_t ) * pData->scanCnf.resultListSize;
??getZMacDynamicSize_4:
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     B,#0x21
        MUL     AB
        MOV     R2,A
        MOV     R3,B
        SJMP    ??getZMacDynamicSize_3
//  111   }
//  112 
//  113   return 0;
??getZMacDynamicSize_0:
        MOV     R2,#0x0
??getZMacDynamicSize_5:
        MOV     R3,#0x0
        CFI EndBlock cfiBlock0
??getZMacDynamicSize_3:
        REQUIRE ?Subroutine8
        ; // Fall through to label ?Subroutine8
//  114 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine8:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+-5
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        POP     DPH
        CFI CFA_SP SP+-4
        CFI DPH0 SameValue
        POP     DPL
        CFI CFA_SP SP+-3
        CFI DPL0 SameValue
        LJMP    ?BRET
        CFI EndBlock cfiBlock1
//  115 

        RSEG CODE_C:CODE:REORDER:NOROOT(0)
        DATA
//  116 const uint8 CODE zmacCBEventTable [] = {
zmacCBEventTable:
        DB 255, 34, 35, 36, 42, 38, 41, 37, 49, 50, 51, 55, 32, 33, 54, 255, 65
//  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  ********************************************************************************************************/

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  161 void  MAC_CbackEvent(macCbackEvent_t *pData)
MAC_CbackEvent:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function MAC_CbackEvent
//  162 {
        FUNCALL MAC_CbackEvent, getZMacDynamicSize
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_msg_deallocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_msg_allocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_mem_free
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, MAC_MlmeGetReq
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_msg_deallocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 24, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 24, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL MAC_CbackEvent, osal_msg_send
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 21, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 21, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0x10
        LCALL   ?BANKED_ENTER_XDATA
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 16)
        ; Saved register size: 16
        ; Auto size: 5
        MOV     A,#-0x5
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 21)
        MOV     ?V0 + 4,R2
        MOV     ?V0 + 5,R3
//  163 #ifdef MT_MAC_CB_FUNC
//  164   zmacSendMTCallback ( pData );
//  165 #elif !defined NONWK
//  166 
//  167   uint8 macEvent = pData->hdr.event;
        MOV     DPL,R2
        MOV     DPH,R3
        MOVX    A,@DPTR
        MOV     ?V0 + 6,A
//  168   uint16 msgLen = zmacCBSizeTable[macEvent] + getZMacDynamicSize(macEvent, pData);
        ; Setup parameters for call to function getZMacDynamicSize
        MOV     R1,A
        LCALL   ??getZMacDynamicSize?relay
        MOV     ?V0 + 0,R2
        MOV     R0,?V0 + 0
        LCALL   ?Subroutine2 & 0xFFFF
??CrossCallReturnLabel_5:
        MOV     R2,A
        MOV     A,R0
        ADD     A,R2
        MOV     R6,A
        MOV     A,R3
        ADDC    A,#0x0
        MOV     R7,A
//  169   macCbackEvent_t *msgPtr;
//  170 
//  171   /* Allocate osal msg buffer */
//  172   if (msgLen > 0)
        MOV     A,R6
        JNZ     ??MAC_CbackEvent_0
        MOV     A,R7
??MAC_CbackEvent_0:
        JNZ     $+5
        LJMP    ??MAC_CbackEvent_1 & 0xFFFF
//  173   {
//  174     if (macEvent == MAC_MCPS_DATA_IND)
        MOV     A,#0xd
        XRL     A,?V0 + 6
        JNZ     ??MAC_CbackEvent_2
//  175       msgPtr = pData;
        MOV     R6,?V0 + 4
        MOV     R7,?V0 + 5
        SJMP    ??MAC_CbackEvent_3
//  176     else
//  177     {
//  178       if ( macEvent == MAC_MCPS_DATA_CNF )
??MAC_CbackEvent_2:
        MOV     A,#0xc
        XRL     A,?V0 + 6
        JNZ     ??MAC_CbackEvent_4
//  179       {
//  180         osal_msg_deallocate( (uint8*)pData->dataCnf.pDataReq );
        ; Setup parameters for call to function osal_msg_deallocate
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R2,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R3,A
        LCALL   ??osal_msg_deallocate?relay
//  181       }
//  182       msgPtr = (macCbackEvent_t *)osal_msg_allocate(msgLen);
??MAC_CbackEvent_4:
        ; Setup parameters for call to function osal_msg_allocate
        MOV     A,R6
        MOV     R2,A
        MOV     A,R7
        MOV     R3,A
        LCALL   ??osal_msg_allocate?relay
        MOV     ?V0 + 0,R2
        MOV     ?V0 + 1,R3
        MOV     R6,?V0 + 0
        MOV     R7,?V0 + 1
//  183     }
//  184 
//  185     if (msgPtr)
??MAC_CbackEvent_3:
        MOV     A,R6
        JNZ     ??MAC_CbackEvent_5
        MOV     A,R7
??MAC_CbackEvent_5:
        JNZ     $+5
        LJMP    ??MAC_CbackEvent_1 & 0xFFFF
//  186     {
//  187       if (macEvent != MAC_MCPS_DATA_IND)
        MOV     A,#0xd
        XRL     A,?V0 + 6
        JZ      ??MAC_CbackEvent_6
//  188         osal_memcpy(msgPtr, pData, zmacCBSizeTable[macEvent]);
        ; Setup parameters for call to function osal_memcpy
        MOV     ?V0 + 0,?V0 + 4
        MOV     ?V0 + 1,?V0 + 5
        MOV     ?V0 + 2,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 24)
        LCALL   ?Subroutine2 & 0xFFFF
??CrossCallReturnLabel_6:
        MOV     R4,A
        MOV     R5,#0x0
        MOV     A,R6
        MOV     R2,A
        MOV     A,R7
        LCALL   ??Subroutine3_0 & 0xFFFF
??CrossCallReturnLabel_9:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 21)
//  189 
//  190       switch (macEvent) {
??MAC_CbackEvent_6:
        MOV     A,?V0 + 6
        LCALL   ?UC_SWITCH_SPARSE
`?<Jumptable for MAC_CbackEvent>_0`:
        DATA
        DB        0
        DB        4
        DB        5
        DW        ??MAC_CbackEvent_7
        DB        7
        DW        ??MAC_CbackEvent_8
        DB        8
        DW        ??MAC_CbackEvent_9
        DB        13
        DW        ??MAC_CbackEvent_10
        DW        ??MAC_CbackEvent_11
        CODE
??MAC_CbackEvent_7:
        LCALL   ?Subroutine1 & 0xFFFF
??CrossCallReturnLabel_3:
        LCALL   ??Subroutine0_0 & 0xFFFF
??CrossCallReturnLabel_2:
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 24)
        MOV     R4,#0x21
        MOV     R5,#0x0
        MOV     R2,?V0 + 4
        MOV     R3,?V0 + 5
        LCALL   ??Subroutine3_1 & 0xFFFF
??CrossCallReturnLabel_10:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 21)
//  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);
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOV     A,?V0 + 4
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,?V0 + 5
        MOVX    @DPTR,A
//  199           osal_memcpy(pBeacon->pPanDesc + 1, pBeacon->pSdu, pBeacon->sduLength);
        LCALL   ?Subroutine5 & 0xFFFF
??CrossCallReturnLabel_14:
        ; Setup parameters for call to function osal_memcpy
        MOV     DPL,?V0 + 4
        MOV     DPH,A
        MOVX    A,@DPTR
        MOV     ?V0 + 0,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     ?V0 + 1,A
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 24)
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R4,A
        MOV     R5,#0x0
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        ADD     A,#0x21
        MOV     R2,A
        INC     DPTR
        MOVX    A,@DPTR
        LCALL   ?Subroutine3 & 0xFFFF
??CrossCallReturnLabel_7:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 21)
//  200           pBeacon->pSdu = (uint8 *) (pBeacon->pPanDesc + 1);
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        ADD     A,#0x21
        MOV     R0,A
        INC     DPTR
        MOVX    A,@DPTR
        LCALL   ?Subroutine4 & 0xFFFF
??CrossCallReturnLabel_12:
        MOV     A,R0
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R1
        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:
        MOV     DPTR,#ZMac_ScanBuf
        MOVX    A,@DPTR
        JNZ     ??MAC_CbackEvent_13
        INC     DPTR
        MOVX    A,@DPTR
??MAC_CbackEvent_13:
        JNZ     $+5
        LJMP    ??MAC_CbackEvent_11 & 0xFFFF
//  209           {
//  210             if (pScan->scanType == ZMAC_ED_SCAN)
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        JNZ     ??MAC_CbackEvent_14
//  211             {
//  212               pScan->result.pEnergyDetect = (uint8*) (pScan + 1);
        LCALL   ?Subroutine5 & 0xFFFF
??CrossCallReturnLabel_15:
        MOV     A,R6
        ADD     A,#0xb
        MOV     R0,A
        MOV     A,R7
        LCALL   ?Subroutine4 & 0xFFFF
??CrossCallReturnLabel_13:
        MOV     A,R0
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R1
        LCALL   ?Subroutine0 & 0xFFFF
//  213               osal_memcpy(pScan->result.pEnergyDetect, ZMac_ScanBuf, ZMAC_ED_SCAN_MAXCHANNELS);
??CrossCallReturnLabel_0:
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 24)
        MOV     R4,#0x1b
        MOV     R5,#0x0
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        MOVX    A,@DPTR
        MOV     R2,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R3,A
        SJMP    ??MAC_CbackEvent_15
        CFI CFA_XSP16 add(XSP16, 21)
//  214             }
//  215             else
//  216             {
//  217               pScan->result.pPanDescriptor = (macPanDesc_t*) (pScan + 1);
??MAC_CbackEvent_14:
        LCALL   ?Subroutine1 & 0xFFFF
??CrossCallReturnLabel_4:
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOV     A,?V0 + 4
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,?V0 + 5
        LCALL   ?Subroutine0 & 0xFFFF
//  218               osal_memcpy(pScan + 1, ZMac_ScanBuf, sizeof( ZMacPanDesc_t ) * pScan->resultListSize);
??CrossCallReturnLabel_1:
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 24)
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     B,#0x21
        MUL     AB
        MOV     R4,A
        MOV     R5,B
        MOV     R2,?V0 + 4
        MOV     R3,?V0 + 5
??MAC_CbackEvent_15:
        LCALL   ??Subroutine3_1 & 0xFFFF
??CrossCallReturnLabel_11:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 21)
//  219             }
//  220 
//  221             osal_mem_free(ZMac_ScanBuf);
        ; Setup parameters for call to function osal_mem_free
        MOV     DPTR,#ZMac_ScanBuf
        MOVX    A,@DPTR
        MOV     R2,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R3,A
        LCALL   ??osal_mem_free?relay
//  222             ZMac_ScanBuf = NULL;
        MOV     DPTR,#ZMac_ScanBuf
        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:
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        INC     DPTR
        MOVX    A,@DPTR
        MOV     DPL,R6
        MOV     DPH,R7
        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:
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     A,#-0x2
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,#-0x1
        MOVX    @DPTR,A
//  236           ZMacDataInd_t *pDataInd = (ZMacDataInd_t *) pData;
//  237           uint8 event, status, len, *msdu;
//  238 
//  239           MAC_MlmeGetReq( MAC_SHORT_ADDRESS, &shortAddr );
        ; Setup parameters for call to function MAC_MlmeGetReq
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     R2,DPL
        MOV     R3,DPH
        MOV     R1,#0x53
        LCALL   ??MAC_MlmeGetReq?relay
//  240           if ( shortAddr == INVALID_SHORT_ADDR || shortAddr == BROADCAST_ADDR )
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOVX    A,@DPTR
        XRL     A,#0xfe
        JNZ     ??MAC_CbackEvent_17
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??MAC_CbackEvent_17:
        JZ      ??MAC_CbackEvent_18
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOVX    A,@DPTR
        XRL     A,#0xff
        JNZ     ??MAC_CbackEvent_19
        INC     DPTR
        MOVX    A,@DPTR
        XRL     A,#0xff
??MAC_CbackEvent_19:
        JNZ     ??MAC_CbackEvent_20
//  241           {
//  242             osal_msg_deallocate( (uint8 *)msgPtr );
??MAC_CbackEvent_18:
        ; Setup parameters for call to function osal_msg_deallocate
        MOV     A,R6
        MOV     R2,A
        MOV     A,R7
        MOV     R3,A
        LCALL   ??osal_msg_deallocate?relay
//  243             return;
        LJMP    ??MAC_CbackEvent_1 & 0xFFFF
//  244           }
//  245 
//  246           /* Store parameters */
//  247           event = pData->hdr.event;
??MAC_CbackEvent_20:
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        MOVX    A,@DPTR
        PUSH    A
        CFI CFA_SP SP+-1
        MOV     A,#0x2
        LCALL   ?XSTACK_DISP0_8
        POP     A
        CFI CFA_SP SP+0
        LCALL   ?Subroutine6 & 0xFFFF
//  248           status = pData->hdr.status;
??CrossCallReturnLabel_16:
        MOVX    A,@DPTR
        MOV     ?V0 + 7,A
//  249           len = pData->dataInd.msdu.len;
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     ?V0 + 3,A
//  250           msdu = pData->dataInd.msdu.p;
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        INC     DPTR
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R0,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R1,A
        MOV     A,#0x3
        LCALL   ?XSTACK_DISP0_8
        MOV     A,R0
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R1
        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));
        ; Setup parameters for call to function osal_memcpy
        MOV     A,?V0 + 4
        ADD     A,#0x12
        MOV     ?V0 + 0,A
        MOV     A,?V0 + 5
        ADDC    A,#0x0
        MOV     ?V0 + 1,A
        MOV     ?V0 + 2,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 24)
        MOV     R4,#0x1e
        MOV     R5,#0x0
        MOV     A,?V0 + 4
        ADD     A,#0x2
        MOV     R2,A
        MOV     A,?V0 + 5
        LCALL   ?Subroutine3 & 0xFFFF
??CrossCallReturnLabel_8:
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 21)
//  259 #endif
//  260           /* Security - set to zero for now */
//  261           pDataInd->Sec.SecurityLevel = false;
        MOV     A,?V0 + 4
        ADD     A,#0x2a
        MOV     DPL,A
        MOV     A,?V0 + 5
        ADDC    A,#0x0
        MOV     DPH,A
        CLR     A
        LCALL   ?Subroutine6 & 0xFFFF
//  262 
//  263           /* Restore parameters */
//  264           pDataInd->hdr.Status = status;
??CrossCallReturnLabel_17:
        MOV     A,?V0 + 7
        MOVX    @DPTR,A
//  265           pDataInd->hdr.Event = event;
        MOV     A,#0x2
        LCALL   ?XSTACK_DISP0_8
        MOVX    A,@DPTR
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        MOVX    @DPTR,A
//  266           pDataInd->msduLength = len;
        MOV     A,?V0 + 4
        ADD     A,#0x2d
        MOV     DPL,A
        MOV     A,?V0 + 5
        ADDC    A,#0x0
        MOV     DPH,A
        MOV     A,?V0 + 3
        MOVX    @DPTR,A
//  267 
//  268           if (len)
        JZ      ??MAC_CbackEvent_21
//  269             pDataInd->msdu = msdu;
        MOV     A,#0x3
        LCALL   ?XSTACK_DISP0_8
        MOVX    A,@DPTR
        MOV     R0,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ?Subroutine7 & 0xFFFF
??CrossCallReturnLabel_18:
        LJMP    ??CrossCallReturnLabel_12 & 0xFFFF
//  270           else
//  271             pDataInd->msdu = NULL;
??MAC_CbackEvent_21:
        LCALL   ?Subroutine7 & 0xFFFF
??CrossCallReturnLabel_19:
        CLR     A
        MOVX    @DPTR,A
??MAC_CbackEvent_16:
        INC     DPTR
??MAC_CbackEvent_12:
        MOVX    @DPTR,A
//  272 
//  273           break;
//  274         }
//  275       }
//  276 
//  277       msgPtr->hdr.event = zmacCBEventTable[macEvent];
??MAC_CbackEvent_11:
        MOV     A,?V0 + 6
        ADD     A,#(zmacCBEventTable & 0xff)
        MOV     DPL,A
        CLR     A
        ADDC    A,#((zmacCBEventTable >> 8) & 0xff)
        MOV     DPH,A
        CLR     A
        MOVC    A,@A+DPTR
        MOV     DPL,R6
        MOV     DPH,R7
        MOVX    @DPTR,A
//  278       osal_msg_send( NWK_TaskID, (uint8 *)msgPtr );
        ; Setup parameters for call to function osal_msg_send
        MOV     A,R6
        MOV     R2,A
        MOV     A,R7
        MOV     R3,A
        MOV     DPTR,#NWK_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_msg_send?relay
??MAC_CbackEvent_1:
        MOV     A,#0x5
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 16)
        MOV     R7,#0x8
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock2
//  279     }
//  280   }
//  281 #endif
//  282 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine7:
        CFI Block cfiCond3 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_18
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond4 Using cfiCommon0
        CFI (cfiCond4) NoFunction
        CFI (cfiCond4) Conditional ??CrossCallReturnLabel_19
        CFI (cfiCond4) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond4) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond4) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond4) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond4) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond4) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond4) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond4) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond4) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond4) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond4) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond4) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond4) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond4) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond4) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond4) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond4) CFA_SP SP+0
        CFI (cfiCond4) CFA_XSP16 add(XSP16, 21)
        CFI Block cfiPicker5 Using cfiCommon1
        CFI (cfiPicker5) NoFunction
        CFI (cfiPicker5) Picker
        MOV     A,?V0 + 4
        ADD     A,#0x2e
        MOV     DPL,A
        MOV     A,?V0 + 5
        ADDC    A,#0x0
        MOV     DPH,A
        RET
        CFI EndBlock cfiCond3
        CFI EndBlock cfiCond4
        CFI EndBlock cfiPicker5

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine6:
        CFI Block cfiCond6 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_16
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond7 Using cfiCommon0
        CFI (cfiCond7) NoFunction
        CFI (cfiCond7) Conditional ??CrossCallReturnLabel_17
        CFI (cfiCond7) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond7) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond7) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond7) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond7) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond7) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond7) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond7) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond7) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond7) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond7) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond7) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond7) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond7) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond7) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond7) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond7) CFA_SP SP+0
        CFI (cfiCond7) CFA_XSP16 add(XSP16, 21)
        CFI Block cfiPicker8 Using cfiCommon1
        CFI (cfiPicker8) NoFunction
        CFI (cfiPicker8) Picker
        MOVX    @DPTR,A
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        INC     DPTR
        RET
        CFI EndBlock cfiCond6
        CFI EndBlock cfiCond7
        CFI EndBlock cfiPicker8

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine5:
        CFI Block cfiCond9 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_14
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond10 Using cfiCommon0
        CFI (cfiCond10) NoFunction
        CFI (cfiCond10) Conditional ??CrossCallReturnLabel_15
        CFI (cfiCond10) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond10) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond10) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond10) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond10) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond10) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond10) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond10) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond10) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond10) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond10) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond10) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond10) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond10) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond10) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond10) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond10) CFA_SP SP+0
        CFI (cfiCond10) CFA_XSP16 add(XSP16, 21)
        CFI Block cfiPicker11 Using cfiCommon1
        CFI (cfiPicker11) NoFunction
        CFI (cfiPicker11) Picker
        MOV     A,R6
        ADD     A,#0x9
        MOV     ?V0 + 4,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     ?V0 + 5,A
        RET
        CFI EndBlock cfiCond9
        CFI EndBlock cfiCond10
        CFI EndBlock cfiPicker11

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine4:
        CFI Block cfiCond12 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_12
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond13 Using cfiCommon0
        CFI (cfiCond13) NoFunction
        CFI (cfiCond13) Conditional ??CrossCallReturnLabel_13
        CFI (cfiCond13) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond13) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond13) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond13) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond13) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond13) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond13) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond13) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond13) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond13) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond13) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond13) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond13) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond13) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond13) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond13) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond13) CFA_SP SP+0
        CFI (cfiCond13) CFA_XSP16 add(XSP16, 21)
        CFI Block cfiPicker14 Using cfiCommon1
        CFI (cfiPicker14) NoFunction
        CFI (cfiPicker14) Picker
        ADDC    A,#0x0
        MOV     R1,A
        MOV     DPL,?V0 + 4
        MOV     DPH,?V0 + 5
        RET
        CFI EndBlock cfiCond12
        CFI EndBlock cfiCond13
        CFI EndBlock cfiPicker14

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine3:
        CFI Block cfiCond15 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_7
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 24)
        CFI Block cfiCond16 Using cfiCommon0
        CFI (cfiCond16) NoFunction
        CFI (cfiCond16) Conditional ??CrossCallReturnLabel_8
        CFI (cfiCond16) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond16) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond16) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond16) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond16) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond16) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond16) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond16) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond16) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond16) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond16) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond16) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond16) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond16) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond16) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond16) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond16) CFA_SP SP+0
        CFI (cfiCond16) CFA_XSP16 add(XSP16, 24)
        CFI Block cfiPicker17 Using cfiCommon1
        CFI (cfiPicker17) NoFunction
        CFI (cfiPicker17) Picker
        ADDC    A,#0x0
        CFI Block cfiCond18 Using cfiCommon0
        CFI (cfiCond18) NoFunction
        CFI (cfiCond18) Conditional ??CrossCallReturnLabel_9
        CFI (cfiCond18) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond18) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond18) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond18) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond18) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond18) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond18) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond18) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond18) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond18) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond18) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond18) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond18) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond18) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond18) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond18) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond18) CFA_SP SP+0
        CFI (cfiCond18) CFA_XSP16 add(XSP16, 24)
??Subroutine3_0:
        MOV     R3,A
        CFI Block cfiCond19 Using cfiCommon0
        CFI (cfiCond19) NoFunction
        CFI (cfiCond19) Conditional ??CrossCallReturnLabel_10
        CFI (cfiCond19) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond19) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond19) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond19) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond19) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond19) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond19) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond19) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond19) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond19) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond19) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond19) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond19) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond19) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond19) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond19) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond19) CFA_SP SP+0
        CFI (cfiCond19) CFA_XSP16 add(XSP16, 24)
        CFI Block cfiCond20 Using cfiCommon0
        CFI (cfiCond20) NoFunction
        CFI (cfiCond20) Conditional ??CrossCallReturnLabel_11
        CFI (cfiCond20) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond20) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond20) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond20) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond20) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond20) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond20) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond20) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond20) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond20) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond20) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond20) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond20) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond20) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond20) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond20) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond20) CFA_SP SP+0
        CFI (cfiCond20) CFA_XSP16 add(XSP16, 24)
??Subroutine3_1:
        LCALL   ??osal_memcpy?relay
        MOV     A,#0x3
        RET
        CFI EndBlock cfiCond15
        CFI EndBlock cfiCond16
        CFI EndBlock cfiPicker17
        CFI EndBlock cfiCond18
        CFI EndBlock cfiCond19
        CFI EndBlock cfiCond20

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine2:
        CFI Block cfiCond21 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_5
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond22 Using cfiCommon0
        CFI (cfiCond22) NoFunction
        CFI (cfiCond22) Conditional ??CrossCallReturnLabel_6
        CFI (cfiCond22) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond22) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond22) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond22) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond22) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond22) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond22) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond22) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond22) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond22) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond22) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond22) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond22) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond22) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond22) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond22) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond22) CFA_SP SP+0
        CFI (cfiCond22) CFA_XSP16 add(XSP16, 24)
        CFI Block cfiPicker23 Using cfiCommon1
        CFI (cfiPicker23) NoFunction
        CFI (cfiPicker23) Picker
        MOV     ?V0 + 0,?V0 + 6
        MOV     A,?V0 + 0
        ADD     A,#(zmacCBSizeTable & 0xff)
        MOV     DPL,A
        CLR     A
        ADDC    A,#((zmacCBSizeTable >> 8) & 0xff)
        MOV     DPH,A
        CLR     A
        MOVC    A,@A+DPTR
        RET
        CFI EndBlock cfiCond21
        CFI EndBlock cfiCond22
        CFI EndBlock cfiPicker23

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine1:
        CFI Block cfiCond24 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_3
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond25 Using cfiCommon0
        CFI (cfiCond25) NoFunction
        CFI (cfiCond25) Conditional ??CrossCallReturnLabel_4
        CFI (cfiCond25) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond25) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond25) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond25) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond25) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond25) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond25) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond25) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond25) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond25) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond25) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond25) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond25) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond25) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond25) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond25) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond25) CFA_SP SP+0
        CFI (cfiCond25) CFA_XSP16 add(XSP16, 21)
        CFI Block cfiPicker26 Using cfiCommon1
        CFI (cfiPicker26) NoFunction
        CFI (cfiPicker26) Picker
        MOV     A,R6
        ADD     A,#0xb
        MOV     ?V0 + 4,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     ?V0 + 5,A
        ; Setup parameters for call to function osal_memcpy
        MOV     DPL,R6
        MOV     DPH,R7
        INC     DPTR
        INC     DPTR
        INC     DPTR
        RET
        CFI EndBlock cfiCond24
        CFI EndBlock cfiCond25
        CFI EndBlock cfiPicker26

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine0:
        CFI Block cfiCond27 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_0
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 21)
        CFI Block cfiCond28 Using cfiCommon0
        CFI (cfiCond28) NoFunction
        CFI (cfiCond28) Conditional ??CrossCallReturnLabel_1
        CFI (cfiCond28) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond28) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond28) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond28) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond28) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond28) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond28) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond28) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond28) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond28) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond28) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond28) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond28) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond28) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond28) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond28) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond28) CFA_SP SP+0
        CFI (cfiCond28) CFA_XSP16 add(XSP16, 21)
        CFI Block cfiPicker29 Using cfiCommon1
        CFI (cfiPicker29) NoFunction
        CFI (cfiPicker29) Picker
        MOVX    @DPTR,A
        ; Setup parameters for call to function osal_memcpy
        ; Setup parameters for call to function osal_memcpy
        MOV     DPTR,#ZMac_ScanBuf
        CFI Block cfiCond30 Using cfiCommon0
        CFI (cfiCond30) NoFunction
        CFI (cfiCond30) Conditional ??CrossCallReturnLabel_2
        CFI (cfiCond30) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond30) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond30) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond30) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond30) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond30) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond30) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond30) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond30) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond30) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond30) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond30) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond30) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond30) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond30) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond30) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond30) CFA_SP SP+0
        CFI (cfiCond30) CFA_XSP16 add(XSP16, 21)
??Subroutine0_0:
        MOVX    A,@DPTR
        MOV     ?V0 + 0,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     ?V0 + 1,A
        MOV     ?V0 + 2,#0x0
        MOV     R0,#?V0 + 0
        RET
        CFI EndBlock cfiCond27
        CFI EndBlock cfiCond28
        CFI EndBlock cfiPicker29
        CFI EndBlock cfiCond30
//  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 

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  295 void zmacSendMTCallback ( macCbackEvent_t *pData )
zmacSendMTCallback:
        CFI Block cfiBlock31 Using cfiCommon0
        CFI Function zmacSendMTCallback
//  296 {
        ; Saved register size: 0
        ; 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 }
        LJMP    ?BRET
        CFI EndBlock cfiBlock31
//  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  ********************************************************************************************************/

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  433 uint8 MAC_CbackCheckPending(void)
MAC_CbackCheckPending:
        CFI Block cfiBlock32 Using cfiCommon0
        CFI Function MAC_CbackCheckPending
//  434 {
        FUNCALL MAC_CbackCheckPending, nwkDB_ReturnIndirectHoldingCnt
        LOCFRAME ISTACK, 2, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 0, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 2, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 0, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        PUSH    DPL
        CFI DPL0 Frame(CFA_SP, 4)
        CFI CFA_SP SP+-4
        PUSH    DPH
        CFI DPH0 Frame(CFA_SP, 5)
        CFI CFA_SP SP+-5
        ; Saved register size: 2
        ; Auto size: 0
//  435 #if !defined (NONWK) && defined (RTR_NWK)
//  436   return (nwkDB_ReturnIndirectHoldingCnt());
        ; Setup parameters for call to function nwkDB_ReturnIndirectHoldingCnt
        LCALL   ??nwkDB_ReturnIndirectHoldingCnt?relay
        LJMP    ?Subroutine8 & 0xFFFF
        CFI EndBlock cfiBlock32
//  437 #else
//  438   return (0);
//  439 #endif
//  440 }

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

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

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

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

        END
//  441 
//  442 
//  443 /********************************************************************************************************
//  444  ********************************************************************************************************/
//  445 
//  446 
// 
// 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
