ReactOS 0.4.15-dev-7846-g8ba6c66
inbvport.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for inbvport.c:

Go to the source code of this file.

Functions

BOOLEAN NTAPI InbvPortPollOnly (IN ULONG PortId)
 
BOOLEAN NTAPI InbvPortGetByte (IN ULONG PortId, OUT PUCHAR Byte)
 
VOID NTAPI InbvPortPutByte (IN ULONG PortId, IN UCHAR Byte)
 
VOID NTAPI InbvPortEnableFifo (IN ULONG PortId, IN BOOLEAN Enable)
 
VOID NTAPI InbvPortTerminate (IN ULONG PortId)
 
BOOLEAN NTAPI InbvPortInitialize (IN ULONG BaudRate, IN ULONG PortNumber, IN PUCHAR PortAddress, OUT PULONG PortId, IN BOOLEAN IsMMIODevice)
 

Variables

CPPORT Port [4]
 

Function Documentation

◆ InbvPortEnableFifo()

VOID NTAPI InbvPortEnableFifo ( IN ULONG  PortId,
IN BOOLEAN  Enable 
)

Definition at line 56 of file inbvport.c.

58{
59 /* Set FIFO as requested */
61}
VOID NTAPI CpEnableFifo(IN PUCHAR Address, IN BOOLEAN Enable)
Definition: cport.c:51
CPPORT Port[4]
Definition: inbvport.c:16
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
static WCHAR Address[46]
Definition: ping.c:68

Referenced by HdlspEnableTerminal().

◆ InbvPortGetByte()

BOOLEAN NTAPI InbvPortGetByte ( IN ULONG  PortId,
OUT PUCHAR  Byte 
)

Definition at line 38 of file inbvport.c.

40{
41 /* Read a byte from the port */
42 return CpGetByte(&Port[PortId], Byte, TRUE, FALSE) == CP_GET_SUCCESS;
43}
#define CP_GET_SUCCESS
Definition: cportlib.h:18
USHORT NTAPI CpGetByte(IN PCPPORT Port, OUT PUCHAR Byte, IN BOOLEAN Wait, IN BOOLEAN Poll)
Definition: cport.c:253
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned char Byte
Definition: zlib.h:37

Referenced by HdlspDispatch().

◆ InbvPortInitialize()

BOOLEAN NTAPI InbvPortInitialize ( IN ULONG  BaudRate,
IN ULONG  PortNumber,
IN PUCHAR  PortAddress,
OUT PULONG  PortId,
IN BOOLEAN  IsMMIODevice 
)

Definition at line 73 of file inbvport.c.

78{
79 /* Not yet supported */
80 ASSERT(IsMMIODevice == FALSE);
81
82#if defined(SARCH_PC98)
83 /* Set default baud rate */
84 if (BaudRate == 0) BaudRate = 9600;
85
86 /* Check if port or address given */
87 if (PortNumber)
88 {
89 /* Pick correct address for port */
90 if (!PortAddress)
91 {
92 if (PortNumber == 1)
93 {
94 PortAddress = (PUCHAR)0x30;
95 }
96 else
97 {
98 PortAddress = (PUCHAR)0x238;
99 PortNumber = 2;
100 }
101 }
102 }
103 else
104 {
105 /* Pick correct port for address */
106 PortAddress = (PUCHAR)0x30;
107 if (CpDoesPortExist(PortAddress))
108 {
109 PortNumber = 1;
110 }
111 else
112 {
113 PortAddress = (PUCHAR)0x238;
114 if (!CpDoesPortExist(PortAddress))
115 return FALSE;
116
117 PortNumber = 2;
118 }
119 }
120#else
121 /* Set default baud rate */
122 if (BaudRate == 0) BaudRate = 19200;
123
124 /* Check if port or address given */
125 if (PortNumber)
126 {
127 /* Pick correct address for port */
128 if (!PortAddress)
129 {
130 switch (PortNumber)
131 {
132 case 1:
133 PortAddress = (PUCHAR)0x3F8;
134 break;
135
136 case 2:
137 PortAddress = (PUCHAR)0x2F8;
138 break;
139
140 case 3:
141 PortAddress = (PUCHAR)0x3E8;
142 break;
143
144 default:
145 PortNumber = 4;
146 PortAddress = (PUCHAR)0x2E8;
147 }
148 }
149 }
150 else
151 {
152 /* Pick correct port for address */
153 PortAddress = (PUCHAR)0x2F8;
154 if (CpDoesPortExist(PortAddress))
155 {
156 PortNumber = 2;
157 }
158 else
159 {
160 PortAddress = (PUCHAR)0x3F8;
161 if (!CpDoesPortExist(PortAddress)) return FALSE;
162 PortNumber = 1;
163 }
164 }
165#endif
166
167 /* Initialize the port unless it's already up, and then return it */
168 if (Port[PortNumber - 1].Address) return FALSE;
169
170 CpInitialize(&Port[PortNumber - 1], PortAddress, BaudRate);
171 *PortId = PortNumber - 1;
172
173 return TRUE;
174}
NTSTATUS NTAPI CpInitialize(IN PCPPORT Port, IN PUCHAR Address, IN ULONG BaudRate)
Definition: cport.c:85
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:224
#define ASSERT(a)
Definition: mode.c:44
ULONG PortNumber
Definition: storport.c:18
unsigned char * PUCHAR
Definition: typedefs.h:53

Referenced by HdlspEnableTerminal().

◆ InbvPortPollOnly()

BOOLEAN NTAPI InbvPortPollOnly ( IN ULONG  PortId)

Definition at line 28 of file inbvport.c.

29{
30 UCHAR Dummy;
31
32 /* Poll a byte from the port */
33 return CpGetByte(&Port[PortId], &Dummy, FALSE, TRUE) == CP_GET_SUCCESS;
34}
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by HdlspDispatch().

◆ InbvPortPutByte()

VOID NTAPI InbvPortPutByte ( IN ULONG  PortId,
IN UCHAR  Byte 
)

Definition at line 47 of file inbvport.c.

49{
50 /* Send the byte */
51 CpPutByte(&Port[PortId], Byte);
52}
VOID NTAPI CpPutByte(IN PCPPORT Port, IN UCHAR Byte)
Definition: cport.c:303

Referenced by HdlspPutData(), and HdlspSendStringAtBaud().

◆ InbvPortTerminate()

VOID NTAPI InbvPortTerminate ( IN ULONG  PortId)

Definition at line 65 of file inbvport.c.

66{
67 /* The port is now available */
68 Port[PortId].Address = NULL;
69}
#define NULL
Definition: types.h:112
PUCHAR Address
Definition: cportlib.h:29

Referenced by HdlspEnableTerminal().

Variable Documentation

◆ Port

CPPORT Port[4]
Initial value:
=
{
{NULL, 0, TRUE},
{NULL, 0, TRUE},
{NULL, 0, TRUE},
{NULL, 0, TRUE}
}

Definition at line 16 of file inbvport.c.

Referenced by InbvPortEnableFifo(), InbvPortGetByte(), InbvPortInitialize(), InbvPortPollOnly(), InbvPortPutByte(), and InbvPortTerminate().