1 /*
2  * Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/dt-bindings/interrupt-controller/renesas-ra-icu.h>
8 
9 #ifndef ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_RA_ICU_H_
10 #define ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_RA_ICU_H_
11 
12 #define RA_ICU_FLAG_EVENT_OFFSET  8
13 #define RA_ICU_FLAG_EVENT_MASK    (BIT_MASK(8) << RA_ICU_FLAG_EVENT_OFFSET)
14 #define RA_ICU_FLAG_INTCFG_OFFSET 16
15 #define RA_ICU_FLAG_INTCFG_MASK   (BIT_MASK(8) << RA_ICU_FLAG_INTCFG_OFFSET)
16 
17 enum icu_irq_mode {
18 	ICU_FALLING,
19 	ICU_RISING,
20 	ICU_BOTH_EDGE,
21 	ICU_LOW_LEVEL,
22 };
23 
24 typedef void (*ra_isr_handler)(const void *);
25 
26 extern void ra_icu_clear_int_flag(unsigned int irqn);
27 
28 extern int ra_icu_query_available_irq(uint32_t event);
29 extern int ra_icu_query_exists_irq(uint32_t event);
30 
31 extern void ra_icu_query_irq_config(unsigned int irq, uint32_t *intcfg, ra_isr_handler *pisr,
32 				    const void **cbarg);
33 
34 extern int ra_icu_irq_connect_dynamic(unsigned int irq, unsigned int priority,
35 				      void (*routine)(const void *parameter), const void *parameter,
36 				      uint32_t flags);
37 
38 extern int ra_icu_irq_disconnect_dynamic(unsigned int irq, unsigned int priority,
39 					 void (*routine)(const void *parameter),
40 					 const void *parameter, uint32_t flags);
41 
42 #endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_RA_ICU_H_ */
43