zephyr/kernel/irq_offload.c
Anas Nashif 2c31db4cc8 kernel: split irq_offload ccode into own file
Move irq_offload code out of thread.c into own file. This code is not
related to threads.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-06 19:27:28 -05:00

24 lines
556 B
C

/*
* Copyright (c) 2018,2024 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/irq_offload.h>
/* Make offload_sem visible outside testing, in order to release
* it outside when error happened.
*/
K_SEM_DEFINE(offload_sem, 1, 1);
void irq_offload(irq_offload_routine_t routine, const void *parameter)
{
#ifdef CONFIG_IRQ_OFFLOAD_NESTED
arch_irq_offload(routine, parameter);
#else
k_sem_take(&offload_sem, K_FOREVER);
arch_irq_offload(routine, parameter);
k_sem_give(&offload_sem);
#endif
}