qemu/hw/ssi.h
Anthony Liguori 39bffca203 qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion.  I did it in three steps and then
rebased it into a single step which avoids repeatedly touching every file in
the tree.

The first step was a sed-based addition of the parent type to the subclass
registration functions.

The second step was another sed-based removal of subclass registration functions
while also adding virtual functions from the base class into a class_init
function as appropriate.

Finally, a python script was used to convert the DeviceInfo structures and
qdev_register_subclass functions to TypeInfo structures, class_init functions,
and type_register_static calls.

We are almost fully converted to QOM after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-03 10:41:06 -06:00

52 lines
1.5 KiB
C

/* QEMU Synchronous Serial Interface support. */
/* In principle SSI is a point-point interface. As such the qemu
implementation has a single slave device on a "bus".
However it is fairly common for boards to have multiple slaves
connected to a single master, and select devices with an external
chip select. This is implemented in qemu by having an explicit mux device.
It is assumed that master and slave are both using the same transfer width.
*/
#ifndef QEMU_SSI_H
#define QEMU_SSI_H
#include "qdev.h"
typedef struct SSISlave SSISlave;
#define TYPE_SSI_SLAVE "ssi-slave"
#define SSI_SLAVE(obj) \
OBJECT_CHECK(SSISlave, (obj), TYPE_SSI_SLAVE)
#define SSI_SLAVE_CLASS(klass) \
OBJECT_CLASS_CHECK(SSISlaveClass, (klass), TYPE_SSI_SLAVE)
#define SSI_SLAVE_GET_CLASS(obj) \
OBJECT_GET_CLASS(SSISlaveClass, (obj), TYPE_SSI_SLAVE)
/* Slave devices. */
typedef struct SSISlaveClass {
DeviceClass parent_class;
int (*init)(SSISlave *dev);
uint32_t (*transfer)(SSISlave *dev, uint32_t val);
} SSISlaveClass;
struct SSISlave {
DeviceState qdev;
};
#define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
/* Master interface. */
SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
/* max111x.c */
void max111x_set_input(DeviceState *dev, int line, uint8_t value);
#endif