xref: /qemu/include/hw/misc/stm32l4x5_syscfg.h (revision 20936684b6dd02eec35591661553a57f3515cf5b)
1*20936684SInès Varhol /*
2*20936684SInès Varhol  * STM32L4x5 SYSCFG (System Configuration Controller)
3*20936684SInès Varhol  *
4*20936684SInès Varhol  * Copyright (c) 2023 Arnaud Minier <arnaud.minier@telecom-paris.fr>
5*20936684SInès Varhol  * Copyright (c) 2023 Inès Varhol <ines.varhol@telecom-paris.fr>
6*20936684SInès Varhol  *
7*20936684SInès Varhol  * SPDX-License-Identifier: GPL-2.0-or-later
8*20936684SInès Varhol  *
9*20936684SInès Varhol  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10*20936684SInès Varhol  * See the COPYING file in the top-level directory.
11*20936684SInès Varhol  *
12*20936684SInès Varhol  * This work is based on the stm32f4xx_syscfg by Alistair Francis.
13*20936684SInès Varhol  * Original code is licensed under the MIT License:
14*20936684SInès Varhol  *
15*20936684SInès Varhol  * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
16*20936684SInès Varhol  */
17*20936684SInès Varhol 
18*20936684SInès Varhol /*
19*20936684SInès Varhol  * The reference used is the STMicroElectronics RM0351 Reference manual
20*20936684SInès Varhol  * for STM32L4x5 and STM32L4x6 advanced Arm ® -based 32-bit MCUs.
21*20936684SInès Varhol  * https://www.st.com/en/microcontrollers-microprocessors/stm32l4x5/documentation.html
22*20936684SInès Varhol  */
23*20936684SInès Varhol 
24*20936684SInès Varhol #ifndef HW_STM32L4X5_SYSCFG_H
25*20936684SInès Varhol #define HW_STM32L4X5_SYSCFG_H
26*20936684SInès Varhol 
27*20936684SInès Varhol #include "hw/sysbus.h"
28*20936684SInès Varhol #include "qom/object.h"
29*20936684SInès Varhol 
30*20936684SInès Varhol #define TYPE_STM32L4X5_SYSCFG "stm32l4x5-syscfg"
31*20936684SInès Varhol OBJECT_DECLARE_SIMPLE_TYPE(Stm32l4x5SyscfgState, STM32L4X5_SYSCFG)
32*20936684SInès Varhol 
33*20936684SInès Varhol #define NUM_GPIOS 8
34*20936684SInès Varhol #define GPIO_NUM_PINS 16
35*20936684SInès Varhol #define SYSCFG_NUM_EXTICR 4
36*20936684SInès Varhol 
37*20936684SInès Varhol struct Stm32l4x5SyscfgState {
38*20936684SInès Varhol     SysBusDevice parent_obj;
39*20936684SInès Varhol 
40*20936684SInès Varhol     MemoryRegion mmio;
41*20936684SInès Varhol 
42*20936684SInès Varhol     uint32_t memrmp;
43*20936684SInès Varhol     uint32_t cfgr1;
44*20936684SInès Varhol     uint32_t exticr[SYSCFG_NUM_EXTICR];
45*20936684SInès Varhol     uint32_t scsr;
46*20936684SInès Varhol     uint32_t cfgr2;
47*20936684SInès Varhol     uint32_t swpr;
48*20936684SInès Varhol     uint32_t skr;
49*20936684SInès Varhol     uint32_t swpr2;
50*20936684SInès Varhol 
51*20936684SInès Varhol     qemu_irq gpio_out[GPIO_NUM_PINS];
52*20936684SInès Varhol };
53*20936684SInès Varhol 
54*20936684SInès Varhol #endif
55