Anas Nashif | 2c31db4 | 2024-02-22 22:19:05 -0500 | [diff] [blame] | 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 | |
| 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); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 22 | #endif /* CONFIG_IRQ_OFFLOAD_NESTED */ |
Anas Nashif | 2c31db4 | 2024-02-22 22:19:05 -0500 | [diff] [blame] | 23 | } |