2009-05-14 23:35:09 +02:00
|
|
|
/* 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;
|
|
|
|
|
2011-12-16 20:36:39 +01:00
|
|
|
#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)
|
|
|
|
|
2009-05-14 23:35:09 +02:00
|
|
|
/* Slave devices. */
|
2011-12-16 20:36:39 +01:00
|
|
|
typedef struct SSISlaveClass {
|
|
|
|
DeviceClass parent_class;
|
|
|
|
|
2009-08-14 10:36:05 +02:00
|
|
|
int (*init)(SSISlave *dev);
|
2009-05-14 23:35:09 +02:00
|
|
|
uint32_t (*transfer)(SSISlave *dev, uint32_t val);
|
2011-12-16 20:36:39 +01:00
|
|
|
} SSISlaveClass;
|
2009-05-14 23:35:09 +02:00
|
|
|
|
|
|
|
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. */
|
2009-05-23 01:05:19 +02:00
|
|
|
SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
|
2009-05-14 23:35:09 +02:00
|
|
|
|
|
|
|
uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
|
|
|
|
|
2009-05-14 23:35:09 +02:00
|
|
|
/* max111x.c */
|
|
|
|
void max111x_set_input(DeviceState *dev, int line, uint8_t value);
|
|
|
|
|
2009-05-14 23:35:09 +02:00
|
|
|
#endif
|