pci: Allow PCI bus subtypes to support extended config space accesses
[qemu/ar7.git] / include / hw / i2c / microbit_i2c.h
blobaad636127ea162bd78edf913262b37734e8f88d0
1 /*
2 * Microbit stub for Nordic Semiconductor nRF51 SoC Two-Wire Interface
3 * http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf
5 * Copyright 2019 Red Hat, Inc.
7 * This code is licensed under the GPL version 2 or later. See
8 * the COPYING file in the top-level directory.
9 */
11 #ifndef MICROBIT_I2C_H
12 #define MICROBIT_I2C_H
14 #include "hw/sysbus.h"
15 #include "hw/arm/nrf51.h"
17 #define NRF51_TWI_TASK_STARTRX 0x000
18 #define NRF51_TWI_TASK_STARTTX 0x008
19 #define NRF51_TWI_TASK_STOP 0x014
20 #define NRF51_TWI_EVENT_STOPPED 0x104
21 #define NRF51_TWI_EVENT_RXDREADY 0x108
22 #define NRF51_TWI_EVENT_TXDSENT 0x11c
23 #define NRF51_TWI_REG_ENABLE 0x500
24 #define NRF51_TWI_REG_RXD 0x518
25 #define NRF51_TWI_REG_TXD 0x51c
26 #define NRF51_TWI_REG_ADDRESS 0x588
28 #define TYPE_MICROBIT_I2C "microbit.i2c"
29 #define MICROBIT_I2C(obj) \
30 OBJECT_CHECK(MicrobitI2CState, (obj), TYPE_MICROBIT_I2C)
32 #define MICROBIT_I2C_NREGS (NRF51_TWI_SIZE / sizeof(uint32_t))
34 typedef struct {
35 SysBusDevice parent_obj;
37 MemoryRegion iomem;
38 uint32_t regs[MICROBIT_I2C_NREGS];
39 uint32_t read_idx;
40 } MicrobitI2CState;
42 #endif /* MICROBIT_I2C_H */