2024-02-23 11:19:05 +08:00
|
|
|
/*
|
|
|
|
* 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);
|
2024-03-08 19:00:10 +08:00
|
|
|
#endif /* CONFIG_IRQ_OFFLOAD_NESTED */
|
2024-02-23 11:19:05 +08:00
|
|
|
}
|