Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/soc/irq.h
1476 views
1
/*
2
* BPMP-Lite IRQ driver for Tegra X1
3
*
4
* Copyright (c) 2019 CTCaer
5
*
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms and conditions of the GNU General Public License,
8
* version 2, as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
* more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef IRQ_H
20
#define IRQ_H
21
22
#include <utils/types.h>
23
24
#define IRQ_MAX_HANDLERS 16
25
26
/* Primary interrupt controller ids */
27
#define IRQ_TMR1 0
28
#define IRQ_TMR2 1
29
#define IRQ_RTC 2
30
#define IRQ_CEC 3
31
#define IRQ_SHR_SEM_INBOX_FULL 4
32
#define IRQ_SHR_SEM_INBOX_EMPTY 5
33
#define IRQ_SHR_SEM_OUTBOX_FULL 6
34
#define IRQ_SHR_SEM_OUTBOX_EMPTY 7
35
#define IRQ_NVJPEG 8
36
#define IRQ_NVDEC 9
37
#define IRQ_QUAD_SPI 10
38
#define IRQ_DPAUX_INT1 11
39
#define IRQ_SATA_RX_STAT 13
40
#define IRQ_SDMMC1 14
41
#define IRQ_SDMMC2 15
42
#define IRQ_VGPIO_INT 16
43
#define IRQ_VII2C_INT 17
44
#define IRQ_SDMMC3 19
45
#define IRQ_USB 20
46
#define IRQ_USB2 21
47
#define IRQ_SATA_CTL 23
48
#define IRQ_PMC_INT 24
49
#define IRQ_FC_INT 25
50
#define IRQ_APB_DMA_CPU 26
51
#define IRQ_ARB_SEM_GNT_COP 28
52
#define IRQ_ARB_SEM_GNT_CPU 29
53
#define IRQ_SDMMC4 31
54
55
/* Secondary interrupt controller ids */
56
#define IRQ_GPIO1 32
57
#define IRQ_GPIO2 33
58
#define IRQ_GPIO3 34
59
#define IRQ_GPIO4 35
60
#define IRQ_UARTA 36
61
#define IRQ_UARTB 37
62
#define IRQ_I2C 38
63
#define IRQ_USB3_HOST_INT 39
64
#define IRQ_USB3_HOST_SMI 40
65
#define IRQ_TMR3 41
66
#define IRQ_TMR4 42
67
#define IRQ_USB3_HOST_PME 43
68
#define IRQ_USB3_DEV_HOST 44
69
#define IRQ_ACTMON 45
70
#define IRQ_UARTC 46
71
#define IRQ_THERMAL 48
72
#define IRQ_XUSB_PADCTL 49
73
#define IRQ_TSEC 50
74
#define IRQ_EDP 51
75
#define IRQ_I2C5 53
76
#define IRQ_GPIO5 55
77
#define IRQ_USB3_DEV_SMI 56
78
#define IRQ_USB3_DEV_PME 57
79
#define IRQ_SE 58
80
#define IRQ_SPI1 59
81
#define IRQ_APB_DMA_COP 60
82
#define IRQ_CLDVFS 62
83
#define IRQ_I2C6 63
84
85
/* Tertiary interrupt controller ids */
86
#define IRQ_HOST1X_SYNCPT_COP 64
87
#define IRQ_HOST1X_SYNCPT_CPU 65
88
#define IRQ_HOST1X_GEN_COP 66
89
#define IRQ_HOST1X_GEN_CPU 67
90
#define IRQ_NVENC 68
91
#define IRQ_VI 69
92
#define IRQ_ISPB 70
93
#define IRQ_ISP 71
94
#define IRQ_VIC 72
95
#define IRQ_DISPLAY 73
96
#define IRQ_DISPLAYB 74
97
#define IRQ_SOR1 75
98
#define IRQ_SOR 76
99
#define IRQ_MC 77
100
#define IRQ_EMC 78
101
#define IRQ_TSECB 80
102
#define IRQ_HDA 81
103
#define IRQ_SPI2 82
104
#define IRQ_SPI3 83
105
#define IRQ_I2C2 84
106
#define IRQ_PMU_EXT 86
107
#define IRQ_GPIO6 87
108
#define IRQ_GPIO7 89
109
#define IRQ_UARTD 90
110
#define IRQ_I2C3 92
111
#define IRQ_SPI4 93
112
113
/* Quaternary interrupt controller ids */
114
#define IRQ_DTV 96
115
#define IRQ_PCIE_INT 98
116
#define IRQ_PCIE_MSI 99
117
#define IRQ_AVP_CACHE 101
118
#define IRQ_APE_INT1 102
119
#define IRQ_APE_INT0 103
120
#define IRQ_APB_DMA_CH0 104
121
#define IRQ_APB_DMA_CH1 105
122
#define IRQ_APB_DMA_CH2 106
123
#define IRQ_APB_DMA_CH3 107
124
#define IRQ_APB_DMA_CH4 108
125
#define IRQ_APB_DMA_CH5 109
126
#define IRQ_APB_DMA_CH6 110
127
#define IRQ_APB_DMA_CH7 111
128
#define IRQ_APB_DMA_CH8 112
129
#define IRQ_APB_DMA_CH9 113
130
#define IRQ_APB_DMA_CH10 114
131
#define IRQ_APB_DMA_CH11 115
132
#define IRQ_APB_DMA_CH12 116
133
#define IRQ_APB_DMA_CH13 117
134
#define IRQ_APB_DMA_CH14 118
135
#define IRQ_APB_DMA_CH15 119
136
#define IRQ_I2C4 120
137
#define IRQ_TMR5 121
138
#define IRQ_WDT_CPU 123
139
#define IRQ_WDT_AVP 124
140
#define IRQ_GPIO8 125
141
#define IRQ_CAR 126
142
143
/* Quinary interrupt controller ids */
144
#define IRQ_APB_DMA_CH16 128
145
#define IRQ_APB_DMA_CH17 129
146
#define IRQ_APB_DMA_CH18 130
147
#define IRQ_APB_DMA_CH19 131
148
#define IRQ_APB_DMA_CH20 132
149
#define IRQ_APB_DMA_CH21 133
150
#define IRQ_APB_DMA_CH22 134
151
#define IRQ_APB_DMA_CH23 135
152
#define IRQ_APB_DMA_CH24 136
153
#define IRQ_APB_DMA_CH25 137
154
#define IRQ_APB_DMA_CH26 138
155
#define IRQ_APB_DMA_CH27 139
156
#define IRQ_APB_DMA_CH28 140
157
#define IRQ_APB_DMA_CH29 141
158
#define IRQ_APB_DMA_CH30 142
159
#define IRQ_APB_DMA_CH31 143
160
#define IRQ_CPU0_PMU_INTR 144
161
#define IRQ_CPU1_PMU_INTR 145
162
#define IRQ_CPU2_PMU_INTR 146
163
#define IRQ_CPU3_PMU_INTR 147
164
#define IRQ_SDMMC1_SYS 148
165
#define IRQ_SDMMC2_SYS 149
166
#define IRQ_SDMMC3_SYS 150
167
#define IRQ_SDMMC4_SYS 151
168
#define IRQ_TMR6 152
169
#define IRQ_TMR7 153
170
#define IRQ_TMR8 154
171
#define IRQ_TMR9 155
172
#define IRQ_TMR0 156
173
#define IRQ_GPU_STALL 157
174
#define IRQ_GPU_NONSTALL 158
175
#define IRQ_DPAUX 159
176
177
/* Senary interrupt controller ids */
178
#define IRQ_MPCORE_AXIERRIRQ 160
179
#define IRQ_MPCORE_INTERRIRQ 161
180
#define IRQ_EVENT_GPIO_A 162
181
#define IRQ_EVENT_GPIO_B 163
182
#define IRQ_EVENT_GPIO_C 164
183
#define IRQ_EVENT_GPIO_D_T210B01 165
184
#define IRQ_FLOW_RSM_CPU 168
185
#define IRQ_FLOW_RSM_COP 169
186
#define IRQ_TMR_SHARED 170
187
#define IRQ_MPCORE_CTIIRQ0 171
188
#define IRQ_MPCORE_CTIIRQ1 172
189
#define IRQ_MPCORE_CTIIRQ2 173
190
#define IRQ_MPCORE_CTIIRQ3 174
191
#define IRQ_MSELECT_ERROR 175
192
#define IRQ_TMR10 176
193
#define IRQ_TMR11 177
194
#define IRQ_TMR12 178
195
#define IRQ_TMR13 179
196
197
typedef int (*irq_handler_t)(u32 irq, void *data);
198
199
typedef enum _irq_status_t
200
{
201
IRQ_NONE = 0,
202
IRQ_HANDLED = 1,
203
IRQ_ERROR = 2,
204
205
IRQ_ENABLED = 0,
206
IRQ_NO_SLOTS_AVAILABLE = 1,
207
IRQ_ALREADY_REGISTERED = 2
208
} irq_status_t;
209
210
typedef enum _irq_flags_t
211
{
212
IRQ_FLAG_NONE = 0,
213
IRQ_FLAG_ONE_OFF = BIT(0),
214
IRQ_FLAG_REPLACEABLE = BIT(1)
215
} irq_flags_t;
216
217
void irq_end();
218
void irq_free(u32 irq);
219
void irq_wait_event();
220
void irq_disable_wait_event();
221
irq_status_t irq_request(u32 irq, irq_handler_t handler, void *data, irq_flags_t flags);
222
223
#endif
224