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

📄 igxbug.h

📁 Windows CE 6.0 BSP for VOIP sample phone. Intel PXA270 platform.
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
/** @file igxBug.h
 *  @Debugging macros 
 *
 *  Copyright (c) Marvell Semiconductor, Inc. 
 */
 
#ifndef _IXBUG_H_
#define _IXBUG_H_
#ifndef DEFINE_DEBUG_VARS
extern ULONG DebugLevel;                    		// this must be defined somewhere in drvr.
#endif

#define DBBASE          		0x378               	// base address for debug strobe output for analyzer snooping
#define DBLINE1         		0x01                	// bit 0 is parallel port pin 1
#define DBLINE2         		0x02                	// bit 1 is parallel port pin 14
#define DBLINE3         		0x04                	// bit 2 is parallel port pin 16
#define DBLINE4         		0x08                	// bit 3 is parallel port pin 17

#define DBG_NONE        	0x00000000          // No debug - all off.
#define DBG_ERROR       	0x00000001          // Debug for ERRORS
#define DBG_WARNING     	0x00000002          // Debug for Warnings.
#define DBG_LOAD        	0x00000004          // Debug for driver load
#define DBG_UNLOAD      	0x00000008          // Debug for driver unload.

#define DBG_ISR         	0x00000010          // Debug for ISR messages.
#define DBG_HWIF        	0x00000020          // Debug for Hw interface.
#define DBG_TXDATA      	0x00000040          // Transmit data path debug
#define DBG_RXDATA      	0x00000080          // Receive data path debug.

#define DBG_FWDL        	0x00000100          // debug fw download.
#define DBG_CMDRESP     	0x00000200          // Debug fw command/responses.
#define DBG_REGS        	0x00000400          // Debug register dumps.
#define DBG_OID         	0x00000800          // Debug OIDS

#define DBG_MACEVENT    	0x00001000          // Debug MAC events.
#define DBG_TIMERS      	0x00002000          // Debug timers.
#define DBG_WEP         	0x00004000          // Wep related debug
#define DBG_PNP         	0x00008000          // Plug-n-play related debug.

#define DBG_TXDATADUMP  0x00010000        // detailed dump of tx data.
#define DBG_RXDATADUMP  0x00020000        // detailed dump of tx data.
#define DBG_SCAN        	  0x00040000        // Debug scan operation.
#define DBG_SP			  0x00080000        // Debug for specified message.

#define DBG_L2ROAMING   0x00100000
//#define DBG_THRESH      	0x00100000        	// debug for frag and rts threshold parms.
#define DBG_DRALEE   	0x00200000        	// debug for preamble parameter.
#define DBG_DATARATE    	0x00400000          // Link speed/data rate debug.
#define DBG_POWER       	0x00800000          // debug power management.

#define DBG_DEEPSLEEP   	0x08000000		// debug DeepSleep

#define DBG_ADHOCAES   	0x10000000		// debug Adhoc aes

#define DBG_NEWCMD  	0x20000000		// debug new command structure
#define DBG_NEWPS       	0x40000000          // debug the new PS structure
#define DBG_ALLEN       	0x80000000       
#define DBG_SUBSCRIBEEVENT	0x40000000
#define DBG_HOSTWAKEUP 0x40000000
#define DBG_CCX			0x80000000       

// Ran out of debug message
/*#define DBG_T1          	0x01000000        	// Our various time stamps.. up to 6.
#define DBG_T2          		0x02000000          	//  ||
#define DBG_T3          		0x04000000          	//  || 
#define DBG_T4         	 	0x08000000          	//  || 

#define DBG_T5          		0x10000000          	//  ||
#define DBG_T6          		0x20000000          	//  \/
*/

#define DBG_T1          		0x00000000          	// Our various time stamps.. up to 6.
#define DBG_T2          		0x00000000          	//  ||
#define DBG_T3          		0x00000000          	//  || 
#define DBG_T4          		0x00000000          	//  || 

#define DBG_T5          		0x00000000          	//  ||
#define DBG_T6          		0x00000000          	//  \/

#define DBG_QOS			0x01000000
#define DBG_WPA			0x02000000

//#define DBG_CRLF        	0x40000000        	// add some cr lfs before this message.
//#define DBG_RAW         	0x80000000        	// raw debug output
#define DBG_CRLF        	0x00000000          // add some cr lfs before this message.
#define DBG_RAW         	0x00000000          // raw debug output

#define DBG_IOCTL       	0x04000000


#define DBG_ALL         		0xffffffff          	// All debug enabled.

#define DBG_DONTCARE (DBG_RAW | DBG_CRLF)   // either of these by themselves should not cause debug to print.
#define DBG_TIMESTAMPS ( DBG_T1 |  DBG_T2  | DBG_T3 | DBG_T4 | DBG_T5 | DBG_T6 )
/*
#define DBG_DEFAULT (DBG_NONE	\
| DBG_TIMERS     		\
| DBG_LOAD			\
| DBG_TXDATA     		\
| DBG_RXDATA     	\
| DBG_ISR			\
| DBG_PNP			\
| DBG_TIMERS		\
| DBG_WARNING		\
)
*/

/*
#define DBG_DEFAULT (DBG_NONE \
| DBG_ERROR      		\
| DBG_WARNING    	\
| DBG_NONE)

*/

#define DBG_DEFAULT (DBG_NONE \
| DBG_ERROR      		\
| DBG_WARNING    	\
| DBG_ALLEN			\
| DBG_NONE)

/*
#define DBG_DEFAULT (DBG_NONE \
| DBG_ERROR      		\
| DBG_WARNING    	\
| DBG_OID        		\
| DBG_CMDRESP		\
| DBG_LOAD			\
| DBG_NEWPS		\
| DBG_FWDL			\
| DBG_UNLOAD     	\
| DBG_NONE)
*/
//--------------------------------------------------------------------------------
// PJG: Add any of these to above define and uncomment to enable area of debug.
//--------------------------------------------------------------------------------
//| DBG_NEWPS		\
//| DBG_NEWCMD		\
//| DBG_DATARATE  	\
//| DBG_TXDATA     	\
//| DBG_CMDRESP    	\
//| DBG_ALL         	\
//| DBG_PNP        	\
//| DBG_LOAD       	\
//| DBG_UNLOAD     	\
//| DBG_POWER      	\
//| DBG_TXDATA     	\
//| DBG_RXDATA     	\
//| DBG_ISR       		\
//| DBG_TXDATADUMP \
//| DBG_TIMESTAMPS 	\
//| DBG_WEP       	 	\
//| DBG_SCAN       	\
//| DBG_CMDRESP    	\
//| DBG_OID        	\
//| DBG_MACEVENT  	\
//| DBG_TIMERS     	\
//| DBG_FWDL       	\
//| DBG_REGS       	\
//| DBG_HWIF       	\
//| DBG_TXDATADUMP \
//| DBG_RXDATADUMP \
//| DBG_TXDATA     	\
//| DBG_RXDATA     	\
//| DBG_POWERSAVE  \
//| DBG_L2ROAMING  	\
//| DBG_DATARATE   	\
//| DBG_WPA        	\
//| DBG_QOS        	\

#ifdef DBG

#ifdef DEFINE_DEBUG_VAR
ULONG DebugLevel = DBG_DEFAULT;
LARGE_INTEGER    lastTime;
LARGE_INTEGER    curTime;
#else
extern unsigned char lptRegImage1;
extern unsigned char lptRegImage2;
extern ULONG DebugLevel;
extern LARGE_INTEGER    t1Time, t1LastTime, t1CurTime;
extern LARGE_INTEGER    t2Time, t2LastTime, t2CurTime;
extern LARGE_INTEGER    t3Time, t3LastTime, t3CurTime;
extern LARGE_INTEGER    t4Time, t4LastTime, t4CurTime;
extern LARGE_INTEGER    t5Time, t5LastTime, t5CurTime;
extern LARGE_INTEGER    t6Time, t6LastTime, t6CurTime;
#endif

#endif // #ifdef DBG

NTHALAPI
LARGE_INTEGER
KeQueryPerformanceCounter (
   OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL
   );

extern LARGE_INTEGER isrTimeDelay;                                
#ifdef MRVL_USE_DBG

#ifdef UNDER_CE_XSCALE

#define DBGSTROBE_LINE_ON( line )
#define DBGSTROBE_LINE_OFF( line )
#define INITDEBUG()

#else // #ifdef UNDER_CE_XSCALE

// PJG: Parallel port is negative logic. clear the bit to have positive voltage show on scope.
#define DBGSTROBE_LINE_ON( line )                       \
{                                                       \
    UCHAR regVal;                                       \
    int val = line;                                     \
    NdisRawReadPortUchar(DBBASE + 2, &regVal);          \
    regVal &= ~val;                                     \
    NdisRawWritePortUchar(DBBASE + 2, regVal);          \
}

// PJG: Parallel port is negative logic. set the bit to have low on scope
#define DBGSTROBE_LINE_OFF( line )                      \
{                                                       \
    UCHAR regVal;                                       \
    int val = line;                                     \
    NdisRawReadPortUchar(DBBASE + 2, &regVal);          \
    regVal |= val;                                      \
    NdisRawWritePortUchar(DBBASE + 2, regVal);          \
}
 

#define BUGPRINT(Str) DbgPrint Str
#define INITDEBUG() \
    NdisGetCurrentSystemTime(&t1Time); \
    NdisGetCurrentSystemTime(&t2Time); \
    NdisGetCurrentSystemTime(&t3Time); \
    NdisGetCurrentSystemTime(&t4Time); \
    NdisGetCurrentSystemTime(&t5Time); \
    NdisGetCurrentSystemTime(&t6Time); \
    NdisGetCurrentSystemTime(&t1CurTime); \
    NdisGetCurrentSystemTime(&t2CurTime); \
    NdisGetCurrentSystemTime(&t3CurTime); \
    NdisGetCurrentSystemTime(&t4CurTime); \
    NdisGetCurrentSystemTime(&t5CurTime); \
    NdisGetCurrentSystemTime(&t6CurTime); \
    NdisGetCurrentSystemTime(&t1LastTime); \
    NdisGetCurrentSystemTime(&t2LastTime); \
    NdisGetCurrentSystemTime(&t3LastTime); \
    NdisGetCurrentSystemTime(&t4LastTime); \
    NdisGetCurrentSystemTime(&t5LastTime); \
    NdisGetCurrentSystemTime(&t6LastTime); \
    NdisRawReadPortUchar(DBBASE + 1, &lptRegImage1);

#endif // #ifdef UNDER_CE_XSCALE

#ifdef UNDER_CE

// BEGIN *** #ifdef MRVL_PRINT_DBG_MSG ***
#ifdef MRVL_PRINT_DBG_MSG
void MrvPrintFile(const char *fmt, ...);
#define PrintMacro MrvPrintFile
#else
#define PrintMacro
#endif 
// END *** #ifdef MRVL_PRINT_DBG_MSG ***

#else
#define PrintMacro DbgPrint
#endif

#define DBGPRINT(lvl, Str)                              \
    {                                                   \
    ULONG __lvl = lvl;                                  \
    if ( DebugLevel & (__lvl & ~DBG_DONTCARE))          \
    {                                                   \
        if ( lvl & DBG_CRLF )                           \
        {                                               \
            PrintMacro("\n");                         	\
        }                                               \
        if ( __lvl & DBG_TIMESTAMPS)                    \
        {                                               \
        if ( __lvl & DBG_T1 )                           \
        {                                               \
            NdisGetCurrentSystemTime(&t1CurTime);       \
            PrintMacro("T1:%I64d - ",t1CurTime.QuadPart - t1LastTime.QuadPart); \
            t1LastTime.QuadPart = t1CurTime.QuadPart;   \
        }                                               \
        else if ( __lvl & DBG_T2 )                      \
        {                                               \
            NdisGetCurrentSystemTime(&t2CurTime);       \
            PrintMacro("T2:%I64d - ",t2CurTime.QuadPart - t2LastTime.QuadPart); \
            t2LastTime.QuadPart = t2CurTime.QuadPart;   \
        }                                               \
        else if ( __lvl & DBG_T3 )                      \
        {                                               \
            NdisGetCurrentSystemTime(&t3CurTime);       \
            PrintMacro("T3:%I64d - ",t3CurTime.QuadPart - t3LastTime.QuadPart); \
            t3LastTime.QuadPart = t3CurTime.QuadPart;   \
        }                                               \
        else if ( __lvl & DBG_T4 )                      \
        {                                               \
            NdisGetCurrentSystemTime(&t4CurTime);       \
            PrintMacro("T4:%I64d - ",t4CurTime.QuadPart - t4LastTime.QuadPart); \
            t4LastTime.QuadPart = t4CurTime.QuadPart;   \
        }                                               \
        else if ( __lvl & DBG_T5 )                      \
        {                                               \
            NdisGetCurrentSystemTime(&t5CurTime);       \
            PrintMacro("T5:%I64d - ",t5CurTime.QuadPart - t5LastTime.QuadPart); \
            t5LastTime.QuadPart = t5CurTime.QuadPart;   \
        }                                               \
        else if ( __lvl & DBG_T6)                       \
        {                                               \
            NdisGetCurrentSystemTime(&t6CurTime);       \
            PrintMacro("T6:%I64d - ",t6CurTime.QuadPart - t6LastTime.QuadPart); \
            t6LastTime.QuadPart = t6CurTime.QuadPart;   \
        }                                               \
        }                                               \
        PrintMacro Str;                                 \
    }}
#else
#define DBGPRINT(lvl,Str)
#define INITDEBUG()
#define DBGSTROBE_LINE_ON(line)
#define DBGSTROBE_LINE_OFF(line)
#endif

void AllenPrintFile(const char *fmt, ...);

//#define AllenDBGPRINT(lvl, Str)   

#define AllenDBGPRINT(lvl, Str)       \
    {                                                   \
           AllenPrintFile Str;                        \
    }

#endif

⌨️ 快捷键说明

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