5 #include "qemu-common.h"
6 #include "qapi/qmp/qerror.h"
10 static inline DeviceState
*
11 xilinx_intc_create(hwaddr base
, qemu_irq irq
, int kind_of_intr
)
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
);
23 /* OPB Timer/Counter. */
24 static inline DeviceState
*
25 xilinx_timer_create(hwaddr base
, qemu_irq irq
, int oto
, int freq
)
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
);
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
)
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
);
58 xilinx_axiethernet_init(DeviceState
*dev
, NICInfo
*nd
, StreamSlave
*peer
,
59 hwaddr base
, qemu_irq irq
, int txmem
, int rxmem
)
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",
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
);
75 xilinx_axidma_init(DeviceState
*dev
, StreamSlave
*peer
, hwaddr base
,
76 qemu_irq irq
, qemu_irq irq2
, int freqhz
)
80 qdev_prop_set_uint32(dev
, "freqhz", freqhz
);
81 object_property_set_link(OBJECT(dev
), OBJECT(peer
), "axistream-connected",
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
);