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