]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/ipack/ipack.h
Move QOM typedefs and add missing includes
[mirror_qemu.git] / include / hw / ipack / ipack.h
CommitLineData
9c16fa79
AG
1/*
2 * QEMU IndustryPack emulation
3 *
4 * Copyright (C) 2012 Igalia, S.L.
b996aed5 5 * Author: Alberto Garcia <berto@igalia.com>
9c16fa79
AG
6 *
7 * This code is licensed under the GNU GPL v2 or (at your option) any
8 * later version.
9 */
10
11#ifndef QEMU_IPACK_H
12#define QEMU_IPACK_H
13
a27bd6c7 14#include "hw/qdev-core.h"
db1015e9 15#include "qom/object.h"
9c16fa79
AG
16
17typedef struct IPackBus IPackBus;
18
19#define TYPE_IPACK_BUS "IndustryPack"
20#define IPACK_BUS(obj) OBJECT_CHECK(IPackBus, (obj), TYPE_IPACK_BUS)
21
22struct IPackBus {
a21ac343
AF
23 /*< private >*/
24 BusState parent_obj;
25
9c16fa79
AG
26 /* All fields are private */
27 uint8_t n_slots;
28 uint8_t free_slot;
29 qemu_irq_handler set_irq;
30};
31
32typedef struct IPackDevice IPackDevice;
33typedef struct IPackDeviceClass IPackDeviceClass;
34
35#define TYPE_IPACK_DEVICE "ipack-device"
36#define IPACK_DEVICE(obj) \
37 OBJECT_CHECK(IPackDevice, (obj), TYPE_IPACK_DEVICE)
38#define IPACK_DEVICE_CLASS(klass) \
39 OBJECT_CLASS_CHECK(IPackDeviceClass, (klass), TYPE_IPACK_DEVICE)
40#define IPACK_DEVICE_GET_CLASS(obj) \
41 OBJECT_GET_CLASS(IPackDeviceClass, (obj), TYPE_IPACK_DEVICE)
42
43struct IPackDeviceClass {
5c570902 44 /*< private >*/
9c16fa79 45 DeviceClass parent_class;
5c570902 46 /*< public >*/
9c16fa79 47
5c570902
AF
48 DeviceRealize realize;
49 DeviceUnrealize unrealize;
9c16fa79
AG
50
51 uint16_t (*io_read)(IPackDevice *dev, uint8_t addr);
52 void (*io_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
53
54 uint16_t (*id_read)(IPackDevice *dev, uint8_t addr);
55 void (*id_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
56
57 uint16_t (*int_read)(IPackDevice *dev, uint8_t addr);
58 void (*int_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
59
60 uint16_t (*mem_read16)(IPackDevice *dev, uint32_t addr);
61 void (*mem_write16)(IPackDevice *dev, uint32_t addr, uint16_t val);
62
63 uint8_t (*mem_read8)(IPackDevice *dev, uint32_t addr);
64 void (*mem_write8)(IPackDevice *dev, uint32_t addr, uint8_t val);
65};
66
67struct IPackDevice {
227d3272
AF
68 /*< private >*/
69 DeviceState parent_obj;
70 /*< public >*/
71
9c16fa79
AG
72 int32_t slot;
73 /* IRQ objects for the IndustryPack INT0# and INT1# */
74 qemu_irq *irq;
75};
76
77extern const VMStateDescription vmstate_ipack_device;
78
79#define VMSTATE_IPACK_DEVICE(_field, _state) \
80 VMSTATE_STRUCT(_field, _state, 1, vmstate_ipack_device, IPackDevice)
81
82IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot);
77cbb28a
AF
83void ipack_bus_new_inplace(IPackBus *bus, size_t bus_size,
84 DeviceState *parent,
9c16fa79
AG
85 const char *name, uint8_t n_slots,
86 qemu_irq_handler handler);
87
88#endif