]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/SerialIo.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Protocol / SerialIo.h
index 5dd3aa17b9f582f60e7c615c2963bdbbb38d17c0..30a2260fd7d60ef0f15f5146829fe0658ad407be 100644 (file)
@@ -4,14 +4,8 @@
   Abstraction of a basic serial device. Targeted at 16550 UART, but\r
   could be much more generic.\r
 \r
-  Copyright (c) 2006, Intel Corporation                                                         \r
-  All rights reserved. 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
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
     0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } \\r
   }\r
 \r
-//\r
-// Protocol GUID defined in EFI1.1.\r
-// \r
+#define EFI_SERIAL_TERMINAL_DEVICE_TYPE_GUID \\r
+  { \\r
+    0X6AD9A60F, 0X5815, 0X4C7C, { 0X8A, 0X10, 0X50, 0X53, 0XD2, 0XBF, 0X7A, 0X1B } \\r
+  }\r
+\r
+///\r
+/// Protocol GUID defined in EFI1.1.\r
+///\r
 #define SERIAL_IO_PROTOCOL  EFI_SERIAL_IO_PROTOCOL_GUID\r
 \r
 typedef struct _EFI_SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL;\r
 \r
+///\r
+/// Backward-compatible with EFI1.1.\r
+///\r
+typedef EFI_SERIAL_IO_PROTOCOL SERIAL_IO_INTERFACE;\r
 \r
-//\r
-// Backward-compatible with EFI1.1.\r
-// \r
-typedef EFI_SERIAL_IO_PROTOCOL  SERIAL_IO_INTERFACE;\r
-\r
-//\r
-// Serial IO Data structures\r
-//\r
+///\r
+/// Parity type that is computed or checked as each character is transmitted or received. If the\r
+/// device does not support parity, the value is the default parity value.\r
+///\r
 typedef enum {\r
   DefaultParity,\r
   NoParity,\r
@@ -48,6 +47,9 @@ typedef enum {
   SpaceParity\r
 } EFI_PARITY_TYPE;\r
 \r
+///\r
+/// Stop bits type\r
+///\r
 typedef enum {\r
   DefaultStopBits,\r
   OneStopBit,\r
@@ -77,39 +79,39 @@ typedef enum {
 //\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
+#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
+\r
 /**\r
   Reset the serial device.\r
 \r
   @param  This              Protocol instance pointer.\r
-                            \r
+\r
   @retval EFI_SUCCESS       The device was reset.\r
   @retval EFI_DEVICE_ERROR  The serial device could not be reset.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_RESET) (\r
+(EFIAPI *EFI_SERIAL_RESET)(\r
   IN EFI_SERIAL_IO_PROTOCOL *This\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
-  Sets the baud rate, receive FIFO depth, transmit/receice time out, parity, \r
-  data buts, and stop bits on a serial device.\r
+  Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,\r
+  data bits, and stop bits on a serial device.\r
 \r
   @param  This             Protocol instance pointer.\r
-  @param  BaudRate         The requested baud rate. A BaudRate value of 0 will use the the\r
+  @param  BaudRate         The requested baud rate. A BaudRate value of 0 will use the\r
                            device's default interface speed.\r
   @param  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
+                           the device's default FIFO depth.\r
   @param  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
@@ -122,13 +124,14 @@ EFI_STATUS
                            value of DefaultStopBits will use the device's default number of\r
                            stop bits.\r
 \r
-  @retval EFI_SUCCESS      The device was reset.\r
-  @retval EFI_DEVICE_ERROR The serial device could not be reset.\r
+  @retval EFI_SUCCESS           The device was reset.\r
+  @retval EFI_INVALID_PARAMETER One or more attributes has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The serial device is not functioning correctly.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) (\r
+(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES)(\r
   IN EFI_SERIAL_IO_PROTOCOL         *This,\r
   IN UINT64                         BaudRate,\r
   IN UINT32                         ReceiveFifoDepth,\r
@@ -136,8 +139,7 @@ EFI_STATUS
   IN EFI_PARITY_TYPE                Parity,\r
   IN UINT8                          DataBits,\r
   IN EFI_STOP_BITS_TYPE             StopBits\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Set the control bits on a serial device\r
@@ -152,29 +154,27 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) (\r
+(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS)(\r
   IN EFI_SERIAL_IO_PROTOCOL         *This,\r
   IN UINT32                         Control\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Retrieves the status of thecontrol bits on a serial device\r
 \r
   @param  This              Protocol instance pointer.\r
   @param  Control           A pointer to return the current Control signals from the serial device.\r
-                            \r
+\r
   @retval EFI_SUCCESS       The control bits were read from the serial device.\r
   @retval EFI_DEVICE_ERROR  The serial device is not functioning correctly.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) (\r
+(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS)(\r
   IN EFI_SERIAL_IO_PROTOCOL         *This,\r
   OUT UINT32                        *Control\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Writes data to a serial device.\r
@@ -191,12 +191,11 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_WRITE) (\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
 \r
 /**\r
   Writes data to a serial device.\r
@@ -213,63 +212,98 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SERIAL_READ) (\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
 \r
 /**\r
-  The data values in SERIAL_IO_MODE are read-only and are updated by the code \r
+  @par Data Structure Description:\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
+  @param ControlMask\r
+  A mask for 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
+\r
+  @param TimeOut\r
+  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
+\r
+  @param BaudRate\r
+  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
+\r
+  @param ReceiveFifoDepth\r
+  The number of characters the device will buffer on input\r
+\r
+  @param DataBits\r
+  The number of characters the device will buffer on input\r
+\r
+  @param Parity\r
+  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
+\r
+  @param StopBits\r
+  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
+  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
+  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 EFI_SERIAL_IO_PROTOCOL_REVISION    0x00010000\r
-#define SERIAL_IO_INTERFACE_REVISION  EFI_SERIAL_IO_PROTOCOL_REVISION\r
+#define EFI_SERIAL_IO_PROTOCOL_REVISION     0x00010000\r
+#define EFI_SERIAL_IO_PROTOCOL_REVISION1p1  0x00010001\r
+#define SERIAL_IO_INTERFACE_REVISION        EFI_SERIAL_IO_PROTOCOL_REVISION\r
 \r
+///\r
+/// The Serial I/O protocol is used to communicate with UART-style serial devices.\r
+/// These can be standard UART serial ports in PC-AT systems, serial ports attached\r
+/// to a USB interface, or potentially any character-based I/O device.\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
+  /// The revision to which the EFI_SERIAL_IO_PROTOCOL adheres. All future revisions\r
+  /// must be backwards compatible. If a future version is not backwards compatible,\r
+  /// it is not the same GUID.\r
+  ///\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
+  /// Pointer to SERIAL_IO_MODE data.\r
+  ///\r
+  EFI_SERIAL_IO_MODE             *Mode;\r
+  ///\r
+  /// Pointer to a GUID identifying the device connected to the serial port.\r
+  /// This field is NULL when the protocol is installed by the serial port\r
+  /// driver and may be populated by a platform driver for a serial port\r
+  /// with a known device attached. The field will remain NULL if there is\r
+  /// no platform serial device identification information available.\r
+  ///\r
+  CONST EFI_GUID                 *DeviceTypeGuid; // Revision 1.1\r
 };\r
 \r
-extern EFI_GUID gEfiSerialIoProtocolGuid;\r
+extern EFI_GUID  gEfiSerialIoProtocolGuid;\r
+extern EFI_GUID  gEfiSerialTerminalDeviceTypeGuid;\r
 \r
 #endif\r