pl011.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms and conditions of the GNU General Public License,
  4. * version 2 or later, as published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  8. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  9. * more details.
  10. *
  11. * You should have received a copy of the GNU General Public License along with
  12. * this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef HW_PL011_H
  15. #define HW_PL011_H
  16. static inline DeviceState *pl011_create(hwaddr addr,
  17. qemu_irq irq,
  18. CharDriverState *chr)
  19. {
  20. DeviceState *dev;
  21. SysBusDevice *s;
  22. dev = qdev_create(NULL, "pl011");
  23. s = SYS_BUS_DEVICE(dev);
  24. qdev_prop_set_chr(dev, "chardev", chr);
  25. qdev_init_nofail(dev);
  26. sysbus_mmio_map(s, 0, addr);
  27. sysbus_connect_irq(s, 0, irq);
  28. return dev;
  29. }
  30. static inline DeviceState *pl011_luminary_create(hwaddr addr,
  31. qemu_irq irq,
  32. CharDriverState *chr)
  33. {
  34. DeviceState *dev;
  35. SysBusDevice *s;
  36. dev = qdev_create(NULL, "pl011_luminary");
  37. s = SYS_BUS_DEVICE(dev);
  38. qdev_prop_set_chr(dev, "chardev", chr);
  39. qdev_init_nofail(dev);
  40. sysbus_mmio_map(s, 0, addr);
  41. sysbus_connect_irq(s, 0, irq);
  42. return dev;
  43. }
  44. #endif