blob: 40171040add54bad5a52d7c004ed6170cd4ad210 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
/*++
Copyright (c) 1990 Microsoft Corporation
Module Name:
ixkdcom.h
Abstract:
This module contains the header file for a very simple com port package.
Author:
Bryan M. Willman (bryanwi) 24-Sep-1990
Revision History:
John Vert (jvert) 19-Jul-1991
Moved into HAL
--*/
#define COM1_PORT 0x03f8
#define COM2_PORT 0x02f8
#define COM_DAT 0x00
#define COM_IEN 0x01 // interrupt enable register
#define COM_LCR 0x03 // line control registers
#define COM_MCR 0x04 // modem control reg
#define COM_LSR 0x05 // line status register
#define COM_MSR 0x06 // modem status register
#define COM_DLL 0x00 // divisor latch least sig
#define COM_DLM 0x01 // divisor latch most sig
#define COM_BI 0x10
#define COM_FE 0x08
#define COM_PE 0x04
#define COM_OE 0x02
#define LC_DLAB 0x80 // divisor latch access bit
#define CLOCK_RATE 0x1C200 // USART clock rate
#define MC_DTRRTS 0x03 // Control bits to assert DTR and RTS
#define MS_DSRCTSCD 0xB0 // Status bits for DSR, CTS and CD
#define MS_CD 0x80
#define BD_150 150
#define BD_300 300
#define BD_600 600
#define BD_1200 1200
#define BD_2400 2400
#define BD_4800 4800
#define BD_9600 9600
#define BD_14400 14400
#define BD_19200 19200
#define BD_56000 56000
#define COM_OUTRDY 0x20
#define COM_DATRDY 0x01
//
// This bit controls the loopback testing mode of the device. Basically
// the outputs are connected to the inputs (and vice versa).
//
#define SERIAL_MCR_LOOP 0x10
//
// This bit is used for general purpose output.
//
#define SERIAL_MCR_OUT1 0x04
//
// This bit contains the (complemented) state of the clear to send
// (CTS) line.
//
#define SERIAL_MSR_CTS 0x10
//
// This bit contains the (complemented) state of the data set ready
// (DSR) line.
//
#define SERIAL_MSR_DSR 0x20
//
// This bit contains the (complemented) state of the ring indicator
// (RI) line.
//
#define SERIAL_MSR_RI 0x40
//
// This bit contains the (complemented) state of the data carrier detect
// (DCD) line.
//
#define SERIAL_MSR_DCD 0x80
typedef struct _CPPORT {
PUCHAR Address;
ULONG Baud;
USHORT Flags;
TIME_FIELDS CarrierLostTime;
// ULONG LockVar;
// KSPIN_LOCK Lock;
} CPPORT, *PCPPORT;
#define PORT_DEFAULTRATE 0x0001 // baud rate not specified, using default
#define PORT_MODEMCONTROL 0x0002 // using modem controls
#define PORT_SAVED 0x0004 // port is in saved state
#define PORT_NOCDLTIME 0x0010 // 'Carrier detect lost' time not set
#define PORT_DISBAUD 0x0020 // Display baud rate abbrv
#define PORT_SENDINGSTRING 0x0040 // Sending modem string (don't recurse)
#define PORT_MDM_CD 0x0080 // CD while in modem control mode
VOID
CpInitialize (
PCPPORT Port,
PUCHAR Address,
ULONG Rate
);
VOID
CpSetBaud (
PCPPORT Port,
ULONG Rate
);
USHORT
CpQueryBaud (
PCPPORT Port
);
VOID
CpPutByte (
PCPPORT Port,
UCHAR Byte
);
USHORT
CpGetByte (
PCPPORT Port,
PUCHAR Byte,
BOOLEAN WaitForData
);
VOID
CpLockPort (
PCPPORT Port
);
VOID
CpUnlockPort (
PCPPORT Port
);
VOID
CpStallExecution (
VOID
);
BOOLEAN
CpDoesPortExist(
IN PUCHAR Address
);
|