blob: f6db81ccf3e2322397fb6495badf88e9719b8c6b [file] [log] [blame]
Anas Nashif2c31db42024-02-22 22:19:05 -05001/*
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 */
12K_SEM_DEFINE(offload_sem, 1, 1);
13
14void 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 Heinbcd1d192024-03-08 12:00:10 +010022#endif /* CONFIG_IRQ_OFFLOAD_NESTED */
Anas Nashif2c31db42024-02-22 22:19:05 -050023}