1 /*
2  * Copyright (c) 2018,2024 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include <zephyr/kernel.h>
7 #include <zephyr/irq_offload.h>
8 
9 /* Make offload_sem visible outside testing, in order to release
10  * it outside when error happened.
11  */
12 K_SEM_DEFINE(offload_sem, 1, 1);
13 
irq_offload(irq_offload_routine_t routine,const void * parameter)14 void irq_offload(irq_offload_routine_t routine, const void *parameter)
15 {
16 #ifdef CONFIG_IRQ_OFFLOAD_NESTED
17 	arch_irq_offload(routine, parameter);
18 #else
19 	k_sem_take(&offload_sem, K_FOREVER);
20 	arch_irq_offload(routine, parameter);
21 	k_sem_give(&offload_sem);
22 #endif /* CONFIG_IRQ_OFFLOAD_NESTED */
23 }
24