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