diff options
Diffstat (limited to 'hw/milkymist-hw.h')
-rw-r--r-- | hw/milkymist-hw.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/milkymist-hw.h b/hw/milkymist-hw.h index 15acdbc..20de68e 100644 --- a/hw/milkymist-hw.h +++ b/hw/milkymist-hw.h @@ -1,6 +1,9 @@ #ifndef QEMU_HW_MILKYMIST_H #define QEMU_HW_MILKYMIST_H +#include "qdev.h" +#include "qdev-addr.h" + static inline DeviceState *milkymist_uart_create(target_phys_addr_t base, qemu_irq rx_irq, qemu_irq tx_irq) { @@ -183,6 +186,23 @@ static inline DeviceState *milkymist_minimac_create(target_phys_addr_t base, return dev; } +static inline DeviceState *milkymist_minimac2_create(target_phys_addr_t base, + target_phys_addr_t buffers_base, qemu_irq rx_irq, qemu_irq tx_irq) +{ + DeviceState *dev; + + qemu_check_nic_model(&nd_table[0], "minimac2"); + dev = qdev_create(NULL, "milkymist-minimac2"); + qdev_prop_set_taddr(dev, "buffers_base", buffers_base); + qdev_set_nic_properties(dev, &nd_table[0]); + qdev_init_nofail(dev); + sysbus_mmio_map(sysbus_from_qdev(dev), 0, base); + sysbus_connect_irq(sysbus_from_qdev(dev), 0, rx_irq); + sysbus_connect_irq(sysbus_from_qdev(dev), 1, tx_irq); + + return dev; +} + static inline DeviceState *milkymist_softusb_create(target_phys_addr_t base, qemu_irq irq, uint32_t pmem_base, uint32_t pmem_size, uint32_t dmem_base, uint32_t dmem_size) |