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