parallel-isa.c 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * QEMU Parallel PORT (ISA bus helpers)
  3. *
  4. * These functions reside in a separate file since they also might be
  5. * required for linking when compiling QEMU without CONFIG_PARALLEL.
  6. *
  7. * Copyright (c) 2003 Fabrice Bellard
  8. *
  9. * SPDX-License-Identifier: MIT
  10. */
  11. #include "qemu/osdep.h"
  12. #include "sysemu/sysemu.h"
  13. #include "hw/isa/isa.h"
  14. #include "hw/qdev-properties.h"
  15. #include "hw/char/parallel.h"
  16. static void parallel_init(ISABus *bus, int index, Chardev *chr)
  17. {
  18. DeviceState *dev;
  19. ISADevice *isadev;
  20. isadev = isa_create(bus, "isa-parallel");
  21. dev = DEVICE(isadev);
  22. qdev_prop_set_uint32(dev, "index", index);
  23. qdev_prop_set_chr(dev, "chardev", chr);
  24. qdev_init_nofail(dev);
  25. }
  26. void parallel_hds_isa_init(ISABus *bus, int n)
  27. {
  28. int i;
  29. assert(n <= MAX_PARALLEL_PORTS);
  30. for (i = 0; i < n; i++) {
  31. if (parallel_hds[i]) {
  32. parallel_init(bus, i, parallel_hds[i]);
  33. }
  34. }
  35. }