3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #ifndef _WIN_NT_SERIAL_IO_
22 #define _WIN_NT_SERIAL_IO_
25 #define SERIAL_MAX_BUFFER_SIZE 256
26 #define TIMEOUT_STALL_INTERVAL 10
32 UINT8 Data
[SERIAL_MAX_BUFFER_SIZE
];
35 #define WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 's', 'i')
40 // Protocol data for the new handle we are going to add
43 EFI_SERIAL_IO_PROTOCOL SerialIo
;
44 EFI_SERIAL_IO_MODE SerialIoMode
;
45 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
50 EFI_HANDLE ControllerHandle
;
51 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
;
52 UART_DEVICE_PATH UartDevicePath
;
53 EFI_WIN_NT_THUNK_PROTOCOL
*WinNtThunk
;
55 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
58 // Private NT type Data;
65 BOOLEAN SoftwareLoopbackEnable
;
66 BOOLEAN HardwareFlowControl
;
67 BOOLEAN HardwareLoopbackEnable
;
71 } WIN_NT_SERIAL_IO_PRIVATE_DATA
;
73 #define WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS(a) \
74 CR(a, WIN_NT_SERIAL_IO_PRIVATE_DATA, SerialIo, WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE)
77 // Global Protocol Variables
79 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtSerialIoDriverBinding
;
80 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtSerialIoComponentName
;
83 // Macros to convert EFI serial types to NT serial types.
89 #define SERIAL_TIMEOUT_DEFAULT (1000 * 1000)
90 #define SERIAL_BAUD_DEFAULT 115200
91 #define SERIAL_FIFO_DEFAULT 14
92 #define SERIAL_DATABITS_DEFAULT 8
93 #define SERIAL_PARITY_DEFAULT DefaultParity
94 #define SERIAL_STOPBITS_DEFAULT DefaultStopBits
96 #define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
97 EFI_SERIAL_DATA_SET_READY | \
98 EFI_SERIAL_RING_INDICATE | \
99 EFI_SERIAL_CARRIER_DETECT | \
100 EFI_SERIAL_REQUEST_TO_SEND | \
101 EFI_SERIAL_DATA_TERMINAL_READY | \
102 EFI_SERIAL_INPUT_BUFFER_EMPTY)
104 #define ConvertBaud2Nt(x) (DWORD) x
105 #define ConvertData2Nt(x) (BYTE) x
107 #define ConvertParity2Nt(x) \
109 x == DefaultParity ? NOPARITY : \
110 x == NoParity ? NOPARITY : \
111 x == EvenParity ? EVENPARITY : \
112 x == OddParity ? ODDPARITY : \
113 x == MarkParity ? MARKPARITY : \
114 x == SpaceParity ? SPACEPARITY : 0 \
117 #define ConvertStop2Nt(x) \
119 x == DefaultParity ? ONESTOPBIT : \
120 x == OneFiveStopBits ? ONE5STOPBITS : \
121 x == TwoStopBits ? TWOSTOPBITS : 0 \
124 #define ConvertTime2Nt(x) ((x) / 1000)
127 // 115400 baud with rounding errors
129 #define SERIAL_PORT_MAX_BAUD_RATE 115400
132 // Function Prototypes
136 InitializeWinNtSerialIo (
137 IN EFI_HANDLE ImageHandle
,
138 IN EFI_SYSTEM_TABLE
*SystemTable
144 TODO: Add function description
148 ImageHandle - TODO: add argument description
149 SystemTable - TODO: add argument description
153 TODO: add return values
161 WinNtSerialIoDriverBindingSupported (
162 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
163 IN EFI_HANDLE Handle
,
164 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
170 TODO: Add function description
174 This - TODO: add argument description
175 Handle - TODO: add argument description
176 RemainingDevicePath - TODO: add argument description
180 TODO: add return values
188 WinNtSerialIoDriverBindingStart (
189 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
190 IN EFI_HANDLE Handle
,
191 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
197 TODO: Add function description
201 This - TODO: add argument description
202 Handle - TODO: add argument description
203 RemainingDevicePath - TODO: add argument description
207 TODO: add return values
215 WinNtSerialIoDriverBindingStop (
216 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
217 IN EFI_HANDLE Handle
,
218 IN UINTN NumberOfChildren
,
219 IN EFI_HANDLE
*ChildHandleBuffer
225 TODO: Add function description
229 This - TODO: add argument description
230 Handle - TODO: add argument description
231 NumberOfChildren - TODO: add argument description
232 ChildHandleBuffer - TODO: add argument description
236 TODO: add return values
245 IN EFI_SERIAL_IO_PROTOCOL
*This
251 TODO: Add function description
255 This - TODO: add argument description
259 TODO: add return values
267 WinNtSerialIoSetAttributes (
268 IN EFI_SERIAL_IO_PROTOCOL
*This
,
270 IN UINT32 ReceiveFifoDepth
,
272 IN EFI_PARITY_TYPE Parity
,
274 IN EFI_STOP_BITS_TYPE StopBits
280 TODO: Add function description
284 This - TODO: add argument description
285 BaudRate - TODO: add argument description
286 ReceiveFifoDepth - TODO: add argument description
287 Timeout - TODO: add argument description
288 Parity - TODO: add argument description
289 DataBits - TODO: add argument description
290 StopBits - TODO: add argument description
294 TODO: add return values
302 WinNtSerialIoSetControl (
303 IN EFI_SERIAL_IO_PROTOCOL
*This
,
310 TODO: Add function description
314 This - TODO: add argument description
315 Control - TODO: add argument description
319 TODO: add return values
327 WinNtSerialIoGetControl (
328 IN EFI_SERIAL_IO_PROTOCOL
*This
,
335 TODO: Add function description
339 This - TODO: add argument description
340 Control - TODO: add argument description
344 TODO: add return values
353 IN EFI_SERIAL_IO_PROTOCOL
*This
,
354 IN OUT UINTN
*BufferSize
,
361 TODO: Add function description
365 This - TODO: add argument description
366 BufferSize - TODO: add argument description
367 Buffer - TODO: add argument description
371 TODO: add return values
380 IN EFI_SERIAL_IO_PROTOCOL
*This
,
381 IN OUT UINTN
*BufferSize
,
388 TODO: Add function description
392 This - TODO: add argument description
393 BufferSize - TODO: add argument description
394 Buffer - TODO: add argument description
398 TODO: add return values
405 IN SERIAL_DEV_FIFO
*Fifo
411 TODO: Add function description
415 Fifo - TODO: add argument description
419 TODO: add return values
426 IN SERIAL_DEV_FIFO
*Fifo
432 TODO: Add function description
436 Fifo - TODO: add argument description
440 TODO: add return values
447 IN SERIAL_DEV_FIFO
*Fifo
,
454 TODO: Add function description
458 Fifo - TODO: add argument description
459 Data - TODO: add argument description
463 TODO: add return values
469 IsaSerialFifoRemove (
470 IN SERIAL_DEV_FIFO
*Fifo
,
477 TODO: Add function description
481 Fifo - TODO: add argument description
482 Data - TODO: add argument description
486 TODO: add return values
492 IsaSerialReceiveTransmit (
493 WIN_NT_SERIAL_IO_PRIVATE_DATA
*Private
499 TODO: Add function description
503 Private - TODO: add argument description
507 TODO: add return values