1 #ifndef _EFI_SER_H 2 #define _EFI_SER_H 3 4 /*++ 5 6 Copyright (c) 1998 Intel Corporation 7 8 Module Name: 9 10 efiser.h 11 12 Abstract: 13 14 EFI serial protocol 15 16 Revision History 17 18 --*/ 19 20 // 21 // Serial protocol 22 // 23 24 #define EFI_SERIAL_IO_PROTOCOL_GUID \ 25 { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} } 26 #define SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL_GUID 27 28 INTERFACE_DECL(_EFI_SERIAL_IO_PROTOCOL); 29 30 typedef enum { 31 DefaultParity, 32 NoParity, 33 EvenParity, 34 OddParity, 35 MarkParity, 36 SpaceParity 37 } EFI_PARITY_TYPE; 38 39 typedef enum { 40 DefaultStopBits, 41 OneStopBit, // 1 stop bit 42 OneFiveStopBits, // 1.5 stop bits 43 TwoStopBits // 2 stop bits 44 } EFI_STOP_BITS_TYPE; 45 46 #define EFI_SERIAL_CLEAR_TO_SEND 0x0010 // RO 47 #define EFI_SERIAL_DATA_SET_READY 0x0020 // RO 48 #define EFI_SERIAL_RING_INDICATE 0x0040 // RO 49 #define EFI_SERIAL_CARRIER_DETECT 0x0080 // RO 50 #define EFI_SERIAL_REQUEST_TO_SEND 0x0002 // WO 51 #define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 // WO 52 #define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 // RO 53 #define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 // RO 54 #define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 // RW 55 #define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 // RW 56 #define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 // RW 57 58 typedef 59 EFI_STATUS 60 (EFIAPI *EFI_SERIAL_RESET) ( 61 IN struct _EFI_SERIAL_IO_PROTOCOL *This 62 ); 63 64 typedef 65 EFI_STATUS 66 (EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) ( 67 IN struct _EFI_SERIAL_IO_PROTOCOL *This, 68 IN UINT64 BaudRate, 69 IN UINT32 ReceiveFifoDepth, 70 IN UINT32 Timeout, 71 IN EFI_PARITY_TYPE Parity, 72 IN UINT8 DataBits, 73 IN EFI_STOP_BITS_TYPE StopBits 74 ); 75 76 typedef 77 EFI_STATUS 78 (EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) ( 79 IN struct _EFI_SERIAL_IO_PROTOCOL *This, 80 IN UINT32 Control 81 ); 82 83 typedef 84 EFI_STATUS 85 (EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) ( 86 IN struct _EFI_SERIAL_IO_PROTOCOL *This, 87 OUT UINT32 *Control 88 ); 89 90 typedef 91 EFI_STATUS 92 (EFIAPI *EFI_SERIAL_WRITE) ( 93 IN struct _EFI_SERIAL_IO_PROTOCOL *This, 94 IN OUT UINTN *BufferSize, 95 IN VOID *Buffer 96 ); 97 98 typedef 99 EFI_STATUS 100 (EFIAPI *EFI_SERIAL_READ) ( 101 IN struct _EFI_SERIAL_IO_PROTOCOL *This, 102 IN OUT UINTN *BufferSize, 103 OUT VOID *Buffer 104 ); 105 106 typedef struct { 107 UINT32 ControlMask; 108 109 // current Attributes 110 UINT32 Timeout; 111 UINT64 BaudRate; 112 UINT32 ReceiveFifoDepth; 113 UINT32 DataBits; 114 UINT32 Parity; 115 UINT32 StopBits; 116 } SERIAL_IO_MODE; 117 118 #define SERIAL_IO_INTERFACE_REVISION 0x00010000 119 120 typedef struct _EFI_SERIAL_IO_PROTOCOL { 121 UINT32 Revision; 122 EFI_SERIAL_RESET Reset; 123 EFI_SERIAL_SET_ATTRIBUTES SetAttributes; 124 EFI_SERIAL_SET_CONTROL_BITS SetControl; 125 EFI_SERIAL_GET_CONTROL_BITS GetControl; 126 EFI_SERIAL_WRITE Write; 127 EFI_SERIAL_READ Read; 128 129 SERIAL_IO_MODE *Mode; 130 } EFI_SERIAL_IO_PROTOCOL; 131 132 typedef struct _EFI_SERIAL_IO_PROTOCOL _SERIAL_IO_INTERFACE; 133 typedef EFI_SERIAL_IO_PROTOCOL SERIAL_IO_INTERFACE; 134 135 #endif 136 137