/[gxemul]/trunk/src/include/devices.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/src/include/devices.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (show annotations)
Mon Oct 8 16:18:11 2007 UTC (13 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 25104 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.772 2005/06/04 12:02:16 debug Exp $
20050428	Disabling the "-fmove-all-movables" option in the configure
		script, because it causes the compile to fail on OpenBSD/sgi.
20050502	Minor updates.
20050503	Removing the WRT54G mode (it was bogus anyway), and adding a
		comment about Windows NT for MIPS in doc/experiments.html.
		Minor updates to the x86 instruction decoding.
20050504	Adding some more x86 instructions.
		Adding support for reading files from ISO9660 CDROMs (including
		gzipped files). It's an ugly hack, but it seems to work.
		Various other minor updates (dev_vga.c, pc_bios.c etc).
20050505	Some more x86-related updates.
		Beginning (what I hope will be) a major code cleanup phase.
		"bootris" (an x86 bootsector) runs :-)
20050506	Adding some more x86 instructions.
20050507	tmpnam => mkstemp.
		Working on a hack to allow VGA charcells to be shown even when
		not running with X11.
		Adding more x86 instructions.
20050508	x86 32-bit SIB addressing fix, and more instructions.
20050509	Adding more x86 instructions.
20050510	Minor documentation updates, and other updates (x86 stuff etc.)
20050511	More x86-related updates.
20050513	Various updates, mostly x86-related. (Trying to fix flag 
		calculation, factoring out the ugly shift/rotate code, and
		some other things.)
20050514	Adding support for loading some old i386 a.out executables.
		Finally beginning the cleanup of machine/PROM/bios dependant
		info.
		Some minor documentation updates.
		Trying to clean up ARCBIOS stuff a little.
20050515	Trying to make it possible to actually use more than one disk
		type per machine (floppy, ide, scsi).
		Trying to clean up the kbd vs PROM console stuff. (For PC and
		ARC emulation modes, mostly.)
		Beginning to add an 8259 interrupt controller, and connecting
		it to the x86 emulation.
20050516	The first x86 interrupts seem to work (keyboard stuff).
		Adding a 8253/8254 programmable interval timer skeleton.
		FreeDOS now reaches a command prompt and can be interacted
		with.
20050517	After some bugfixes, MS-DOS also (sometimes) reaches a
		command prompt now.
		Trying to fix the pckbc to work with MS-DOS' keyb.com, but no
		success yet.
20050518	Adding a simple 32-bit x86 MMU skeleton.
20050519	Some more work on the x86 stuff. (Beginning the work on paging,
		and various other fixes).
20050520	More updates. Working on dev_vga (4-bit graphics modes), adding
		40 columns support to the PC bios emulation.
		Trying to add support for resizing windows when switching
		between graphics modes.
20050521	Many more x86-related updates.
20050522	Correcting the initial stack pointer's sign-extension for
		ARCBIOS emulation (thanks to Alec Voropay for noticing the
		error).
		Continuing on the cleanup (ARCBIOS etc).
		dev_vga updates.
20050523	More x86 updates: trying to add some support for protected mode
		interrupts (via gate descriptors) and many other fixes.
		More ARCBIOS cleanup.
		Adding a device flag which indicates that reads cause no
		side-effects. (Useful for the "dump" command in the debugger,
		and other things.)
		Adding support for directly starting up x86 ELFs, skipping the
		bootloader stage. (Most ELFs, however, are not suitable for
		this.)
20050524	Adding simple 32-bit x86 TSS task switching, but no privilege
		level support yet.
		More work on dev_vga. A small "Copper bars" demo works. :-)
		Adding support for Trap Flag (single-step exceptions), at least
		in real mode, and various other x86-related fixes.
20050525	Adding a new disk image prefix (gH;S;) which can be used to
		override the default nr of heads and sectors per track.
20050527	Various bug fixes, more work on the x86 mode (stack change on
		interrupts between different priv.levels), and some minor
		documentation updates.
20050528	Various fixes (x86 stuff).
20050529	More x86 fixes. An OpenBSD/i386 bootfloppy reaches userland
		and can be interacted with (although there are problems with
		key repetition). NetBSD/i386 triggers a serious CISC-related
		problem: instruction fetches across page boundaries, where
		the later part isn't actually part of the instruction.
20050530	Various minor updates. (Documentation updates, etc.)
20050531	Adding some experimental code (experiments/new_test_*) which
		could be useful for dynamic (but not binary) translation in
		the future.
20050602	Adding a dummy ARM skeleton.
		Fixing the pckbc key repetition problem (by adding release
		scancodes for all keypresses).
20050603	Minor updates for the next release.
20050604	Release testing. Minor updates.

==============  RELEASE 0.3.3  ==============

20050604	There'll probably be a 0.3.3.1 release soon, with some very
		very tiny updates.


1 #ifndef DEVICES_H
2 #define DEVICES_H
3
4 /*
5 * Copyright (C) 2003-2005 Anders Gavare. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 *
31 * $Id: devices.h,v 1.167 2005/05/22 20:05:40 debug Exp $
32 *
33 * Memory mapped devices.
34 *
35 * TODO: Separate into lots of smaller files? That might speed up a compile,
36 * but I'm not sure that it's a price worth paying.
37 */
38
39 #include <sys/types.h>
40 #include <inttypes.h>
41
42 struct cpu;
43 struct machine;
44 struct memory;
45 struct pci_data;
46
47 /* #ifdef WITH_X11
48 #include <X11/Xlib.h>
49 #endif */
50
51 /* dev_8259.c: */
52 struct pic8259_data {
53 int irq_nr; /* if connected to another 8259 */
54
55 int irq_base;
56 int current_command;
57
58 int init_state;
59
60 int priority_reg;
61 uint8_t irr; /* interrupt request register */
62 uint8_t isr; /* interrupt in-service register */
63 uint8_t ier; /* interrupt enable register */
64 };
65
66 /* dev_dec_ioasic.c: */
67 #define DEV_DEC_IOASIC_LENGTH 0x80100
68 #define N_DEC_IOASIC_REGS (0x1f0 / 0x10)
69 #define MAX_IOASIC_DMA_FUNCTIONS 8
70 struct dec_ioasic_data {
71 uint32_t reg[N_DEC_IOASIC_REGS];
72 int (*(dma_func[MAX_IOASIC_DMA_FUNCTIONS]))(struct cpu *, void *, uint64_t addr, size_t dma_len, int tx);
73 void *dma_func_extra[MAX_IOASIC_DMA_FUNCTIONS];
74 int rackmount_flag;
75 };
76 int dev_dec_ioasic_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
77 struct dec_ioasic_data *dev_dec_ioasic_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr, int rackmount_flag);
78
79 /* dev_asc.c: */
80 #define DEV_ASC_DEC_LENGTH 0x40000
81 #define DEV_ASC_PICA_LENGTH 0x1000
82 #define DEV_ASC_DEC 1
83 #define DEV_ASC_PICA 2
84 int dev_asc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
85 void dev_asc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr,
86 int irq_nr, void *turbochannel, int mode,
87 size_t (*dma_controller)(void *dma_controller_data,
88 unsigned char *data, size_t len, int writeflag),
89 void *dma_controller_data);
90
91 /* dev_au1x00.c: */
92 struct au1x00_ic_data {
93 int ic_nr;
94 uint32_t request0_int;
95 uint32_t request1_int;
96 uint32_t config0;
97 uint32_t config1;
98 uint32_t config2;
99 uint32_t source;
100 uint32_t assign_request;
101 uint32_t wakeup;
102 uint32_t mask;
103 };
104
105 int dev_au1x00_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
106 struct au1x00_ic_data *dev_au1x00_init(struct machine *machine, struct memory *mem);
107
108 /* dev_bt431.c: */
109 #define DEV_BT431_LENGTH 0x20
110 #define DEV_BT431_NREGS 0x800 /* ? */
111 int dev_bt431_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
112 struct vfb_data;
113 void dev_bt431_init(struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data, int color_fb_flag);
114
115 /* dev_bt455.c: */
116 #define DEV_BT455_LENGTH 0x20
117 int dev_bt455_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
118 struct vfb_data;
119 void dev_bt455_init(struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data);
120
121 /* dev_bt459.c: */
122 #define DEV_BT459_LENGTH 0x20
123 #define DEV_BT459_NREGS 0x1000
124 #define BT459_PX 1 /* px[g] */
125 #define BT459_BA 2 /* cfb */
126 #define BT459_BBA 3 /* sfb */
127 int dev_bt459_access(struct cpu *cpu, struct memory *mem,
128 uint64_t relative_addr, unsigned char *data, size_t len,
129 int writeflag, void *);
130 struct vfb_data;
131 void dev_bt459_init(struct machine *machine, struct memory *mem,
132 uint64_t baseaddr, uint64_t baseaddr_irq, struct vfb_data *vfb_data,
133 int color_fb_flag, int irq_nr, int type);
134
135 /* dev_cons.c: */
136 #define DEV_CONS_ADDRESS 0x0000000010000000
137 #define DEV_CONS_LENGTH 0x0000000000000020
138 #define DEV_CONS_PUTGETCHAR 0x0000
139 #define DEV_CONS_HALT 0x0010
140 int dev_cons_access(struct cpu *cpu, struct memory *mem,
141 uint64_t relative_addr, unsigned char *data, size_t len,
142 int writeflag, void *);
143 int dev_cons_init(struct machine *machine, struct memory *mem,
144 uint64_t baseaddr, char *name, int irq_nr);
145
146 /* dev_colorplanemask.c: */
147 #define DEV_COLORPLANEMASK_LENGTH 0x0000000000000010
148 int dev_colorplanemask_access(struct cpu *cpu, struct memory *mem,
149 uint64_t relative_addr, unsigned char *data, size_t len,
150 int writeflag, void *);
151 void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr,
152 unsigned char *color_plane_mask);
153
154 /* dev_dc7085.c: */
155 #define DEV_DC7085_LENGTH 0x0000000000000080
156 /* see dc7085.h for more info */
157 void dev_dc7085_tick(struct cpu *cpu, void *);
158 int dev_dc7085_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
159 int dev_dc7085_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb);
160
161 /* dev_dec5800.c: */
162 #define DEV_DEC5800_LENGTH 0x1000 /* ? */
163 struct dec5800_data {
164 uint32_t csr;
165 uint32_t vector_0x50;
166 };
167 int dev_dec5800_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
168 struct dec5800_data *dev_dec5800_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
169 /* 16 slots, 0x2000 bytes each */
170 #define DEV_DECBI_LENGTH 0x20000
171 int dev_decbi_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
172 void dev_decbi_init(struct memory *mem, uint64_t baseaddr);
173 #define DEV_DECCCA_LENGTH 0x10000 /* ? */
174 #define DEC_DECCCA_BASEADDR 0x19000000 /* ? I just made this up */
175 int dev_deccca_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
176 void dev_deccca_init(struct memory *mem, uint64_t baseaddr);
177 #define DEV_DECXMI_LENGTH 0x800000
178 int dev_decxmi_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
179 void dev_decxmi_init(struct memory *mem, uint64_t baseaddr);
180
181 /* dev_fb.c: */
182 #define DEV_FB_LENGTH 0x3c0000 /* 3c0000 to not colide with turbochannel rom, otherwise size = (4*1024*1024) */
183 #define VFB_GENERIC 0
184 #define VFB_HPCMIPS 1
185 #define VFB_DEC_VFB01 2
186 #define VFB_DEC_VFB02 3
187 #define VFB_DEC_MAXINE 4
188 #define VFB_PLAYSTATION2 5
189 struct vfb_data {
190 int vfb_type;
191
192 int vfb_scaledown;
193
194 int xsize;
195 int ysize;
196 int bit_depth;
197 int color32k;
198
199 unsigned char color_plane_mask;
200
201 int bytes_per_line; /* cached */
202
203 int visible_xsize;
204 int visible_ysize;
205
206 size_t framebuffer_size;
207 int x11_xsize, x11_ysize;
208
209 int update_x1, update_y1, update_x2, update_y2;
210
211 /* RGB palette for <= 8 bit modes: (r,g,b bytes for each) */
212 unsigned char rgb_palette[256 * 3];
213
214 /* These should always be in sync: */
215 unsigned char *framebuffer;
216 struct fb_window *fb_window;
217 };
218 #define VFB_MFB_BT455 0x100000
219 #define VFB_MFB_BT431 0x180000
220 #define VFB_MFB_VRAM 0x200000
221 #define VFB_CFB_BT459 0x200000
222 void set_grayscale_palette(struct vfb_data *d, int ncolors);
223 void dev_fb_resize(struct vfb_data *d, int new_xsize, int new_ysize);
224 void dev_fb_setcursor(struct vfb_data *d, int cursor_x, int cursor_y, int on,
225 int cursor_xsize, int cursor_ysize);
226 void framebuffer_blockcopyfill(struct vfb_data *d, int fillflag, int fill_r,
227 int fill_g, int fill_b, int x1, int y1, int x2, int y2,
228 int from_x, int from_y);
229 void dev_fb_tick(struct cpu *, void *);
230 int dev_fb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
231 struct vfb_data *dev_fb_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int vfb_type,
232 int visible_xsize, int visible_ysize, int xsize, int ysize, int bit_depth, char *name, int logo);
233
234 /* dev_gt.c: */
235 #define DEV_GT_LENGTH 0x0000000000001000
236 int dev_gt_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
237 struct pci_data *dev_gt_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int pciirq);
238
239 /* dev_jazz.c: */
240 #define DEV_JAZZ_LENGTH 0x280
241 struct jazz_data {
242 struct cpu *cpu;
243
244 /* Jazz stuff: */
245 uint32_t int_enable_mask;
246 uint32_t int_asserted;
247
248 /* ISA stuff: */
249 uint32_t isa_int_enable_mask;
250 uint32_t isa_int_asserted;
251
252 int interval;
253 int interval_start;
254
255 int jazz_timer_value;
256 int jazz_timer_current;
257
258 uint64_t dma_translation_table_base;
259 uint64_t dma_translation_table_limit;
260
261 uint32_t dma0_mode;
262 uint32_t dma0_enable;
263 uint32_t dma0_count;
264 uint32_t dma0_addr;
265
266 uint32_t dma1_mode;
267 /* same for dma1,2,3 actually (TODO) */
268
269 int led;
270 };
271 size_t dev_jazz_dma_controller(void *dma_controller_data,
272 unsigned char *data, size_t len, int writeflag);
273
274 /* dev_kn01.c: */
275 #define DEV_KN01_CSR_LENGTH 0x0000000000000004
276 int dev_kn01_csr_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
277 void dev_kn01_csr_init(struct memory *mem, uint64_t baseaddr, int color_fb);
278 #define DEV_VDAC_LENGTH 0x20
279 #define DEV_VDAC_MAPWA 0x00
280 #define DEV_VDAC_MAP 0x04
281 #define DEV_VDAC_MASK 0x08
282 #define DEV_VDAC_MAPRA 0x0c
283 #define DEV_VDAC_OVERWA 0x10
284 #define DEV_VDAC_OVER 0x14
285 #define DEV_VDAC_OVERRA 0x1c
286 int dev_vdac_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
287 void dev_vdac_init(struct memory *mem, uint64_t baseaddr, unsigned char *rgb_palette, int color_fb_flag);
288
289 /* dev_kn02.c: */
290 struct kn02_csr {
291 uint8_t csr[sizeof(uint32_t)];
292 uint8_t filler[4096 - sizeof(uint32_t)]; /* for bintrans mapping */
293 };
294 int dev_kn02_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
295 struct kn02_csr *dev_kn02_init(struct cpu *cpu, struct memory *mem,
296 uint64_t baseaddr);
297
298 /* dev_kn220.c: */
299 #define DEV_DEC5500_IOBOARD_LENGTH 0x100000
300 int dev_dec5500_ioboard_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
301 struct dec5500_ioboard_data *dev_dec5500_ioboard_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr);
302 #define DEV_SGEC_LENGTH 0x1000
303 int dev_sgec_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
304 void dev_sgec_init(struct memory *mem, uint64_t baseaddr, int irq_nr);
305
306 /* dev_kn230.c: */
307 struct kn230_csr {
308 uint32_t csr;
309 };
310
311 /* dev_le.c: */
312 #define DEV_LE_LENGTH 0x1c0200
313 int dev_le_access(struct cpu *cpu, struct memory *mem,
314 uint64_t relative_addr, unsigned char *data, size_t len,
315 int writeflag, void *);
316 void dev_le_init(struct machine *machine, struct memory *mem,
317 uint64_t baseaddr, uint64_t buf_start, uint64_t buf_end,
318 int irq_nr, int len);
319
320 /* dev_m700_fb.c: */
321 #define DEV_M700_FB_LENGTH 0x10000 /* TODO? */
322 int dev_m700_fb_access(struct cpu *cpu, struct memory *mem,
323 uint64_t relative_addr, unsigned char *data, size_t len,
324 int writeflag, void *);
325 void dev_m700_fb_init(struct machine *machine, struct memory *mem,
326 uint64_t baseaddr, uint64_t baseaddr2);
327
328 /* dev_ns16550.c: */
329 #define DEV_NS16550_LENGTH 0x0000000000000008
330 /* see comreg.h and ns16550reg.h for more info */
331 int dev_ns16550_access(struct cpu *cpu, struct memory *mem,
332 uint64_t relative_addr, unsigned char *data, size_t len,
333 int writeflag, void *);
334 int dev_ns16550_init(struct machine *machine, struct memory *mem,
335 uint64_t baseaddr, int irq_nr, int addrmult, int in_use, char *name);
336
337 /* dev_mc146818.c: */
338 #define DEV_MC146818_LENGTH 0x0000000000000100
339 #define MC146818_DEC 0
340 #define MC146818_PC_CMOS 1
341 #define MC146818_ARC_NEC 2
342 #define MC146818_ARC_JAZZ 3
343 #define MC146818_SGI 4
344 /* see mc146818reg.h for more info */
345 void dev_mc146818_tick(struct cpu *cpu, void *);
346 int dev_mc146818_access(struct cpu *cpu, struct memory *mem,
347 uint64_t relative_addr, unsigned char *data, size_t len,
348 int writeflag, void *);
349 void dev_mc146818_init(struct machine *machine, struct memory *mem,
350 uint64_t baseaddr, int irq_nr, int access_style, int addrdiv);
351
352 /* dev_pckbc.c: */
353 #define DEV_PCKBC_LENGTH 0x10
354 #define PCKBC_8042 0
355 #define PCKBC_8242 1
356 #define PCKBC_JAZZ 3
357 int dev_pckbc_access(struct cpu *cpu, struct memory *mem,
358 uint64_t relative_addr, unsigned char *data, size_t len,
359 int writeflag, void *);
360 int dev_pckbc_init(struct machine *machine, struct memory *mem,
361 uint64_t baseaddr, int type, int keyboard_irqnr, int mouse_irqnr,
362 int in_use, int pc_style_flag);
363
364 /* dev_pmppc.c: */
365 int dev_pmppc_board_access(struct cpu *cpu, struct memory *mem,
366 uint64_t relative_addr, unsigned char *data, size_t len, int writeflag,
367 void *);
368 void dev_pmppc_init(struct memory *mem);
369
370 /* dev_ps2_spd.c: */
371 #define DEV_PS2_SPD_LENGTH 0x800
372 int dev_ps2_spd_access(struct cpu *cpu, struct memory *mem,
373 uint64_t relative_addr, unsigned char *data, size_t len,
374 int writeflag, void *);
375 void dev_ps2_spd_init(struct machine *machine, struct memory *mem,
376 uint64_t baseaddr);
377
378 /* dev_ps2_stuff.c: */
379 #include "ps2_dmacreg.h"
380 #define N_PS2_DMA_CHANNELS 10
381 #define N_PS2_TIMERS 4
382 struct ps2_data {
383 uint32_t timer_count[N_PS2_TIMERS];
384 uint32_t timer_comp[N_PS2_TIMERS];
385 uint32_t timer_mode[N_PS2_TIMERS];
386 uint32_t timer_hold[N_PS2_TIMERS]; /* NOTE: only 0 and 1 are valid */
387
388 uint64_t dmac_reg[DMAC_REGSIZE / 0x10];
389
390 uint64_t other_memory_base[N_PS2_DMA_CHANNELS];
391
392 uint32_t intr;
393 uint32_t imask;
394 uint32_t sbus_smflg;
395 };
396 #define DEV_PS2_STUFF_LENGTH 0x10000
397 int dev_ps2_stuff_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
398 struct ps2_data *dev_ps2_stuff_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
399
400 /* dev_pmagja.c: */
401 #define DEV_PMAGJA_LENGTH 0x3c0000
402 int dev_pmagja_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
403 void dev_pmagja_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr);
404
405 /* dev_px.c: */
406 struct px_data {
407 struct memory *fb_mem;
408 struct vfb_data *vfb_data;
409 int type;
410 char *px_name;
411 int irq_nr;
412 int bitdepth;
413 int xconfig;
414 int yconfig;
415
416 uint32_t intr;
417 unsigned char sram[128 * 1024];
418 };
419 /* TODO: perhaps these types are wrong? */
420 #define DEV_PX_TYPE_PX 0
421 #define DEV_PX_TYPE_PXG 1
422 #define DEV_PX_TYPE_PXGPLUS 2
423 #define DEV_PX_TYPE_PXGPLUSTURBO 3
424 #define DEV_PX_LENGTH 0x3c0000
425 int dev_px_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
426 void dev_px_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int px_type, int irq_nr);
427
428 /* dev_ram.c: */
429 #define DEV_RAM_RAM 0
430 #define DEV_RAM_MIRROR 1
431 int dev_ram_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
432 void dev_ram_init(struct memory *mem, uint64_t baseaddr, uint64_t length, int mode, uint64_t otheraddr);
433
434 /* dev_scc.c: */
435 #define DEV_SCC_LENGTH 0x1000
436 int dev_scc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
437 int dev_scc_dma_func(struct cpu *cpu, void *extra, uint64_t addr, size_t dma_len, int tx);
438 void *dev_scc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb, int scc_nr, int addrmul);
439
440 /* dev_sfb.c: */
441 #define DEV_SFB_LENGTH 0x400000
442 int dev_sfb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
443 void dev_sfb_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data);
444
445 /* dev_sgi_gbe.c: */
446 #define DEV_SGI_GBE_LENGTH 0x1000000
447 int dev_sgi_gbe_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
448 void dev_sgi_gbe_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
449
450 /* dev_sgi_ip20.c: */
451 #define DEV_SGI_IP20_LENGTH 0x40
452 #define DEV_SGI_IP20_BASE 0x1fb801c0
453 struct sgi_ip20_data {
454 int dummy;
455 };
456 int dev_sgi_ip20_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
457 struct sgi_ip20_data *dev_sgi_ip20_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr);
458
459 /* dev_sgi_ip22.c: */
460 #define DEV_SGI_IP22_LENGTH 0x100
461 #define DEV_SGI_IP22_IMC_LENGTH 0x100
462 #define DEV_SGI_IP22_UNKNOWN2_LENGTH 0x100
463 #define IP22_IMC_BASE 0x1fa00000
464 #define IP22_UNKNOWN2_BASE 0x1fb94000
465 struct sgi_ip22_data {
466 int guiness_flag;
467 uint32_t reg[DEV_SGI_IP22_LENGTH / 4];
468 uint32_t imc_reg[DEV_SGI_IP22_IMC_LENGTH / 4];
469 uint32_t unknown2_reg[DEV_SGI_IP22_UNKNOWN2_LENGTH / 4];
470 uint32_t unknown_timer;
471 };
472 int dev_sgi_ip22_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
473 struct sgi_ip22_data *dev_sgi_ip22_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int guiness_flag);
474
475 /* dev_sgi_ip30.c: */
476 #define DEV_SGI_IP30_LENGTH 0x80000
477 struct sgi_ip30_data {
478 /* ip30: */
479 uint64_t imask0; /* 0x10000 */
480 uint64_t reg_0x10018;
481 uint64_t isr; /* 0x10030 */
482 uint64_t reg_0x20000;
483 uint64_t reg_0x30000;
484
485 /* ip30_2: */
486 uint64_t reg_0x0029c;
487
488 /* ip30_3: */
489 uint64_t reg_0x00284;
490
491 /* ip30_4: */
492 uint64_t reg_0x000b0;
493
494 /* ip30_5: */
495 uint64_t reg_0x00000;
496 };
497 int dev_sgi_ip30_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
498 struct sgi_ip30_data *dev_sgi_ip30_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
499
500 /* dev_sgi_ip32.c: */
501 #define DEV_CRIME_LENGTH 0x0000000000001000
502 struct crime_data {
503 unsigned char reg[DEV_CRIME_LENGTH];
504 int irq_nr;
505 int use_fb;
506 };
507 int dev_crime_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
508 struct crime_data *dev_crime_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb);
509 #define DEV_MACE_LENGTH 0x100
510 struct mace_data {
511 unsigned char reg[DEV_MACE_LENGTH];
512 int irqnr;
513 };
514 int dev_mace_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
515 struct mace_data *dev_mace_init(struct memory *mem, uint64_t baseaddr, int irqnr);
516 #define DEV_MACEPCI_LENGTH 0x1000
517 int dev_macepci_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
518 struct pci_data *dev_macepci_init(struct memory *mem, uint64_t baseaddr, int pciirq);
519 #define DEV_SGI_MEC_LENGTH 0x1000
520 int dev_sgi_mec_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
521 void dev_sgi_mec_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, unsigned char *macaddr);
522 #define DEV_SGI_UST_LENGTH 0x10000
523 int dev_sgi_ust_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
524 void dev_sgi_ust_init(struct memory *mem, uint64_t baseaddr);
525 #define DEV_SGI_MTE_LENGTH 0x10000
526 int dev_sgi_mte_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
527 void dev_sgi_mte_init(struct memory *mem, uint64_t baseaddr);
528
529 /* dev_sii.c: */
530 #define DEV_SII_LENGTH 0x100
531 void dev_sii_tick(struct cpu *cpu, void *);
532 int dev_sii_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
533 void dev_sii_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, uint64_t buf_start, uint64_t buf_end, int irq_nr);
534
535 /* dev_ssc.c: */
536 #define DEV_SSC_LENGTH 0x1000
537 int dev_ssc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
538 void dev_ssc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb, uint32_t *);
539
540 /* dev_turbochannel.c: */
541 #define DEV_TURBOCHANNEL_LEN 0x0470
542 int dev_turbochannel_access(struct cpu *cpu, struct memory *mem,
543 uint64_t relative_addr, unsigned char *data, size_t len,
544 int writeflag, void *);
545 void dev_turbochannel_init(struct machine *machine, struct memory *mem,
546 int slot_nr, uint64_t baseaddr, uint64_t endaddr, char *device_name,
547 int irq);
548
549 /* dev_vga.c: */
550 int dev_vga_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
551 unsigned char *data, size_t len, int writeflag, void *);
552 void dev_vga_init(struct machine *machine, struct memory *mem,
553 uint64_t videomem_base, uint64_t control_base, char *name);
554
555 /* dev_vr41xx.c: */
556 #define DEV_VR41XX_LENGTH 0x800 /* TODO? */
557 struct vr41xx_data {
558 int cpumodel;
559
560 int kiu_console_handle;
561 int kiu_offset;
562 int kiu_irq_nr;
563 int kiu_int_assert;
564 int d0;
565 int d1;
566 int d2;
567 int d3;
568 int d4;
569 int d5;
570 int dont_clear_next;
571 int escape_state;
572
573 /* See icureg.h in NetBSD for more info. */
574 uint16_t sysint1;
575 uint16_t msysint1;
576 uint16_t giuint;
577 uint16_t giumask;
578 uint16_t sysint2;
579 uint16_t msysint2;
580 };
581
582 int dev_vr41xx_access(struct cpu *cpu, struct memory *mem,
583 uint64_t relative_addr, unsigned char *data, size_t len,
584 int writeflag, void *);
585 struct vr41xx_data *dev_vr41xx_init(struct machine *machine,
586 struct memory *mem, int cpumodel);
587
588 /* dev_wdc.c: */
589 #define DEV_WDC_LENGTH 0x8
590 int dev_wdc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
591 void dev_wdc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int base_drive);
592
593 /* dev_wdsc.c: */
594 #define DEV_WDSC_NREGS 0x100 /* 8-bit register select */
595 #define DEV_WDSC_LENGTH 0x10
596 int dev_wdsc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
597 void dev_wdsc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int controller_nr, int irq_nr);
598
599 /* dev_zs.c: */
600 #define DEV_ZS_LENGTH 0x10
601 int dev_zs_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
602 unsigned char *data, size_t len, int writeflag, void *);
603 int dev_zs_init(struct machine *machine, struct memory *mem, uint64_t baseaddr,
604 int irq_nr, int addrmult, char *name);
605
606 /* lk201.c: */
607 struct lk201_data {
608 int use_fb;
609 int console_handle;
610
611 void (*add_to_rx_queue)(void *,int,int);
612 void *add_data;
613
614 unsigned char keyb_buf[8];
615 int keyb_buf_pos;
616
617 int mouse_mode;
618 int mouse_revision; /* 0..15 */
619 int mouse_x, mouse_y, mouse_buttons;
620
621 int old_host_mouse_x;
622 int old_host_mouse_y;
623 int old_host_mouse_stays_put;
624 int mouse_check_interval;
625 int mouse_check_interval_reset;
626 };
627 void lk201_tick(struct lk201_data *);
628 void lk201_tx_data(struct lk201_data *, int port, int idata);
629 void lk201_init(struct lk201_data *d, int use_fb,
630 void (*add_to_rx_queue)(void *,int,int), int console_handle, void *);
631
632
633 #endif /* DEVICES_H */
634

  ViewVC Help
Powered by ViewVC 1.1.26