///////////////////////////////////////////////////////////////////////////////
//                                                                            /
// IAR 8051 C/C++ Compiler V7.30B/W32                   12/Jun/2010  16:11:18 /
// 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\mt\DebugTrace.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\mt\DebugTrace.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\Deb /
//                          ugTrace.s51                                       /
//                                                                            /
//                                                                            /
///////////////////////////////////////////////////////////////////////////////

        NAME DebugTrace

        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 ?ALLOC_XSTACK8
        EXTERN ?BANKED_ENTER_XDATA
        EXTERN ?BANKED_LEAVE_XDATA
        EXTERN ?BDISPATCH
        EXTERN ?DEALLOC_XSTACK8
        EXTERN ?PUSH_XSTACK_I_THREE
        EXTERN ?V0
        EXTERN ?XSP
        EXTERN ?XSTACK_DISP0_8

        PUBLIC ??debug_msg?relay
        FUNCTION ??debug_msg?relay,0203H
        PUBLIC ??debug_str?relay
        FUNCTION ??debug_str?relay,0203H
        PUBLIC debug_msg
        FUNCTION debug_msg,021203H
        ARGFRAME XSTACK, 4, STACK
        LOCFRAME ISTACK, 1, STACK
        LOCFRAME XSTACK, 18, STACK
        PUBLIC debug_str
        FUNCTION debug_str,021203H
        ARGFRAME XSTACK, 0, STACK
        LOCFRAME ISTACK, 1, STACK
        LOCFRAME XSTACK, 17, 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_allocate   SYMBOL "osal_msg_allocate"
osal_msg_send       SYMBOL "osal_msg_send"
osal_strlen         SYMBOL "osal_strlen"
osal_memcpy         SYMBOL "osal_memcpy"
??osal_memcpy?relay SYMBOL "?relay", osal_memcpy
??osal_msg_allocate?relay SYMBOL "?relay", osal_msg_allocate
??osal_msg_send?relay SYMBOL "?relay", osal_msg_send
??osal_strlen?relay SYMBOL "?relay", osal_strlen
debug_msg           SYMBOL "debug_msg"
??debug_msg?relay   SYMBOL "?relay", debug_msg
debug_str           SYMBOL "debug_str"
??debug_str?relay   SYMBOL "?relay", debug_str

        EXTERN osal_msg_allocate
        FUNCTION osal_msg_allocate,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 18, 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, 18, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN osal_strlen
        FUNCTION osal_strlen,0202H
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, 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, 17, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        EXTERN ??osal_memcpy?relay
        FUNCTION ??osal_memcpy?relay,00H
        EXTERN ??osal_msg_allocate?relay
        FUNCTION ??osal_msg_allocate?relay,00H
        EXTERN ??osal_msg_send?relay
        FUNCTION ??osal_msg_send?relay,00H
        EXTERN ??osal_strlen?relay
        FUNCTION ??osal_strlen?relay,00H
        EXTERN MT_TaskID
        EXTERN debugCompId
        EXTERN debugThreshold

// C:\Texas Instruments\ZStack-1.4.3-1.2.1\Components\mt\DebugTrace.c
//    1 /**************************************************************************************************
//    2   Filename:       DebugTrace.c
//    3   Revised:        $Date: 2007-10-28 18:43:04 -0700 (Sun, 28 Oct 2007) $
//    4   Revision:       $Revision: 15800 $
//    5 
//    6   Description:    This interface provides quick one-function-call functions to
//    7                   Monitor and Test reporting mechanisms.
//    8 
//    9 
//   10   Copyright 2004-2007 Texas Instruments Incorporated. All rights reserved.
//   11 
//   12   IMPORTANT: Your use of this Software is limited to those specific rights
//   13   granted under the terms of a software license agreement between the user
//   14   who downloaded the software, his/her employer (which must be your employer)
//   15   and Texas Instruments Incorporated (the "License").  You may not use this
//   16   Software unless you agree to abide by the terms of the License. The License
//   17   limits your use, and you acknowledge, that the Software may not be modified,
//   18   copied or distributed unless embedded on a Texas Instruments microcontroller
//   19   or used solely and exclusively in conjunction with a Texas Instruments radio
//   20   frequency transceiver, which is integrated into your product.  Other than for
//   21   the foregoing purpose, you may not use, reproduce, copy, prepare derivative
//   22   works of, modify, distribute, perform, display or sell this Software and/or
//   23   its documentation for any purpose.
//   24 
//   25   YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
//   26   PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
//   27   INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
//   28   NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
//   29   TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
//   30   NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
//   31   LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
//   32   INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
//   33   OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
//   34   OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
//   35   (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
//   36 
//   37   Should you have any questions regarding your right to use this Software,
//   38   contact Texas Instruments Incorporated at www.TI.com.
//   39 **************************************************************************************************/
//   40 
//   41 #if defined( MT_TASK ) || defined( APP_DEBUG )
//   42 
//   43 /*********************************************************************
//   44  * INCLUDES
//   45  */
//   46 #include "ZComDef.h"
//   47 #include "OSAL.h"
//   48 #include "MTEL.h"
//   49 #include "DebugTrace.h"
//   50 
//   51 #if defined ( APP_DEBUG )
//   52   #include "DebugApp.h"
//   53 #endif
//   54 
//   55  /*********************************************************************
//   56  * MACROS
//   57  */
//   58 
//   59 /*********************************************************************
//   60  * CONSTANTS
//   61  */
//   62 
//   63 
//   64 /*********************************************************************
//   65  * TYPEDEFS
//   66  */
//   67 
//   68 /*********************************************************************
//   69  * GLOBAL VARIABLES
//   70  */
//   71 
//   72 /*********************************************************************
//   73  * EXTERNAL VARIABLES
//   74  */
//   75 
//   76 /*********************************************************************
//   77  * EXTERNAL FUNCTIONS
//   78  */
//   79 
//   80  /*********************************************************************
//   81  * LOCAL VARIABLES
//   82  */
//   83 
//   84 /*********************************************************************
//   85  * LOCAL FUNCTIONS
//   86  */
//   87 
//   88 /*********************************************************************
//   89  * @fn      debug_msg
//   90  *
//   91  * @brief
//   92  *
//   93  *   This feature allows modules to display debug information as
//   94  *   applications execute in real-time.  This feature will work similar
//   95  *   to "printf()" but will output to the serial port for display in
//   96  *   the Z-Test tool.
//   97  *
//   98  *   This feature will most likely be compiled out in the production code
//   99  *   to save code space.
//  100  *
//  101  * @param   byte compID - Component ID
//  102  * @param   byte severity - CRITICAL(0x01), ERROR(0x02), INFORMATION(0x03)
//  103  *                          or TRACE(0x04)
//  104  * @param   byte numParams - number of parameter fields (param1-3)
//  105  * @param   UINT16 param1 - user defined data
//  106  * @param   UINT16 param2 - user defined data
//  107  * @param   UINT16 param3 - user defined data
//  108  *
//  109  * @return  void
//  110  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  111 void debug_msg( byte compID, byte severity, byte numParams, UINT16 param1,
debug_msg:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function debug_msg
//  112 																								UINT16 param2, UINT16 param3 )
//  113 {
        FUNCALL debug_msg, osal_msg_allocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 18, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 18, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL debug_msg, osal_msg_send
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 18, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 18, 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: 2
        MOV     A,#-0x2
        LCALL   ?ALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 18)
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOV     A,R4
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R5
        MOVX    @DPTR,A
        MOV     ?V0 + 2,R1
        MOV     ?V0 + 3,R2
        MOV     ?V0 + 4,R3
        MOV     A,#0x12
        LCALL   ?XSTACK_DISP0_8
        MOVX    A,@DPTR
        MOV     ?V0 + 6,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     ?V0 + 7,A
        MOV     A,#0x14
        LCALL   ?XSTACK_DISP0_8
        MOVX    A,@DPTR
        MOV     R6,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R7,A
//  114 
//  115   mtDebugMsg_t *mtDebugMsg;
//  116   UINT16 timestamp;
//  117 
//  118 #if defined ( APP_DEBUG ) && !defined (ZDO_COORDINATOR)
//  119   DebugApp_BuildMsg( compID, severity, numParams, param1, param2, param3 );
//  120   return;
//  121 #endif
//  122 
//  123   if ( debugThreshold == 0 || debugCompId != compID )
        MOV     DPTR,#debugThreshold
        MOVX    A,@DPTR
        JZ      ??debug_msg_0
        MOV     DPTR,#debugCompId
        MOVX    A,@DPTR
        XRL     A,?V0 + 2
        JNZ     ??debug_msg_0
//  124     return;
//  125 
//  126   // Fill in the timestamp
//  127   timestamp = 0;
//  128 
//  129   // Get a message buffer to build the debug message
//  130   mtDebugMsg = (mtDebugMsg_t *)osal_msg_allocate( sizeof( mtDebugMsg_t ) );
        ; Setup parameters for call to function osal_msg_allocate
        MOV     R2,#0xd
        MOV     R3,#0x0
        LCALL   ??osal_msg_allocate?relay
//  131   if ( mtDebugMsg )
        MOV     A,R2
        JNZ     ??debug_msg_1
        MOV     A,R3
??debug_msg_1:
        JZ      ??debug_msg_0
//  132   {
//  133       mtDebugMsg->hdr.event = CMD_DEBUG_MSG;
        MOV     A,#0x2
        MOV     DPL,R2
        MOV     DPH,R3
        MOVX    @DPTR,A
//  134       mtDebugMsg->compID = compID;
        INC     DPTR
        INC     DPTR
        MOV     A,?V0 + 2
        LCALL   ?Subroutine1 & 0xFFFF
//  135       mtDebugMsg->severity = severity;
??CrossCallReturnLabel_2:
        MOV     A,?V0 + 3
        LCALL   ?Subroutine1 & 0xFFFF
//  136       mtDebugMsg->numParams = numParams;
??CrossCallReturnLabel_3:
        INC     DPTR
        MOV     A,?V0 + 4
        MOVX    @DPTR,A
//  137 
//  138       mtDebugMsg->param1 = param1;
        MOV     DPL,?XSP + 0
        MOV     DPH,?XSP + 1
        MOVX    A,@DPTR
        MOV     R0,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R1,A
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        MOV     A,R0
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R1
        LCALL   ?Subroutine0 & 0xFFFF
//  139       mtDebugMsg->param2 = param2;
??CrossCallReturnLabel_0:
        MOV     A,?V0 + 6
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,?V0 + 7
        LCALL   ?Subroutine0 & 0xFFFF
//  140       mtDebugMsg->param3 = param3;
??CrossCallReturnLabel_1:
        INC     DPTR
        INC     DPTR
        MOV     A,R6
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R7
        MOVX    @DPTR,A
//  141       mtDebugMsg->timestamp = timestamp;
        MOV     A,R2
        ADD     A,#0xb
        MOV     DPL,A
        MOV     A,R3
        ADDC    A,#0x0
        MOV     DPH,A
        CLR     A
        MOVX    @DPTR,A
        INC     DPTR
        MOVX    @DPTR,A
//  142 
//  143       osal_msg_send( MT_TaskID, (uint8 *)mtDebugMsg );
        ; Setup parameters for call to function osal_msg_send
        MOV     DPTR,#MT_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_msg_send?relay
??debug_msg_0:
        MOV     A,#0x2
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 16)
        MOV     R7,#0x8
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock0
//  144   }
//  145 
//  146 } /* debug_msg() */

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine1:
        CFI Block cfiCond1 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_2
        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, 18)
        CFI Block cfiCond2 Using cfiCommon0
        CFI (cfiCond2) NoFunction
        CFI (cfiCond2) Conditional ??CrossCallReturnLabel_3
        CFI (cfiCond2) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond2) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond2) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond2) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond2) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond2) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond2) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond2) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond2) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond2) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond2) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond2) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond2) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond2) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond2) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond2) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond2) CFA_SP SP+0
        CFI (cfiCond2) CFA_XSP16 add(XSP16, 18)
        CFI Block cfiPicker3 Using cfiCommon1
        CFI (cfiPicker3) NoFunction
        CFI (cfiPicker3) Picker
        LCALL   ?Subroutine2 & 0xFFFF
??CrossCallReturnLabel_4:
        RET
        CFI EndBlock cfiCond1
        CFI EndBlock cfiCond2
        CFI EndBlock cfiPicker3

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine2:
        CFI Block cfiCond4 Using cfiCommon0
        CFI NoFunction
        CFI Conditional ??CrossCallReturnLabel_4, ??CrossCallReturnLabel_2
        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, 18)
        CFI Block cfiCond5 Using cfiCommon0
        CFI (cfiCond5) NoFunction
        CFI (cfiCond5) Conditional ??CrossCallReturnLabel_4, ??CrossCallReturnLabel_3
        CFI (cfiCond5) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond5) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond5) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond5) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond5) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond5) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond5) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond5) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond5) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond5) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond5) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond5) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond5) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond5) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond5) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond5) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond5) CFA_SP SP+0
        CFI (cfiCond5) CFA_XSP16 add(XSP16, 18)
        CFI Block cfiCond6 Using cfiCommon0
        CFI (cfiCond6) NoFunction
        CFI (cfiCond6) Conditional ??CrossCallReturnLabel_5, ??CrossCallReturnLabel_0
        CFI (cfiCond6) R6 load(1, XDATA, add(CFA_XSP16, literal(-16)))
        CFI (cfiCond6) VB load(1, XDATA, add(CFA_XSP16, literal(-15)))
        CFI (cfiCond6) V0 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI (cfiCond6) V1 load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI (cfiCond6) V2 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI (cfiCond6) V3 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI (cfiCond6) V4 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI (cfiCond6) V5 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI (cfiCond6) V6 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI (cfiCond6) V7 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI (cfiCond6) R7 load(1, XDATA, add(CFA_XSP16, literal(-6)))
        CFI (cfiCond6) ?RET_LOW load(1, XDATA, add(CFA_XSP16, literal(-5)))
        CFI (cfiCond6) ?RET_HIGH load(1, XDATA, add(CFA_XSP16, literal(-4)))
        CFI (cfiCond6) ?BRET_EXT load(1, XDATA, add(CFA_XSP16, literal(-3)))
        CFI (cfiCond6) DPL0 load(1, XDATA, add(CFA_XSP16, literal(-2)))
        CFI (cfiCond6) DPH0 load(1, XDATA, add(CFA_XSP16, literal(-1)))
        CFI (cfiCond6) CFA_SP SP+0
        CFI (cfiCond6) CFA_XSP16 add(XSP16, 18)
        CFI Block cfiCond7 Using cfiCommon0
        CFI (cfiCond7) NoFunction
        CFI (cfiCond7) Conditional ??CrossCallReturnLabel_5, ??CrossCallReturnLabel_1
        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, 18)
        CFI Block cfiPicker8 Using cfiCommon1
        CFI (cfiPicker8) NoFunction
        CFI (cfiPicker8) Picker
        MOVX    @DPTR,A
        MOV     DPL,R2
        MOV     DPH,R3
        INC     DPTR
        INC     DPTR
        INC     DPTR
        RET
        CFI EndBlock cfiCond4
        CFI EndBlock cfiCond5
        CFI EndBlock cfiCond6
        CFI EndBlock cfiCond7
        CFI EndBlock cfiPicker8

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine0:
        CFI Block cfiCond9 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, 18)
        CFI Block cfiCond10 Using cfiCommon0
        CFI (cfiCond10) NoFunction
        CFI (cfiCond10) Conditional ??CrossCallReturnLabel_1
        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, 18)
        CFI Block cfiPicker11 Using cfiCommon1
        CFI (cfiPicker11) NoFunction
        CFI (cfiPicker11) Picker
        LCALL   ?Subroutine2 & 0xFFFF
??CrossCallReturnLabel_5:
        INC     DPTR
        INC     DPTR
        INC     DPTR
        INC     DPTR
        RET
        CFI EndBlock cfiCond9
        CFI EndBlock cfiCond10
        CFI EndBlock cfiPicker11
//  147 
//  148 /*********************************************************************
//  149  * @fn      debug_str
//  150  *
//  151  * @brief
//  152  *
//  153  *   This feature allows modules to display a debug text string as
//  154  *   applications execute in real-time. This feature will output to
//  155  *   the serial port for display in the Z-Test tool.
//  156  *
//  157  *   This feature will most likely be compiled out in the production
//  158  *   code in order to save code space.
//  159  *
//  160  * @param   byte *str_ptr - pointer to null-terminated string
//  161  *
//  162  * @return  void
//  163  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//  164 void debug_str( byte *str_ptr )
debug_str:
        CFI Block cfiBlock12 Using cfiCommon0
        CFI Function debug_str
//  165 {
        FUNCALL debug_str, osal_strlen
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL debug_str, osal_msg_allocate
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL debug_str, osal_memcpy
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 17, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 17, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        FUNCALL debug_str, osal_msg_send
        LOCFRAME ISTACK, 0, STACK
        LOCFRAME PSTACK, 0, STACK
        LOCFRAME XSTACK, 14, STACK
        LOCFRAME IOVERLAY, 0, STATIC
        LOCFRAME DOVERLAY, 0, STATIC
        ARGFRAME ISTACK, 0, STACK
        ARGFRAME PSTACK, 0, STACK
        ARGFRAME XSTACK, 14, STACK
        ARGFRAME IOVERLAY, 0, STATIC
        ARGFRAME DOVERLAY, 0, STATIC
        MOV     A,#-0xe
        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 V5 load(1, XDATA, add(CFA_XSP16, literal(-7)))
        CFI V4 load(1, XDATA, add(CFA_XSP16, literal(-8)))
        CFI V3 load(1, XDATA, add(CFA_XSP16, literal(-9)))
        CFI V2 load(1, XDATA, add(CFA_XSP16, literal(-10)))
        CFI V1 load(1, XDATA, add(CFA_XSP16, literal(-11)))
        CFI V0 load(1, XDATA, add(CFA_XSP16, literal(-12)))
        CFI VB load(1, XDATA, add(CFA_XSP16, literal(-13)))
        CFI R6 load(1, XDATA, add(CFA_XSP16, literal(-14)))
        CFI CFA_SP SP+0
        CFI CFA_XSP16 add(XSP16, 14)
        ; Saved register size: 14
        ; Auto size: 0
        MOV     ?V0 + 0,R2
        MOV     ?V0 + 1,R3
//  166   mtDebugStr_t *msg;
//  167   byte mln;
//  168   byte sln;
//  169 
//  170   // Text string length
//  171   sln = (byte)osal_strlen( (void*)str_ptr );
        ; Setup parameters for call to function osal_strlen
        LCALL   ??osal_strlen?relay
        MOV     A,R2
        MOV     ?V0 + 3,A
//  172 
//  173   // Debug string message length
//  174   mln = sizeof ( mtDebugStr_t ) + sln;
//  175 
//  176   // Get a message buffer to build the debug message
//  177   msg = (mtDebugStr_t *)osal_msg_allocate( mln );
        ; Setup parameters for call to function osal_msg_allocate
        MOV     A,#0x5
        ADD     A,?V0 + 3
        MOV     R2,A
        MOV     R3,#0x0
        LCALL   ??osal_msg_allocate?relay
        MOV     ?V0 + 4,R2
        MOV     ?V0 + 5,R3
        MOV     R6,?V0 + 4
        MOV     R7,?V0 + 5
//  178   if ( msg )
        MOV     A,R6
        JNZ     ??debug_str_0
        MOV     A,R7
??debug_str_0:
        JZ      ??debug_str_1
//  179   {
//  180     // Message type, length
//  181     msg->hdr.event = CMD_DEBUG_STR;
        MOV     A,#0x6
        MOV     DPL,R6
        MOV     DPH,R7
        MOVX    @DPTR,A
//  182     msg->sln = sln;
        INC     DPTR
        INC     DPTR
        MOV     A,?V0 + 3
        MOVX    @DPTR,A
//  183 
//  184     // Append message, no terminator
//  185     msg->pString = (uint8 *)(msg+1);
        MOV     A,R6
        ADD     A,#0x3
        INC     R2
        INC     R2
        INC     R2
        MOV     A,R7
        ADDC    A,#0x0
        MOV     R3,A
        MOV     A,R6
        ADD     A,#0x5
        MOV     R0,A
        MOV     A,R7
        ADDC    A,#0x0
        MOV     R1,A
        MOV     DPL,R2
        MOV     DPH,R3
        MOV     A,R0
        MOVX    @DPTR,A
        INC     DPTR
        MOV     A,R1
        MOVX    @DPTR,A
//  186     osal_memcpy ( msg->pString, str_ptr, sln );
        ; Setup parameters for call to function osal_memcpy
        MOV     ?V0 + 2,#0x0
        MOV     R0,#?V0 + 0
        LCALL   ?PUSH_XSTACK_I_THREE
        CFI CFA_XSP16 add(XSP16, 17)
        MOV     R4,?V0 + 3
        MOV     R5,#0x0
        MOV     DPL,R2
        MOV     DPH,R3
        MOVX    A,@DPTR
        MOV     R2,A
        INC     DPTR
        MOVX    A,@DPTR
        MOV     R3,A
        LCALL   ??osal_memcpy?relay
        MOV     A,#0x3
        LCALL   ?DEALLOC_XSTACK8
        CFI CFA_XSP16 add(XSP16, 14)
//  187 
//  188     osal_msg_send( MT_TaskID, (uint8 *)msg );
        ; Setup parameters for call to function osal_msg_send
        MOV     A,R6
        MOV     R2,A
        MOV     A,R7
        MOV     R3,A
        MOV     DPTR,#MT_TaskID
        MOVX    A,@DPTR
        MOV     R1,A
        LCALL   ??osal_msg_send?relay
//  189   }
//  190 } // debug_str()
??debug_str_1:
        MOV     R7,#0x6
        LJMP    ?BANKED_LEAVE_XDATA
        CFI EndBlock cfiBlock12

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

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

        END
//  191 
//  192 /*********************************************************************
//  193 *********************************************************************/
//  194 #endif  // MT_TASK
// 
// 319 bytes in segment BANKED_CODE
//  12 bytes in segment BANK_RELAYS
// 
// 331 bytes of CODE memory
//
//Errors: none
//Warnings: none
