+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- SerialIo.h\r
-\r
-Abstract:\r
-\r
- Serial IO protocol as defined in the EFI 1.0 specification.\r
-\r
- Abstraction of a basic serial device. Targeted at 16550 UART, but\r
- could be much more generic.\r
-\r
---*/\r
-\r
-#ifndef _SERIAL_IO_H_\r
-#define _SERIAL_IO_H_\r
-\r
-#define EFI_SERIAL_IO_PROTOCOL_GUID \\r
- { \\r
- 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} \\r
- }\r
-\r
-EFI_FORWARD_DECLARATION (EFI_SERIAL_IO_PROTOCOL);\r
-\r
-//\r
-// Serial IO Data structures\r
-//\r
-typedef enum {\r
- DefaultParity,\r
- NoParity,\r
- EvenParity,\r
- OddParity,\r
- MarkParity,\r
- SpaceParity\r
-} EFI_PARITY_TYPE;\r
-\r
-typedef enum {\r
- DefaultStopBits,\r
- OneStopBit,\r
- OneFiveStopBits,\r
- TwoStopBits\r
-} EFI_STOP_BITS_TYPE;\r
-\r
-//\r
-// define for Control bits, grouped by read only, write only, and read write\r
-//\r
-//\r
-// Read Only\r
-//\r
-#define EFI_SERIAL_CLEAR_TO_SEND 0x00000010\r
-#define EFI_SERIAL_DATA_SET_READY 0x00000020\r
-#define EFI_SERIAL_RING_INDICATE 0x00000040\r
-#define EFI_SERIAL_CARRIER_DETECT 0x00000080\r
-#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x00000100\r
-#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x00000200\r
-\r
-//\r
-// Write Only\r
-//\r
-#define EFI_SERIAL_REQUEST_TO_SEND 0x00000002\r
-#define EFI_SERIAL_DATA_TERMINAL_READY 0x00000001\r
-\r
-//\r
-// Read Write\r
-//\r
-#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x00001000\r
-#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x00002000\r
-#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x00004000\r
-\r
-//\r
-// Serial IO Member Functions\r
-//\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_RESET) (\r
- IN EFI_SERIAL_IO_PROTOCOL * This\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Reset the serial device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
-\r
- Returns:\r
- EFI_SUCCESS - The device was reset.\r
- EFI_DEVICE_ERROR - The serial device could not be reset.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) (\r
- IN EFI_SERIAL_IO_PROTOCOL * This,\r
- IN UINT64 BaudRate,\r
- IN UINT32 ReceiveFifoDepth,\r
- IN UINT32 Timeout,\r
- IN EFI_PARITY_TYPE Parity,\r
- IN UINT8 DataBits,\r
- IN EFI_STOP_BITS_TYPE StopBits\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Sets the baud rate, receive FIFO depth, transmit/receice time out, parity, \r
- data buts, and stop bits on a serial device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- BaudRate - The requested baud rate. A BaudRate value of 0 will use the the\r
- device's default interface speed.\r
- ReveiveFifoDepth - The requested depth of the FIFO on the receive side of the\r
- serial interface. A ReceiveFifoDepth value of 0 will use \r
- the device's dfault FIFO depth.\r
- Timeout - The requested time out for a single character in microseconds. \r
- This timeout applies to both the transmit and receive side of the\r
- interface. A Timeout value of 0 will use the device's default time\r
- out value.\r
- Parity - The type of parity to use on this serial device. A Parity value of\r
- DefaultParity will use the device's default parity value. \r
- DataBits - The number of data bits to use on the serial device. A DataBits\r
- vaule of 0 will use the device's default data bit setting.\r
- StopBits - The number of stop bits to use on this serial device. A StopBits\r
- value of DefaultStopBits will use the device's default number of\r
- stop bits. \r
-\r
- Returns:\r
- EFI_SUCCESS - The device was reset.\r
- EFI_DEVICE_ERROR - The serial device could not be reset.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) (\r
- IN EFI_SERIAL_IO_PROTOCOL * This,\r
- IN UINT32 Control\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Set the control bits on a serial device\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- Control - Set the bits of Control that are settable.\r
-\r
- Returns:\r
- EFI_SUCCESS - The new control bits were set on the serial device.\r
- EFI_UNSUPPORTED - The serial device does not support this operation.\r
- EFI_DEVICE_ERROR - The serial device is not functioning correctly.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) (\r
- IN EFI_SERIAL_IO_PROTOCOL * This,\r
- OUT UINT32 *Control\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Retrieves the status of thecontrol bits on a serial device\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- Control - A pointer to return the current Control signals from the serial\r
- device.\r
-\r
- Returns:\r
- EFI_SUCCESS - The control bits were read from the serial device.\r
- EFI_DEVICE_ERROR - The serial device is not functioning correctly.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_WRITE) (\r
- IN EFI_SERIAL_IO_PROTOCOL * This,\r
- IN OUT UINTN *BufferSize,\r
- IN VOID *Buffer\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Writes data to a serial device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- BufferSize - On input, the size of the Buffer. On output, the amount of \r
- data actually written.\r
- Buffer - The buffer of data to write\r
-\r
- Returns:\r
- EFI_SUCCESS - The data was written.\r
- EFI_DEVICE_ERROR - The device reported an error.\r
- EFI_TIMEOUT - The data write was stopped due to a timeout.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_READ) (\r
- IN EFI_SERIAL_IO_PROTOCOL * This,\r
- IN OUT UINTN *BufferSize,\r
- OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Writes data to a serial device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- BufferSize - On input, the size of the Buffer. On output, the amount of \r
- data returned in Buffer.\r
- Buffer - The buffer to return the data into.\r
-\r
- Returns:\r
- EFI_SUCCESS - The data was read.\r
- EFI_DEVICE_ERROR - The device reported an error.\r
- EFI_TIMEOUT - The data write was stopped due to a timeout.\r
-\r
---*/\r
-;\r
-\r
-/*++\r
-\r
- The data values in SERIAL_IO_MODE are read-only and are updated by the code \r
- that produces the SERIAL_IO_PROTOCOL member functions.\r
-\r
- ControlMask - A mask fo the Control bits that the device supports. The device\r
- must always support the Input Buffer Empty control bit.\r
- TimeOut - If applicable, the number of microseconds to wait before timing out\r
- a Read or Write operation.\r
- BaudRate - If applicable, the current baud rate setting of the device; otherwise,\r
- baud rate has the value of zero to indicate that device runs at the\r
- device's designed speed.\r
- ReceiveFifoDepth - The number of characters the device will buffer on input\r
- DataBits - The number of characters the device will buffer on input\r
- Parity - If applicable, this is the EFI_PARITY_TYPE that is computed or \r
- checked as each character is transmitted or reveived. If the device\r
- does not support parity the value is the default parity value.\r
- StopBits - If applicable, the EFI_STOP_BITS_TYPE number of stop bits per\r
- character. If the device does not support stop bits the value is\r
- the default stop bit values.\r
-\r
---*/\r
-typedef struct {\r
- UINT32 ControlMask;\r
-\r
- //\r
- // current Attributes\r
- //\r
- UINT32 Timeout;\r
- UINT64 BaudRate;\r
- UINT32 ReceiveFifoDepth;\r
- UINT32 DataBits;\r
- UINT32 Parity;\r
- UINT32 StopBits;\r
-} EFI_SERIAL_IO_MODE;\r
-\r
-#define SERIAL_IO_INTERFACE_REVISION 0x00010000\r
-\r
-struct _EFI_SERIAL_IO_PROTOCOL {\r
- UINT32 Revision;\r
- EFI_SERIAL_RESET Reset;\r
- EFI_SERIAL_SET_ATTRIBUTES SetAttributes;\r
- EFI_SERIAL_SET_CONTROL_BITS SetControl;\r
- EFI_SERIAL_GET_CONTROL_BITS GetControl;\r
- EFI_SERIAL_WRITE Write;\r
- EFI_SERIAL_READ Read;\r
-\r
- EFI_SERIAL_IO_MODE *Mode;\r
-};\r
-\r
-extern EFI_GUID gEfiSerialIoProtocolGuid;\r
-\r
-#endif\r