Blame view

hw/ssi.h 1.24 KB
Paul Brook authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 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;

/* Slave devices.  */
typedef struct {
Paul Brook authored
20
    DeviceInfo qdev;
Paul Brook authored
21
22
23
24
25
26
27
28
29
30
31
32
    void (*init)(SSISlave *dev);
    uint32_t (*transfer)(SSISlave *dev, uint32_t val);
} SSISlaveInfo;

struct SSISlave {
    DeviceState qdev;
    SSISlaveInfo *info;
};

#define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev)
#define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev)
33
void ssi_register_slave(SSISlaveInfo *info);
Paul Brook authored
34
35
36
37

DeviceState *ssi_create_slave(SSIBus *bus, const char *name);

/* Master interface.  */
Paul Brook authored
38
SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
Paul Brook authored
39
40
41

uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
Paul Brook authored
42
43
44
/* max111x.c */
void max111x_set_input(DeviceState *dev, int line, uint8_t value);
Paul Brook authored
45
#endif