virtio-serial: Fix endianness bug in the config space
[qemu/ar7.git] / hw / xilinx.h
blob090e6f7c3df23cd27599e52fb0a3ae892f7c2802
2 /* OPB Interrupt Controller. */
3 qemu_irq *microblaze_pic_init_cpu(CPUState *env);
5 static inline DeviceState *
6 xilinx_intc_create(target_phys_addr_t base, qemu_irq irq, int kind_of_intr)
8 DeviceState *dev;
10 dev = qdev_create(NULL, "xilinx,intc");
11 qdev_prop_set_uint32(dev, "kind-of-intr", kind_of_intr);
12 qdev_init_nofail(dev);
13 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
14 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
15 return dev;
18 /* OPB Timer/Counter. */
19 static inline DeviceState *
20 xilinx_timer_create(target_phys_addr_t base, qemu_irq irq, int nr, int freq)
22 DeviceState *dev;
24 dev = qdev_create(NULL, "xilinx,timer");
25 qdev_prop_set_uint32(dev, "nr-timers", nr);
26 qdev_prop_set_uint32(dev, "frequency", freq);
27 qdev_init_nofail(dev);
28 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
29 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
30 return dev;
33 /* XPS Ethernet Lite MAC. */
34 static inline DeviceState *
35 xilinx_ethlite_create(NICInfo *nd, target_phys_addr_t base, qemu_irq irq,
36 int txpingpong, int rxpingpong)
38 DeviceState *dev;
40 qemu_check_nic_model(nd, "xilinx-ethlite");
42 dev = qdev_create(NULL, "xilinx,ethlite");
43 qdev_set_nic_properties(dev, nd);
44 qdev_prop_set_uint32(dev, "txpingpong", txpingpong);
45 qdev_prop_set_uint32(dev, "rxpingpong", rxpingpong);
46 qdev_init_nofail(dev);
47 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
48 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
49 return dev;
52 static inline DeviceState *
53 xilinx_axiethernet_create(void *dmach,
54 NICInfo *nd, target_phys_addr_t base, qemu_irq irq,
55 int txmem, int rxmem)
57 DeviceState *dev;
58 qemu_check_nic_model(nd, "xilinx-axienet");
60 dev = qdev_create(NULL, "xilinx,axienet");
61 qdev_set_nic_properties(dev, nd);
62 qdev_prop_set_uint32(dev, "c_rxmem", rxmem);
63 qdev_prop_set_uint32(dev, "c_txmem", txmem);
64 qdev_prop_set_ptr(dev, "dmach", dmach);
65 qdev_init_nofail(dev);
66 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
67 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
69 return dev;
72 static inline DeviceState *
73 xilinx_axiethernetdma_create(void *dmach,
74 target_phys_addr_t base, qemu_irq irq,
75 qemu_irq irq2, int freqhz)
77 DeviceState *dev = NULL;
79 dev = qdev_create(NULL, "xilinx,axidma");
80 qdev_prop_set_uint32(dev, "freqhz", freqhz);
81 qdev_prop_set_ptr(dev, "dmach", dmach);
82 qdev_init_nofail(dev);
84 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
85 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq2);
86 sysbus_connect_irq(sysbus_from_qdev(dev), 1, irq);
88 return dev;