Statistics
| Branch: | Revision:

root / hw / ssi.h @ 5493e33f

History | View | Annotate | Download (1.1 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 90d37239 Paul Brook
/* Slave devices.  */
19 90d37239 Paul Brook
typedef struct {
20 90d37239 Paul Brook
    void (*init)(SSISlave *dev);
21 90d37239 Paul Brook
    uint32_t (*transfer)(SSISlave *dev, uint32_t val);
22 90d37239 Paul Brook
} SSISlaveInfo;
23 90d37239 Paul Brook
24 90d37239 Paul Brook
struct SSISlave {
25 90d37239 Paul Brook
    DeviceState qdev;
26 90d37239 Paul Brook
    SSISlaveInfo *info;
27 90d37239 Paul Brook
};
28 90d37239 Paul Brook
29 90d37239 Paul Brook
#define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
30 90d37239 Paul Brook
#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
31 90d37239 Paul Brook
32 90d37239 Paul Brook
void ssi_register_slave(const char *name, int size, SSISlaveInfo *info);
33 90d37239 Paul Brook
34 90d37239 Paul Brook
DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
35 90d37239 Paul Brook
36 90d37239 Paul Brook
/* Master interface.  */
37 90d37239 Paul Brook
SSIBus *ssi_create_bus(void);
38 90d37239 Paul Brook
39 90d37239 Paul Brook
uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
40 90d37239 Paul Brook
41 90d37239 Paul Brook
#endif