root / hw / ssi.h @ a85d6887
History | View | Annotate | Download (1.2 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 | 02e2da45 | Paul Brook | DeviceInfo qdev; |
21 | 90d37239 | Paul Brook | void (*init)(SSISlave *dev);
|
22 | 90d37239 | Paul Brook | uint32_t (*transfer)(SSISlave *dev, uint32_t val); |
23 | 90d37239 | Paul Brook | } SSISlaveInfo; |
24 | 90d37239 | Paul Brook | |
25 | 90d37239 | Paul Brook | struct SSISlave {
|
26 | 90d37239 | Paul Brook | DeviceState qdev; |
27 | 90d37239 | Paul Brook | SSISlaveInfo *info; |
28 | 90d37239 | Paul Brook | }; |
29 | 90d37239 | Paul Brook | |
30 | 90d37239 | Paul Brook | #define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
|
31 | 90d37239 | Paul Brook | #define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
|
32 | 90d37239 | Paul Brook | |
33 | 074f2fff | Gerd Hoffmann | void ssi_register_slave(SSISlaveInfo *info);
|
34 | 90d37239 | Paul Brook | |
35 | 90d37239 | Paul Brook | DeviceState *ssi_create_slave(SSIBus *bus, const char *name); |
36 | 90d37239 | Paul Brook | |
37 | 90d37239 | Paul Brook | /* Master interface. */
|
38 | 02e2da45 | Paul Brook | SSIBus *ssi_create_bus(DeviceState *parent, const char *name); |
39 | 90d37239 | Paul Brook | |
40 | 90d37239 | Paul Brook | uint32_t ssi_transfer(SSIBus *bus, uint32_t val); |
41 | 90d37239 | Paul Brook | |
42 | a984a69e | Paul Brook | /* max111x.c */
|
43 | a984a69e | Paul Brook | void max111x_set_input(DeviceState *dev, int line, uint8_t value); |
44 | a984a69e | Paul Brook | |
45 | 90d37239 | Paul Brook | #endif |