isa.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef HW_ISA_H
  2. #define HW_ISA_H
  3. /* ISA bus */
  4. #include "ioport.h"
  5. #include "memory.h"
  6. #include "qdev.h"
  7. #define ISA_NUM_IRQS 16
  8. typedef struct ISABus ISABus;
  9. typedef struct ISADevice ISADevice;
  10. typedef struct ISADeviceInfo ISADeviceInfo;
  11. struct ISADevice {
  12. DeviceState qdev;
  13. uint32_t isairq[2];
  14. int nirqs;
  15. int ioport_id;
  16. };
  17. typedef int (*isa_qdev_initfn)(ISADevice *dev);
  18. struct ISADeviceInfo {
  19. DeviceInfo qdev;
  20. isa_qdev_initfn init;
  21. };
  22. ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
  23. void isa_bus_irqs(qemu_irq *irqs);
  24. qemu_irq isa_get_irq(int isairq);
  25. void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
  26. void isa_qdev_register(ISADeviceInfo *info);
  27. MemoryRegion *isa_address_space(ISADevice *dev);
  28. ISADevice *isa_create(const char *name);
  29. ISADevice *isa_try_create(const char *name);
  30. ISADevice *isa_create_simple(const char *name);
  31. /**
  32. * isa_register_ioport: Install an I/O port region on the ISA bus.
  33. *
  34. * Register an I/O port region via memory_region_add_subregion
  35. * inside the ISA I/O address space.
  36. *
  37. * @dev: the ISADevice against which these are registered; may be NULL.
  38. * @io: the #MemoryRegion being registered.
  39. * @start: the base I/O port.
  40. */
  41. void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start);
  42. /**
  43. * isa_register_portio_list: Initialize a set of ISA io ports
  44. *
  45. * Several ISA devices have many dis-joint I/O ports. Worse, these I/O
  46. * ports can be interleaved with I/O ports from other devices. This
  47. * function makes it easy to create multiple MemoryRegions for a single
  48. * device and use the legacy portio routines.
  49. *
  50. * @dev: the ISADevice against which these are registered; may be NULL.
  51. * @start: the base I/O port against which the portio->offset is applied.
  52. * @portio: the ports, sorted by offset.
  53. * @opaque: passed into the old_portio callbacks.
  54. * @name: passed into memory_region_init_io.
  55. */
  56. void isa_register_portio_list(ISADevice *dev, uint16_t start,
  57. const MemoryRegionPortio *portio,
  58. void *opaque, const char *name);
  59. extern target_phys_addr_t isa_mem_base;
  60. void isa_mmio_setup(MemoryRegion *mr, target_phys_addr_t size);
  61. void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size);
  62. /* dma.c */
  63. int DMA_get_channel_mode (int nchan);
  64. int DMA_read_memory (int nchan, void *buf, int pos, int size);
  65. int DMA_write_memory (int nchan, void *buf, int pos, int size);
  66. void DMA_hold_DREQ (int nchan);
  67. void DMA_release_DREQ (int nchan);
  68. void DMA_schedule(int nchan);
  69. void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit);
  70. void DMA_register_channel (int nchan,
  71. DMA_transfer_handler transfer_handler,
  72. void *opaque);
  73. #endif