aboutsummaryrefslogtreecommitdiff
path: root/include/hw/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw/gpio')
-rw-r--r--include/hw/gpio/aspeed_gpio.h18
-rw-r--r--include/hw/gpio/bcm2835_gpio.h10
-rw-r--r--include/hw/gpio/imx_gpio.h9
-rw-r--r--include/hw/gpio/nrf51_gpio.h9
4 files changed, 27 insertions, 19 deletions
diff --git a/include/hw/gpio/aspeed_gpio.h b/include/hw/gpio/aspeed_gpio.h
index a2deac046a..2582e6e0dc 100644
--- a/include/hw/gpio/aspeed_gpio.h
+++ b/include/hw/gpio/aspeed_gpio.h
@@ -11,13 +11,13 @@
#define ASPEED_GPIO_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_ASPEED_GPIO "aspeed.gpio"
-#define ASPEED_GPIO(obj) OBJECT_CHECK(AspeedGPIOState, (obj), TYPE_ASPEED_GPIO)
-#define ASPEED_GPIO_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedGPIOClass, (klass), TYPE_ASPEED_GPIO)
-#define ASPEED_GPIO_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedGPIOClass, (obj), TYPE_ASPEED_GPIO)
+typedef struct AspeedGPIOClass AspeedGPIOClass;
+typedef struct AspeedGPIOState AspeedGPIOState;
+DECLARE_OBJ_CHECKERS(AspeedGPIOState, AspeedGPIOClass,
+ ASPEED_GPIO, TYPE_ASPEED_GPIO)
#define ASPEED_GPIO_MAX_NR_SETS 8
#define ASPEED_REGS_PER_BANK 14
@@ -58,16 +58,16 @@ typedef struct AspeedGPIOReg {
enum GPIORegType type;
} AspeedGPIOReg;
-typedef struct AspeedGPIOClass {
+struct AspeedGPIOClass {
SysBusDevice parent_obj;
const GPIOSetProperties *props;
uint32_t nr_gpio_pins;
uint32_t nr_gpio_sets;
uint32_t gap;
const AspeedGPIOReg *reg_table;
-} AspeedGPIOClass;
+};
-typedef struct AspeedGPIOState {
+struct AspeedGPIOState {
/* <private> */
SysBusDevice parent;
@@ -95,6 +95,6 @@ typedef struct AspeedGPIOState {
uint32_t debounce_2;
uint32_t input_mask;
} sets[ASPEED_GPIO_MAX_NR_SETS];
-} AspeedGPIOState;
+};
#endif /* _ASPEED_GPIO_H_ */
diff --git a/include/hw/gpio/bcm2835_gpio.h b/include/hw/gpio/bcm2835_gpio.h
index b0de0a3c74..e06e08a0fe 100644
--- a/include/hw/gpio/bcm2835_gpio.h
+++ b/include/hw/gpio/bcm2835_gpio.h
@@ -16,8 +16,9 @@
#include "hw/sd/sd.h"
#include "hw/sysbus.h"
+#include "qom/object.h"
-typedef struct BCM2835GpioState {
+struct BCM2835GpioState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -31,10 +32,11 @@ typedef struct BCM2835GpioState {
uint32_t lev0, lev1;
uint8_t sd_fsel;
qemu_irq out[54];
-} BCM2835GpioState;
+};
+typedef struct BCM2835GpioState BCM2835GpioState;
#define TYPE_BCM2835_GPIO "bcm2835_gpio"
-#define BCM2835_GPIO(obj) \
- OBJECT_CHECK(BCM2835GpioState, (obj), TYPE_BCM2835_GPIO)
+DECLARE_INSTANCE_CHECKER(BCM2835GpioState, BCM2835_GPIO,
+ TYPE_BCM2835_GPIO)
#endif
diff --git a/include/hw/gpio/imx_gpio.h b/include/hw/gpio/imx_gpio.h
index ffab437f23..a72b272ace 100644
--- a/include/hw/gpio/imx_gpio.h
+++ b/include/hw/gpio/imx_gpio.h
@@ -21,9 +21,12 @@
#define IMX_GPIO_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_IMX_GPIO "imx.gpio"
-#define IMX_GPIO(obj) OBJECT_CHECK(IMXGPIOState, (obj), TYPE_IMX_GPIO)
+typedef struct IMXGPIOState IMXGPIOState;
+DECLARE_INSTANCE_CHECKER(IMXGPIOState, IMX_GPIO,
+ TYPE_IMX_GPIO)
#define IMX_GPIO_MEM_SIZE 0x20
@@ -39,7 +42,7 @@
#define IMX_GPIO_PIN_COUNT 32
-typedef struct IMXGPIOState {
+struct IMXGPIOState {
/*< private >*/
SysBusDevice parent_obj;
@@ -58,6 +61,6 @@ typedef struct IMXGPIOState {
qemu_irq irq[2];
qemu_irq output[IMX_GPIO_PIN_COUNT];
-} IMXGPIOState;
+};
#endif /* IMX_GPIO_H */
diff --git a/include/hw/gpio/nrf51_gpio.h b/include/hw/gpio/nrf51_gpio.h
index 1d62bbc928..55d7d24a52 100644
--- a/include/hw/gpio/nrf51_gpio.h
+++ b/include/hw/gpio/nrf51_gpio.h
@@ -27,8 +27,11 @@
#define NRF51_GPIO_H
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_NRF51_GPIO "nrf51_soc.gpio"
-#define NRF51_GPIO(obj) OBJECT_CHECK(NRF51GPIOState, (obj), TYPE_NRF51_GPIO)
+typedef struct NRF51GPIOState NRF51GPIOState;
+DECLARE_INSTANCE_CHECKER(NRF51GPIOState, NRF51_GPIO,
+ TYPE_NRF51_GPIO)
#define NRF51_GPIO_PINS 32
@@ -47,7 +50,7 @@
#define NRF51_GPIO_PULLDOWN 1
#define NRF51_GPIO_PULLUP 3
-typedef struct NRF51GPIOState {
+struct NRF51GPIOState {
SysBusDevice parent_obj;
MemoryRegion mmio;
@@ -63,7 +66,7 @@ typedef struct NRF51GPIOState {
uint32_t old_out_connected;
qemu_irq output[NRF51_GPIO_PINS];
-} NRF51GPIOState;
+};
#endif