Software APIs
isr_testutils.c
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
6// util/autogen_testutils.py
7
8#include "sw/device/lib/testing/autogen/isr_testutils.h"
10
12#include "sw/device/lib/testing/test_framework/check.h"
13
14void isr_testutils_ac_range_check_isr(
15 plic_isr_ctx_t plic_ctx, ac_range_check_isr_ctx_t ac_range_check_ctx,
16 bool mute_status_irq, top_darjeeling_plic_peripheral_t *peripheral_serviced,
17 dif_ac_range_check_irq_t *irq_serviced) {
18
19 // Claim the IRQ at the PLIC.
20 dif_rv_plic_irq_id_t plic_irq_id;
21 CHECK_DIF_OK(
22 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
23
24 // Get the peripheral the IRQ belongs to.
25 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
26 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
27
28 // Get the IRQ that was fired from the PLIC IRQ ID.
29 dif_ac_range_check_irq_t irq =
30 (dif_ac_range_check_irq_t)(plic_irq_id -
31 ac_range_check_ctx
32 .plic_ac_range_check_start_irq_id);
33 *irq_serviced = irq;
34
35 // Check if it is supposed to be the only IRQ fired.
36 if (ac_range_check_ctx.is_only_irq) {
38 CHECK_DIF_OK(dif_ac_range_check_irq_get_state(
39 ac_range_check_ctx.ac_range_check, &snapshot));
40 CHECK(snapshot == (dif_ac_range_check_irq_state_snapshot_t)(1 << irq),
41 "Only ac_range_check IRQ %d expected to fire. Actual IRQ state = %x",
42 irq, snapshot);
43 }
44
45 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
46 dif_irq_type_t type;
47 CHECK_DIF_OK(dif_ac_range_check_irq_get_type(
48 ac_range_check_ctx.ac_range_check, irq, &type));
49 if (type == kDifIrqTypeEvent) {
50 CHECK_DIF_OK(dif_ac_range_check_irq_acknowledge(
51 ac_range_check_ctx.ac_range_check, irq));
52 } else if (mute_status_irq) {
53 CHECK_DIF_OK(dif_ac_range_check_irq_set_enabled(
54 ac_range_check_ctx.ac_range_check, irq, kDifToggleDisabled));
55 }
56
57 // Complete the IRQ at the PLIC.
58 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
59 plic_irq_id));
60}
61
62void isr_testutils_alert_handler_isr(
63 plic_isr_ctx_t plic_ctx, alert_handler_isr_ctx_t alert_handler_ctx,
64 top_darjeeling_plic_peripheral_t *peripheral_serviced,
65 dif_alert_handler_irq_t *irq_serviced) {
66
67 // Claim the IRQ at the PLIC.
68 dif_rv_plic_irq_id_t plic_irq_id;
69 CHECK_DIF_OK(
70 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
71
72 // Get the peripheral the IRQ belongs to.
73 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
74 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
75
76 // Get the IRQ that was fired from the PLIC IRQ ID.
77 dif_alert_handler_irq_t irq =
78 (dif_alert_handler_irq_t)(plic_irq_id -
79 alert_handler_ctx
80 .plic_alert_handler_start_irq_id);
81 *irq_serviced = irq;
82
83 // Check if it is supposed to be the only IRQ fired.
84 if (alert_handler_ctx.is_only_irq) {
86 CHECK_DIF_OK(dif_alert_handler_irq_get_state(
87 alert_handler_ctx.alert_handler, &snapshot));
88 CHECK(snapshot == (dif_alert_handler_irq_state_snapshot_t)(1 << irq),
89 "Only alert_handler IRQ %d expected to fire. Actual IRQ state = %x",
90 irq, snapshot);
91 }
92
93 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
94 dif_irq_type_t type;
95 CHECK_DIF_OK(dif_alert_handler_irq_get_type(alert_handler_ctx.alert_handler,
96 irq, &type));
97 if (type == kDifIrqTypeEvent) {
98 CHECK_DIF_OK(dif_alert_handler_irq_acknowledge(
99 alert_handler_ctx.alert_handler, irq));
100 }
101
102 // Complete the IRQ at the PLIC.
103 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
104 plic_irq_id));
105}
106
107void isr_testutils_aon_timer_isr(
108 plic_isr_ctx_t plic_ctx, aon_timer_isr_ctx_t aon_timer_ctx,
109 top_darjeeling_plic_peripheral_t *peripheral_serviced,
110 dif_aon_timer_irq_t *irq_serviced) {
111
112 // Claim the IRQ at the PLIC.
113 dif_rv_plic_irq_id_t plic_irq_id;
114 CHECK_DIF_OK(
115 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
116
117 // Get the peripheral the IRQ belongs to.
118 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
119 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
120
121 // Get the IRQ that was fired from the PLIC IRQ ID.
122 dif_aon_timer_irq_t irq =
123 (dif_aon_timer_irq_t)(plic_irq_id -
124 aon_timer_ctx.plic_aon_timer_start_irq_id);
125 *irq_serviced = irq;
126
127 // Check if it is supposed to be the only IRQ fired.
128 if (aon_timer_ctx.is_only_irq) {
130 CHECK_DIF_OK(
131 dif_aon_timer_irq_get_state(aon_timer_ctx.aon_timer, &snapshot));
132 CHECK(snapshot == (dif_aon_timer_irq_state_snapshot_t)(1 << irq),
133 "Only aon_timer IRQ %d expected to fire. Actual IRQ state = %x", irq,
134 snapshot);
135 }
136
137 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
138 dif_irq_type_t type;
139 CHECK_DIF_OK(dif_aon_timer_irq_get_type(aon_timer_ctx.aon_timer, irq, &type));
140 if (type == kDifIrqTypeEvent) {
141 CHECK_DIF_OK(dif_aon_timer_irq_acknowledge(aon_timer_ctx.aon_timer, irq));
142 }
143
144 // Complete the IRQ at the PLIC.
145 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
146 plic_irq_id));
147}
148
149void isr_testutils_csrng_isr(
150 plic_isr_ctx_t plic_ctx, csrng_isr_ctx_t csrng_ctx,
151 top_darjeeling_plic_peripheral_t *peripheral_serviced,
152 dif_csrng_irq_t *irq_serviced) {
153
154 // Claim the IRQ at the PLIC.
155 dif_rv_plic_irq_id_t plic_irq_id;
156 CHECK_DIF_OK(
157 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
158
159 // Get the peripheral the IRQ belongs to.
160 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
161 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
162
163 // Get the IRQ that was fired from the PLIC IRQ ID.
164 dif_csrng_irq_t irq =
165 (dif_csrng_irq_t)(plic_irq_id - csrng_ctx.plic_csrng_start_irq_id);
166 *irq_serviced = irq;
167
168 // Check if it is supposed to be the only IRQ fired.
169 if (csrng_ctx.is_only_irq) {
171 CHECK_DIF_OK(dif_csrng_irq_get_state(csrng_ctx.csrng, &snapshot));
172 CHECK(snapshot == (dif_csrng_irq_state_snapshot_t)(1 << irq),
173 "Only csrng IRQ %d expected to fire. Actual IRQ state = %x", irq,
174 snapshot);
175 }
176
177 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
178 dif_irq_type_t type;
179 CHECK_DIF_OK(dif_csrng_irq_get_type(csrng_ctx.csrng, irq, &type));
180 if (type == kDifIrqTypeEvent) {
181 CHECK_DIF_OK(dif_csrng_irq_acknowledge(csrng_ctx.csrng, irq));
182 }
183
184 // Complete the IRQ at the PLIC.
185 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
186 plic_irq_id));
187}
188
189void isr_testutils_dma_isr(
190 plic_isr_ctx_t plic_ctx, dma_isr_ctx_t dma_ctx, bool mute_status_irq,
191 top_darjeeling_plic_peripheral_t *peripheral_serviced,
192 dif_dma_irq_t *irq_serviced) {
193
194 // Claim the IRQ at the PLIC.
195 dif_rv_plic_irq_id_t plic_irq_id;
196 CHECK_DIF_OK(
197 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
198
199 // Get the peripheral the IRQ belongs to.
200 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
201 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
202
203 // Get the IRQ that was fired from the PLIC IRQ ID.
204 dif_dma_irq_t irq =
205 (dif_dma_irq_t)(plic_irq_id - dma_ctx.plic_dma_start_irq_id);
206 *irq_serviced = irq;
207
208 // Check if it is supposed to be the only IRQ fired.
209 if (dma_ctx.is_only_irq) {
211 CHECK_DIF_OK(dif_dma_irq_get_state(dma_ctx.dma, &snapshot));
212 CHECK(snapshot == (dif_dma_irq_state_snapshot_t)(1 << irq),
213 "Only dma IRQ %d expected to fire. Actual IRQ state = %x", irq,
214 snapshot);
215 }
216
217 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
218 dif_irq_type_t type;
219 CHECK_DIF_OK(dif_dma_irq_get_type(dma_ctx.dma, irq, &type));
220 if (type == kDifIrqTypeEvent) {
221 CHECK_DIF_OK(dif_dma_irq_acknowledge(dma_ctx.dma, irq));
222 } else if (mute_status_irq) {
223 CHECK_DIF_OK(dif_dma_irq_set_enabled(dma_ctx.dma, irq, kDifToggleDisabled));
224 }
225
226 // Complete the IRQ at the PLIC.
227 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
228 plic_irq_id));
229}
230
231void isr_testutils_edn_isr(
232 plic_isr_ctx_t plic_ctx, edn_isr_ctx_t edn_ctx,
233 top_darjeeling_plic_peripheral_t *peripheral_serviced,
234 dif_edn_irq_t *irq_serviced) {
235
236 // Claim the IRQ at the PLIC.
237 dif_rv_plic_irq_id_t plic_irq_id;
238 CHECK_DIF_OK(
239 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
240
241 // Get the peripheral the IRQ belongs to.
242 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
243 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
244
245 // Get the IRQ that was fired from the PLIC IRQ ID.
246 dif_edn_irq_t irq =
247 (dif_edn_irq_t)(plic_irq_id - edn_ctx.plic_edn_start_irq_id);
248 *irq_serviced = irq;
249
250 // Check if it is supposed to be the only IRQ fired.
251 if (edn_ctx.is_only_irq) {
253 CHECK_DIF_OK(dif_edn_irq_get_state(edn_ctx.edn, &snapshot));
254 CHECK(snapshot == (dif_edn_irq_state_snapshot_t)(1 << irq),
255 "Only edn IRQ %d expected to fire. Actual IRQ state = %x", irq,
256 snapshot);
257 }
258
259 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
260 dif_irq_type_t type;
261 CHECK_DIF_OK(dif_edn_irq_get_type(edn_ctx.edn, irq, &type));
262 if (type == kDifIrqTypeEvent) {
263 CHECK_DIF_OK(dif_edn_irq_acknowledge(edn_ctx.edn, irq));
264 }
265
266 // Complete the IRQ at the PLIC.
267 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
268 plic_irq_id));
269}
270
271void isr_testutils_entropy_src_isr(
272 plic_isr_ctx_t plic_ctx, entropy_src_isr_ctx_t entropy_src_ctx,
273 top_darjeeling_plic_peripheral_t *peripheral_serviced,
274 dif_entropy_src_irq_t *irq_serviced) {
275
276 // Claim the IRQ at the PLIC.
277 dif_rv_plic_irq_id_t plic_irq_id;
278 CHECK_DIF_OK(
279 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
280
281 // Get the peripheral the IRQ belongs to.
282 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
283 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
284
285 // Get the IRQ that was fired from the PLIC IRQ ID.
286 dif_entropy_src_irq_t irq =
287 (dif_entropy_src_irq_t)(plic_irq_id -
288 entropy_src_ctx.plic_entropy_src_start_irq_id);
289 *irq_serviced = irq;
290
291 // Check if it is supposed to be the only IRQ fired.
292 if (entropy_src_ctx.is_only_irq) {
294 CHECK_DIF_OK(
295 dif_entropy_src_irq_get_state(entropy_src_ctx.entropy_src, &snapshot));
296 CHECK(snapshot == (dif_entropy_src_irq_state_snapshot_t)(1 << irq),
297 "Only entropy_src IRQ %d expected to fire. Actual IRQ state = %x",
298 irq, snapshot);
299 }
300
301 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
302 dif_irq_type_t type;
303 CHECK_DIF_OK(
304 dif_entropy_src_irq_get_type(entropy_src_ctx.entropy_src, irq, &type));
305 if (type == kDifIrqTypeEvent) {
306 CHECK_DIF_OK(
307 dif_entropy_src_irq_acknowledge(entropy_src_ctx.entropy_src, irq));
308 }
309
310 // Complete the IRQ at the PLIC.
311 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
312 plic_irq_id));
313}
314
315void isr_testutils_gpio_isr(
316 plic_isr_ctx_t plic_ctx, gpio_isr_ctx_t gpio_ctx,
317 top_darjeeling_plic_peripheral_t *peripheral_serviced,
318 dif_gpio_irq_t *irq_serviced) {
319
320 // Claim the IRQ at the PLIC.
321 dif_rv_plic_irq_id_t plic_irq_id;
322 CHECK_DIF_OK(
323 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
324
325 // Get the peripheral the IRQ belongs to.
326 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
327 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
328
329 // Get the IRQ that was fired from the PLIC IRQ ID.
330 dif_gpio_irq_t irq =
331 (dif_gpio_irq_t)(plic_irq_id - gpio_ctx.plic_gpio_start_irq_id);
332 *irq_serviced = irq;
333
334 // Check if it is supposed to be the only IRQ fired.
335 if (gpio_ctx.is_only_irq) {
337 CHECK_DIF_OK(dif_gpio_irq_get_state(gpio_ctx.gpio, &snapshot));
338 CHECK(snapshot == (dif_gpio_irq_state_snapshot_t)(1 << irq),
339 "Only gpio IRQ %d expected to fire. Actual IRQ state = %x", irq,
340 snapshot);
341 }
342
343 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
344 dif_irq_type_t type;
345 CHECK_DIF_OK(dif_gpio_irq_get_type(gpio_ctx.gpio, irq, &type));
346 if (type == kDifIrqTypeEvent) {
347 CHECK_DIF_OK(dif_gpio_irq_acknowledge(gpio_ctx.gpio, irq));
348 }
349
350 // Complete the IRQ at the PLIC.
351 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
352 plic_irq_id));
353}
354
355void isr_testutils_hmac_isr(
356 plic_isr_ctx_t plic_ctx, hmac_isr_ctx_t hmac_ctx, bool mute_status_irq,
357 top_darjeeling_plic_peripheral_t *peripheral_serviced,
358 dif_hmac_irq_t *irq_serviced) {
359
360 // Claim the IRQ at the PLIC.
361 dif_rv_plic_irq_id_t plic_irq_id;
362 CHECK_DIF_OK(
363 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
364
365 // Get the peripheral the IRQ belongs to.
366 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
367 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
368
369 // Get the IRQ that was fired from the PLIC IRQ ID.
370 dif_hmac_irq_t irq =
371 (dif_hmac_irq_t)(plic_irq_id - hmac_ctx.plic_hmac_start_irq_id);
372 *irq_serviced = irq;
373
374 // Check if it is supposed to be the only IRQ fired.
375 if (hmac_ctx.is_only_irq) {
377 CHECK_DIF_OK(dif_hmac_irq_get_state(hmac_ctx.hmac, &snapshot));
378 CHECK(snapshot == (dif_hmac_irq_state_snapshot_t)(1 << irq),
379 "Only hmac IRQ %d expected to fire. Actual IRQ state = %x", irq,
380 snapshot);
381 }
382
383 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
384 dif_irq_type_t type;
385 CHECK_DIF_OK(dif_hmac_irq_get_type(hmac_ctx.hmac, irq, &type));
386 if (type == kDifIrqTypeEvent) {
387 CHECK_DIF_OK(dif_hmac_irq_acknowledge(hmac_ctx.hmac, irq));
388 } else if (mute_status_irq) {
389 CHECK_DIF_OK(
390 dif_hmac_irq_set_enabled(hmac_ctx.hmac, irq, kDifToggleDisabled));
391 }
392
393 // Complete the IRQ at the PLIC.
394 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
395 plic_irq_id));
396}
397
398void isr_testutils_i2c_isr(
399 plic_isr_ctx_t plic_ctx, i2c_isr_ctx_t i2c_ctx, bool mute_status_irq,
400 top_darjeeling_plic_peripheral_t *peripheral_serviced,
401 dif_i2c_irq_t *irq_serviced) {
402
403 // Claim the IRQ at the PLIC.
404 dif_rv_plic_irq_id_t plic_irq_id;
405 CHECK_DIF_OK(
406 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
407
408 // Get the peripheral the IRQ belongs to.
409 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
410 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
411
412 // Get the IRQ that was fired from the PLIC IRQ ID.
413 dif_i2c_irq_t irq =
414 (dif_i2c_irq_t)(plic_irq_id - i2c_ctx.plic_i2c_start_irq_id);
415 *irq_serviced = irq;
416
417 // Check if it is supposed to be the only IRQ fired.
418 if (i2c_ctx.is_only_irq) {
420 CHECK_DIF_OK(dif_i2c_irq_get_state(i2c_ctx.i2c, &snapshot));
421 CHECK(snapshot == (dif_i2c_irq_state_snapshot_t)(1 << irq),
422 "Only i2c IRQ %d expected to fire. Actual IRQ state = %x", irq,
423 snapshot);
424 }
425
426 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
427 dif_irq_type_t type;
428 CHECK_DIF_OK(dif_i2c_irq_get_type(i2c_ctx.i2c, irq, &type));
429 if (type == kDifIrqTypeEvent) {
430 CHECK_DIF_OK(dif_i2c_irq_acknowledge(i2c_ctx.i2c, irq));
431 } else if (mute_status_irq) {
432 CHECK_DIF_OK(dif_i2c_irq_set_enabled(i2c_ctx.i2c, irq, kDifToggleDisabled));
433 }
434
435 // Complete the IRQ at the PLIC.
436 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
437 plic_irq_id));
438}
439
440void isr_testutils_keymgr_dpe_isr(
441 plic_isr_ctx_t plic_ctx, keymgr_dpe_isr_ctx_t keymgr_dpe_ctx,
442 top_darjeeling_plic_peripheral_t *peripheral_serviced,
443 dif_keymgr_dpe_irq_t *irq_serviced) {
444
445 // Claim the IRQ at the PLIC.
446 dif_rv_plic_irq_id_t plic_irq_id;
447 CHECK_DIF_OK(
448 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
449
450 // Get the peripheral the IRQ belongs to.
451 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
452 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
453
454 // Get the IRQ that was fired from the PLIC IRQ ID.
455 dif_keymgr_dpe_irq_t irq =
456 (dif_keymgr_dpe_irq_t)(plic_irq_id -
457 keymgr_dpe_ctx.plic_keymgr_dpe_start_irq_id);
458 *irq_serviced = irq;
459
460 // Check if it is supposed to be the only IRQ fired.
461 if (keymgr_dpe_ctx.is_only_irq) {
463 CHECK_DIF_OK(
464 dif_keymgr_dpe_irq_get_state(keymgr_dpe_ctx.keymgr_dpe, &snapshot));
465 CHECK(snapshot == (dif_keymgr_dpe_irq_state_snapshot_t)(1 << irq),
466 "Only keymgr_dpe IRQ %d expected to fire. Actual IRQ state = %x", irq,
467 snapshot);
468 }
469
470 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
471 dif_irq_type_t type;
472 CHECK_DIF_OK(
473 dif_keymgr_dpe_irq_get_type(keymgr_dpe_ctx.keymgr_dpe, irq, &type));
474 if (type == kDifIrqTypeEvent) {
475 CHECK_DIF_OK(
476 dif_keymgr_dpe_irq_acknowledge(keymgr_dpe_ctx.keymgr_dpe, irq));
477 }
478
479 // Complete the IRQ at the PLIC.
480 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
481 plic_irq_id));
482}
483
484void isr_testutils_kmac_isr(
485 plic_isr_ctx_t plic_ctx, kmac_isr_ctx_t kmac_ctx, bool mute_status_irq,
486 top_darjeeling_plic_peripheral_t *peripheral_serviced,
487 dif_kmac_irq_t *irq_serviced) {
488
489 // Claim the IRQ at the PLIC.
490 dif_rv_plic_irq_id_t plic_irq_id;
491 CHECK_DIF_OK(
492 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
493
494 // Get the peripheral the IRQ belongs to.
495 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
496 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
497
498 // Get the IRQ that was fired from the PLIC IRQ ID.
499 dif_kmac_irq_t irq =
500 (dif_kmac_irq_t)(plic_irq_id - kmac_ctx.plic_kmac_start_irq_id);
501 *irq_serviced = irq;
502
503 // Check if it is supposed to be the only IRQ fired.
504 if (kmac_ctx.is_only_irq) {
506 CHECK_DIF_OK(dif_kmac_irq_get_state(kmac_ctx.kmac, &snapshot));
507 CHECK(snapshot == (dif_kmac_irq_state_snapshot_t)(1 << irq),
508 "Only kmac IRQ %d expected to fire. Actual IRQ state = %x", irq,
509 snapshot);
510 }
511
512 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
513 dif_irq_type_t type;
514 CHECK_DIF_OK(dif_kmac_irq_get_type(kmac_ctx.kmac, irq, &type));
515 if (type == kDifIrqTypeEvent) {
516 CHECK_DIF_OK(dif_kmac_irq_acknowledge(kmac_ctx.kmac, irq));
517 } else if (mute_status_irq) {
518 CHECK_DIF_OK(
519 dif_kmac_irq_set_enabled(kmac_ctx.kmac, irq, kDifToggleDisabled));
520 }
521
522 // Complete the IRQ at the PLIC.
523 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
524 plic_irq_id));
525}
526
527void isr_testutils_mbx_isr(
528 plic_isr_ctx_t plic_ctx, mbx_isr_ctx_t mbx_ctx,
529 top_darjeeling_plic_peripheral_t *peripheral_serviced,
530 dif_mbx_irq_t *irq_serviced) {
531
532 // Claim the IRQ at the PLIC.
533 dif_rv_plic_irq_id_t plic_irq_id;
534 CHECK_DIF_OK(
535 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
536
537 // Get the peripheral the IRQ belongs to.
538 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
539 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
540
541 // Get the IRQ that was fired from the PLIC IRQ ID.
542 dif_mbx_irq_t irq =
543 (dif_mbx_irq_t)(plic_irq_id - mbx_ctx.plic_mbx_start_irq_id);
544 *irq_serviced = irq;
545
546 // Check if it is supposed to be the only IRQ fired.
547 if (mbx_ctx.is_only_irq) {
549 CHECK_DIF_OK(dif_mbx_irq_get_state(mbx_ctx.mbx, &snapshot));
550 CHECK(snapshot == (dif_mbx_irq_state_snapshot_t)(1 << irq),
551 "Only mbx IRQ %d expected to fire. Actual IRQ state = %x", irq,
552 snapshot);
553 }
554
555 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
556 dif_irq_type_t type;
557 CHECK_DIF_OK(dif_mbx_irq_get_type(mbx_ctx.mbx, irq, &type));
558 if (type == kDifIrqTypeEvent) {
559 CHECK_DIF_OK(dif_mbx_irq_acknowledge(mbx_ctx.mbx, irq));
560 }
561
562 // Complete the IRQ at the PLIC.
563 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
564 plic_irq_id));
565}
566
567void isr_testutils_otbn_isr(
568 plic_isr_ctx_t plic_ctx, otbn_isr_ctx_t otbn_ctx,
569 top_darjeeling_plic_peripheral_t *peripheral_serviced,
570 dif_otbn_irq_t *irq_serviced) {
571
572 // Claim the IRQ at the PLIC.
573 dif_rv_plic_irq_id_t plic_irq_id;
574 CHECK_DIF_OK(
575 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
576
577 // Get the peripheral the IRQ belongs to.
578 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
579 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
580
581 // Get the IRQ that was fired from the PLIC IRQ ID.
582 dif_otbn_irq_t irq =
583 (dif_otbn_irq_t)(plic_irq_id - otbn_ctx.plic_otbn_start_irq_id);
584 *irq_serviced = irq;
585
586 // Check if it is supposed to be the only IRQ fired.
587 if (otbn_ctx.is_only_irq) {
589 CHECK_DIF_OK(dif_otbn_irq_get_state(otbn_ctx.otbn, &snapshot));
590 CHECK(snapshot == (dif_otbn_irq_state_snapshot_t)(1 << irq),
591 "Only otbn IRQ %d expected to fire. Actual IRQ state = %x", irq,
592 snapshot);
593 }
594
595 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
596 dif_irq_type_t type;
597 CHECK_DIF_OK(dif_otbn_irq_get_type(otbn_ctx.otbn, irq, &type));
598 if (type == kDifIrqTypeEvent) {
599 CHECK_DIF_OK(dif_otbn_irq_acknowledge(otbn_ctx.otbn, irq));
600 }
601
602 // Complete the IRQ at the PLIC.
603 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
604 plic_irq_id));
605}
606
607void isr_testutils_otp_ctrl_isr(
608 plic_isr_ctx_t plic_ctx, otp_ctrl_isr_ctx_t otp_ctrl_ctx,
609 top_darjeeling_plic_peripheral_t *peripheral_serviced,
610 dif_otp_ctrl_irq_t *irq_serviced) {
611
612 // Claim the IRQ at the PLIC.
613 dif_rv_plic_irq_id_t plic_irq_id;
614 CHECK_DIF_OK(
615 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
616
617 // Get the peripheral the IRQ belongs to.
618 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
619 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
620
621 // Get the IRQ that was fired from the PLIC IRQ ID.
622 dif_otp_ctrl_irq_t irq =
623 (dif_otp_ctrl_irq_t)(plic_irq_id -
624 otp_ctrl_ctx.plic_otp_ctrl_start_irq_id);
625 *irq_serviced = irq;
626
627 // Check if it is supposed to be the only IRQ fired.
628 if (otp_ctrl_ctx.is_only_irq) {
630 CHECK_DIF_OK(dif_otp_ctrl_irq_get_state(otp_ctrl_ctx.otp_ctrl, &snapshot));
631 CHECK(snapshot == (dif_otp_ctrl_irq_state_snapshot_t)(1 << irq),
632 "Only otp_ctrl IRQ %d expected to fire. Actual IRQ state = %x", irq,
633 snapshot);
634 }
635
636 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
637 dif_irq_type_t type;
638 CHECK_DIF_OK(dif_otp_ctrl_irq_get_type(otp_ctrl_ctx.otp_ctrl, irq, &type));
639 if (type == kDifIrqTypeEvent) {
640 CHECK_DIF_OK(dif_otp_ctrl_irq_acknowledge(otp_ctrl_ctx.otp_ctrl, irq));
641 }
642
643 // Complete the IRQ at the PLIC.
644 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
645 plic_irq_id));
646}
647
648void isr_testutils_pwrmgr_isr(
649 plic_isr_ctx_t plic_ctx, pwrmgr_isr_ctx_t pwrmgr_ctx,
650 top_darjeeling_plic_peripheral_t *peripheral_serviced,
651 dif_pwrmgr_irq_t *irq_serviced) {
652
653 // Claim the IRQ at the PLIC.
654 dif_rv_plic_irq_id_t plic_irq_id;
655 CHECK_DIF_OK(
656 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
657
658 // Get the peripheral the IRQ belongs to.
659 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
660 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
661
662 // Get the IRQ that was fired from the PLIC IRQ ID.
663 dif_pwrmgr_irq_t irq =
664 (dif_pwrmgr_irq_t)(plic_irq_id - pwrmgr_ctx.plic_pwrmgr_start_irq_id);
665 *irq_serviced = irq;
666
667 // Check if it is supposed to be the only IRQ fired.
668 if (pwrmgr_ctx.is_only_irq) {
670 CHECK_DIF_OK(dif_pwrmgr_irq_get_state(pwrmgr_ctx.pwrmgr, &snapshot));
671 CHECK(snapshot == (dif_pwrmgr_irq_state_snapshot_t)(1 << irq),
672 "Only pwrmgr IRQ %d expected to fire. Actual IRQ state = %x", irq,
673 snapshot);
674 }
675
676 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
677 dif_irq_type_t type;
678 CHECK_DIF_OK(dif_pwrmgr_irq_get_type(pwrmgr_ctx.pwrmgr, irq, &type));
679 if (type == kDifIrqTypeEvent) {
680 CHECK_DIF_OK(dif_pwrmgr_irq_acknowledge(pwrmgr_ctx.pwrmgr, irq));
681 }
682
683 // Complete the IRQ at the PLIC.
684 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
685 plic_irq_id));
686}
687
688void isr_testutils_racl_ctrl_isr(
689 plic_isr_ctx_t plic_ctx, racl_ctrl_isr_ctx_t racl_ctrl_ctx,
690 bool mute_status_irq, top_darjeeling_plic_peripheral_t *peripheral_serviced,
691 dif_racl_ctrl_irq_t *irq_serviced) {
692
693 // Claim the IRQ at the PLIC.
694 dif_rv_plic_irq_id_t plic_irq_id;
695 CHECK_DIF_OK(
696 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
697
698 // Get the peripheral the IRQ belongs to.
699 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
700 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
701
702 // Get the IRQ that was fired from the PLIC IRQ ID.
703 dif_racl_ctrl_irq_t irq =
704 (dif_racl_ctrl_irq_t)(plic_irq_id -
705 racl_ctrl_ctx.plic_racl_ctrl_start_irq_id);
706 *irq_serviced = irq;
707
708 // Check if it is supposed to be the only IRQ fired.
709 if (racl_ctrl_ctx.is_only_irq) {
711 CHECK_DIF_OK(
712 dif_racl_ctrl_irq_get_state(racl_ctrl_ctx.racl_ctrl, &snapshot));
713 CHECK(snapshot == (dif_racl_ctrl_irq_state_snapshot_t)(1 << irq),
714 "Only racl_ctrl IRQ %d expected to fire. Actual IRQ state = %x", irq,
715 snapshot);
716 }
717
718 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
719 dif_irq_type_t type;
720 CHECK_DIF_OK(dif_racl_ctrl_irq_get_type(racl_ctrl_ctx.racl_ctrl, irq, &type));
721 if (type == kDifIrqTypeEvent) {
722 CHECK_DIF_OK(dif_racl_ctrl_irq_acknowledge(racl_ctrl_ctx.racl_ctrl, irq));
723 } else if (mute_status_irq) {
724 CHECK_DIF_OK(dif_racl_ctrl_irq_set_enabled(racl_ctrl_ctx.racl_ctrl, irq,
726 }
727
728 // Complete the IRQ at the PLIC.
729 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
730 plic_irq_id));
731}
732
733void isr_testutils_rv_timer_isr(
734 plic_isr_ctx_t plic_ctx, rv_timer_isr_ctx_t rv_timer_ctx,
735 top_darjeeling_plic_peripheral_t *peripheral_serviced,
736 dif_rv_timer_irq_t *irq_serviced) {
737
738 // Claim the IRQ at the PLIC.
739 dif_rv_plic_irq_id_t plic_irq_id;
740 CHECK_DIF_OK(
741 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
742
743 // Get the peripheral the IRQ belongs to.
744 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
745 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
746
747 // Get the IRQ that was fired from the PLIC IRQ ID.
748 dif_rv_timer_irq_t irq =
749 (dif_rv_timer_irq_t)(plic_irq_id -
750 rv_timer_ctx.plic_rv_timer_start_irq_id);
751 *irq_serviced = irq;
752
753 // Check if it is supposed to be the only IRQ fired.
754 if (rv_timer_ctx.is_only_irq) {
756 CHECK_DIF_OK(dif_rv_timer_irq_get_state(rv_timer_ctx.rv_timer,
757 plic_ctx.hart_id, &snapshot));
758 CHECK(snapshot == (dif_rv_timer_irq_state_snapshot_t)(1 << irq),
759 "Only rv_timer IRQ %d expected to fire. Actual IRQ state = %x", irq,
760 snapshot);
761 }
762
763 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
764 dif_irq_type_t type;
765 CHECK_DIF_OK(dif_rv_timer_irq_get_type(rv_timer_ctx.rv_timer, irq, &type));
766 if (type == kDifIrqTypeEvent) {
767 CHECK_DIF_OK(dif_rv_timer_irq_acknowledge(rv_timer_ctx.rv_timer, irq));
768 }
769
770 // Complete the IRQ at the PLIC.
771 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
772 plic_irq_id));
773}
774
775void isr_testutils_soc_proxy_isr(
776 plic_isr_ctx_t plic_ctx, soc_proxy_isr_ctx_t soc_proxy_ctx,
777 top_darjeeling_plic_peripheral_t *peripheral_serviced,
778 dif_soc_proxy_irq_t *irq_serviced) {
779
780 // Claim the IRQ at the PLIC.
781 dif_rv_plic_irq_id_t plic_irq_id;
782 CHECK_DIF_OK(
783 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
784
785 // Get the peripheral the IRQ belongs to.
786 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
787 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
788
789 // Get the IRQ that was fired from the PLIC IRQ ID.
790 dif_soc_proxy_irq_t irq =
791 (dif_soc_proxy_irq_t)(plic_irq_id -
792 soc_proxy_ctx.plic_soc_proxy_start_irq_id);
793 *irq_serviced = irq;
794
795 // Check if it is supposed to be the only IRQ fired.
796 if (soc_proxy_ctx.is_only_irq) {
798 CHECK_DIF_OK(
799 dif_soc_proxy_irq_get_state(soc_proxy_ctx.soc_proxy, &snapshot));
800 CHECK(snapshot == (dif_soc_proxy_irq_state_snapshot_t)(1 << irq),
801 "Only soc_proxy IRQ %d expected to fire. Actual IRQ state = %x", irq,
802 snapshot);
803 }
804
805 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
806 dif_irq_type_t type;
807 CHECK_DIF_OK(dif_soc_proxy_irq_get_type(soc_proxy_ctx.soc_proxy, irq, &type));
808 if (type == kDifIrqTypeEvent) {
809 CHECK_DIF_OK(dif_soc_proxy_irq_acknowledge(soc_proxy_ctx.soc_proxy, irq));
810 }
811
812 // Complete the IRQ at the PLIC.
813 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
814 plic_irq_id));
815}
816
817void isr_testutils_spi_device_isr(
818 plic_isr_ctx_t plic_ctx, spi_device_isr_ctx_t spi_device_ctx,
819 bool mute_status_irq, top_darjeeling_plic_peripheral_t *peripheral_serviced,
820 dif_spi_device_irq_t *irq_serviced) {
821
822 // Claim the IRQ at the PLIC.
823 dif_rv_plic_irq_id_t plic_irq_id;
824 CHECK_DIF_OK(
825 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
826
827 // Get the peripheral the IRQ belongs to.
828 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
829 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
830
831 // Get the IRQ that was fired from the PLIC IRQ ID.
832 dif_spi_device_irq_t irq =
833 (dif_spi_device_irq_t)(plic_irq_id -
834 spi_device_ctx.plic_spi_device_start_irq_id);
835 *irq_serviced = irq;
836
837 // Check if it is supposed to be the only IRQ fired.
838 if (spi_device_ctx.is_only_irq) {
840 CHECK_DIF_OK(
841 dif_spi_device_irq_get_state(spi_device_ctx.spi_device, &snapshot));
842 CHECK(snapshot == (dif_spi_device_irq_state_snapshot_t)(1 << irq),
843 "Only spi_device IRQ %d expected to fire. Actual IRQ state = %x", irq,
844 snapshot);
845 }
846
847 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
848 dif_irq_type_t type;
849 CHECK_DIF_OK(
850 dif_spi_device_irq_get_type(spi_device_ctx.spi_device, irq, &type));
851 if (type == kDifIrqTypeEvent) {
852 CHECK_DIF_OK(
853 dif_spi_device_irq_acknowledge(spi_device_ctx.spi_device, irq));
854 } else if (mute_status_irq) {
855 CHECK_DIF_OK(dif_spi_device_irq_set_enabled(spi_device_ctx.spi_device, irq,
857 }
858
859 // Complete the IRQ at the PLIC.
860 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
861 plic_irq_id));
862}
863
864void isr_testutils_spi_host_isr(
865 plic_isr_ctx_t plic_ctx, spi_host_isr_ctx_t spi_host_ctx,
866 bool mute_status_irq, top_darjeeling_plic_peripheral_t *peripheral_serviced,
867 dif_spi_host_irq_t *irq_serviced) {
868
869 // Claim the IRQ at the PLIC.
870 dif_rv_plic_irq_id_t plic_irq_id;
871 CHECK_DIF_OK(
872 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
873
874 // Get the peripheral the IRQ belongs to.
875 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
876 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
877
878 // Get the IRQ that was fired from the PLIC IRQ ID.
879 dif_spi_host_irq_t irq =
880 (dif_spi_host_irq_t)(plic_irq_id -
881 spi_host_ctx.plic_spi_host_start_irq_id);
882 *irq_serviced = irq;
883
884 // Check if it is supposed to be the only IRQ fired.
885 if (spi_host_ctx.is_only_irq) {
887 CHECK_DIF_OK(dif_spi_host_irq_get_state(spi_host_ctx.spi_host, &snapshot));
888 CHECK(snapshot == (dif_spi_host_irq_state_snapshot_t)(1 << irq),
889 "Only spi_host IRQ %d expected to fire. Actual IRQ state = %x", irq,
890 snapshot);
891 }
892
893 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
894 dif_irq_type_t type;
895 CHECK_DIF_OK(dif_spi_host_irq_get_type(spi_host_ctx.spi_host, irq, &type));
896 if (type == kDifIrqTypeEvent) {
897 CHECK_DIF_OK(dif_spi_host_irq_acknowledge(spi_host_ctx.spi_host, irq));
898 } else if (mute_status_irq) {
899 CHECK_DIF_OK(dif_spi_host_irq_set_enabled(spi_host_ctx.spi_host, irq,
901 }
902
903 // Complete the IRQ at the PLIC.
904 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
905 plic_irq_id));
906}
907
908void isr_testutils_uart_isr(
909 plic_isr_ctx_t plic_ctx, uart_isr_ctx_t uart_ctx, bool mute_status_irq,
910 top_darjeeling_plic_peripheral_t *peripheral_serviced,
911 dif_uart_irq_t *irq_serviced) {
912
913 // Claim the IRQ at the PLIC.
914 dif_rv_plic_irq_id_t plic_irq_id;
915 CHECK_DIF_OK(
916 dif_rv_plic_irq_claim(plic_ctx.rv_plic, plic_ctx.hart_id, &plic_irq_id));
917
918 // Get the peripheral the IRQ belongs to.
919 *peripheral_serviced = (top_darjeeling_plic_peripheral_t)
920 top_darjeeling_plic_interrupt_for_peripheral[plic_irq_id];
921
922 // Get the IRQ that was fired from the PLIC IRQ ID.
923 dif_uart_irq_t irq =
924 (dif_uart_irq_t)(plic_irq_id - uart_ctx.plic_uart_start_irq_id);
925 *irq_serviced = irq;
926
927 // Check if it is supposed to be the only IRQ fired.
928 if (uart_ctx.is_only_irq) {
930 CHECK_DIF_OK(dif_uart_irq_get_state(uart_ctx.uart, &snapshot));
931 CHECK(snapshot == (dif_uart_irq_state_snapshot_t)(1 << irq),
932 "Only uart IRQ %d expected to fire. Actual IRQ state = %x", irq,
933 snapshot);
934 }
935
936 // Acknowledge the IRQ at the peripheral if IRQ is of the event type.
937 dif_irq_type_t type;
938 CHECK_DIF_OK(dif_uart_irq_get_type(uart_ctx.uart, irq, &type));
939 if (type == kDifIrqTypeEvent) {
940 CHECK_DIF_OK(dif_uart_irq_acknowledge(uart_ctx.uart, irq));
941 } else if (mute_status_irq) {
942 CHECK_DIF_OK(
943 dif_uart_irq_set_enabled(uart_ctx.uart, irq, kDifToggleDisabled));
944 }
945
946 // Complete the IRQ at the PLIC.
947 CHECK_DIF_OK(dif_rv_plic_irq_complete(plic_ctx.rv_plic, plic_ctx.hart_id,
948 plic_irq_id));
949}