2 * SiFive System-on-Chip general purpose input/output register definition
4 * Copyright 2019 AdaCore
6 * Base on nrf51_gpio.c:
8 * Copyright 2018 Steffen Görtz <contrib@steffen-goertz.de>
10 * This code is licensed under the GPL version 2 or later. See
11 * the COPYING file in the top-level directory.
17 #include "hw/sysbus.h"
18 #include "qom/object.h"
20 #define TYPE_SIFIVE_GPIO "sifive_soc.gpio"
21 typedef struct SIFIVEGPIOState SIFIVEGPIOState
;
22 DECLARE_INSTANCE_CHECKER(SIFIVEGPIOState
, SIFIVE_GPIO
,
25 #define SIFIVE_GPIO_PINS 32
27 #define SIFIVE_GPIO_SIZE 0x100
29 #define SIFIVE_GPIO_REG_VALUE 0x000
30 #define SIFIVE_GPIO_REG_INPUT_EN 0x004
31 #define SIFIVE_GPIO_REG_OUTPUT_EN 0x008
32 #define SIFIVE_GPIO_REG_PORT 0x00C
33 #define SIFIVE_GPIO_REG_PUE 0x010
34 #define SIFIVE_GPIO_REG_DS 0x014
35 #define SIFIVE_GPIO_REG_RISE_IE 0x018
36 #define SIFIVE_GPIO_REG_RISE_IP 0x01C
37 #define SIFIVE_GPIO_REG_FALL_IE 0x020
38 #define SIFIVE_GPIO_REG_FALL_IP 0x024
39 #define SIFIVE_GPIO_REG_HIGH_IE 0x028
40 #define SIFIVE_GPIO_REG_HIGH_IP 0x02C
41 #define SIFIVE_GPIO_REG_LOW_IE 0x030
42 #define SIFIVE_GPIO_REG_LOW_IP 0x034
43 #define SIFIVE_GPIO_REG_IOF_EN 0x038
44 #define SIFIVE_GPIO_REG_IOF_SEL 0x03C
45 #define SIFIVE_GPIO_REG_OUT_XOR 0x040
47 struct SIFIVEGPIOState
{
48 SysBusDevice parent_obj
;
52 qemu_irq irq
[SIFIVE_GPIO_PINS
];
53 qemu_irq output
[SIFIVE_GPIO_PINS
];
55 uint32_t value
; /* Actual value of the pin */
58 uint32_t port
; /* Pin value requested by the user */
79 #endif /* SIFIVE_GPIO_H */