ARM Packages: Corrected non-DOS line endings
[mirror_edk2.git] / EmbeddedPkg / Include / Protocol / HardwareInterrupt.h
CommitLineData
2ef2b01e
A
1/** @file\r
2 Abstraction for hardware based interrupt routine\r
3 \r
4 On non IA-32 systems it is common to have a single hardware interrupt vector\r
5 and a 2nd layer of software that routes the interrupt handlers based on the\r
6 interrupt source. This protocol enables this routing. The driver implementing \r
7 this protocol is responsible for clearing the pending interrupt in the \r
8 interrupt routing hardware. The HARDWARE_INTERRUPT_HANDLER is responsible \r
9 for clearing interrupt sources from individual devices.\r
10\r
11\r
60274cca 12 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
2ef2b01e 13\r
60274cca 14 This program and the accompanying materials\r
2ef2b01e
A
15 are licensed and made available under the terms and conditions of the BSD License\r
16 which accompanies this distribution. The full text of the license may be found at\r
17 http://opensource.org/licenses/bsd-license.php\r
18\r
19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
21\r
22**/\r
23\r
24#ifndef __HARDWARE_INTERRUPT_H__\r
25#define __HARDWARE_INTERRUPT_H__\r
26\r
27#include <Protocol/DebugSupport.h>\r
28\r
29\r
30//\r
31// Protocol GUID\r
32//\r
33// EAB39028-3D05-4316-AD0C-D64808DA3FF1\r
34\r
35#define EFI_HARDWARE_INTERRUPT_PROTOCOL_GGUID \\r
36 { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }\r
37\r
38\r
39typedef struct _EFI_HARDWARE_INTERRUPT_PROTOCOL EFI_HARDWARE_INTERRUPT_PROTOCOL;\r
40\r
41\r
42typedef UINTN HARDWARE_INTERRUPT_SOURCE;\r
43\r
44\r
45/**\r
46 C Interrupt Handler calledin the interrupt context when Source interrupt is active.\r
47\r
48 @param Source Source of the interrupt. Hardware routing off a specific platform defines\r
49 what source means.\r
50 @param SystemContext Pointer to system register context. Mostly used by debuggers and will\r
51 update the system context after the return from the interrupt if \r
52 modified. Don't change these values unless you know what you are doing\r
53\r
54**/\r
55typedef\r
56VOID\r
57(EFIAPI *HARDWARE_INTERRUPT_HANDLER) (\r
58 IN HARDWARE_INTERRUPT_SOURCE Source,\r
59 IN EFI_SYSTEM_CONTEXT SystemContext \r
60 );\r
61\r
62\r
63/**\r
64 Register Handler for the specified interrupt source.\r
65\r
66 @param This Instance pointer for this protocol\r
67 @param Source Hardware source of the interrupt\r
68 @param Handler Callback for interrupt. NULL to unregister\r
69\r
70 @retval EFI_SUCCESS Source was updated to support Handler.\r
71 @retval EFI_DEVICE_ERROR Hardware could not be programmed.\r
72\r
73**/\r
74typedef\r
75EFI_STATUS\r
76(EFIAPI *HARDWARE_INTERRUPT_REGISTER) (\r
77 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,\r
78 IN HARDWARE_INTERRUPT_SOURCE Source,\r
79 IN HARDWARE_INTERRUPT_HANDLER Handler\r
80 );\r
81\r
82\r
83/**\r
84 Enable interrupt source Source.\r
85\r
86 @param This Instance pointer for this protocol\r
87 @param Source Hardware source of the interrupt\r
88\r
89 @retval EFI_SUCCESS Source interrupt enabled.\r
90 @retval EFI_DEVICE_ERROR Hardware could not be programmed.\r
91\r
92**/\r
93typedef\r
94EFI_STATUS\r
95(EFIAPI *HARDWARE_INTERRUPT_ENABLE) (\r
96 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,\r
97 IN HARDWARE_INTERRUPT_SOURCE Source\r
98 );\r
99\r
100\r
101\r
102/**\r
103 Disable interrupt source Source.\r
104\r
105 @param This Instance pointer for this protocol\r
106 @param Source Hardware source of the interrupt\r
107\r
108 @retval EFI_SUCCESS Source interrupt disabled.\r
109 @retval EFI_DEVICE_ERROR Hardware could not be programmed.\r
110\r
111**/\r
112typedef\r
113EFI_STATUS\r
114(EFIAPI *HARDWARE_INTERRUPT_DISABLE) (\r
115 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,\r
116 IN HARDWARE_INTERRUPT_SOURCE Source\r
117 );\r
118\r
119\r
120/**\r
121 Return current state of interrupt source Source.\r
122\r
123 @param This Instance pointer for this protocol\r
124 @param Source Hardware source of the interrupt\r
125 @param InterruptState TRUE: source enabled, FALSE: source disabled.\r
126\r
127 @retval EFI_SUCCESS InterruptState is valid\r
128 @retval EFI_DEVICE_ERROR InterruptState is not valid\r
129\r
130**/\r
131typedef\r
132EFI_STATUS\r
133(EFIAPI *HARDWARE_INTERRUPT_INTERRUPT_STATE) (\r
134 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,\r
135 IN HARDWARE_INTERRUPT_SOURCE Source,\r
753816a3 136 IN BOOLEAN *InterruptState \r
137 );\r
138\r
139/**\r
140 Signal to the hardware that the End Of Intrrupt state \r
141 has been reached.\r
142\r
143 @param This Instance pointer for this protocol\r
144 @param Source Hardware source of the interrupt\r
145\r
146 @retval EFI_SUCCESS Source interrupt EOI'ed.\r
147 @retval EFI_DEVICE_ERROR Hardware could not be programmed.\r
148\r
149**/\r
150typedef\r
151EFI_STATUS\r
152(EFIAPI *HARDWARE_INTERRUPT_END_OF_INTERRUPT) (\r
153 IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,\r
154 IN HARDWARE_INTERRUPT_SOURCE Source\r
2ef2b01e
A
155 );\r
156\r
157\r
158struct _EFI_HARDWARE_INTERRUPT_PROTOCOL {\r
159 HARDWARE_INTERRUPT_REGISTER RegisterInterruptSource;\r
160 HARDWARE_INTERRUPT_ENABLE EnableInterruptSource;\r
161 HARDWARE_INTERRUPT_DISABLE DisableInterruptSource;\r
162 HARDWARE_INTERRUPT_INTERRUPT_STATE GetInterruptSourceState;\r
753816a3 163 HARDWARE_INTERRUPT_END_OF_INTERRUPT EndOfInterrupt;\r
2ef2b01e
A
164};\r
165\r
166extern EFI_GUID gHardwareInterruptProtocolGuid;\r
167\r
168#endif\r
169\r
170\r