]>
Commit | Line | Data |
---|---|---|
79383c9c BS |
1 | #ifndef HW_ISA_H |
2 | #define HW_ISA_H | |
f915a115 | 3 | |
87ecb68b PB |
4 | /* ISA bus */ |
5 | ||
022c62cb PB |
6 | #include "exec/ioport.h" |
7 | #include "exec/memory.h" | |
83c9f4ca | 8 | #include "hw/qdev.h" |
f915a115 | 9 | |
b881fbe9 JK |
10 | #define ISA_NUM_IRQS 16 |
11 | ||
8f04ee08 AL |
12 | #define TYPE_ISA_DEVICE "isa-device" |
13 | #define ISA_DEVICE(obj) \ | |
14 | OBJECT_CHECK(ISADevice, (obj), TYPE_ISA_DEVICE) | |
15 | #define ISA_DEVICE_CLASS(klass) \ | |
16 | OBJECT_CLASS_CHECK(ISADeviceClass, (klass), TYPE_ISA_DEVICE) | |
17 | #define ISA_DEVICE_GET_CLASS(obj) \ | |
18 | OBJECT_GET_CLASS(ISADeviceClass, (obj), TYPE_ISA_DEVICE) | |
19 | ||
0d936928 AL |
20 | #define TYPE_ISA_BUS "ISA" |
21 | #define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS) | |
22 | ||
8f04ee08 AL |
23 | typedef struct ISADeviceClass { |
24 | DeviceClass parent_class; | |
8f04ee08 | 25 | } ISADeviceClass; |
f915a115 | 26 | |
d1a1be18 | 27 | struct ISABus { |
2ae0e48d AF |
28 | /*< private >*/ |
29 | BusState parent_obj; | |
30 | /*< public >*/ | |
31 | ||
d1a1be18 HP |
32 | MemoryRegion *address_space_io; |
33 | qemu_irq *irqs; | |
34 | }; | |
35 | ||
f915a115 | 36 | struct ISADevice { |
4a17cc4f AF |
37 | /*< private >*/ |
38 | DeviceState parent_obj; | |
39 | /*< public >*/ | |
40 | ||
2091ba23 | 41 | uint32_t isairq[2]; |
78e20593 | 42 | int nirqs; |
ebf47c24 | 43 | int ioport_id; |
f915a115 GH |
44 | }; |
45 | ||
c2d0d012 | 46 | ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io); |
48a18b3c HP |
47 | void isa_bus_irqs(ISABus *bus, qemu_irq *irqs); |
48 | qemu_irq isa_get_irq(ISADevice *dev, int isairq); | |
2e15e23b | 49 | void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); |
c839adec | 50 | MemoryRegion *isa_address_space(ISADevice *dev); |
ac100273 | 51 | MemoryRegion *isa_address_space_io(ISADevice *dev); |
48a18b3c HP |
52 | ISADevice *isa_create(ISABus *bus, const char *name); |
53 | ISADevice *isa_try_create(ISABus *bus, const char *name); | |
54 | ISADevice *isa_create_simple(ISABus *bus, const char *name); | |
87ecb68b | 55 | |
14e7a645 AJ |
56 | ISADevice *isa_vga_init(ISABus *bus); |
57 | ||
d7500734 AK |
58 | /** |
59 | * isa_register_ioport: Install an I/O port region on the ISA bus. | |
60 | * | |
61 | * Register an I/O port region via memory_region_add_subregion | |
62 | * inside the ISA I/O address space. | |
63 | * | |
64 | * @dev: the ISADevice against which these are registered; may be NULL. | |
65 | * @io: the #MemoryRegion being registered. | |
66 | * @start: the base I/O port. | |
67 | */ | |
68 | void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start); | |
69 | ||
70 | /** | |
71 | * isa_register_portio_list: Initialize a set of ISA io ports | |
72 | * | |
73 | * Several ISA devices have many dis-joint I/O ports. Worse, these I/O | |
74 | * ports can be interleaved with I/O ports from other devices. This | |
75 | * function makes it easy to create multiple MemoryRegions for a single | |
76 | * device and use the legacy portio routines. | |
77 | * | |
78 | * @dev: the ISADevice against which these are registered; may be NULL. | |
79 | * @start: the base I/O port against which the portio->offset is applied. | |
80 | * @portio: the ports, sorted by offset. | |
520902a6 | 81 | * @opaque: passed into the portio callbacks. |
d7500734 AK |
82 | * @name: passed into memory_region_init_io. |
83 | */ | |
84 | void isa_register_portio_list(ISADevice *dev, uint16_t start, | |
85 | const MemoryRegionPortio *portio, | |
86 | void *opaque, const char *name); | |
87 | ||
a527b545 HP |
88 | static inline ISABus *isa_bus_from_device(ISADevice *d) |
89 | { | |
3e7b8f4e | 90 | return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); |
a527b545 HP |
91 | } |
92 | ||
a8170e5e | 93 | extern hwaddr isa_mem_base; |
87ecb68b | 94 | |
87ecb68b PB |
95 | /* dma.c */ |
96 | int DMA_get_channel_mode (int nchan); | |
97 | int DMA_read_memory (int nchan, void *buf, int pos, int size); | |
98 | int DMA_write_memory (int nchan, void *buf, int pos, int size); | |
99 | void DMA_hold_DREQ (int nchan); | |
100 | void DMA_release_DREQ (int nchan); | |
101 | void DMA_schedule(int nchan); | |
4556bd8b | 102 | void DMA_init(int high_page_enable, qemu_irq *cpu_request_exit); |
87ecb68b PB |
103 | void DMA_register_channel (int nchan, |
104 | DMA_transfer_handler transfer_handler, | |
105 | void *opaque); | |
79383c9c | 106 | #endif |