2 * PROJECT: ReactOS Kernel
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: ntoskrnl/inbv/inbvport.c
5 * PURPOSE: Serial Port Boot Driver for Headless Terminal Support
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES ******************************************************************/
14 /* GLOBALS *******************************************************************/
24 /* FUNCTIONS *****************************************************************/
28 InbvPortPollOnly(IN ULONG PortId
)
32 /* Poll a byte from the port */
33 return CpGetByte(&Port
[PortId
], &Dummy
, FALSE
, TRUE
) == CP_GET_SUCCESS
;
38 InbvPortGetByte(IN ULONG PortId
,
41 /* Read a byte from the port */
42 return CpGetByte(&Port
[PortId
], Byte
, TRUE
, FALSE
) == CP_GET_SUCCESS
;
47 InbvPortPutByte(IN ULONG PortId
,
51 CpPutByte(&Port
[PortId
], Byte
);
56 InbvPortEnableFifo(IN ULONG PortId
,
59 /* Set FIFO as requested */
60 CpEnableFifo(Port
[PortId
].Address
, Enable
);
65 InbvPortTerminate(IN ULONG PortId
)
67 /* The port is now available */
68 Port
[PortId
].Address
= NULL
;
73 InbvPortInitialize(IN ULONG BaudRate
,
75 IN PUCHAR PortAddress
,
77 IN BOOLEAN IsMMIODevice
)
79 /* Not yet supported */
80 ASSERT(IsMMIODevice
== FALSE
);
82 /* Set default baud rate */
83 if (BaudRate
== 0) BaudRate
= 19200;
85 /* Check if port or address given */
88 /* Pick correct address for port */
94 PortAddress
= (PUCHAR
)0x3F8;
98 PortAddress
= (PUCHAR
)0x2F8;
102 PortAddress
= (PUCHAR
)0x3E8;
107 PortAddress
= (PUCHAR
)0x2E8;
113 /* Pick correct port for address */
114 PortAddress
= (PUCHAR
)0x2F8;
115 if (CpDoesPortExist(PortAddress
))
121 PortAddress
= (PUCHAR
)0x3F8;
122 if (!CpDoesPortExist(PortAddress
)) return FALSE
;
127 /* Initialize the port unless it's already up, and then return it */
128 if (Port
[PortNumber
- 1].Address
) return FALSE
;
130 CpInitialize(&Port
[PortNumber
- 1], PortAddress
, BaudRate
);
131 *PortId
= PortNumber
- 1;