Statistics
| Branch: | Revision:

root / hw / ssi.h @ 9d055d8a

History | View | Annotate | Download (1.5 kB)

1 90d37239 Paul Brook
/* QEMU Synchronous Serial Interface support.  */
2 90d37239 Paul Brook
3 90d37239 Paul Brook
/* In principle SSI is a point-point interface.  As such the qemu
4 90d37239 Paul Brook
   implementation has a single slave device on a "bus".
5 90d37239 Paul Brook
   However it is fairly common for boards to have multiple slaves
6 90d37239 Paul Brook
   connected to a single master, and select devices with an external
7 90d37239 Paul Brook
   chip select.  This is implemented in qemu by having an explicit mux device.
8 90d37239 Paul Brook
   It is assumed that master and slave are both using the same transfer width.
9 90d37239 Paul Brook
   */
10 90d37239 Paul Brook
11 90d37239 Paul Brook
#ifndef QEMU_SSI_H
12 90d37239 Paul Brook
#define QEMU_SSI_H
13 90d37239 Paul Brook
14 90d37239 Paul Brook
#include "qdev.h"
15 90d37239 Paul Brook
16 90d37239 Paul Brook
typedef struct SSISlave SSISlave;
17 90d37239 Paul Brook
18 cd6c4cf2 Anthony Liguori
#define TYPE_SSI_SLAVE "ssi-slave"
19 cd6c4cf2 Anthony Liguori
#define SSI_SLAVE(obj) \
20 cd6c4cf2 Anthony Liguori
     OBJECT_CHECK(SSISlave, (obj), TYPE_SSI_SLAVE)
21 cd6c4cf2 Anthony Liguori
#define SSI_SLAVE_CLASS(klass) \
22 cd6c4cf2 Anthony Liguori
     OBJECT_CLASS_CHECK(SSISlaveClass, (klass), TYPE_SSI_SLAVE)
23 cd6c4cf2 Anthony Liguori
#define SSI_SLAVE_GET_CLASS(obj) \
24 cd6c4cf2 Anthony Liguori
     OBJECT_GET_CLASS(SSISlaveClass, (obj), TYPE_SSI_SLAVE)
25 cd6c4cf2 Anthony Liguori
26 90d37239 Paul Brook
/* Slave devices.  */
27 cd6c4cf2 Anthony Liguori
typedef struct SSISlaveClass {
28 cd6c4cf2 Anthony Liguori
    DeviceClass parent_class;
29 cd6c4cf2 Anthony Liguori
30 81a322d4 Gerd Hoffmann
    int (*init)(SSISlave *dev);
31 90d37239 Paul Brook
    uint32_t (*transfer)(SSISlave *dev, uint32_t val);
32 cd6c4cf2 Anthony Liguori
} SSISlaveClass;
33 90d37239 Paul Brook
34 90d37239 Paul Brook
struct SSISlave {
35 90d37239 Paul Brook
    DeviceState qdev;
36 90d37239 Paul Brook
};
37 90d37239 Paul Brook
38 90d37239 Paul Brook
#define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
39 90d37239 Paul Brook
#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
40 90d37239 Paul Brook
41 90d37239 Paul Brook
DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
42 90d37239 Paul Brook
43 90d37239 Paul Brook
/* Master interface.  */
44 02e2da45 Paul Brook
SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
45 90d37239 Paul Brook
46 90d37239 Paul Brook
uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
47 90d37239 Paul Brook
48 a984a69e Paul Brook
/* max111x.c */
49 a984a69e Paul Brook
void max111x_set_input(DeviceState *dev, int line, uint8_t value);
50 a984a69e Paul Brook
51 90d37239 Paul Brook
#endif