1 |
2 |
alfik |
/////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// $Id: plugin.h 11556 2012-12-02 19:59:23Z vruppert $
|
3 |
|
|
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// Copyright (C) 2002-2012 The Bochs Project
|
6 |
|
|
//
|
7 |
|
|
// This library is free software; you can redistribute it and/or
|
8 |
|
|
// modify it under the terms of the GNU Lesser General Public
|
9 |
|
|
// License as published by the Free Software Foundation; either
|
10 |
|
|
// version 2 of the License, or (at your option) any later version.
|
11 |
|
|
//
|
12 |
|
|
// This library is distributed in the hope that it will be useful,
|
13 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
|
|
// Lesser General Public License for more details.
|
16 |
|
|
//
|
17 |
|
|
// You should have received a copy of the GNU Lesser General Public
|
18 |
|
|
// License along with this library; if not, write to the Free Software
|
19 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20 |
|
|
//
|
21 |
|
|
/////////////////////////////////////////////////////////////////////////
|
22 |
|
|
//
|
23 |
|
|
// This file provides macros and types needed for plugins. It is based on
|
24 |
|
|
// the plugin.h file from plex86, but with significant changes to make
|
25 |
|
|
// it work in Bochs.
|
26 |
|
|
// Plex86 is Copyright (C) 1999-2000 The plex86 developers team
|
27 |
|
|
//
|
28 |
|
|
/////////////////////////////////////////////////////////////////////////
|
29 |
|
|
|
30 |
|
|
#ifndef __PLUGIN_H
|
31 |
|
|
#define __PLUGIN_H
|
32 |
|
|
|
33 |
|
|
#include "extplugin.h"
|
34 |
|
|
|
35 |
|
|
class bx_devices_c;
|
36 |
|
|
BOCHSAPI extern logfunctions *pluginlog;
|
37 |
|
|
|
38 |
|
|
#ifdef __cplusplus
|
39 |
|
|
extern "C" {
|
40 |
|
|
#endif
|
41 |
|
|
|
42 |
|
|
#define BX_PLUGIN_UNMAPPED "unmapped"
|
43 |
|
|
#define BX_PLUGIN_BIOSDEV "biosdev"
|
44 |
|
|
#define BX_PLUGIN_CMOS "cmos"
|
45 |
|
|
#define BX_PLUGIN_VGA "vga"
|
46 |
|
|
#define BX_PLUGIN_CIRRUS "svga_cirrus"
|
47 |
|
|
#define BX_PLUGIN_FLOPPY "floppy"
|
48 |
|
|
#define BX_PLUGIN_PARALLEL "parallel"
|
49 |
|
|
#define BX_PLUGIN_SERIAL "serial"
|
50 |
|
|
#define BX_PLUGIN_KEYBOARD "keyboard"
|
51 |
|
|
#define BX_PLUGIN_BUSMOUSE "busmouse"
|
52 |
|
|
#define BX_PLUGIN_HARDDRV "harddrv"
|
53 |
|
|
#define BX_PLUGIN_HDIMAGE "hdimage"
|
54 |
|
|
#define BX_PLUGIN_DMA "dma"
|
55 |
|
|
#define BX_PLUGIN_PIC "pic"
|
56 |
|
|
#define BX_PLUGIN_PIT "pit"
|
57 |
|
|
#define BX_PLUGIN_PCI "pci"
|
58 |
|
|
#define BX_PLUGIN_PCI2ISA "pci2isa"
|
59 |
|
|
#define BX_PLUGIN_PCI_IDE "pci_ide"
|
60 |
|
|
#define BX_PLUGIN_SOUNDMOD "soundmod"
|
61 |
|
|
#define BX_PLUGIN_SB16 "sb16"
|
62 |
|
|
#define BX_PLUGIN_ES1370 "es1370"
|
63 |
|
|
#define BX_PLUGIN_NETMOD "netmod"
|
64 |
|
|
#define BX_PLUGIN_NE2K "ne2k"
|
65 |
|
|
#define BX_PLUGIN_EXTFPUIRQ "extfpuirq"
|
66 |
|
|
#define BX_PLUGIN_PCIDEV "pcidev"
|
67 |
|
|
#define BX_PLUGIN_USB_COMMON "usb_common"
|
68 |
|
|
#define BX_PLUGIN_USB_UHCI "usb_uhci"
|
69 |
|
|
#define BX_PLUGIN_USB_OHCI "usb_ohci"
|
70 |
|
|
#define BX_PLUGIN_USB_XHCI "usb_xhci"
|
71 |
|
|
#define BX_PLUGIN_PCIPNIC "pcipnic"
|
72 |
|
|
#define BX_PLUGIN_E1000 "e1000"
|
73 |
|
|
#define BX_PLUGIN_GAMEPORT "gameport"
|
74 |
|
|
#define BX_PLUGIN_SPEAKER "speaker"
|
75 |
|
|
#define BX_PLUGIN_ACPI "acpi"
|
76 |
|
|
#define BX_PLUGIN_IODEBUG "iodebug"
|
77 |
|
|
#define BX_PLUGIN_IOAPIC "ioapic"
|
78 |
|
|
#define BX_PLUGIN_VOODOO "voodoo"
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
#define BX_REGISTER_DEVICE_DEVMODEL(a,b,c,d) pluginRegisterDeviceDevmodel(a,b,c,d)
|
82 |
|
|
#define BX_UNREGISTER_DEVICE_DEVMODEL(a) pluginUnregisterDeviceDevmodel(a)
|
83 |
|
|
#define PLUG_device_present(a) pluginDevicePresent(a)
|
84 |
|
|
|
85 |
|
|
#if BX_PLUGINS
|
86 |
|
|
|
87 |
|
|
#define PLUG_load_plugin(name,type) {bx_load_plugin(#name,type);}
|
88 |
|
|
#define PLUG_load_opt_plugin(name) bx_load_plugin(name,PLUGTYPE_OPTIONAL)
|
89 |
|
|
#define PLUG_load_user_plugin(name) {bx_load_plugin(name,PLUGTYPE_USER);}
|
90 |
|
|
#define PLUG_unload_plugin(name) {bx_unload_plugin(#name,1);}
|
91 |
|
|
#define PLUG_unload_opt_plugin(name) bx_unload_plugin(name,1)
|
92 |
|
|
#define PLUG_unload_user_plugin(name) {bx_unload_plugin(name,1);}
|
93 |
|
|
|
94 |
|
|
#define DEV_register_ioread_handler(b,c,d,e,f) pluginRegisterIOReadHandler(b,c,d,e,f)
|
95 |
|
|
#define DEV_register_iowrite_handler(b,c,d,e,f) pluginRegisterIOWriteHandler(b,c,d,e,f)
|
96 |
|
|
#define DEV_unregister_ioread_handler(b,c,d,e) pluginUnregisterIOReadHandler(b,c,d,e)
|
97 |
|
|
#define DEV_unregister_iowrite_handler(b,c,d,e) pluginUnregisterIOWriteHandler(b,c,d,e)
|
98 |
|
|
#define DEV_register_ioread_handler_range(b,c,d,e,f,g) pluginRegisterIOReadHandlerRange(b,c,d,e,f,g)
|
99 |
|
|
#define DEV_register_iowrite_handler_range(b,c,d,e,f,g) pluginRegisterIOWriteHandlerRange(b,c,d,e,f,g)
|
100 |
|
|
#define DEV_unregister_ioread_handler_range(b,c,d,e,f) pluginUnregisterIOReadHandlerRange(b,c,d,e,f)
|
101 |
|
|
#define DEV_unregister_iowrite_handler_range(b,c,d,e,f) pluginUnregisterIOWriteHandlerRange(b,c,d,e,f)
|
102 |
|
|
#define DEV_register_default_ioread_handler(b,c,d,e) pluginRegisterDefaultIOReadHandler(b,c,d,e)
|
103 |
|
|
#define DEV_register_default_iowrite_handler(b,c,d,e) pluginRegisterDefaultIOWriteHandler(b,c,d,e)
|
104 |
|
|
|
105 |
|
|
#define DEV_register_irq(b,c) pluginRegisterIRQ(b,c)
|
106 |
|
|
#define DEV_unregister_irq(b,c) pluginUnregisterIRQ(b,c)
|
107 |
|
|
|
108 |
|
|
#else
|
109 |
|
|
|
110 |
|
|
// When plugins are off, PLUG_load_plugin will call the plugin_init function
|
111 |
|
|
// directly.
|
112 |
|
|
#define PLUG_load_plugin(name,type) {lib##name##_LTX_plugin_init(NULL,type,0,NULL);}
|
113 |
|
|
#define PLUG_load_opt_plugin(name) bx_load_opt_plugin(name)
|
114 |
|
|
#define PLUG_unload_plugin(name) {lib##name##_LTX_plugin_fini();}
|
115 |
|
|
#define PLUG_unload_opt_plugin(name) bx_unload_opt_plugin(name,1);
|
116 |
|
|
#define DEV_register_ioread_handler(b,c,d,e,f) bx_devices.register_io_read_handler(b,c,d,e,f)
|
117 |
|
|
#define DEV_register_iowrite_handler(b,c,d,e,f) bx_devices.register_io_write_handler(b,c,d,e,f)
|
118 |
|
|
#define DEV_unregister_ioread_handler(b,c,d,e) bx_devices.unregister_io_read_handler(b,c,d,e)
|
119 |
|
|
#define DEV_unregister_iowrite_handler(b,c,d,e) bx_devices.unregister_io_write_handler(b,c,d,e)
|
120 |
|
|
#define DEV_register_ioread_handler_range(b,c,d,e,f,g) bx_devices.register_io_read_handler_range(b,c,d,e,f,g)
|
121 |
|
|
#define DEV_register_iowrite_handler_range(b,c,d,e,f,g) bx_devices.register_io_write_handler_range(b,c,d,e,f,g)
|
122 |
|
|
#define DEV_unregister_ioread_handler_range(b,c,d,e,f) bx_devices.unregister_io_read_handler_range(b,c,d,e,f)
|
123 |
|
|
#define DEV_unregister_iowrite_handler_range(b,c,d,e,f) bx_devices.unregister_io_write_handler_range(b,c,d,e,f)
|
124 |
|
|
#define DEV_register_default_ioread_handler(b,c,d,e) bx_devices.register_default_io_read_handler(b,c,d,e)
|
125 |
|
|
#define DEV_register_default_iowrite_handler(b,c,d,e) bx_devices.register_default_io_write_handler(b,c,d,e)
|
126 |
|
|
#define DEV_register_irq(b,c) bx_devices.register_irq(b,c)
|
127 |
|
|
#define DEV_unregister_irq(b,c) bx_devices.unregister_irq(b,c)
|
128 |
|
|
|
129 |
|
|
#endif // #if BX_PLUGINS
|
130 |
|
|
|
131 |
|
|
///////// Common device macros
|
132 |
|
|
#define DEV_init_devices() {bx_devices.init(BX_MEM(0)); }
|
133 |
|
|
#define DEV_reset_devices(type) {bx_devices.reset(type); }
|
134 |
|
|
#define DEV_register_state() {bx_devices.register_state(); }
|
135 |
|
|
#define DEV_after_restore_state() {bx_devices.after_restore_state(); }
|
136 |
|
|
|
137 |
|
|
#define DEV_register_timer(a,b,c,d,e,f) bx_pc_system.register_timer(a,b,c,d,e,f)
|
138 |
|
|
#define DEV_mouse_enabled_changed(en) (bx_devices.mouse_enabled_changed(en))
|
139 |
|
|
#define DEV_mouse_motion(dx, dy, dz, bs, absxy) (bx_devices.mouse_motion(dx, dy, dz, bs, absxy))
|
140 |
|
|
|
141 |
|
|
///////// Removable devices macros
|
142 |
|
|
#define DEV_optional_key_enq(a) (bx_devices.optional_key_enq(a))
|
143 |
|
|
#define DEV_register_removable_keyboard(a,b) (bx_devices.register_removable_keyboard(a,b))
|
144 |
|
|
#define DEV_unregister_removable_keyboard(a) (bx_devices.unregister_removable_keyboard(a))
|
145 |
|
|
#define DEV_register_default_mouse(a,b,c) (bx_devices.register_default_mouse(a,b,c))
|
146 |
|
|
#define DEV_register_removable_mouse(a,b,c) (bx_devices.register_removable_mouse(a,b,c))
|
147 |
|
|
#define DEV_unregister_removable_mouse(a) (bx_devices.unregister_removable_mouse(a))
|
148 |
|
|
|
149 |
|
|
///////// I/O APIC macros
|
150 |
|
|
#define DEV_ioapic_present() (bx_devices.pluginIOAPIC != &bx_devices.stubIOAPIC)
|
151 |
|
|
#define DEV_ioapic_set_enabled(a,b) (bx_devices.pluginIOAPIC->set_enabled(a,b))
|
152 |
|
|
#define DEV_ioapic_receive_eoi(a) (bx_devices.pluginIOAPIC->receive_eoi(a))
|
153 |
|
|
#define DEV_ioapic_set_irq_level(a,b) (bx_devices.pluginIOAPIC->set_irq_level(a,b))
|
154 |
|
|
|
155 |
|
|
///////// CMOS macros
|
156 |
|
|
#define DEV_cmos_get_reg(a) (bx_devices.pluginCmosDevice->get_reg(a))
|
157 |
|
|
#define DEV_cmos_set_reg(a,b) (bx_devices.pluginCmosDevice->set_reg(a,b))
|
158 |
|
|
#define DEV_cmos_checksum() (bx_devices.pluginCmosDevice->checksum_cmos())
|
159 |
|
|
#define DEV_cmos_get_timeval() (bx_devices.pluginCmosDevice->get_timeval())
|
160 |
|
|
#define DEV_cmos_present() (bx_devices.pluginCmosDevice != &bx_devices.stubCmos)
|
161 |
|
|
|
162 |
|
|
///////// keyboard macros
|
163 |
|
|
#define DEV_kbd_gen_scancode(key) \
|
164 |
|
|
(bx_devices.pluginKeyboard->gen_scancode(key))
|
165 |
|
|
#define DEV_kbd_paste_bytes(bytes, count) \
|
166 |
|
|
(bx_devices.pluginKeyboard->paste_bytes(bytes,count))
|
167 |
|
|
|
168 |
|
|
///////// hard drive macros
|
169 |
|
|
#define DEV_hd_read_handler(a, b, c) \
|
170 |
|
|
(bx_devices.pluginHardDrive->virt_read_handler(b, c))
|
171 |
|
|
#define DEV_hd_write_handler(a, b, c, d) \
|
172 |
|
|
(bx_devices.pluginHardDrive->virt_write_handler(b, c, d))
|
173 |
|
|
#define DEV_hd_get_first_cd_handle() \
|
174 |
|
|
(bx_devices.pluginHardDrive->get_first_cd_handle())
|
175 |
|
|
#define DEV_hd_get_cd_media_status(handle) \
|
176 |
|
|
(bx_devices.pluginHardDrive->get_cd_media_status(handle))
|
177 |
|
|
#define DEV_hd_set_cd_media_status(handle, status) \
|
178 |
|
|
(bx_devices.pluginHardDrive->set_cd_media_status(handle, status))
|
179 |
|
|
#define DEV_hd_present() (bx_devices.pluginHardDrive != &bx_devices.stubHardDrive)
|
180 |
|
|
#define DEV_hd_bmdma_read_sector(a,b,c) bx_devices.pluginHardDrive->bmdma_read_sector(a,b,c)
|
181 |
|
|
#define DEV_hd_bmdma_write_sector(a,b) bx_devices.pluginHardDrive->bmdma_write_sector(a,b)
|
182 |
|
|
#define DEV_hd_bmdma_complete(a) bx_devices.pluginHardDrive->bmdma_complete(a)
|
183 |
|
|
#define DEV_hdimage_init_image(a,b,c) bx_devices.pluginHDImageCtl->init_image(a,b,c)
|
184 |
|
|
#define DEV_hdimage_init_cdrom(a) bx_devices.pluginHDImageCtl->init_cdrom(a)
|
185 |
|
|
|
186 |
|
|
#define DEV_bulk_io_quantum_requested() (bx_devices.bulkIOQuantumsRequested)
|
187 |
|
|
#define DEV_bulk_io_quantum_transferred() (bx_devices.bulkIOQuantumsTransferred)
|
188 |
|
|
#define DEV_bulk_io_host_addr() (bx_devices.bulkIOHostAddr)
|
189 |
|
|
|
190 |
|
|
///////// FLOPPY macro
|
191 |
|
|
#define DEV_floppy_set_media_status(drive, status) bx_devices.pluginFloppyDevice->set_media_status(drive, status)
|
192 |
|
|
|
193 |
|
|
///////// DMA macros
|
194 |
|
|
#define DEV_dma_register_8bit_channel(channel, dmaRead, dmaWrite, name) \
|
195 |
|
|
(bx_devices.pluginDmaDevice->registerDMA8Channel(channel, dmaRead, dmaWrite, name))
|
196 |
|
|
#define DEV_dma_register_16bit_channel(channel, dmaRead, dmaWrite, name) \
|
197 |
|
|
(bx_devices.pluginDmaDevice->registerDMA16Channel(channel, dmaRead, dmaWrite, name))
|
198 |
|
|
#define DEV_dma_unregister_channel(channel) \
|
199 |
|
|
(bx_devices.pluginDmaDevice->unregisterDMAChannel(channel))
|
200 |
|
|
#define DEV_dma_set_drq(channel, val) \
|
201 |
|
|
(bx_devices.pluginDmaDevice->set_DRQ(channel, val))
|
202 |
|
|
#define DEV_dma_get_tc() \
|
203 |
|
|
(bx_devices.pluginDmaDevice->get_TC())
|
204 |
|
|
#define DEV_dma_raise_hlda() \
|
205 |
|
|
(bx_devices.pluginDmaDevice->raise_HLDA())
|
206 |
|
|
|
207 |
|
|
///////// PIC macros
|
208 |
|
|
#define DEV_pic_lower_irq(b) (bx_devices.pluginPicDevice->lower_irq(b))
|
209 |
|
|
#define DEV_pic_raise_irq(b) (bx_devices.pluginPicDevice->raise_irq(b))
|
210 |
|
|
#define DEV_pic_set_mode(a,b) (bx_devices.pluginPicDevice->set_mode(a,b))
|
211 |
|
|
#define DEV_pic_iac() (bx_devices.pluginPicDevice->IAC())
|
212 |
|
|
|
213 |
|
|
///////// VGA macros
|
214 |
|
|
#define DEV_vga_mem_read(addr) (bx_devices.pluginVgaDevice->mem_read(addr))
|
215 |
|
|
#define DEV_vga_mem_write(addr, val) (bx_devices.pluginVgaDevice->mem_write(addr, val))
|
216 |
|
|
#define DEV_vga_redraw_area(left, top, right, bottom) \
|
217 |
|
|
(bx_devices.pluginVgaDevice->redraw_area(left, top, right, bottom))
|
218 |
|
|
#define DEV_vga_get_text_snapshot(rawsnap, height, width) \
|
219 |
|
|
(bx_devices.pluginVgaDevice->get_text_snapshot(rawsnap, height, width))
|
220 |
|
|
#define DEV_vga_refresh(a) \
|
221 |
|
|
(bx_devices.pluginVgaDevice->refresh_display(bx_devices.pluginVgaDevice,a))
|
222 |
|
|
#define DEV_vga_set_override(a,b) (bx_devices.pluginVgaDevice->set_override(a,b))
|
223 |
|
|
|
224 |
|
|
///////// PCI macros
|
225 |
|
|
#define DEV_register_pci_handlers(a,b,c,d) \
|
226 |
|
|
(bx_devices.register_pci_handlers(a,b,c,d))
|
227 |
|
|
#define DEV_pci_get_confAddr() bx_devices.pci_get_confAddr()
|
228 |
|
|
#define DEV_pci_set_irq(a,b,c) bx_devices.pluginPci2IsaBridge->pci_set_irq(a,b,c)
|
229 |
|
|
#define DEV_pci_set_base_mem(a,b,c,d,e,f) \
|
230 |
|
|
(bx_devices.pci_set_base_mem(a,b,c,d,e,f))
|
231 |
|
|
#define DEV_pci_set_base_io(a,b,c,d,e,f,g,h) \
|
232 |
|
|
(bx_devices.pci_set_base_io(a,b,c,d,e,f,g,h))
|
233 |
|
|
#define DEV_ide_bmdma_present() bx_devices.pluginPciIdeController->bmdma_present()
|
234 |
|
|
#define DEV_ide_bmdma_set_irq(a) bx_devices.pluginPciIdeController->bmdma_set_irq(a)
|
235 |
|
|
#define DEV_acpi_generate_smi(a) bx_devices.pluginACPIController->generate_smi(a)
|
236 |
|
|
|
237 |
|
|
///////// Speaker macros
|
238 |
|
|
#define DEV_speaker_beep_on(frequency) bx_devices.pluginSpeaker->beep_on(frequency)
|
239 |
|
|
#define DEV_speaker_beep_off() bx_devices.pluginSpeaker->beep_off()
|
240 |
|
|
|
241 |
|
|
///////// Memory macros
|
242 |
|
|
#define DEV_register_memory_handlers(param,rh,wh,b,e) \
|
243 |
|
|
bx_devices.mem->registerMemoryHandlers(param,rh,wh,b,e)
|
244 |
|
|
#define DEV_unregister_memory_handlers(param,b,e) \
|
245 |
|
|
bx_devices.mem->unregisterMemoryHandlers(param,b,e)
|
246 |
|
|
#define DEV_mem_set_memory_type(a,b,c) \
|
247 |
|
|
bx_devices.mem->set_memory_type((memory_area_t)a,b,c)
|
248 |
|
|
#define DEV_mem_set_bios_write(a) bx_devices.mem->set_bios_write(a)
|
249 |
|
|
|
250 |
|
|
///////// USB device macros
|
251 |
|
|
#define DEV_usb_init_device(a,b,c,d) (usbdev_type)bx_devices.pluginUsbDevCtl->init_device(a,b,(void**)c,d)
|
252 |
|
|
#define DEV_usb_send_msg(a,b) bx_devices.pluginUsbDevCtl->usb_send_msg((void*)a,b)
|
253 |
|
|
|
254 |
|
|
///////// Sound module macro
|
255 |
|
|
#define DEV_sound_init_module(a,b) \
|
256 |
|
|
((bx_sound_lowlevel_c*)bx_devices.pluginSoundModCtl->init_module(a,b))
|
257 |
|
|
#define DEV_soundmod_beep_on(a) bx_devices.pluginSoundModCtl->beep_on(a)
|
258 |
|
|
#define DEV_soundmod_beep_off() bx_devices.pluginSoundModCtl->beep_off()
|
259 |
|
|
|
260 |
|
|
///////// Networking module macro
|
261 |
|
|
#define DEV_net_init_module(a,b,c,d) \
|
262 |
|
|
((eth_pktmover_c*)bx_devices.pluginNetModCtl->init_module(a,(void*)b,(void*)c,d))
|
263 |
|
|
|
264 |
|
|
///////// Gameport macro
|
265 |
|
|
#define DEV_gameport_set_enabled(a) bx_devices.pluginGameport->set_enabled(a)
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
#if BX_HAVE_DLFCN_H
|
269 |
|
|
#include <dlfcn.h>
|
270 |
|
|
#endif
|
271 |
|
|
|
272 |
|
|
typedef Bit32u (*ioReadHandler_t)(void *, Bit32u, unsigned);
|
273 |
|
|
typedef void (*ioWriteHandler_t)(void *, Bit32u, Bit32u, unsigned);
|
274 |
|
|
|
275 |
|
|
extern plugin_t *plugins;
|
276 |
|
|
|
277 |
|
|
typedef struct _device_t
|
278 |
|
|
{
|
279 |
|
|
const char *name;
|
280 |
|
|
plugin_t *plugin;
|
281 |
|
|
plugintype_t plugtype;
|
282 |
|
|
|
283 |
|
|
class bx_devmodel_c *devmodel; // BBD hack
|
284 |
|
|
|
285 |
|
|
struct _device_t *next;
|
286 |
|
|
} device_t;
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
extern device_t *devices;
|
290 |
|
|
|
291 |
|
|
void plugin_startup(void);
|
292 |
|
|
void plugin_load(char *name, char *args, plugintype_t);
|
293 |
|
|
plugin_t *plugin_unload(plugin_t *plugin);
|
294 |
|
|
void plugin_init_all(void);
|
295 |
|
|
void plugin_fini_all(void);
|
296 |
|
|
|
297 |
|
|
/* === Device Stuff === */
|
298 |
|
|
typedef void (*deviceInitMem_t)(BX_MEM_C *);
|
299 |
|
|
typedef void (*deviceInitDev_t)(void);
|
300 |
|
|
typedef void (*deviceReset_t)(unsigned);
|
301 |
|
|
|
302 |
|
|
BOCHSAPI void pluginRegisterDeviceDevmodel(plugin_t *plugin, plugintype_t type, bx_devmodel_c *dev, const char *name);
|
303 |
|
|
BOCHSAPI void pluginUnregisterDeviceDevmodel(const char *name);
|
304 |
|
|
BOCHSAPI bx_bool pluginDevicePresent(const char *name);
|
305 |
|
|
|
306 |
|
|
/* === IO port stuff === */
|
307 |
|
|
BOCHSAPI extern int (*pluginRegisterIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
|
308 |
|
|
unsigned base, const char *name, Bit8u mask);
|
309 |
|
|
BOCHSAPI extern int (*pluginRegisterIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
|
310 |
|
|
unsigned base, const char *name, Bit8u mask);
|
311 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
|
312 |
|
|
unsigned base, Bit8u mask);
|
313 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
|
314 |
|
|
unsigned base, Bit8u mask);
|
315 |
|
|
BOCHSAPI extern int (*pluginRegisterIOReadHandlerRange)(void *thisPtr, ioReadHandler_t callback,
|
316 |
|
|
unsigned base, unsigned end, const char *name, Bit8u mask);
|
317 |
|
|
BOCHSAPI extern int (*pluginRegisterIOWriteHandlerRange)(void *thisPtr, ioWriteHandler_t callback,
|
318 |
|
|
unsigned base, unsigned end, const char *name, Bit8u mask);
|
319 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOReadHandlerRange)(void *thisPtr, ioReadHandler_t callback,
|
320 |
|
|
unsigned begin, unsigned end, Bit8u mask);
|
321 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOWriteHandlerRange)(void *thisPtr, ioWriteHandler_t callback,
|
322 |
|
|
unsigned begin, unsigned end, Bit8u mask);
|
323 |
|
|
BOCHSAPI extern int (*pluginRegisterDefaultIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
|
324 |
|
|
const char *name, Bit8u mask);
|
325 |
|
|
BOCHSAPI extern int (*pluginRegisterDefaultIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
|
326 |
|
|
const char *name, Bit8u mask);
|
327 |
|
|
|
328 |
|
|
/* === IRQ stuff === */
|
329 |
|
|
BOCHSAPI extern void (*pluginRegisterIRQ)(unsigned irq, const char *name);
|
330 |
|
|
BOCHSAPI extern void (*pluginUnregisterIRQ)(unsigned irq, const char *name);
|
331 |
|
|
|
332 |
|
|
/* === Timer stuff === */
|
333 |
|
|
BOCHSAPI extern int (*pluginRegisterTimer)(void *this_ptr, void (*funct)(void *),
|
334 |
|
|
Bit32u useconds, bx_bool continuous,
|
335 |
|
|
bx_bool active, const char *name);
|
336 |
|
|
|
337 |
|
|
BOCHSAPI extern void (*pluginActivateTimer)(unsigned id, Bit32u usec, bx_bool continuous);
|
338 |
|
|
|
339 |
|
|
/* === HRQ stuff === */
|
340 |
|
|
BOCHSAPI extern void (*pluginSetHRQ)(unsigned val);
|
341 |
|
|
BOCHSAPI extern void (*pluginSetHRQHackCallback)(void (*callback)(void));
|
342 |
|
|
|
343 |
|
|
void plugin_abort(void);
|
344 |
|
|
|
345 |
|
|
int bx_load_plugin(const char *name, plugintype_t type);
|
346 |
|
|
extern void bx_unload_plugin(const char *name, bx_bool devflag);
|
347 |
|
|
extern void bx_init_plugins(void);
|
348 |
|
|
extern void bx_reset_plugins(unsigned);
|
349 |
|
|
extern void bx_unload_plugins(void);
|
350 |
|
|
extern void bx_unload_core_plugins(void);
|
351 |
|
|
extern void bx_plugins_register_state(void);
|
352 |
|
|
extern void bx_plugins_after_restore_state(void);
|
353 |
|
|
|
354 |
|
|
#if !BX_PLUGINS
|
355 |
|
|
int bx_load_opt_plugin(const char *name);
|
356 |
|
|
int bx_unload_opt_plugin(const char *name, bx_bool devflag);
|
357 |
|
|
#endif
|
358 |
|
|
|
359 |
|
|
// every plugin must define these, within the extern"C" block, so that
|
360 |
|
|
// a non-mangled function symbol is available in the shared library.
|
361 |
|
|
void plugin_fini(void);
|
362 |
|
|
int plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[]);
|
363 |
|
|
|
364 |
|
|
// still in extern "C"
|
365 |
|
|
#if BX_PLUGINS && defined(_MSC_VER)
|
366 |
|
|
#define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \
|
367 |
|
|
extern "C" __declspec(dllexport) int __cdecl lib##mod##_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[]); \
|
368 |
|
|
extern "C" __declspec(dllexport) void __cdecl lib##mod##_LTX_plugin_fini(void);
|
369 |
|
|
#else
|
370 |
|
|
#define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \
|
371 |
|
|
int lib##mod##_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[]); \
|
372 |
|
|
void lib##mod##_LTX_plugin_fini(void);
|
373 |
|
|
#endif
|
374 |
|
|
|
375 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(harddrv)
|
376 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(hdimage)
|
377 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(keyboard)
|
378 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(busmouse)
|
379 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(serial)
|
380 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(unmapped)
|
381 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(biosdev)
|
382 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(cmos)
|
383 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(dma)
|
384 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pic)
|
385 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pit)
|
386 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(vga)
|
387 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(svga_cirrus)
|
388 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(floppy)
|
389 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(parallel)
|
390 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
|
391 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
|
392 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci_ide)
|
393 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcidev)
|
394 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_common)
|
395 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_uhci)
|
396 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_ohci)
|
397 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(usb_xhci)
|
398 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(soundmod)
|
399 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sb16)
|
400 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(es1370)
|
401 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(netmod)
|
402 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ne2k)
|
403 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcipnic)
|
404 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(e1000)
|
405 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(extfpuirq)
|
406 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(gameport)
|
407 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(speaker)
|
408 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(acpi)
|
409 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(iodebug)
|
410 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ioapic)
|
411 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(voodoo)
|
412 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(amigaos)
|
413 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(carbon)
|
414 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(macintosh)
|
415 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(nogui)
|
416 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(rfb)
|
417 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sdl)
|
418 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(svga)
|
419 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(term)
|
420 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(win32)
|
421 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(wx)
|
422 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(x)
|
423 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(user)
|
424 |
|
|
|
425 |
|
|
|
426 |
|
|
#ifdef __cplusplus
|
427 |
|
|
}
|
428 |
|
|
#endif
|
429 |
|
|
|
430 |
|
|
#endif /* __PLUGIN_H */
|