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