zephyr/include/irq_offload.h
Andrew Boie e09a0255da kernel: sychronize irq_offload() access
Entering irq_offload() on multiple CPUs can cause
difficult to debug/reproduce crashes. Demote irq_offload()
to non-inline (it never needed to be inline anyway) and
wrap the arch call in a semaphore.

Some tests which were unnecessarily killing threads
have been fixed; these threads exit by themselves anyway
and we won't leave the semaphore dangling.

The definition of z_arch_irq_offload() moved to
arch_interface.h as it only gets called by kernel C code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-08 15:16:43 -08:00

41 lines
873 B
C

/*
* Copyright (c) 2015 Intel corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief IRQ Offload interface
*/
#ifndef ZEPHYR_INCLUDE_IRQ_OFFLOAD_H_
#define ZEPHYR_INCLUDE_IRQ_OFFLOAD_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef CONFIG_IRQ_OFFLOAD
typedef void (*irq_offload_routine_t)(void *parameter);
/**
* @brief Run a function in interrupt context
*
* This function synchronously runs the provided function in interrupt
* context, passing in the supplied parameter. Useful for test code
* which needs to show that kernel objects work correctly in interrupt
* context.
*
* @param routine The function to run
* @param parameter Argument to pass to the function when it is run as an
* interrupt
*/
void irq_offload(irq_offload_routine_t routine, void *parameter);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SW_IRQ_H_ */