📄 serfw.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, 1996, 1997 Microsoft Corporation
Copyright (c) NEC Electronics Inc. 1998.
Module Name:
serfw.h
Abstract:
Functions:
Note:
VR4102 evaluation board Serial Driver code.
--*/
#ifndef __SERFW_H__
#define __SERFW_H__
// The library has a default baud table, but this can be replaced
#define BAUD_TABLE_SIZE 11
typedef struct __PAIRS {
ULONG Key;
ULONG AssociatedValue;
} PAIRS, *PPAIRS;
// The library has a default values
#define BYTESIZE_INIT 0x08
#define STOPBITS_INIT ONESTOPBIT
#define PARITY_INIT NOPARITY
#define BAUDRATE_INIT 9600
#define CLOSE_DEBOUNCE_TICKS 200
/*
@doc HWINTERNAL
@struct PERP_IO_SER_INFO | Private HW implementation dependent structure.
*/
typedef struct __PERP_IO_SER_INFO {
// And we keep shadows of many of the 16550 registers
UCHAR FCR; // @field FIFO control state.
UCHAR IIR; // @field State of Interrupt Identification Register.
UCHAR LSR; // @field Line Status Register.
UCHAR MSR; // @field Modem Status Register.
// We wouldn't normally shadow these, except for power on/off
UCHAR IER; // @field Interrupt Enable Register.
UCHAR LCR; // @field Line Control Register.
UCHAR MCR; // @field Modem Control Register.
UCHAR Scratch; // @field Scratch Register.
// Keep a copy of DCB since we rely on may of its parms
DCB dcb; // @field Device Control Block (copy of DCB in MDD)
HANDLE FlushDone; // @field Handle to flush done event.
BOOL AddTXIntr; // @field Flag - Fake a TX intr.
ULONG DCDWakeUp;
ULONG DroppedBytes; /* @field Number of dropped bytes */
ULONG FlushPending; /* ADD 11.14 (n-takaya)*/
COMSTAT Status; /* @field Bitfield representing Win32 comm status. */
ULONG CommErrors; /* @field Bitfield representing Win32 comm error status. */
ULONG ModemStatus; /* @field Bitfield representing Win32 modem status. */
COMMPROP CommProp; /* @field Pointer to CommProp structure. */
PVOID pMddHead; /* @field First arg to mdd callbacks. */
DWORD dwCloseTicks; /* @field Tick count of last close. */
DWORD PortOpen:1; /* @field Flag to denote Open/Close. */
DWORD IrMode:1; /* @field Currently in IRMode. */
BOOL CTSFlowOff; // @field Flag - CTS flow control state.
BOOL DSRFlowOff; // @field Flag - DSR flow control state.
DWORD fPowerOff:1; /* @field Power off has occured. */
CRITICAL_SECTION CS;
} PERP_IO_SER_INFO, *PPERP_IO_SER_INFO;
/*
*### OEM Prototype
*/
PVOID HWInit( ULONG Identifier, PVOID pMddHead );
ULONG HWDeinit( PVOID pHead );
BOOL HWOpen( PVOID pHead );
ULONG HWClose( PVOID pHead );
ULONG HWGetBytes( PVOID pHead, PUCHAR pTargetBuffer, PULONG pByteNumber );
PVOID HWGetRxStart( PVOID pHead );
INTERRUPT_TYPE HWGetIntrType( PVOID pHead );
VOID HWClearOtherIntr( PVOID pHead );
VOID HWClearLineIntr( PVOID pHead );
ULONG HWGetRxBufferSize( PVOID pHead );
VOID HWTxIntrHandler( PVOID pHead );
ULONG HWPutBytes( PVOID pHead, PUCHAR pSrc, ULONG NumberOfBytes, PULONG pBytesSend );
BOOL HWPowerOff( PVOID pHead );
BOOL HWPowerOn( PVOID pHead );
VOID HWClearDTR( PVOID pHead );
VOID HWSetDTR( PVOID pHead );
VOID HWClearRTS( PVOID pHead );
VOID HWSetRTS( PVOID pHead );
BOOL HWEnableIR( PVOID pHead, ULONG BaudRate );
BOOL HWDisableIR( PVOID pHead );
VOID HWClearBreak( PVOID pHead );
VOID HWSetBreak( PVOID pHead );
BOOL HWXmitComChar( PVOID pHead, UCHAR ComChar );
ULONG HWGetStatus( PVOID pHead, LPCOMSTAT lpStat );
VOID HWReset( PVOID pHead );
VOID HWGetModemStatus( PVOID pHead, PULONG pModemStatus );
VOID HWGetCommProperties( PVOID pHead, LPCOMMPROP pCommProp );
VOID HWPurgeComm( PVOID pHead, DWORD fdwAction );
BOOL HWSetDCB( PVOID pHead, LPDCB pDCB );
BOOL HWSetCommTimeouts( PVOID pHead, LPCOMMTIMEOUTS lpCommTO );
BOOL HWIoctl( PVOID pHead, DWORD dwCode, PBYTE pBufIn, DWORD dwLenIn,
PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut);
PDEVICE_LIST GetSerialObject( VOID );
/*
*### Internal Prototype
*/
BOOL HWMapRegisterAddresses( VOID );
VOID HWUnmapRegisterAddress( VOID );
BOOL HWSetBaudRate( PVOID, ULONG );
BOOL HWSetByteSize( PVOID, ULONG );
BOOL HWSetStopBits( PVOID, ULONG );
BOOL HWSetParity( PVOID, ULONG );
VOID HWReadLSR( PPERP_IO_SER_INFO );
VOID HWReadMSR( PPERP_IO_SER_INFO );
#endif /* __SERFW_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -