1 /*
2  * Copyright (c) 2025 Silicon Laboratories Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_DRIVERS_FAKE_DRIVER_H_
8 #define ZEPHYR_INCLUDE_DRIVERS_FAKE_DRIVER_H_
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #ifdef CONFIG_BOARD_QEMU_CORTEX_M3
15 
16 #define TEST_IRQ_NUM  42
17 #define TEST_IRQ_PRIO 1
18 
19 #elif defined(CONFIG_GIC)
20 /*
21  * For the platforms that use the ARM GIC, use the SGI (software generated
22  * interrupt) line 14 for testing.
23  */
24 #define TEST_IRQ_NUM  14
25 #define TEST_IRQ_PRIO IRQ_DEFAULT_PRIORITY
26 
27 #else
28 /* For all the other platforms, use the last available IRQ line for testing. */
29 #define TEST_IRQ_NUM  (CONFIG_NUM_IRQS - 1)
30 #define TEST_IRQ_PRIO 1
31 #endif
32 
33 typedef void (*fake_driver_irq_callback_t)(const struct device *dev, void *user_data);
34 
35 struct fake_driver_config {
36 	void (*irq_config_func)(void);
37 	uint16_t irq_num;
38 	uint8_t irq_priority;
39 };
40 
41 struct fake_driver_data {
42 	fake_driver_irq_callback_t irq_callback;
43 	void *user_data;
44 };
45 
46 __subsystem struct fake_driver_api {
47 	int (*configure)(const struct device *dev, int config);
48 	int (*register_irq_callback)(const struct device *dev, fake_driver_irq_callback_t cb,
49 				     void *user_data);
50 };
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif /* ZEPHYR_INCLUDE_DRIVERS_FAKE_DRIVER_H_ */
57