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"
15 #include "qom/object.h"
18 #define TYPE_IPACK_BUS "IndustryPack"
19 OBJECT_DECLARE_SIMPLE_TYPE(IPackBus
, IPACK_BUS
)
25 /* All fields are private */
28 qemu_irq_handler set_irq
;
32 #define TYPE_IPACK_DEVICE "ipack-device"
33 OBJECT_DECLARE_TYPE(IPackDevice
, IPackDeviceClass
,
36 struct IPackDeviceClass
{
38 DeviceClass parent_class
;
41 DeviceRealize realize
;
42 DeviceUnrealize unrealize
;
44 uint16_t (*io_read
)(IPackDevice
*dev
, uint8_t addr
);
45 void (*io_write
)(IPackDevice
*dev
, uint8_t addr
, uint16_t val
);
47 uint16_t (*id_read
)(IPackDevice
*dev
, uint8_t addr
);
48 void (*id_write
)(IPackDevice
*dev
, uint8_t addr
, uint16_t val
);
50 uint16_t (*int_read
)(IPackDevice
*dev
, uint8_t addr
);
51 void (*int_write
)(IPackDevice
*dev
, uint8_t addr
, uint16_t val
);
53 uint16_t (*mem_read16
)(IPackDevice
*dev
, uint32_t addr
);
54 void (*mem_write16
)(IPackDevice
*dev
, uint32_t addr
, uint16_t val
);
56 uint8_t (*mem_read8
)(IPackDevice
*dev
, uint32_t addr
);
57 void (*mem_write8
)(IPackDevice
*dev
, uint32_t addr
, uint8_t val
);
62 DeviceState parent_obj
;
66 /* IRQ objects for the IndustryPack INT0# and INT1# */
70 extern const VMStateDescription vmstate_ipack_device
;
72 #define VMSTATE_IPACK_DEVICE(_field, _state) \
73 VMSTATE_STRUCT(_field, _state, 1, vmstate_ipack_device, IPackDevice)
75 IPackDevice
*ipack_device_find(IPackBus
*bus
, int32_t slot
);
76 void ipack_bus_init(IPackBus
*bus
, size_t bus_size
,
79 qemu_irq_handler handler
);