summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h
blob: 2b1cb5f28e0f0857511d02276aac30c42797792a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/** @file

  Copyright (c) 2016-2017, Linaro Ltd. All rights reserved.<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef __HARDWARE_INTERRUPT2_H__
#define __HARDWARE_INTERRUPT2_H__

#include <Protocol/HardwareInterrupt.h>

// 22838932-1a2d-4a47-aaba-f3f7cf569470

#define EFI_HARDWARE_INTERRUPT2_PROTOCOL_GUID \
  { 0x32898322, 0x2d1a, 0x474a, \
    { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }

typedef enum {
  EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_LOW,
  EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH,
  EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_FALLING,
  EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING,
} EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE;

typedef struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL \
                 EFI_HARDWARE_INTERRUPT2_PROTOCOL;

/**
  Register Handler for the specified interrupt source.

  @param This     Instance pointer for this protocol
  @param Source   Hardware source of the interrupt
  @param Handler  Callback for interrupt. NULL to unregister

  @retval EFI_SUCCESS Source was updated to support Handler.
  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_REGISTER) (
  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN HARDWARE_INTERRUPT_SOURCE Source,
  IN HARDWARE_INTERRUPT_HANDLER Handler
  );


/**
  Enable interrupt source Source.

  @param This     Instance pointer for this protocol
  @param Source   Hardware source of the interrupt

  @retval EFI_SUCCESS       Source interrupt enabled.
  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_ENABLE) (
  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN HARDWARE_INTERRUPT_SOURCE Source
  );


/**
  Disable interrupt source Source.

  @param This     Instance pointer for this protocol
  @param Source   Hardware source of the interrupt

  @retval EFI_SUCCESS       Source interrupt disabled.
  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_DISABLE) (
  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN HARDWARE_INTERRUPT_SOURCE Source
  );


/**
  Return current state of interrupt source Source.

  @param This     Instance pointer for this protocol
  @param Source   Hardware source of the interrupt
  @param InterruptState  TRUE: source enabled, FALSE: source disabled.

  @retval EFI_SUCCESS       InterruptState is valid
  @retval EFI_DEVICE_ERROR  InterruptState is not valid

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_INTERRUPT_STATE) (
  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN HARDWARE_INTERRUPT_SOURCE Source,
  IN BOOLEAN *InterruptState
  );

/**
  Signal to the hardware that the End Of Interrupt state
  has been reached.

  @param This     Instance pointer for this protocol
  @param Source   Hardware source of the interrupt

  @retval EFI_SUCCESS       Source interrupt EOI'ed.
  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_END_OF_INTERRUPT) (
  IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN HARDWARE_INTERRUPT_SOURCE Source
  );

/**
  Return the configured trigger type for an interrupt source

  @param This         Instance pointer for this protocol
  @param Source       Hardware source of the interrupt
  @param TriggerType  The configured trigger type

  @retval EFI_SUCCESS       Operation successful
  @retval EFI_DEVICE_ERROR  Information could not be returned

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE) (
  IN  EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN  HARDWARE_INTERRUPT_SOURCE Source,
  OUT EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE *TriggerType
  );


/**
 Configure the trigger type for an interrupt source

  @param This         Instance pointer for this protocol
  @param Source       Hardware source of the interrupt
  @param TriggerType  The trigger type to configure

  @retval EFI_SUCCESS       Operation successful
  @retval EFI_DEVICE_ERROR  Hardware could not be programmed.

**/
typedef
EFI_STATUS
(EFIAPI *HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE) (
  IN  EFI_HARDWARE_INTERRUPT2_PROTOCOL *This,
  IN  HARDWARE_INTERRUPT_SOURCE Source,
  IN  EFI_HARDWARE_INTERRUPT2_TRIGGER_TYPE TriggerType
  );

struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL {
  HARDWARE_INTERRUPT2_REGISTER            RegisterInterruptSource;
  HARDWARE_INTERRUPT2_ENABLE              EnableInterruptSource;
  HARDWARE_INTERRUPT2_DISABLE             DisableInterruptSource;
  HARDWARE_INTERRUPT2_INTERRUPT_STATE     GetInterruptSourceState;
  HARDWARE_INTERRUPT2_END_OF_INTERRUPT    EndOfInterrupt;

  // v2 members
  HARDWARE_INTERRUPT2_GET_TRIGGER_TYPE    GetTriggerType;
  HARDWARE_INTERRUPT2_SET_TRIGGER_TYPE    SetTriggerType;
};

extern EFI_GUID gHardwareInterrupt2ProtocolGuid;

#endif