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

📄 settings.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
📖 第 1 页 / 共 2 页
字号:
					(dbgOpt & DBG_FIR_MODE)) {	\
			DBGPRINT(dbgprint_params_in_parens);		\
		}							\
		else if (dbgOpt & DBG_SIR_MODE) {			\
			DBGPRINT(dbgprint_params_in_parens);		\
		}							\
	}

#define DBGSTAT(dbgprint_params_in_parens)				\
	if (dbgOpt & DBG_STAT) {					\
        if (!firstIrDevice)                             \
        {                                               \
			DBGPRINT(dbgprint_params_in_parens);		\
        }                                               \
        else \
		if ((firstIrDevice->currentSpeed > MAX_SIR_SPEED) &&	\
					(dbgOpt & DBG_FIR_MODE)) {	\
			DBGPRINT(dbgprint_params_in_parens);		\
		}							\
		else if (dbgOpt & DBG_SIR_MODE) {			\
			DBGPRINT(dbgprint_params_in_parens);		\
		}							\
	}

#define DBGPKT(dbgprint_params_in_parens)				\
	if (dbgOpt & DBG_PACKET) {					\
        if (!firstIrDevice)                             \
        {                                               \
			DBGPRINT(dbgprint_params_in_parens);		\
        }                                               \
        else \
		if ((firstIrDevice->currentSpeed > MAX_SIR_SPEED) &&	\
					(dbgOpt & DBG_FIR_MODE)) {	\
			DBGPRINT(dbgprint_params_in_parens);		\
		}							\
		else if (dbgOpt & DBG_SIR_MODE) {			\
			DBGPRINT(dbgprint_params_in_parens);		\
		}							\
	}

#define DBG_D(i) DbgPrint("IRSIR:"#i"==%d\n", (i))
#define DBG_X(x) DbgPrint("IRSIR:"#x"==0x%0*X\n", sizeof(x)*2, ((unsigned long)(x))&((1<<(sizeof(x)*8))-1) )
#define DBG_UNISTR(s) DbgPrint("IRSIR:"#s"==%wZ\n", (s))

extern 	VOID DBG_NDIS_Buffer(PNDIS_BUFFER ndisBuf);

#define DBG_NDIS_BUFFER(Ndis_buffer)					\
	if (dbgOpt & DBG_NDIS_PACKET) {					\
        if (!firstIrDevice)                             \
        {                                               \
			DBG_NDIS_Buffer(Ndis_buffer);			\
        }                                               \
        else \
		if ((firstIrDevice->currentSpeed > MAX_SIR_SPEED) &&	\
					(dbgOpt & DBG_FIR_MODE)) {	\
			DBG_NDIS_Buffer(Ndis_buffer);			\
		}							\
		else if (dbgOpt & DBG_SIR_MODE) {			\
			DBG_NDIS_Buffer(Ndis_buffer);			\
		}							\
	}

extern VOID DBG_PrintBuf(PUCHAR bufptr, UINT buflen);

#define DBGPRINTBUF(bufptr, buflen)					\
	if (dbgOpt & DBG_BUF) {						\
        if (!firstIrDevice)                             \
        {                                               \
			DBG_PrintBuf((PUCHAR)(bufptr), (UINT)(buflen));   \
        }                                               \
        else \
		if ((firstIrDevice->currentSpeed > MAX_SIR_SPEED) &&	\
					(dbgOpt & DBG_FIR_MODE)) {	\
			DBG_PrintBuf((PUCHAR)(bufptr), (UINT)(buflen));   \
		}							\
		else if (dbgOpt & DBG_SIR_MODE) {			\
			DBG_PrintBuf((PUCHAR)(bufptr), (UINT)(buflen));	\
		}							\
	}
/*
 *  LOGGING stuff
 */
struct logEntry {
	char *msg;
	LONGLONG usec;
	UINT val;
};

#define LOG_LENGTH 10000

extern UINT dbgLogIndex;
extern struct logEntry dbgLog[];

#define LOG(logmsg, val)						\
{									\
	if (dbgOpt & DBG_LOG) {						\
        if (!firstIrDevice)                             \
        {                                               \
			LogEvent((logmsg), (UINT)(val));		\
        }                                               \
        else \
		if ((firstIrDevice->currentSpeed > MAX_SIR_SPEED) &&	\
					(dbgOpt & DBG_FIR_MODE)) {	\
			LogEvent((logmsg), (UINT)(val));		\
		}							\
		else if (dbgOpt & DBG_SIR_MODE)	{			\
			LogEvent((logmsg), (UINT)(val));		\
		}							\
	}								\
	else if (dbgOpt & DBG_DUMPLOG) {				\
        if (!firstIrDevice)                             \
        {                                               \
			DumpLog();		\
        }                                               \
        else \
		if ((firstIrDevice->currentSpeed > MAX_SIR_SPEED) &&	\
					(dbgOpt & DBG_FIR_MODE)) {	\
			DumpLog();					\
		}							\
		else if (dbgOpt & DBG_SIR_MODE)	 {			\
			DumpLog();					\
		}							\
	}								\
}

#endif // !UNDER_CE

#else /* } { */

#define DbgBreakPoint()
#define DBGOUT(dbgprint_params_in_parens) 
#define DBGERR(dbgprint_params_in_parens)
#define DBGPRINTBUF(bufptr, buflen)
#define DBGSTAT(dbgprint_params_in_parens) 
#define DBGPKT(dbgprint_params_in_parens) 
#define DBG_NDIS_RESULT_STR(_ndisResult) 
#define LOG(logmsg, val)
#define DEBUGFIR(flags, dbgprint_params_in_parens)
#ifndef UNDER_CE
#define DEBUGMSG(flags, dbgprint_params_in_parens)
#endif // !UNDER_CE
#define DBG_D(i)
#define DBG_X(x)
#define DBG_UNISTR(s)

#define DBGDMA(dbgparams)
#define DBGISR(dbgparams)
#define DBGWARN(dbgparams)
#define DBGINIT(dbgparams)


#endif /* } #if DBG  */

enum baudRates {

	/* Slow IR */
	BAUDRATE_2400 = 0,
	BAUDRATE_9600,
	BAUDRATE_19200,
	BAUDRATE_38400,
	BAUDRATE_57600,
	BAUDRATE_115200,

	/* Medium IR */
	BAUDRATE_576000,
	BAUDRATE_1152000,

	/* Fast IR */
	BAUDRATE_4000000,

	NUM_BAUDRATES	/* must be last */
};

#define DEFAULT_BAUDRATE BAUDRATE_115200

#define ALL_SLOW_IRDA_SPEEDS (						\
	NDIS_IRDA_SPEED_2400 | NDIS_IRDA_SPEED_9600 |			\
	NDIS_IRDA_SPEED_19200 | NDIS_IRDA_SPEED_38400 |			\
	NDIS_IRDA_SPEED_57600 | NDIS_IRDA_SPEED_115200)

#define ALL_IRDA_SPEEDS (						\
	ALL_SLOW_IRDA_SPEEDS | NDIS_IRDA_SPEED_1152K | NDIS_IRDA_SPEED_4M)


#define MAX_SIR_SPEED	 115200
#define MIN_FIR_SPEED	4000000

#define DEFAULT_BOFS_CODE  BOFS_48
#define MAX_NUM_EXTRA_BOFS 48
#define DEFAULT_NUM_EXTRA_BOFS MAX_NUM_EXTRA_BOFS


#define DEFAULT_TURNAROUND_usec 1000

typedef struct {
	enum baudRates tableIndex;
	UINT bitsPerSec;
	UINT ndisCode;	// bitmask element
} baudRateInfo;

#define DEFAULT_BAUD_RATE 9600



/*
 * This is the largest IR packet size (counting _I_ field only,
 * and not counting ESC characters) that we handle.
 *
 * Note:  There is an apparent bug with the NSC part.  It cannot transfer
 * more than 2048 bytes TOTAL, including the 2-byte header.  Unfortunately,
 * the actual frame size will be 2 bytes more than what we indicate to the
 * protocol.  We will indicate 2046, but the protocol will actually jump down
 * to 1024, the next step down in frame sizes.
 */
#define MAX_I_DATA_SIZE		2048
#define MAX_NDIS_DATA_SIZE (IR_ADDR_SIZE+IR_CONTROL_SIZE+MAX_I_DATA_SIZE)

#ifdef DBG_ADD_PKT_ID
#pragma message("WARNING: INCOMPATIBLE DEBUG VERSION")
#define MAX_RCV_DATA_SIZE (MAX_NDIS_DATA_SIZE+SLOW_IR_FCS_SIZE+2)
#define MAX_DMA_XMIT_DATA_SIZE (MAX_NDIS_DATA_SIZE+SLOW_IR_FCS_SIZE+2)
#else
#define MAX_RCV_DATA_SIZE  (MAX_NDIS_DATA_SIZE+SLOW_IR_FCS_SIZE) 
#define MAX_DMA_XMIT_DATA_SIZE  (MAX_NDIS_DATA_SIZE+SLOW_IR_FCS_SIZE) 
#endif

#define MAX_TX_PACKETS 7
#define MAX_RX_PACKETS 7
/*
 * We loop an extra time in the receive FSM in order to see EOF after the
 * last data byte; so we need some extra space in readBuf in case we then
 * get garbage instead.
 */
#define RCV_BUFFER_SIZE (MAX_RCV_DATA_SIZE +4+sizeof(LIST_ENTRY))
#define RCV_DMA_SIZE ((MAX_RX_PACKETS+2) * (MAX_RCV_DATA_SIZE + FAST_IR_FCS_SIZE))  

#define RCV_BUF_TO_LIST_ENTRY(b) ((PLIST_ENTRY)((PUCHAR)(b)-sizeof(LIST_ENTRY)))
#define LIST_ENTRY_TO_RCV_BUF(e) ((PVOID)((PUCHAR)(e)+sizeof(LIST_ENTRY)))

#if (RCV_DMA_SIZE > 0x10000)
#error "RCV_DMA_SIZE can't span physical segments"
#endif


/*
 * We allocate buffers twice as large as the max rcv size to accomodate ESC
 * characters and BOFs, etc.  Recall that in the worst possible case, the
 * data contains all BOF/EOF/ESC characters, in which case we must expand
 * it to twice its original size.
 */
#define MAX_POSSIBLE_IR_PACKET_SIZE_FOR_DATA(dataLen) ( 		\
	(dataLen) * 2 + (MAX_NUM_EXTRA_BOFS + 1) *			\
	SLOW_IR_BOF_SIZE + IR_ADDR_SIZE + IR_CONTROL_SIZE +		\
	SLOW_IR_FCS_SIZE + SLOW_IR_EOF_SIZE)

#define MAX_IRDA_DATA_SIZE						\
	MAX_POSSIBLE_IR_PACKET_SIZE_FOR_DATA(MAX_I_DATA_SIZE)

/*
 *  When FCS is computed on an IR packet with FCS appended, the result
 * should be this constant.
 */
#define GOOD_FCS ((USHORT) ~0xf0b8)


/*
 *  Sizes of IrLAP frame fields:
 *	Beginning Of Frame (BOF) 
 *	End Of Frame (EOF) 
 *	Address
 *	Control
 */
#define IR_ADDR_SIZE			1
#define IR_CONTROL_SIZE			1

#define SLOW_IR_BOF_TYPE		UCHAR
#define SLOW_IR_BOF_SIZE		sizeof(SLOW_IR_BOF_TYPE)
#define SLOW_IR_EXTRA_BOF_TYPE  	UCHAR
#define SLOW_IR_EXTRA_BOF_SIZE		sizeof(SLOW_IR_EXTRA_BOF_TYPE)
#define SLOW_IR_EOF_TYPE		UCHAR
#define SLOW_IR_EOF_SIZE		sizeof(SLOW_IR_EOF_TYPE)
#define SLOW_IR_FCS_TYPE		USHORT
#define SLOW_IR_FCS_SIZE		sizeof(SLOW_IR_FCS_TYPE)
#define SLOW_IR_BOF			0xC0
	/* don't use 0xFF, it breaks some HP printers! */
#define SLOW_IR_EXTRA_BOF		0xC0
#define SLOW_IR_EOF			0xC1
#define SLOW_IR_ESC			0x7D
#define SLOW_IR_ESC_COMP		0x20

#define MEDIUM_IR_BOF			0x7E
#define MEDIUM_IR_EOF			0x7E
#define MEDIUM_IR_FCS_SIZE		2

#define FAST_IR_FCS_SIZE		4
#define FAST_IR_EOF_SIZE		1


#define MIN(a,b) (((a) <= (b)) ? (a) : (b))
#define MAX(a,b) (((a) >= (b)) ? (a) : (b))


#endif SETTINGS_H

⌨️ 快捷键说明

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