Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / gpio / npcm7xx_gpio.h
blobb1d771bd776c0cedac47a092068ea57f4e3d9d74
1 /*
2 * Nuvoton NPCM7xx General Purpose Input / Output (GPIO)
4 * Copyright 2020 Google LLC
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 #ifndef NPCM7XX_GPIO_H
16 #define NPCM7XX_GPIO_H
18 #include "exec/memory.h"
19 #include "hw/sysbus.h"
21 /* Number of pins managed by each controller. */
22 #define NPCM7XX_GPIO_NR_PINS (32)
25 * Number of registers in our device state structure. Don't change this without
26 * incrementing the version_id in the vmstate.
28 #define NPCM7XX_GPIO_NR_REGS (0x80 / sizeof(uint32_t))
30 typedef struct NPCM7xxGPIOState {
31 SysBusDevice parent;
33 /* Properties to be defined by the SoC */
34 uint32_t reset_pu;
35 uint32_t reset_pd;
36 uint32_t reset_osrc;
37 uint32_t reset_odsc;
39 MemoryRegion mmio;
41 qemu_irq irq;
42 qemu_irq output[NPCM7XX_GPIO_NR_PINS];
44 uint32_t pin_level;
45 uint32_t ext_level;
46 uint32_t ext_driven;
48 uint32_t regs[NPCM7XX_GPIO_NR_REGS];
49 } NPCM7xxGPIOState;
51 #define TYPE_NPCM7XX_GPIO "npcm7xx-gpio"
52 #define NPCM7XX_GPIO(obj) \
53 OBJECT_CHECK(NPCM7xxGPIOState, (obj), TYPE_NPCM7XX_GPIO)
55 #endif /* NPCM7XX_GPIO_H */