2013-01-11 18:25:29 +01:00
|
|
|
/*
|
|
|
|
* QEMU IndustryPack emulation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Igalia, S.L.
|
2016-02-23 09:44:25 +01:00
|
|
|
* Author: Alberto Garcia <berto@igalia.com>
|
2013-01-11 18:25:29 +01:00
|
|
|
*
|
|
|
|
* This code is licensed under the GNU GPL v2 or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QEMU_IPACK_H
|
|
|
|
#define QEMU_IPACK_H
|
|
|
|
|
2019-08-12 07:23:51 +02:00
|
|
|
#include "hw/qdev-core.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2013-01-11 18:25:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
#define TYPE_IPACK_BUS "IndustryPack"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(IPackBus, IPACK_BUS)
|
2013-01-11 18:25:29 +01:00
|
|
|
|
|
|
|
struct IPackBus {
|
2013-08-01 18:47:34 +02:00
|
|
|
/*< private >*/
|
|
|
|
BusState parent_obj;
|
|
|
|
|
2013-01-11 18:25:29 +01:00
|
|
|
/* All fields are private */
|
|
|
|
uint8_t n_slots;
|
|
|
|
uint8_t free_slot;
|
|
|
|
qemu_irq_handler set_irq;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define TYPE_IPACK_DEVICE "ipack-device"
|
2020-08-31 23:07:37 +02:00
|
|
|
OBJECT_DECLARE_TYPE(IPackDevice, IPackDeviceClass,
|
qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros
One of the goals of having less boilerplate on QOM declarations
is to avoid human error. Requiring an extra argument that is
never used is an opportunity for mistakes.
Remove the unused argument from OBJECT_DECLARE_TYPE and
OBJECT_DECLARE_SIMPLE_TYPE.
Coccinelle patch used to convert all users of the macros:
@@
declarer name OBJECT_DECLARE_TYPE;
identifier InstanceType, ClassType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_TYPE(InstanceType, ClassType,
- lowercase,
UPPERCASE);
@@
declarer name OBJECT_DECLARE_SIMPLE_TYPE;
identifier InstanceType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_SIMPLE_TYPE(InstanceType,
- lowercase,
UPPERCASE);
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200916182519.415636-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-16 20:25:17 +02:00
|
|
|
IPACK_DEVICE)
|
2013-01-11 18:25:29 +01:00
|
|
|
|
|
|
|
struct IPackDeviceClass {
|
2013-08-01 18:45:02 +02:00
|
|
|
/*< private >*/
|
2013-01-11 18:25:29 +01:00
|
|
|
DeviceClass parent_class;
|
2013-08-01 18:45:02 +02:00
|
|
|
/*< public >*/
|
2013-01-11 18:25:29 +01:00
|
|
|
|
2013-08-01 18:45:02 +02:00
|
|
|
DeviceRealize realize;
|
|
|
|
DeviceUnrealize unrealize;
|
2013-01-11 18:25:29 +01:00
|
|
|
|
|
|
|
uint16_t (*io_read)(IPackDevice *dev, uint8_t addr);
|
|
|
|
void (*io_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
|
|
|
|
|
|
|
|
uint16_t (*id_read)(IPackDevice *dev, uint8_t addr);
|
|
|
|
void (*id_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
|
|
|
|
|
|
|
|
uint16_t (*int_read)(IPackDevice *dev, uint8_t addr);
|
|
|
|
void (*int_write)(IPackDevice *dev, uint8_t addr, uint16_t val);
|
|
|
|
|
|
|
|
uint16_t (*mem_read16)(IPackDevice *dev, uint32_t addr);
|
|
|
|
void (*mem_write16)(IPackDevice *dev, uint32_t addr, uint16_t val);
|
|
|
|
|
|
|
|
uint8_t (*mem_read8)(IPackDevice *dev, uint32_t addr);
|
|
|
|
void (*mem_write8)(IPackDevice *dev, uint32_t addr, uint8_t val);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct IPackDevice {
|
2013-08-01 18:48:28 +02:00
|
|
|
/*< private >*/
|
|
|
|
DeviceState parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
2013-01-11 18:25:29 +01:00
|
|
|
int32_t slot;
|
|
|
|
/* IRQ objects for the IndustryPack INT0# and INT1# */
|
|
|
|
qemu_irq *irq;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const VMStateDescription vmstate_ipack_device;
|
|
|
|
|
|
|
|
#define VMSTATE_IPACK_DEVICE(_field, _state) \
|
|
|
|
VMSTATE_STRUCT(_field, _state, 1, vmstate_ipack_device, IPackDevice)
|
|
|
|
|
|
|
|
IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot);
|
2013-08-23 20:07:28 +02:00
|
|
|
void ipack_bus_new_inplace(IPackBus *bus, size_t bus_size,
|
|
|
|
DeviceState *parent,
|
2013-01-11 18:25:29 +01:00
|
|
|
const char *name, uint8_t n_slots,
|
|
|
|
qemu_irq_handler handler);
|
|
|
|
|
|
|
|
#endif
|