📄 settings.h
字号:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-2000 Microsoft Corporation. All rights reserved.
Module Name:
settings.h
Abstract:
This file contains the IrDA Serial IR default settings and buffer
sizes. This is provided as a sample to platform writers and is
expected to be able to be used without modification on most (if not
all) hardware platforms.
Functions:
Notes:
--*/
#ifndef _SETTINGS_H_
#define _SETTINGS_H_
//
// Default settings.
//
#define DEFAULT_BAUDRATE BAUDRATE_9600
#define MAX_NUM_EXTRA_BOFS 48
#define DEFAULT_NUM_EXTRA_BOFS MAX_NUM_EXTRA_BOFS
#define MAX_SPEED_SUPPORTED 115200
#define MAX_TAT_usec 10000
// Max TurnAround
//
// BitsPerSecond uSecDelay
// MaxTAT = ------------- * --------------
// BitsPerChar uSecPerSecond
//
#define MAX_TAT_BOF ((MAX_SPEED_SUPPORTED * MAX_TAT_usec)/8000000)
//
// For OID window size settings.
//
#define MAX_TX_PACKETS 7
#define MAX_RX_PACKETS 7
//
// This is the largest IR packet size (counting _I_ field only and
// not counting ESC characters) that we handle.
//
#define MAX_I_DATA_SIZE 2048
#define MAX_NDIS_DATA_SIZE (SLOW_IR_ADDR_SIZE + \
SLOW_IR_CONTROL_SIZE + \
MAX_I_DATA_SIZE)
#define MAX_RX_DATA_SIZE (MAX_NDIS_DATA_SIZE + \
SLOW_IR_FCS_SIZE)
// We loop an extra time in the rcv state machine in order to see the EOF
// after the last data byte. We need some extra buffer space in case we
// get garbage instead of an EOF.
#define RX_BUFFER_SIZE (MAX_RX_DATA_SIZE + 4)
// We allocate buffers twice as large as the max recv size to accomodate
// ESC characters and BOFs, etc.
// Worst case -> The data contains all BOF/EOF/ESC chars, in which case
// it will expand to twice the 'real' size.
#define MAX_POSSIBLE_IR_PACKET_SIZE_FOR_DATA(datalen) \
((datalen) * 2 + \
(MAX_NUM_EXTRA_BOFS + 1) * SLOW_IR_BOF_SIZE + \
MAX_TAT_BOF + \
SLOW_IR_ADDR_SIZE + \
SLOW_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:
// BOF
// EOF
// Address
// Control
//
#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 sizoef(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_ADDR_SIZE 1
#define SLOW_IR_CONTROL_SIZE 1
#define SLOW_IR_BOF 0xC0
#define SLOW_IR_EXTRA_BOF 0xC0 // Don't use 0xFF, it can break HP printers.
#define SLOW_IR_EOF 0xC1
#define SLOW_IR_ESC 0x7D
#define SLOW_IR_ESC_COMP 0x20
#endif // _SETTINGS_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -