Debian Codegraph @

ports/renesas-ra/ra/ra_icu.h

raw
1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2021 Renesas Electronics Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 #ifndef RA_RA_ICU_H_
26 #define RA_RA_ICU_H_
27
28 #include <stdint.h>
29 #include <stdbool.h>
30
31 // #define IRQ_MAX (16)
32 #define VECTOR_NUMBER_NONE (0xff)
33
34 typedef struct ra_irq_pin {
35 uint8_t irq_no;
36 uint32_t pin;
37 } ra_icu_pin_t;
38
39 typedef void (*ICU_CB)(void *);
40
41 bool ra_icu_find_irq_no(uint32_t pin, uint8_t *irq_no);
42 void ra_icu_set_pin(uint32_t pin, bool irq_enable, bool pullup);
43 void ra_icu_enable_irq_no(uint8_t irq_no);
44 void ra_icu_disable_irq_no(uint8_t irq_no);
45 void ra_icu_enable_pin(uint32_t pin);
46 void ra_icu_disable_pin(uint32_t pin);
47 void ra_icu_priority_irq_no(uint8_t irq_no, uint32_t ipl);
48 void ra_icu_priority_pin(uint32_t pin, uint32_t ipl);
49 void ra_icu_set_callback(uint8_t irq_no, ICU_CB func, void *param);
50 void ra_icu_trigger_irq_no(uint8_t irq_no, uint32_t cond);
51 void ra_icu_trigger_pin(uint32_t pin, uint32_t cond);
52 void ra_icu_set_bounce(uint8_t irq_no, uint32_t bounce);
53 void ra_icu_init(void);
54 void ra_icu_deinit(void);
55 void ra_icu_swint(uint8_t irq_no);
56 void r_icu_isr(void);
57
58 #endif /* RA_RA_ICU_H_ */