2 * QEMU IndustryPack emulation
4 * Copyright (C) 2012 Igalia, S.L.
5 * Author: Alberto Garcia <berto@igalia.com>
7 * This code is licensed under the GNU GPL v2 or (at your option) any
14 #include "hw/qdev-core.h"
16 typedef struct IPackBus IPackBus
;
18 #define TYPE_IPACK_BUS "IndustryPack"
19 #define IPACK_BUS(obj) OBJECT_CHECK(IPackBus, (obj), TYPE_IPACK_BUS)
25 /* All fields are private */
28 qemu_irq_handler set_irq
;
31 typedef struct IPackDevice IPackDevice
;
32 typedef struct IPackDeviceClass IPackDeviceClass
;
34 #define TYPE_IPACK_DEVICE "ipack-device"
35 #define IPACK_DEVICE(obj) \
36 OBJECT_CHECK(IPackDevice, (obj), TYPE_IPACK_DEVICE)
37 #define IPACK_DEVICE_CLASS(klass) \
38 OBJECT_CLASS_CHECK(IPackDeviceClass, (klass), TYPE_IPACK_DEVICE)
39 #define IPACK_DEVICE_GET_CLASS(obj) \
40 OBJECT_GET_CLASS(IPackDeviceClass, (obj), TYPE_IPACK_DEVICE)
42 struct IPackDeviceClass
{
44 DeviceClass parent_class
;
47 DeviceRealize realize
;
48 DeviceUnrealize unrealize
;
50 uint16_t (*io_read
)(IPackDevice
*dev
, uint8_t addr
);
51 void (*io_write
)(IPackDevice
*dev
, uint8_t addr
, uint16_t val
);
53 uint16_t (*id_read
)(IPackDevice
*dev
, uint8_t addr
);
54 void (*id_write
)(IPackDevice
*dev
, uint8_t addr
, uint16_t val
);
56 uint16_t (*int_read
)(IPackDevice
*dev
, uint8_t addr
);
57 void (*int_write
)(IPackDevice
*dev
, uint8_t addr
, uint16_t val
);
59 uint16_t (*mem_read16
)(IPackDevice
*dev
, uint32_t addr
);
60 void (*mem_write16
)(IPackDevice
*dev
, uint32_t addr
, uint16_t val
);
62 uint8_t (*mem_read8
)(IPackDevice
*dev
, uint32_t addr
);
63 void (*mem_write8
)(IPackDevice
*dev
, uint32_t addr
, uint8_t val
);
68 DeviceState parent_obj
;
72 /* IRQ objects for the IndustryPack INT0# and INT1# */
76 extern const VMStateDescription vmstate_ipack_device
;
78 #define VMSTATE_IPACK_DEVICE(_field, _state) \
79 VMSTATE_STRUCT(_field, _state, 1, vmstate_ipack_device, IPackDevice)
81 IPackDevice
*ipack_device_find(IPackBus
*bus
, int32_t slot
);
82 void ipack_bus_new_inplace(IPackBus
*bus
, size_t bus_size
,
84 const char *name
, uint8_t n_slots
,
85 qemu_irq_handler handler
);