blob: 24610a80cba500196014dfecfa9909f823f458ee [file] [log] [blame]
Paul Brook90d37232009-05-14 22:35:09 +01001/* QEMU Synchronous Serial Interface support. */
2
3/* In principle SSI is a point-point interface. As such the qemu
4 implementation has a single slave device on a "bus".
5 However it is fairly common for boards to have multiple slaves
6 connected to a single master, and select devices with an external
7 chip select. This is implemented in qemu by having an explicit mux device.
8 It is assumed that master and slave are both using the same transfer width.
9 */
10
11#ifndef QEMU_SSI_H
12#define QEMU_SSI_H
13
14#include "qdev.h"
15
16typedef struct SSISlave SSISlave;
17
18/* Slave devices. */
19typedef struct {
Paul Brook02e2da42009-05-23 00:05:19 +010020 DeviceInfo qdev;
Gerd Hoffmann81a322d2009-08-14 10:36:05 +020021 int (*init)(SSISlave *dev);
Paul Brook90d37232009-05-14 22:35:09 +010022 uint32_t (*transfer)(SSISlave *dev, uint32_t val);
23} SSISlaveInfo;
24
25struct SSISlave {
26 DeviceState qdev;
27 SSISlaveInfo *info;
28};
29
30#define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
31#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
32
Gerd Hoffmann074f2ff2009-06-10 09:41:42 +020033void ssi_register_slave(SSISlaveInfo *info);
Paul Brook90d37232009-05-14 22:35:09 +010034
35DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
36
37/* Master interface. */
Paul Brook02e2da42009-05-23 00:05:19 +010038SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
Paul Brook90d37232009-05-14 22:35:09 +010039
40uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
41
Paul Brooka984a692009-05-14 22:35:09 +010042/* max111x.c */
43void max111x_set_input(DeviceState *dev, int line, uint8_t value);
44
Paul Brook90d37232009-05-14 22:35:09 +010045#endif