1 |
39 |
zeus |
/////////////////////////////////////////////////////////////////////////
|
2 |
40 |
zeus |
// $Id: plugin.h,v 1.2 2009-01-11 03:22:15 zeus Exp $
|
3 |
39 |
zeus |
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// This file provides macros and types needed for plugins. It is based on
|
6 |
|
|
// the plugin.h file from plex86, but with significant changes to make
|
7 |
|
|
// it work in Bochs.
|
8 |
|
|
// Plex86 is Copyright (C) 1999-2000 The plex86 developers team
|
9 |
|
|
//
|
10 |
|
|
/////////////////////////////////////////////////////////////////////////
|
11 |
|
|
|
12 |
|
|
#ifndef __PLUGIN_H
|
13 |
|
|
#define __PLUGIN_H
|
14 |
|
|
|
15 |
|
|
#include "extplugin.h"
|
16 |
|
|
|
17 |
|
|
class bx_devices_c;
|
18 |
|
|
BOCHSAPI extern logfunctions *pluginlog;
|
19 |
|
|
|
20 |
|
|
#ifdef __cplusplus
|
21 |
|
|
extern "C" {
|
22 |
|
|
#endif
|
23 |
|
|
|
24 |
|
|
#define BX_PLUGIN_UNMAPPED "unmapped"
|
25 |
|
|
#define BX_PLUGIN_BIOSDEV " biosdev"
|
26 |
|
|
#define BX_PLUGIN_CMOS "cmos"
|
27 |
|
|
#define BX_PLUGIN_VGA "vga"
|
28 |
|
|
#define BX_PLUGIN_FLOPPY "floppy"
|
29 |
|
|
#define BX_PLUGIN_PARALLEL "parallel"
|
30 |
|
|
#define BX_PLUGIN_HDEMU "hdemu"
|
31 |
|
|
#define BX_PLUGIN_SERIAL "serial"
|
32 |
|
|
#define BX_PLUGIN_KEYBOARD "keyboard"
|
33 |
|
|
#define BX_PLUGIN_BUSMOUSE "busmouse"
|
34 |
|
|
#define BX_PLUGIN_HARDDRV "harddrv"
|
35 |
|
|
#define BX_PLUGIN_DMA "dma"
|
36 |
|
|
#define BX_PLUGIN_PIC "pic"
|
37 |
|
|
#define BX_PLUGIN_PCI "pci"
|
38 |
|
|
#define BX_PLUGIN_PCI2ISA "pci2isa"
|
39 |
|
|
#define BX_PLUGIN_PCI_IDE "pci_ide"
|
40 |
|
|
#define BX_PLUGIN_SB16 "sb16"
|
41 |
|
|
#define BX_PLUGIN_NE2K "ne2k"
|
42 |
|
|
#define BX_PLUGIN_EXTFPUIRQ "extfpuirq"
|
43 |
|
|
#define BX_PLUGIN_PCIVGA "pcivga"
|
44 |
|
|
#define BX_PLUGIN_PCIDEV "pcidev"
|
45 |
|
|
#define BX_PLUGIN_PCIUSB "pciusb"
|
46 |
|
|
#define BX_PLUGIN_PCIPNIC "pcipnic"
|
47 |
|
|
#define BX_PLUGIN_GAMEPORT "gameport"
|
48 |
|
|
#define BX_PLUGIN_SPEAKER "speaker"
|
49 |
|
|
#define BX_PLUGIN_ACPI "acpi"
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
#define BX_REGISTER_DEVICE_DEVMODEL(a,b,c,d) pluginRegisterDeviceDevmodel(a,b,c,d)
|
53 |
|
|
|
54 |
|
|
#if BX_PLUGINS
|
55 |
|
|
|
56 |
|
|
#define DEV_init_devices() {bx_devices.init(BX_MEM(0)); }
|
57 |
|
|
#define DEV_reset_devices(type) {bx_devices.reset(type); }
|
58 |
|
|
#define DEV_register_state() {bx_devices.register_state(); }
|
59 |
|
|
#define DEV_after_restore_state() {bx_devices.after_restore_state(); }
|
60 |
|
|
#define PLUG_load_plugin(name,type) {bx_load_plugin(#name,type);}
|
61 |
|
|
#define PLUG_unload_plugin(name) {bx_unload_plugin(#name);}
|
62 |
|
|
|
63 |
|
|
#define DEV_register_ioread_handler(b,c,d,e,f) pluginRegisterIOReadHandler(b,c,d,e,f)
|
64 |
|
|
#define DEV_register_iowrite_handler(b,c,d,e,f) pluginRegisterIOWriteHandler(b,c,d,e,f)
|
65 |
|
|
#define DEV_unregister_ioread_handler(b,c,d,e) pluginUnregisterIOReadHandler(b,c,d,e)
|
66 |
|
|
#define DEV_unregister_iowrite_handler(b,c,d,e) pluginUnregisterIOWriteHandler(b,c,d,e)
|
67 |
|
|
#define DEV_register_ioread_handler_range(b,c,d,e,f,g) pluginRegisterIOReadHandlerRange(b,c,d,e,f,g)
|
68 |
|
|
#define DEV_register_iowrite_handler_range(b,c,d,e,f,g) pluginRegisterIOWriteHandlerRange(b,c,d,e,f,g)
|
69 |
|
|
#define DEV_unregister_ioread_handler_range(b,c,d,e,f) pluginUnregisterIOReadHandlerRange(b,c,d,e,f)
|
70 |
|
|
#define DEV_unregister_iowrite_handler_range(b,c,d,e,f) pluginUnregisterIOWriteHandlerRange(b,c,d,e,f)
|
71 |
|
|
#define DEV_register_default_ioread_handler(b,c,d,e) pluginRegisterDefaultIOReadHandler(b,c,d,e)
|
72 |
|
|
#define DEV_register_default_iowrite_handler(b,c,d,e) pluginRegisterDefaultIOWriteHandler(b,c,d,e)
|
73 |
|
|
|
74 |
|
|
#define DEV_register_irq(b,c) pluginRegisterIRQ(b,c)
|
75 |
|
|
#define DEV_unregister_irq(b,c) pluginUnregisterIRQ(b,c)
|
76 |
|
|
|
77 |
|
|
#else
|
78 |
|
|
|
79 |
|
|
#define DEV_init_devices() {bx_devices.init(BX_MEM(0)); }
|
80 |
|
|
#define DEV_reset_devices(type) {bx_devices.reset(type); }
|
81 |
|
|
#define DEV_register_state() {bx_devices.register_state(); }
|
82 |
|
|
#define DEV_after_restore_state() {bx_devices.after_restore_state(); }
|
83 |
|
|
// When plugins are off, PLUG_load_plugin will call the plugin_init function
|
84 |
|
|
// directly.
|
85 |
|
|
#define PLUG_load_plugin(name,type) {lib##name##_LTX_plugin_init(NULL,type,0,NULL);}
|
86 |
|
|
#define PLUG_unload_plugin(name) {lib##name##_LTX_plugin_fini();}
|
87 |
|
|
#define DEV_register_ioread_handler(b,c,d,e,f) bx_devices.register_io_read_handler(b,c,d,e,f)
|
88 |
|
|
#define DEV_register_iowrite_handler(b,c,d,e,f) bx_devices.register_io_write_handler(b,c,d,e,f)
|
89 |
|
|
#define DEV_unregister_ioread_handler(b,c,d,e) bx_devices.unregister_io_read_handler(b,c,d,e)
|
90 |
|
|
#define DEV_unregister_iowrite_handler(b,c,d,e) bx_devices.unregister_io_write_handler(b,c,d,e)
|
91 |
|
|
#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)
|
92 |
|
|
#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)
|
93 |
|
|
#define DEV_unregister_ioread_handler_range(b,c,d,e,f) bx_devices.unregister_io_read_handler_range(b,c,d,e,f)
|
94 |
|
|
#define DEV_unregister_iowrite_handler_range(b,c,d,e,f) bx_devices.unregister_io_write_handler_range(b,c,d,e,f)
|
95 |
|
|
#define DEV_register_default_ioread_handler(b,c,d,e) bx_devices.register_default_io_read_handler(b,c,d,e)
|
96 |
|
|
#define DEV_register_default_iowrite_handler(b,c,d,e) bx_devices.register_default_io_write_handler(b,c,d,e)
|
97 |
|
|
#define DEV_register_irq(b,c) bx_devices.register_irq(b,c)
|
98 |
|
|
#define DEV_unregister_irq(b,c) bx_devices.unregister_irq(b,c)
|
99 |
|
|
|
100 |
|
|
#endif // #if BX_PLUGINS
|
101 |
|
|
|
102 |
|
|
#define DEV_ioapic_present() (bx_devices.ioapic != NULL)
|
103 |
|
|
|
104 |
|
|
// FIXME Do we really need pluginRegisterTimer ?
|
105 |
|
|
#define DEV_register_timer(a,b,c,d,e,f) bx_pc_system.register_timer(a,b,c,d,e,f)
|
106 |
|
|
|
107 |
|
|
///////// CMOS macros
|
108 |
|
|
#define DEV_cmos_get_reg(a) (bx_devices.pluginCmosDevice->get_reg(a))
|
109 |
|
|
#define DEV_cmos_set_reg(a,b) (bx_devices.pluginCmosDevice->set_reg(a,b))
|
110 |
|
|
#define DEV_cmos_checksum() (bx_devices.pluginCmosDevice->checksum_cmos())
|
111 |
|
|
#define DEV_cmos_get_timeval() (bx_devices.pluginCmosDevice->get_timeval())
|
112 |
|
|
#define DEV_cmos_present() (bx_devices.pluginCmosDevice != &bx_devices.stubCmos)
|
113 |
|
|
|
114 |
|
|
///////// keyboard macros
|
115 |
|
|
#define DEV_mouse_motion(dx, dy, state) \
|
116 |
|
|
(bx_devices.pluginKeyboard->mouse_motion(dx, dy, 0, state))
|
117 |
|
|
#define DEV_mouse_motion_ext(dx, dy, dz, state) \
|
118 |
|
|
(bx_devices.pluginKeyboard->mouse_motion(dx, dy, dz, state))
|
119 |
|
|
#define DEV_kbd_gen_scancode(key) \
|
120 |
|
|
(bx_devices.pluginKeyboard->gen_scancode(key))
|
121 |
|
|
#define DEV_kbd_paste_bytes(bytes, count) \
|
122 |
|
|
(bx_devices.pluginKeyboard->paste_bytes(bytes,count))
|
123 |
|
|
|
124 |
|
|
///////// hard drive macros
|
125 |
|
|
#define DEV_hd_read_handler(a, b, c) \
|
126 |
|
|
(bx_devices.pluginHardDrive->virt_read_handler(b, c))
|
127 |
|
|
#define DEV_hd_write_handler(a, b, c, d) \
|
128 |
|
|
(bx_devices.pluginHardDrive->virt_write_handler(b, c, d))
|
129 |
|
|
#define DEV_hd_get_first_cd_handle() \
|
130 |
|
|
(bx_devices.pluginHardDrive->get_first_cd_handle())
|
131 |
|
|
#define DEV_hd_get_device_handle(a,b) \
|
132 |
|
|
(bx_devices.pluginHardDrive->get_device_handle(a,b))
|
133 |
|
|
#define DEV_hd_get_cd_media_status(handle) \
|
134 |
|
|
(bx_devices.pluginHardDrive->get_cd_media_status(handle))
|
135 |
|
|
#define DEV_hd_set_cd_media_status(handle, status) \
|
136 |
|
|
(bx_devices.pluginHardDrive->set_cd_media_status(handle, status))
|
137 |
|
|
#define DEV_hd_present() (bx_devices.pluginHardDrive != &bx_devices.stubHardDrive)
|
138 |
|
|
#define DEV_hd_bmdma_read_sector(a,b,c) bx_devices.pluginHardDrive->bmdma_read_sector(a,b,c)
|
139 |
|
|
#define DEV_hd_bmdma_write_sector(a,b) bx_devices.pluginHardDrive->bmdma_write_sector(a,b)
|
140 |
|
|
#define DEV_hd_bmdma_complete(a) bx_devices.pluginHardDrive->bmdma_complete(a)
|
141 |
|
|
|
142 |
|
|
#define DEV_bulk_io_quantum_requested() (bx_devices.bulkIOQuantumsRequested)
|
143 |
|
|
#define DEV_bulk_io_quantum_transferred() (bx_devices.bulkIOQuantumsTransferred)
|
144 |
|
|
#define DEV_bulk_io_host_addr() (bx_devices.bulkIOHostAddr)
|
145 |
|
|
|
146 |
|
|
///////// FLOPPY macros
|
147 |
|
|
#define DEV_floppy_get_media_status(drive) bx_devices.pluginFloppyDevice->get_media_status(drive)
|
148 |
|
|
#define DEV_floppy_set_media_status(drive, status) bx_devices.pluginFloppyDevice->set_media_status(drive, status)
|
149 |
|
|
#define DEV_floppy_present() (bx_devices.pluginFloppyDevice != &bx_devices.stubFloppy)
|
150 |
|
|
|
151 |
|
|
///////// DMA macros
|
152 |
|
|
#define DEV_dma_register_8bit_channel(channel, dmaRead, dmaWrite, name) \
|
153 |
|
|
(bx_devices.pluginDmaDevice->registerDMA8Channel(channel, dmaRead, dmaWrite, name))
|
154 |
|
|
#define DEV_dma_register_16bit_channel(channel, dmaRead, dmaWrite, name) \
|
155 |
|
|
(bx_devices.pluginDmaDevice->registerDMA16Channel(channel, dmaRead, dmaWrite, name))
|
156 |
|
|
#define DEV_dma_unregister_channel(channel) \
|
157 |
|
|
(bx_devices.pluginDmaDevice->unregisterDMAChannel(channel))
|
158 |
|
|
#define DEV_dma_set_drq(channel, val) \
|
159 |
|
|
(bx_devices.pluginDmaDevice->set_DRQ(channel, val))
|
160 |
|
|
#define DEV_dma_get_tc() \
|
161 |
|
|
(bx_devices.pluginDmaDevice->get_TC())
|
162 |
|
|
#define DEV_dma_raise_hlda() \
|
163 |
|
|
(bx_devices.pluginDmaDevice->raise_HLDA())
|
164 |
|
|
|
165 |
|
|
///////// PIC macros
|
166 |
|
|
#define DEV_pic_lower_irq(b) (bx_devices.pluginPicDevice->lower_irq(b))
|
167 |
|
|
#define DEV_pic_raise_irq(b) (bx_devices.pluginPicDevice->raise_irq(b))
|
168 |
|
|
#define DEV_pic_set_mode(a,b) (bx_devices.pluginPicDevice->set_mode(a,b))
|
169 |
|
|
#define DEV_pic_iac() (bx_devices.pluginPicDevice->IAC())
|
170 |
|
|
#define DEV_pic_show_pic_state() (bx_devices.pluginPicDevice->show_pic_state())
|
171 |
|
|
|
172 |
|
|
///////// VGA macros
|
173 |
|
|
#define DEV_vga_mem_read(addr) (bx_devices.pluginVgaDevice->mem_read(addr))
|
174 |
|
|
#define DEV_vga_mem_write(addr, val) (bx_devices.pluginVgaDevice->mem_write(addr, val))
|
175 |
|
|
#define DEV_vga_redraw_area(left, top, right, bottom) \
|
176 |
|
|
(bx_devices.pluginVgaDevice->redraw_area(left, top, right, bottom))
|
177 |
|
|
#define DEV_vga_get_text_snapshot(rawsnap, height, width) \
|
178 |
|
|
(bx_devices.pluginVgaDevice->get_text_snapshot(rawsnap, height, width))
|
179 |
|
|
#define DEV_vga_refresh() \
|
180 |
|
|
(bx_devices.pluginVgaDevice->trigger_timer(bx_devices.pluginVgaDevice))
|
181 |
|
|
#define DEV_vga_get_actl_pal_idx(index) (bx_devices.pluginVgaDevice->get_actl_palette_idx(index))
|
182 |
|
|
#define DEV_vga_dump_status() (bx_devices.pluginVgaDevice->dump_status())
|
183 |
|
|
|
184 |
|
|
///////// PCI macros
|
185 |
|
|
#define DEV_register_pci_handlers(a,b,c,d) \
|
186 |
|
|
(bx_devices.pluginPciBridge->register_pci_handlers(a,b,c,d))
|
187 |
|
|
#define DEV_is_pci_device(name) bx_devices.pluginPciBridge->is_pci_device(name)
|
188 |
|
|
#define DEV_pci_set_irq(a,b,c) bx_devices.pluginPci2IsaBridge->pci_set_irq(a,b,c)
|
189 |
|
|
#define DEV_pci_set_base_mem(a,b,c,d,e,f) \
|
190 |
|
|
(bx_devices.pluginPciBridge->pci_set_base_mem(a,b,c,d,e,f))
|
191 |
|
|
#define DEV_pci_set_base_io(a,b,c,d,e,f,g,h) \
|
192 |
|
|
(bx_devices.pluginPciBridge->pci_set_base_io(a,b,c,d,e,f,g,h))
|
193 |
|
|
#define DEV_pci_rd_memtype(addr) bx_devices.pluginPciBridge->rd_memType(addr)
|
194 |
|
|
#define DEV_pci_wr_memtype(addr) bx_devices.pluginPciBridge->wr_memType(addr)
|
195 |
|
|
#define DEV_pci_print_i440fx_state() bx_devices.pluginPciBridge->print_i440fx_state()
|
196 |
|
|
#define DEV_ide_bmdma_present() bx_devices.pluginPciIdeController->bmdma_present()
|
197 |
|
|
#define DEV_ide_bmdma_set_irq(a) bx_devices.pluginPciIdeController->bmdma_set_irq(a)
|
198 |
|
|
#define DEV_acpi_generate_smi(a) bx_devices.pluginACPIController->generate_smi(a)
|
199 |
|
|
|
200 |
|
|
///////// NE2000 macro
|
201 |
|
|
#define DEV_ne2k_print_info(file,page,reg,brief) \
|
202 |
|
|
bx_devices.pluginNE2kDevice->print_info(file,page,reg,brief)
|
203 |
|
|
|
204 |
|
|
///////// Speaker macros
|
205 |
|
|
#define DEV_speaker_beep_on(frequency) bx_devices.pluginSpeaker->beep_on(frequency)
|
206 |
|
|
#define DEV_speaker_beep_off() bx_devices.pluginSpeaker->beep_off()
|
207 |
|
|
|
208 |
|
|
///////// Serial macro
|
209 |
|
|
#define DEV_serial_mouse_enq(dx, dy, dz, state) \
|
210 |
|
|
(bx_devices.pluginSerialDevice->serial_mouse_enq(dx, dy, dz, state))
|
211 |
|
|
|
212 |
|
|
///////// BUS mouse macro
|
213 |
|
|
#define DEV_bus_mouse_enq(dx, dy, dz, state) \
|
214 |
|
|
(bx_devices.pluginBusMouse->bus_mouse_enq(dx, dy, 0, state))
|
215 |
|
|
|
216 |
|
|
///////// USB device macros
|
217 |
|
|
#if BX_SUPPORT_PCIUSB
|
218 |
|
|
#define DEV_usb_mouse_enq(dx, dy, dz, state) \
|
219 |
|
|
(bx_devices.pluginPciUSBAdapter->usb_mouse_enq(dx, dy, dz, state))
|
220 |
|
|
#define DEV_usb_mouse_enabled_changed(enable) \
|
221 |
|
|
(bx_devices.pluginPciUSBAdapter->usb_mouse_enabled_changed(enable))
|
222 |
|
|
#define DEV_usb_key_enq(scan_code) \
|
223 |
|
|
(bx_devices.pluginPciUSBAdapter->usb_key_enq(scan_code))
|
224 |
|
|
#define DEV_usb_keyboard_connected() \
|
225 |
|
|
(bx_devices.pluginPciUSBAdapter->usb_keyboard_connected())
|
226 |
|
|
#define DEV_usb_mouse_connected() \
|
227 |
|
|
(bx_devices.pluginPciUSBAdapter->usb_mouse_connected())
|
228 |
|
|
#endif
|
229 |
|
|
|
230 |
|
|
//////// Memory macros
|
231 |
|
|
#define DEV_register_memory_handlers(param,rh,wh,b,e) \
|
232 |
|
|
bx_devices.mem->registerMemoryHandlers(param,rh,wh,b,e)
|
233 |
|
|
#define DEV_unregister_memory_handlers(rh,wh,b,e) \
|
234 |
|
|
bx_devices.mem->unregisterMemoryHandlers(rh,wh,b,e)
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
#if BX_HAVE_DLFCN_H
|
238 |
|
|
#include <dlfcn.h>
|
239 |
|
|
#endif
|
240 |
|
|
|
241 |
|
|
typedef Bit32u (*ioReadHandler_t)(void *, Bit32u, unsigned);
|
242 |
|
|
typedef void (*ioWriteHandler_t)(void *, Bit32u, Bit32u, unsigned);
|
243 |
|
|
|
244 |
|
|
extern plugin_t *plugins;
|
245 |
|
|
|
246 |
|
|
typedef struct _device_t
|
247 |
|
|
{
|
248 |
|
|
const char *name;
|
249 |
|
|
plugin_t *plugin;
|
250 |
|
|
|
251 |
|
|
class bx_devmodel_c *devmodel; // BBD hack
|
252 |
|
|
|
253 |
|
|
struct _device_t *next;
|
254 |
|
|
} device_t;
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
extern device_t *devices;
|
258 |
|
|
|
259 |
|
|
void plugin_startup(void);
|
260 |
|
|
void plugin_load(char *name, char *args, plugintype_t);
|
261 |
|
|
plugin_t *plugin_unload(plugin_t *plugin);
|
262 |
|
|
void plugin_init_all(void);
|
263 |
|
|
void plugin_fini_all(void);
|
264 |
|
|
|
265 |
|
|
/* === Device Stuff === */
|
266 |
|
|
typedef void (*deviceInitMem_t)(BX_MEM_C *);
|
267 |
|
|
typedef void (*deviceInitDev_t)(void);
|
268 |
|
|
typedef void (*deviceReset_t)(unsigned);
|
269 |
|
|
|
270 |
|
|
BOCHSAPI void pluginRegisterDeviceDevmodel(plugin_t *plugin, plugintype_t type, bx_devmodel_c *dev, const char *name);
|
271 |
|
|
BOCHSAPI bx_bool pluginDevicePresent(char *name);
|
272 |
|
|
|
273 |
|
|
/* === IO port stuff === */
|
274 |
|
|
BOCHSAPI extern int (*pluginRegisterIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
|
275 |
|
|
unsigned base, const char *name, Bit8u mask);
|
276 |
|
|
BOCHSAPI extern int (*pluginRegisterIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
|
277 |
|
|
unsigned base, const char *name, Bit8u mask);
|
278 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
|
279 |
|
|
unsigned base, Bit8u mask);
|
280 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
|
281 |
|
|
unsigned base, Bit8u mask);
|
282 |
|
|
BOCHSAPI extern int (*pluginRegisterIOReadHandlerRange)(void *thisPtr, ioReadHandler_t callback,
|
283 |
|
|
unsigned base, unsigned end, const char *name, Bit8u mask);
|
284 |
|
|
BOCHSAPI extern int (*pluginRegisterIOWriteHandlerRange)(void *thisPtr, ioWriteHandler_t callback,
|
285 |
|
|
unsigned base, unsigned end, const char *name, Bit8u mask);
|
286 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOReadHandlerRange)(void *thisPtr, ioReadHandler_t callback,
|
287 |
|
|
unsigned begin, unsigned end, Bit8u mask);
|
288 |
|
|
BOCHSAPI extern int (*pluginUnregisterIOWriteHandlerRange)(void *thisPtr, ioWriteHandler_t callback,
|
289 |
|
|
unsigned begin, unsigned end, Bit8u mask);
|
290 |
|
|
BOCHSAPI extern int (*pluginRegisterDefaultIOReadHandler)(void *thisPtr, ioReadHandler_t callback,
|
291 |
|
|
const char *name, Bit8u mask);
|
292 |
|
|
BOCHSAPI extern int (*pluginRegisterDefaultIOWriteHandler)(void *thisPtr, ioWriteHandler_t callback,
|
293 |
|
|
const char *name, Bit8u mask);
|
294 |
|
|
|
295 |
|
|
/* === A20 enable line stuff === */
|
296 |
|
|
BOCHSAPI extern unsigned (*pluginGetA20E)(void);
|
297 |
|
|
BOCHSAPI extern void (*pluginSetA20E)(unsigned val);
|
298 |
|
|
|
299 |
|
|
/* === IRQ stuff === */
|
300 |
|
|
BOCHSAPI extern void (*pluginRegisterIRQ)(unsigned irq, const char *name);
|
301 |
|
|
BOCHSAPI extern void (*pluginUnregisterIRQ)(unsigned irq, const char *name);
|
302 |
|
|
|
303 |
|
|
/* === Floppy stuff ===*/
|
304 |
|
|
BOCHSAPI extern unsigned (* pluginFloppyGetMediaStatus)(unsigned drive);
|
305 |
|
|
BOCHSAPI extern unsigned (* pluginFloppySetMediaStatus)(unsigned drive, unsigned status);
|
306 |
|
|
|
307 |
|
|
/* === VGA stuff === */
|
308 |
|
|
BOCHSAPI extern void (* pluginVGARedrawArea)(unsigned x0, unsigned y0,
|
309 |
|
|
unsigned width, unsigned height);
|
310 |
|
|
BOCHSAPI extern Bit8u (* pluginVGAMemRead)(Bit32u addr);
|
311 |
|
|
BOCHSAPI extern void (* pluginVGAMemWrite)(Bit32u addr, Bit8u value);
|
312 |
|
|
BOCHSAPI extern void (* pluginVGAGetTextSnapshot)(Bit8u **text_snapshot,
|
313 |
|
|
unsigned *txHeight, unsigned *txWidth);
|
314 |
|
|
BOCHSAPI extern void (* pluginVGARefresh)(void *);
|
315 |
|
|
BOCHSAPI extern void (* pluginVGASetUpdateInterval)(unsigned);
|
316 |
|
|
BOCHSAPI extern Bit8u (* pluginVGAGetActlPaletteIdx)(Bit8u index);
|
317 |
|
|
|
318 |
|
|
/* === Timer stuff === */
|
319 |
|
|
BOCHSAPI extern int (*pluginRegisterTimer)(void *this_ptr, void (*funct)(void *),
|
320 |
|
|
Bit32u useconds, bx_bool continuous,
|
321 |
|
|
bx_bool active, const char *name);
|
322 |
|
|
|
323 |
|
|
BOCHSAPI extern void (*pluginActivateTimer)(unsigned id, Bit32u usec, bx_bool continuous);
|
324 |
|
|
BOCHSAPI extern void (*pluginDeactivateTimer)(unsigned id);
|
325 |
|
|
|
326 |
|
|
/* === HRQ stuff === */
|
327 |
|
|
BOCHSAPI extern void (*pluginSetHRQ)(unsigned val);
|
328 |
|
|
BOCHSAPI extern void (*pluginSetHRQHackCallback)(void (*callback)(void));
|
329 |
|
|
|
330 |
|
|
/* === PCI stuff === */
|
331 |
|
|
BOCHSAPI extern bx_bool (*pluginRegisterPCIDevice)(void *this_ptr,
|
332 |
|
|
Bit32u (*bx_pci_read_handler)(void *, Bit8u, unsigned),
|
333 |
|
|
void(*bx_pci_write_handler)(void *, Bit8u, Bit32u, unsigned),
|
334 |
|
|
Bit8u *devfunc, const char *name, const char *descr);
|
335 |
|
|
BOCHSAPI extern Bit8u (*pluginRd_memType)(Bit32u addr);
|
336 |
|
|
BOCHSAPI extern Bit8u (*pluginWr_memType)(Bit32u addr);
|
337 |
|
|
|
338 |
|
|
void plugin_abort(void);
|
339 |
|
|
|
340 |
|
|
int bx_load_plugin(const char *name, plugintype_t type);
|
341 |
|
|
extern void bx_unload_plugin(const char *name);
|
342 |
|
|
extern void bx_init_plugins(void);
|
343 |
|
|
extern void bx_reset_plugins(unsigned);
|
344 |
|
|
extern void bx_unload_plugins(void);
|
345 |
|
|
extern void bx_plugins_register_state(void);
|
346 |
|
|
extern void bx_plugins_after_restore_state(void);
|
347 |
|
|
|
348 |
|
|
// every plugin must define these, within the extern"C" block, so that
|
349 |
|
|
// a non-mangled function symbol is available in the shared library.
|
350 |
|
|
void plugin_fini(void);
|
351 |
|
|
int plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[]);
|
352 |
|
|
|
353 |
|
|
// still in extern "C"
|
354 |
|
|
#define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \
|
355 |
|
|
int lib##mod##_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[]); \
|
356 |
|
|
void lib##mod##_LTX_plugin_fini(void);
|
357 |
|
|
|
358 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(harddrv)
|
359 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(keyboard)
|
360 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(busmouse)
|
361 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(serial)
|
362 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(unmapped)
|
363 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(biosdev)
|
364 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(cmos)
|
365 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(dma)
|
366 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pic)
|
367 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(vga)
|
368 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(floppy)
|
369 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(parallel)
|
370 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(hdemu)
|
371 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
|
372 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
|
373 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci_ide)
|
374 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcivga)
|
375 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcidev)
|
376 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pciusb)
|
377 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcipnic)
|
378 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sb16)
|
379 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(ne2k)
|
380 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(extfpuirq)
|
381 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(gameport)
|
382 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(speaker)
|
383 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(acpi)
|
384 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(amigaos)
|
385 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(beos)
|
386 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(carbon)
|
387 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(macintosh)
|
388 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(nogui)
|
389 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(rfb)
|
390 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sdl)
|
391 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(svga)
|
392 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(term)
|
393 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(win32)
|
394 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(wx)
|
395 |
|
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(x)
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
#ifdef __cplusplus
|
399 |
|
|
}
|
400 |
|
|
#endif
|
401 |
|
|
|
402 |
|
|
#endif /* __PLUGIN_H */
|