⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debugtrace.s51

📁 cc2430应用实例
💻 S51
📖 第 1 页 / 共 2 页
字号:
//   17     All Rights Reserved.  Permission to use, reproduce, copy, prepare
//   18     derivative works, modify, distribute, perform, display or sell this
//   19     software and/or its documentation for any purpose is prohibited
//   20     without the express written consent of Texas Instruments, Inc.
//   21 *********************************************************************/
//   22 
//   23 #if defined( MT_TASK ) || defined( APP_DEBUG )
//   24 
//   25 /*********************************************************************
//   26  * INCLUDES
//   27  */
//   28 #include "ZComDef.h"
//   29 #include "OSAL.h"
//   30 #include "MTEL.h"
//   31 #include "DebugTrace.h"
//   32 
//   33 #if defined ( APP_DEBUG )
//   34   #include "DebugApp.h"
//   35 #endif
//   36 
//   37  /*********************************************************************
//   38  * MACROS
//   39  */
//   40 
//   41 /*********************************************************************
//   42  * CONSTANTS
//   43  */
//   44 
//   45 
//   46 /*********************************************************************
//   47  * TYPEDEFS
//   48  */
//   49 
//   50 /*********************************************************************
//   51  * GLOBAL VARIABLES
//   52  */
//   53 
//   54 /*********************************************************************
//   55  * EXTERNAL VARIABLES
//   56  */
//   57 
//   58 /*********************************************************************
//   59  * EXTERNAL FUNCTIONS
//   60  */
//   61 
//   62  /*********************************************************************
//   63  * LOCAL VARIABLES
//   64  */
//   65 
//   66 /*********************************************************************
//   67  * LOCAL FUNCTIONS
//   68  */
//   69 
//   70 /*********************************************************************
//   71  * @fn      debug_msg
//   72  *
//   73  * @brief
//   74  *
//   75  *   This feature allows modules to display debug information as
//   76  *   applications execute in real-time.  This feature will work similar
//   77  *   to "printf()" but will output to the serial port for display in
//   78  *   the Z-Test tool.
//   79  *
//   80  *   This feature will most likely be compiled out in the production code
//   81  *   to save code space.
//   82  *
//   83  * @param   byte compID - Component ID
//   84  * @param   byte severity - CRITICAL(0x01), ERROR(0x02), INFORMATION(0x03)
//   85  *                          or TRACE(0x04)
//   86  * @param   byte numParams - number of parameter fields (param1-3)
//   87  * @param   UINT16 param1 - user defined data
//   88  * @param   UINT16 param2 - user defined data
//   89  * @param   UINT16 param3 - user defined data
//   90  *
//   91  * @return  void
//   92  */
//   93 void debug_msg( byte compID, byte severity, byte numParams, UINT16 param1,
//   94 																								UINT16 param2, UINT16 param3 )
//   95 {
//   96 
//   97   mtDebugMsg_t *mtDebugMsg;
//   98   UINT16 timestamp;
//   99 
//  100 #if defined ( APP_DEBUG ) && !defined (ZDO_COORDINATOR)
//  101   DebugApp_BuildMsg( compID, severity, numParams, param1, param2, param3 );
//  102   return;
//  103 #endif
//  104 
//  105   if ( debugThreshold == 0 || debugCompId != compID )
//  106     return;
//  107 
//  108   // Fill in the timestamp
//  109   timestamp = 0;
//  110 
//  111   // Get a message buffer to build the debug message
//  112   mtDebugMsg = (mtDebugMsg_t *)osal_msg_allocate( sizeof( mtDebugMsg_t ) );
//  113   if ( mtDebugMsg )
//  114   {
//  115       mtDebugMsg->hdr.event = CMD_DEBUG_MSG;
//  116       mtDebugMsg->compID = compID;
//  117       mtDebugMsg->severity = severity;
//  118       mtDebugMsg->numParams = numParams;
//  119 
//  120       mtDebugMsg->param1 = param1;
//  121       mtDebugMsg->param2 = param2;
//  122       mtDebugMsg->param3 = param3;
//  123       mtDebugMsg->timestamp = timestamp;
//  124       
//  125       osal_msg_send( MT_TaskID, (uint8 *)mtDebugMsg );
//  126   }
//  127 
//  128 } /* debug_msg() */
//  129 
//  130 /*********************************************************************
//  131  * @fn      debug_str
//  132  *
//  133  * @brief
//  134  *
//  135  *   This feature allows modules to display a debug text string as
//  136  *   applications execute in real-time. This feature will output to
//  137  *   the serial port for display in the Z-Test tool.
//  138  *
//  139  *   This feature will most likely be compiled out in the production
//  140  *   code in order to save code space.
//  141  *
//  142  * @param   byte *str_ptr - pointer to null-terminated string
//  143  *
//  144  * @return  void
//  145  */
//  146 void debug_str( byte *str_ptr )
//  147 {
//  148   mtDebugStr_t *msg;
//  149   byte mln;
//  150   byte sln;
//  151 
//  152   // Text string length
//  153   sln = (byte)osal_strlen( (void*)str_ptr );
//  154 
//  155   // Debug string message length
//  156   mln = sizeof ( mtDebugStr_t ) + sln;
//  157 
//  158   // Get a message buffer to build the debug message
//  159   msg = (mtDebugStr_t *)osal_msg_allocate( mln );
//  160   if ( msg )
//  161   {
//  162     // Message type, length
//  163     msg->hdr.event = CMD_DEBUG_STR;
//  164     msg->sln = sln;
//  165 
//  166     // Append message, no terminator
//  167     msg->pString = (uint8 *)(msg+1);
//  168     osal_memcpy ( msg->pString, str_ptr, sln );
//  169 
//  170     osal_msg_send( MT_TaskID, (uint8 *)msg );
//  171   }
//  172 } // debug_str()
//  173 
//  174 /*********************************************************************
//  175 *********************************************************************/
//  176 #endif  // MT_TASK
// 
// 
// 0 bytes of memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -