HardwareInterrupt2.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /** @file
  2. Copyright (c) 2016-2017, Linaro Ltd. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #ifndef __HARDWARE_INTERRUPT2_H__
  6. #define __HARDWARE_INTERRUPT2_H__
  7. #include <Protocol/HardwareInterrupt.h>
  8. // 22838932-1a2d-4a47-aaba-f3f7cf569470
  9. #define EFI_HARDWARE_INTERRUPT2_PROTOCOL_GUID \
  10. { 0x32898322, 0x2d1a, 0x474a, \
  11. { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }
  12. typedef enum {
  13. EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_LOW,
  14. EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH,
  15. EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_FALLING,
  16. EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING,
  17. } EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE;
  18. typedef struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL \
  19. EFI_HARDWARE_INTERRUPT2_PROTOCOL;
  20. /**
  21. Register Handler for the specified interrupt source.
  22. @param This Instance pointer for this protocol
  23. @param Source Hardware source of the interrupt
  24. @param Handler Callback for interrupt. NULL to unregister
  25. @retval EFI_SUCCESS Source was updated to support Handler.
  26. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  27. **/
  28. typedef
  29. EFI_STATUS
  30. (EFIAPI *HARDWARE_INTERRUPT2_REGISTER)(
  31. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  32. IN HARDWARE_INTERRUPT_SOURCE Source,
  33. IN HARDWARE_INTERRUPT_HANDLER Handler
  34. );
  35. /**
  36. Enable interrupt source Source.
  37. @param This Instance pointer for this protocol
  38. @param Source Hardware source of the interrupt
  39. @retval EFI_SUCCESS Source interrupt enabled.
  40. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  41. **/
  42. typedef
  43. EFI_STATUS
  44. (EFIAPI *HARDWARE_INTERRUPT2_ENABLE)(
  45. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  46. IN HARDWARE_INTERRUPT_SOURCE Source
  47. );
  48. /**
  49. Disable interrupt source Source.
  50. @param This Instance pointer for this protocol
  51. @param Source Hardware source of the interrupt
  52. @retval EFI_SUCCESS Source interrupt disabled.
  53. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  54. **/
  55. typedef
  56. EFI_STATUS
  57. (EFIAPI *HARDWARE_INTERRUPT2_DISABLE)(
  58. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  59. IN HARDWARE_INTERRUPT_SOURCE Source
  60. );
  61. /**
  62. Return current state of interrupt source Source.
  63. @param This Instance pointer for this protocol
  64. @param Source Hardware source of the interrupt
  65. @param InterruptState TRUE: source enabled, FALSE: source disabled.
  66. @retval EFI_SUCCESS InterruptState is valid
  67. @retval EFI_DEVICE_ERROR InterruptState is not valid
  68. **/
  69. typedef
  70. EFI_STATUS
  71. (EFIAPI *HARDWARE_INTERRUPT2_INTERRUPT_STATE)(
  72. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  73. IN HARDWARE_INTERRUPT_SOURCE Source,
  74. IN BOOLEAN *InterruptState
  75. );
  76. /**
  77. Signal to the hardware that the End Of Interrupt state
  78. has been reached.
  79. @param This Instance pointer for this protocol
  80. @param Source Hardware source of the interrupt
  81. @retval EFI_SUCCESS Source interrupt EOI'ed.
  82. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  83. **/
  84. typedef
  85. EFI_STATUS
  86. (EFIAPI *HARDWARE_INTERRUPT2_END_OF_INTERRUPT)(
  87. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  88. IN HARDWARE_INTERRUPT_SOURCE Source
  89. );
  90. /**
  91. Return the configured trigger type for an interrupt source
  92. @param This Instance pointer for this protocol
  93. @param Source Hardware source of the interrupt
  94. @param TriggerType The configured trigger type
  95. @retval EFI_SUCCESS Operation successful
  96. @retval EFI_DEVICE_ERROR Information could not be returned
  97. **/
  98. typedef
  99. EFI_STATUS
  100. (EFIAPI *HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE)(
  101. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  102. IN HARDWARE_INTERRUPT_SOURCE Source,
  103. OUT EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE *TriggerType
  104. );
  105. /**
  106. Configure the trigger type for an interrupt source
  107. @param This Instance pointer for this protocol
  108. @param Source Hardware source of the interrupt
  109. @param TriggerType The trigger type to configure
  110. @retval EFI_SUCCESS Operation successful
  111. @retval EFI_DEVICE_ERROR Hardware could not be programmed.
  112. **/
  113. typedef
  114. EFI_STATUS
  115. (EFIAPI *HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE)(
  116. IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  117. IN HARDWARE_INTERRUPT_SOURCE Source,
  118. IN EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE TriggerType
  119. );
  120. struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL {
  121. HARDWARE_INTERRUPT2_REGISTER RegisterInterruptSource;
  122. HARDWARE_INTERRUPT2_ENABLE EnableInterruptSource;
  123. HARDWARE_INTERRUPT2_DISABLE DisableInterruptSource;
  124. HARDWARE_INTERRUPT2_INTERRUPT_STATE GetInterruptSourceState;
  125. HARDWARE_INTERRUPT2_END_OF_INTERRUPT EndOfInterrupt;
  126. // v2 members
  127. HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE GetTriggerType;
  128. HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE SetTriggerType;
  129. };
  130. extern EFI_GUID gHardwareInterrupt2ProtocolGuid;
  131. #endif