efiser.h 3.5 KB

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