migration: eliminate s->migration_file
[qemu.git] / hw / xilinx.h
blob6c1ee21c5470289acad9972ebc9179147895b0cb
1 #ifndef HW_XILINX_H
2 #define HW_XILINX_H 1
5 #include "qemu-common.h"
6 #include "qapi/qmp/qerror.h"
7 #include "hw/stream.h"
8 #include "net/net.h"
10 static inline DeviceState *
11 xilinx_intc_create(hwaddr base, qemu_irq irq, int kind_of_intr)
13 DeviceState *dev;
15 dev = qdev_create(NULL, "xlnx.xps-intc");
16 qdev_prop_set_uint32(dev, "kind-of-intr", kind_of_intr);
17 qdev_init_nofail(dev);
18 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
19 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
20 return dev;
23 /* OPB Timer/Counter. */
24 static inline DeviceState *
25 xilinx_timer_create(hwaddr base, qemu_irq irq, int oto, int freq)
27 DeviceState *dev;
29 dev = qdev_create(NULL, "xlnx.xps-timer");
30 qdev_prop_set_uint32(dev, "one-timer-only", oto);
31 qdev_prop_set_uint32(dev, "clock-frequency", freq);
32 qdev_init_nofail(dev);
33 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
34 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
35 return dev;
38 /* XPS Ethernet Lite MAC. */
39 static inline DeviceState *
40 xilinx_ethlite_create(NICInfo *nd, hwaddr base, qemu_irq irq,
41 int txpingpong, int rxpingpong)
43 DeviceState *dev;
45 qemu_check_nic_model(nd, "xlnx.xps-ethernetlite");
47 dev = qdev_create(NULL, "xlnx.xps-ethernetlite");
48 qdev_set_nic_properties(dev, nd);
49 qdev_prop_set_uint32(dev, "tx-ping-pong", txpingpong);
50 qdev_prop_set_uint32(dev, "rx-ping-pong", rxpingpong);
51 qdev_init_nofail(dev);
52 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
53 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
54 return dev;
57 static inline void
58 xilinx_axiethernet_init(DeviceState *dev, NICInfo *nd, StreamSlave *peer,
59 hwaddr base, qemu_irq irq, int txmem, int rxmem)
61 Error *errp = NULL;
63 qdev_set_nic_properties(dev, nd);
64 qdev_prop_set_uint32(dev, "rxmem", rxmem);
65 qdev_prop_set_uint32(dev, "txmem", txmem);
66 object_property_set_link(OBJECT(dev), OBJECT(peer), "axistream-connected",
67 &errp);
68 assert_no_error(errp);
69 qdev_init_nofail(dev);
70 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
71 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
74 static inline void
75 xilinx_axidma_init(DeviceState *dev, StreamSlave *peer, hwaddr base,
76 qemu_irq irq, qemu_irq irq2, int freqhz)
78 Error *errp = NULL;
80 qdev_prop_set_uint32(dev, "freqhz", freqhz);
81 object_property_set_link(OBJECT(dev), OBJECT(peer), "axistream-connected",
82 &errp);
83 assert_no_error(errp);
84 qdev_init_nofail(dev);
86 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
87 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
88 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, irq2);
91 #endif