xref: /qemu/include/hw/misc/stm32l4x5_exti.h (revision c9948fdd023dd2031d868c8e26f387e6705c918c)
1*c9948fddSInès Varhol /*
2*c9948fddSInès Varhol  * STM32L4x5 EXTI (Extended interrupts and events controller)
3*c9948fddSInès Varhol  *
4*c9948fddSInès Varhol  * Copyright (c) 2023 Arnaud Minier <arnaud.minier@telecom-paris.fr>
5*c9948fddSInès Varhol  * Copyright (c) 2023 Inès Varhol <ines.varhol@telecom-paris.fr>
6*c9948fddSInès Varhol  *
7*c9948fddSInès Varhol  * SPDX-License-Identifier: GPL-2.0-or-later
8*c9948fddSInès Varhol  *
9*c9948fddSInès Varhol  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10*c9948fddSInès Varhol  * See the COPYING file in the top-level directory.
11*c9948fddSInès Varhol  *
12*c9948fddSInès Varhol  * This work is based on the stm32f4xx_exti by Alistair Francis.
13*c9948fddSInès Varhol  * Original code is licensed under the MIT License:
14*c9948fddSInès Varhol  *
15*c9948fddSInès Varhol  * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
16*c9948fddSInès Varhol  */
17*c9948fddSInès Varhol 
18*c9948fddSInès Varhol /*
19*c9948fddSInès Varhol  * The reference used is the STMicroElectronics RM0351 Reference manual
20*c9948fddSInès Varhol  * for STM32L4x5 and STM32L4x6 advanced Arm ® -based 32-bit MCUs.
21*c9948fddSInès Varhol  * https://www.st.com/en/microcontrollers-microprocessors/stm32l4x5/documentation.html
22*c9948fddSInès Varhol  */
23*c9948fddSInès Varhol 
24*c9948fddSInès Varhol #ifndef HW_STM32L4X5_EXTI_H
25*c9948fddSInès Varhol #define HW_STM32L4X5_EXTI_H
26*c9948fddSInès Varhol 
27*c9948fddSInès Varhol #include "hw/sysbus.h"
28*c9948fddSInès Varhol #include "qom/object.h"
29*c9948fddSInès Varhol 
30*c9948fddSInès Varhol #define TYPE_STM32L4X5_EXTI "stm32l4x5-exti"
31*c9948fddSInès Varhol OBJECT_DECLARE_SIMPLE_TYPE(Stm32l4x5ExtiState, STM32L4X5_EXTI)
32*c9948fddSInès Varhol 
33*c9948fddSInès Varhol #define EXTI_NUM_INTERRUPT_OUT_LINES 40
34*c9948fddSInès Varhol #define EXTI_NUM_REGISTER 2
35*c9948fddSInès Varhol 
36*c9948fddSInès Varhol struct Stm32l4x5ExtiState {
37*c9948fddSInès Varhol     SysBusDevice parent_obj;
38*c9948fddSInès Varhol 
39*c9948fddSInès Varhol     MemoryRegion mmio;
40*c9948fddSInès Varhol 
41*c9948fddSInès Varhol     uint32_t imr[EXTI_NUM_REGISTER];
42*c9948fddSInès Varhol     uint32_t emr[EXTI_NUM_REGISTER];
43*c9948fddSInès Varhol     uint32_t rtsr[EXTI_NUM_REGISTER];
44*c9948fddSInès Varhol     uint32_t ftsr[EXTI_NUM_REGISTER];
45*c9948fddSInès Varhol     uint32_t swier[EXTI_NUM_REGISTER];
46*c9948fddSInès Varhol     uint32_t pr[EXTI_NUM_REGISTER];
47*c9948fddSInès Varhol 
48*c9948fddSInès Varhol     qemu_irq irq[EXTI_NUM_INTERRUPT_OUT_LINES];
49*c9948fddSInès Varhol };
50*c9948fddSInès Varhol 
51*c9948fddSInès Varhol #endif
52