cust_debug.h

来自「一个基于windows mobile 的GPS 接受IC 驱动程序。」· C头文件 代码 · 共 126 行

H
126
字号
#ifndef CUST_DEBUG_H__			// {
#define CUST_DEBUG_H__

#include <Dbgapi.h>

//------------------------------------------------------------------------------
//
//  Configure the debugging.
//
//------------------------------------------------------------------------------

#define  DEBUG_GPS_DRIVER
#undef   DEBUG_GPS_DRIVER

//------------------------------------------------------------------------------
//
//  Tune the SPI driver.
//
//------------------------------------------------------------------------------

#define INCREASE_SPI_PRIORITY
#undef  INCREASE_SPI_PRIORITY

#ifdef INCREASE_SPI_PRIORITY
#define OPT_PRIO_MSG    " prio(102)"
#else
#define OPT_PRIO_MSG    " no prio change"
#endif

//------------------------------------------------------------------------------
//
//  SPI done has 3 options and some minor variations:
//
//  1.0)  Interrupts off for a short time; poll with Sleep(0)
//  1.1)  Interrupts off for a short time; poll with Sleep(1)
//  1.2)  Interrupts off for a short time; poll without Sleep
//  2.0)  Interrupts off for a long  time; poll without Sleep
//  3.0)  Interrupts off for a short time; SPI_DONE interrupt.
//
//------------------------------------------------------------------------------

// #define  SCHEME_1_0
// #define  SCHEME_1_1
// #define  SCHEME_1_2
// #define  SCHEME_2_0
#define  SCHEME_3_0

#if     defined(SCHEME_1_0)         // {

#undef  SPI_DONE_INTERRUPT
#define SHORT_INTERRUPT_OFF_TIME
#define SPI_DONE_POLL()   Sleep(0)
#define FAST_POLL

#define OPT_DONE_MSG   "spiDone(1.0) - intrOff(short) Sleep(0)"

#elif   defined(SCHEME_1_1)         // }{

#undef  SPI_DONE_INTERRUPT
#define SHORT_INTERRUPT_OFF_TIME
#define SPI_DONE_POLL() Sleep(1)
#undef  FAST_POLL                   
#define OPT_DONE_MSG   "spiDone(1.1) - intrOff(short) Sleep(1)"

#elif   defined(SCHEME_1_2)         // }{

#undef  SPI_DONE_INTERRUPT
#define SHORT_INTERRUPT_OFF_TIME
#define SPI_DONE_POLL()
#define FAST_POLL
#define OPT_DONE_MSG   "spiDone(1.2) - intrOff(short)"

#elif   defined(SCHEME_2_0)         // }{

#undef  SPI_DONE_INTERRUPT
#undef  SHORT_INTERRUPT_OFF_TIME
#define SPI_DONE_POLL()
#define FAST_POLL
#define OPT_DONE_MSG   "spiDone(2.0) - intrOff(long)

#elif   defined(SCHEME_3_0)         // }{

#define SPI_DONE_INTERRUPT 1
#undef  SHORT_INTERRUPT_OFF_TIME
#define SPI_DONE_POLL()
#define FAST_POLL
#define OPT_DONE_MSG   "spiDone(3.0) - interrupt"

#else   // nothing defined   }{

#error  "Must define a SPI_EXCHANGE scheme"

#endif                              // }

/*******************************************************************************
 *
 *          Debug Control
 *
 *      This code assumes some reasonable low-level logging library is available
 *
 ******************************************************************************/

void glReportTime(void);

#define GL_ERROR(msg) glReportTime(), NKDbgPrintfW msg

#ifdef  DEBUG_GPS_DRIVER
void gl_debug_dump(int line, const TCHAR* msg, const UINT8* pData, int iSize);
#define MSG(fmt)    TEXT(fmt)
#define GL_PRINT(msg) NKDbgPrintfW msg
#define GL_DEBUG_PACKET(msg,pData,iSize)   gl_debug_dump(__LINE__,msg,(const UINT8*) pData,iSize)
#else
#define MSG(fmt)
#define GL_PRINT(msg)
#define GL_DEBUG_PACKET(msg,pData,iSize)
#endif

#define GL_ASSERT(expr)   \
        if (expr) \
        { \
            GL_ERROR((MSG("Assert error " __FILE__ ":%d" #expr"\r\n"), \
                    __LINE__)); \
        } else 

#endif // CUST_DEBUG_H__ }

⌨️ 快捷键说明

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