Merge remote-tracking branch 'qemu/master'
[qemu/ar7.git] / hw / vlynq.h
blob4cb66663bfae145349005c082d3dc0ac1a8a2f97
1 /*
2 * QEMU VLYNQ Serial Interface support.
4 * Copyright (C) 2009-2011 Stefan Weil
6 * Portions of the code are copies from ssi.h.
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) version 3 or any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef QEMU_VLYNQ_H
24 #define QEMU_VLYNQ_H
26 #include "hw/qdev.h"
28 typedef struct _VLYNQBus VLYNQBus;
29 typedef struct _VLYNQSlave VLYNQSlave;
30 typedef struct _VLYNQSlaveInfo VLYNQSlaveInfo;
32 #if 0
33 /* Slave devices. */
34 typedef struct {
35 int (*init)(VLYNQSlave *dev);
36 uint32_t (*transfer)(VLYNQSlave *dev, uint32_t val);
37 } VLYNQSlaveInfo;
39 struct VLYNQSlave {
40 DeviceState qdev;
41 VLYNQSlaveInfo *info;
44 #define VLYNQ_SLAVE_FROM_QDEV(dev) DO_UPCAST(VLYNQSlave, qdev, dev)
45 #define FROM_VLYNQ_SLAVE(type, dev) DO_UPCAST(type, vlynqdev, dev)
46 #endif
48 typedef struct {
49 DeviceState qdev;
50 //~ uint32_t isairq[2];
51 //~ int nirqs;
52 } VLYNQDevice;
54 typedef int (*vlynq_qdev_initfn)(VLYNQDevice *vlynq_dev);
55 typedef int (*VLYNQUnregisterFunc)(VLYNQDevice *vlynq_dev);
57 typedef struct {
58 vlynq_qdev_initfn init;
59 VLYNQUnregisterFunc exit;
60 } VLYNQDeviceInfo;
62 void vlynq_qdev_register(VLYNQDeviceInfo *info);
64 void vlynq_register_slave(VLYNQSlaveInfo *info);
66 DeviceState *vlynq_create_slave(VLYNQBus *bus, const char *name);
68 /* Master interface. */
69 VLYNQBus *vlynq_create_bus(DeviceState *parent, const char *name);
71 uint32_t vlynq_transfer(VLYNQBus *bus, uint32_t val);
73 /* max111x.c */
74 void max111x_set_input(DeviceState *dev, int line, uint8_t value);
76 #endif