Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Intel corporation |
| 3 | * |
David B. Kinder | ac74d8b | 2017-01-18 17:01:01 -0800 | [diff] [blame] | 4 | * SPDX-License-Identifier: Apache-2.0 |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /** |
Peter Mitsis | 8413e1f | 2016-02-11 11:53:03 -0500 | [diff] [blame] | 8 | * @file |
| 9 | * @brief IRQ Offload interface |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 10 | */ |
Flavio Ceolin | 67ca176 | 2018-09-14 10:43:44 -0700 | [diff] [blame] | 11 | #ifndef ZEPHYR_INCLUDE_IRQ_OFFLOAD_H_ |
| 12 | #define ZEPHYR_INCLUDE_IRQ_OFFLOAD_H_ |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 13 | |
Peter Mitsis | a0e4568 | 2016-01-22 12:38:49 -0500 | [diff] [blame] | 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
Andrew Boie | 979b17f | 2019-10-03 15:20:41 -0700 | [diff] [blame] | 18 | #ifdef CONFIG_IRQ_OFFLOAD |
Tomasz Bursztyka | 84942e4 | 2020-07-10 10:51:37 +0200 | [diff] [blame] | 19 | typedef void (*irq_offload_routine_t)(const void *parameter); |
Andrew Boie | e09a025 | 2019-11-06 14:17:17 -0800 | [diff] [blame] | 20 | |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 21 | /** |
| 22 | * @brief Run a function in interrupt context |
| 23 | * |
| 24 | * This function synchronously runs the provided function in interrupt |
Tomasz Bursztyka | 84942e4 | 2020-07-10 10:51:37 +0200 | [diff] [blame] | 25 | * context, passing in the supplied device. Useful for test code |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 26 | * which needs to show that kernel objects work correctly in interrupt |
| 27 | * context. |
| 28 | * |
| 29 | * @param routine The function to run |
| 30 | * @param parameter Argument to pass to the function when it is run as an |
| 31 | * interrupt |
| 32 | */ |
Tomasz Bursztyka | 84942e4 | 2020-07-10 10:51:37 +0200 | [diff] [blame] | 33 | void irq_offload(irq_offload_routine_t routine, const void *parameter); |
Andrew Boie | 979b17f | 2019-10-03 15:20:41 -0700 | [diff] [blame] | 34 | #endif |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 35 | |
Peter Mitsis | a0e4568 | 2016-01-22 12:38:49 -0500 | [diff] [blame] | 36 | #ifdef __cplusplus |
| 37 | } |
| 38 | #endif |
| 39 | |
Andrew Boie | bba9510 | 2015-11-17 14:08:45 -0800 | [diff] [blame] | 40 | #endif /* _SW_IRQ_H_ */ |