dev_dreamcast_maple.cc Source File

Back to the index.

dev_dreamcast_maple.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2014 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * COMMENT: Dreamcast Maple bus controller
29  *
30  * The Maple bus has 4 ports (A-D), and each port has up to 6 possible "units"
31  * (where unit 0 is the main unit). Communication is done using DMA; each
32  * DMA transfer sends one or more requests, and for each of these requests
33  * a response is generated (or a timeout if there was no device at the
34  * specific port).
35  *
36  * See Marcus Comstedt's page (http://mc.pp.se/dc/maplebus.html) for more
37  * details about the DMA request/responses.
38  *
39  *
40  * TODO:
41  * Unit numbers / IDs for real Maple devices.
42  * The Controller (up/down/left/right, buttons, etc).
43  */
44 
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48 #include <sys/time.h>
49 
50 #include "console.h"
51 #include "cpu.h"
52 #include "device.h"
53 #include "machine.h"
54 #include "memory.h"
55 #include "misc.h"
56 
59 
60 
61 // #define debug fatal
62 
63 #define N_MAPLE_PORTS 4
64 
65 #define MAX_CHARS 8192
66 #define MAX_CONTROLLER_DATA 4096
67 
68 #define MAPLE_TICK_SHIFT 17
69 
70 struct maple_device {
71  struct maple_devinfo devinfo;
72 };
73 
75  /* Registers: */
76  uint32_t dmaaddr;
77  int enable;
78  int timeout;
79 
80  /* Attached devices: */
82 
83  /* For keyboard/controller input: */
89 };
90 
91 
92 /*
93  * Maple devices:
94  *
95  * TODO: Figure out strings and numbers of _real_ Maple devices.
96  */
98  {
100  { LE32_TO_HOST(0xfe060f00),0,0 },/* di_function_data[3] */
101  0xff, /* di_area_code */
102  0, /* di_connector_direction */
103  "Dreamcast Controller", /* di_product_name */
104  "di_product_license", /* di_product_license */
105  LE16_TO_HOST(0x01ae), /* di_standby_power */
106  LE16_TO_HOST(0x01f4) /* di_max_power */
107  }
108 };
110  {
112  { LE32_TO_HOST(2),0,0 }, /* di_function_data[3] */
113  0xff, /* di_area_code */
114  0, /* di_connector_direction */
115  "Keyboard", /* di_product_name */
116  "di_product_license", /* di_product_license */
117  LE16_TO_HOST(100), /* di_standby_power */
118  LE16_TO_HOST(100) /* di_max_power */
119  }
120 };
122  {
123  BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_MOUSE)),/* di_func */
124  { LE32_TO_HOST(0xfe060f00),0,0 },/* di_function_data[3] */
125  0xff, /* di_area_code */
126  0, /* di_connector_direction */
127  "Dreamcast Mouse", /* di_product_name */
128  "di_product_license", /* di_product_license */
129  LE16_TO_HOST(0x0069), /* di_standby_power */
130  LE16_TO_HOST(0x0120) /* di_max_power */
131  }
132 };
133 
134 
136 {
137  struct dreamcast_maple_data *d = (struct dreamcast_maple_data *) extra;
138  int key;
139 
140  while ((key = console_readchar(d->console_handle)) >= 0) {
141  /* Add to the keyboard queue: */
142  d->char_queue[d->char_queue_head] = key;
143  d->char_queue_head = (d->char_queue_head + 1) % MAX_CHARS;
144  if (d->char_queue_head == d->char_queue_tail)
145  fatal("[ dreamcast_maple: KEYBOARD QUEUE OVERRUN! ]\n");
146 
147  /*
148  * NOTE/TODO:
149  *
150  * Implement the controller in a reasonable way!
151  * Theoretically, there are all of these buttons: ABCD XYZ Start
152  * and two digital pads, two analog joysticks, and two
153  * analog fire buttons (left and right).
154  */
155 
156  int control_bits = 0;
157  switch (key) {
158  case 'a':
159  case 'A':
160  control_bits = 0x0004;
161  break;
162  case 'b':
163  case 'B':
164  control_bits = 0x0002;
165  break;
166  case 'c':
167  case 'C':
168  control_bits = 0x0001;
169  break;
170  case 'd':
171  case 'D':
172  control_bits = 0x0800;
173  break;
174 
175  case 'x':
176  case 'X':
177  control_bits = 0x0400;
178  break;
179  case 'y':
180  case 'Y':
181  control_bits = 0x0200;
182  break;
183  case 'z':
184  case 'Z':
185  control_bits = 0x0100;
186  break;
187 
188  case 's':
189  case 'S': /* Start */
190  control_bits = 0x0008;
191  break;
192 
193  case '8': /* up */
194  control_bits = 0x0010;
195  break;
196  case '2': /* down */
197  case 'k':
198  control_bits = 0x0020;
199  break;
200  case '4': /* left */
201  case 'u':
202  control_bits = 0x0040;
203  break;
204  case '6': /* right */
205  case 'o':
206  control_bits = 0x0080;
207  break;
208  }
209 
210  if (control_bits != 0) {
211  /* Add to the controller queue: */
212  d->controller_queue[d->controller_queue_head] = control_bits;
216  fatal("[ dreamcast_maple: CONTROLLER QUEUE "
217  "OVERRUN! ]\n");
218  }
219  }
220 }
221 
222 
223 static int get_key(struct dreamcast_maple_data *d)
224 {
225  int key = d->char_queue[d->char_queue_tail];
226  if (d->char_queue_head == d->char_queue_tail)
227  return -1;
228 
229  d->char_queue_tail = (d->char_queue_tail + 1) % MAX_CHARS;
230  return key;
231 }
232 
233 
234 static int get_controller(struct dreamcast_maple_data *d)
235 {
238  return 0;
239 
242  return c;
243 }
244 
245 
246 /*
247  * maple_getcond_controller_response():
248  *
249  * Generate a controller response. Based on info from Marcus
250  * Comstedt's page: http://mc.pp.se/dc/controller.html
251  */
252 static void maple_getcond_controller_response(struct dreamcast_maple_data *d,
253  struct cpu *cpu, int port, uint32_t receive_addr)
254 {
255  uint8_t buf[8];
256  uint32_t response_code, transfer_code;
257  int c;
258 
259  transfer_code = (MAPLE_RESPONSE_DATATRF << 24) |
260  (((port << 6) | 0x20) << 16) |
261  ((port << 6) << 8) |
262  3 /* Transfer length in 32-bit words */;
263  transfer_code = BE32_TO_HOST(transfer_code);
264  cpu->memory_rw(cpu, cpu->mem, receive_addr, (unsigned char *) (void *) &transfer_code,
266  receive_addr += 4;
267 
268  response_code = BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_CONTROLLER));
269  cpu->memory_rw(cpu, cpu->mem, receive_addr, (unsigned char *) (void *) &response_code,
271  receive_addr += 4;
272 
273  /* NOTE: Inverse of the buttons pressed! */
274  c = ~get_controller(d);
275 
276  /*
277  * buf[0..1] = little endian button bitfield
278  * buf[2] = right analogue trigger (0-255)
279  * buf[3] = left analogue trigger (0-255)
280  * buf[4] = analogue joystick X (0-255)
281  * buf[5] = analogue joystick Y (0-255)
282  * buf[6] = second analogue joystick X (0-255)
283  * buf[7] = second analogue joystick Y (0-255)
284  */
285  memset(buf, 0, 8);
286  buf[0] = c & 0xff;
287  buf[1] = c >> 8;
288  buf[2] = buf[3] = 0; // 0 = not pressed
289  buf[4] = buf[5] = buf[6] = buf[7] = 128; // 128 = centered
290 
291  cpu->memory_rw(cpu, cpu->mem, receive_addr, (unsigned char *) (void *) &buf, 8,
293 }
294 
295 
296 /*
297  * maple_getcond_keyboard_response():
298  *
299  * Generate a keyboard key-press response. Based on info from Marcus
300  * Comstedt's page: http://mc.pp.se/dc/kbd.html
301  */
302 static void maple_getcond_keyboard_response(struct dreamcast_maple_data *d,
303  struct cpu *cpu, int port, uint32_t receive_addr)
304 {
305  int key;
306  uint8_t buf[8];
307  uint32_t response_code, transfer_code;
308 
309  transfer_code = (MAPLE_RESPONSE_DATATRF << 24) |
310  (((port << 6) | 0x20) << 16) |
311  ((port << 6) << 8) |
312  3 /* Transfer length in 32-bit words */;
313  transfer_code = BE32_TO_HOST(transfer_code);
314  cpu->memory_rw(cpu, cpu->mem, receive_addr, (unsigned char *) (void *) &transfer_code,
316  receive_addr += 4;
317 
318  response_code = BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_KEYBOARD));
319  cpu->memory_rw(cpu, cpu->mem, receive_addr, (unsigned char *) (void *) &response_code,
321  receive_addr += 4;
322 
323  key = get_key(d);
324 
325  /*
326  * buf[0] = shift keys (1 = left ctrl, 2 = shift, 0x10 = right ctrl)
327  * buf[1] = led state
328  * buf[2] = key
329  */
330  memset(buf, 0, 8);
331 
332  if (key >= 'a' && key <= 'z') buf[2] = 4 + key - 'a';
333  if (key >= 'A' && key <= 'Z') buf[0] = 2, buf[2] = 4 + key - 'A';
334  if (key >= 1 && key <= 26) buf[0] = 1, buf[2] = 4 + key - 1;
335  if (key >= '1' && key <= '9') buf[2] = 0x1e + key - '1';
336  if (key == '!') buf[0] = 2, buf[2] = 0x1e;
337  if (key == '"') buf[0] = 2, buf[2] = 0x1f;
338  if (key == '#') buf[0] = 2, buf[2] = 0x20;
339  if (key == '$') buf[0] = 2, buf[2] = 0x21;
340  if (key == '%') buf[0] = 2, buf[2] = 0x22;
341  if (key == '^') buf[0] = 2, buf[2] = 0x23;
342  if (key == '&') buf[0] = 2, buf[2] = 0x24;
343  if (key == '*') buf[0] = 2, buf[2] = 0x25;
344  if (key == '(') buf[0] = 2, buf[2] = 0x26;
345  if (key == '@') buf[0] = 2, buf[2] = 0x1f;
346  if (key == '\n' || key == '\r') buf[0] = 0, buf[2] = 0x28;
347  if (key == ')') buf[0] = 2, buf[2] = 0x27;
348  if (key == '\b') buf[0] = 0, buf[2] = 0x2a;
349  if (key == '\t') buf[0] = 0, buf[2] = 0x2b;
350  if (key == ' ') buf[0] = 0, buf[2] = 0x2c;
351  if (key == '0') buf[2] = 0x27;
352  if (key == 27) buf[2] = 0x29;
353  if (key == '-') buf[2] = 0x2d;
354  if (key == '=') buf[2] = 0x2e;
355  if (key == '[') buf[2] = 0x2f;
356  if (key == '\\') buf[2] = 0x31;
357  if (key == '|') buf[2] = 0x31, buf[0] = 2;
358  if (key == ']') buf[2] = 0x32;
359  if (key == ';') buf[2] = 0x33;
360  if (key == ':') buf[2] = 0x34;
361  if (key == ',') buf[2] = 0x36;
362  if (key == '.') buf[2] = 0x37;
363  if (key == '/') buf[2] = 0x38;
364  if (key == '<') buf[2] = 0x36, buf[0] = 2;
365  if (key == '>') buf[2] = 0x37, buf[0] = 2;
366  if (key == '?') buf[2] = 0x38, buf[0] = 2;
367  if (key == '+') buf[2] = 0x57;
368 
369  cpu->memory_rw(cpu, cpu->mem, receive_addr, (unsigned char *) (void *) &buf, 8,
371 }
372 
373 
374 /*
375  * maple_do_dma_xfer():
376  *
377  * Perform a DMA transfer. enable should be 1, and dmaaddr should point to
378  * the memory to transfer.
379  */
381 {
382  uint32_t addr = d->dmaaddr;
383 
384  if (!d->enable) {
385  debug("[ maple_do_dma_xfer: not enabled? ]\n");
386  return;
387  }
388 
389  /* debug("[ dreamcast_maple: DMA transfer, dmaaddr = "
390  "0x%08" PRIx32" ]\n", addr); */
391 
392  /*
393  * DMA transfers must be 32-byte aligned, according to Marcus
394  * Comstedt's Maple demo program.
395  */
396  if (addr & 0x1f) {
397  fatal("[ dreamcast_maple: dmaaddr 0x%08" PRIx32" is NOT"
398  " 32-byte aligned; aborting ]\n", addr);
399  return;
400  }
401 
402  /*
403  * Handle one or more requests/responses:
404  *
405  * (This is "reverse engineered" from Comstedt's maple demo program;
406  * it might not be good enough to emulate how the Maple is being
407  * used by other programs.)
408  */
409  for (;;) {
410  uint32_t receive_addr, response_code, cond;
411  int datalen, port, last_message, cmd, to, from, datalen_cmd;
412  int unit;
413  uint8_t buf[8];
414 
415  /* Read the message' two control words: */
416  cpu->memory_rw(cpu, cpu->mem, addr, (unsigned char *) (void *) &buf, 8, MEM_READ,
418  addr += 8;
419 
420  datalen = buf[0] * sizeof(uint32_t);
421  if (buf[1] & 2) {
422  fatal("[ dreamcast_maple: TODO: GUN bit. ]\n");
423  /* TODO: Set some bits in A05F80C4 to indicate
424  which raster position a lightgun is pointing
425  at! */
426  exit(1);
427  }
428  port = buf[2];
429  last_message = buf[3] & 0x80;
430  receive_addr = buf[4] + (buf[5] << 8) + (buf[6] << 16)
431  + (buf[7] << 24);
432 
433  if (receive_addr & 0xe000001f)
434  fatal("[ dreamcast_maple: WARNING! receive address 0x"
435  "%08" PRIx32" isn't valid! ]\n", receive_addr);
436 
437  /* Read the command word for this message: */
438  cpu->memory_rw(cpu, cpu->mem, addr, (unsigned char *) (void *) &buf, 4, MEM_READ,
440  addr += 4;
441 
442  cmd = buf[0];
443  to = buf[1];
444  from = buf[2];
445  datalen_cmd = buf[3];
446 
447  /* Decode the unit number: */
448  unit = 0;
449  switch (to & 0x3f) {
450  case 0x00:
451  case 0x20: unit = 0; break;
452  case 0x01: unit = 1; break;
453  case 0x02: unit = 2; break;
454  case 0x04: unit = 3; break;
455  case 0x08: unit = 4; break;
456  case 0x10: unit = 5; break;
457  default: fatal("[ dreamcast_maple: ERROR! multiple "
458  "units? Not yet implemented. to = 0x%02x ]\n", to);
459  exit(1);
460  }
461 
462  /* fatal("[ dreamcast_maple: cmd=0x%02x, port=%c, unit=%i"
463  ", datalen=%i words. receive_addr=0x%08x ]\n",
464  cmd, port+'A', unit, datalen_cmd, receive_addr); */
465 
466  /*
467  * Handle the command:
468  */
469  switch (cmd) {
470 
472  if (d->device[port] == NULL || unit != 0) {
473  /* No device present: Timeout. */
474  /* debug("[ dreamcast_maple: response="
475  "timeout ]\n"); */
476  response_code = (uint32_t) -1;
477  response_code = LE32_TO_HOST(response_code);
478  cpu->memory_rw(cpu, cpu->mem, receive_addr,
479  (unsigned char *) (void *) &response_code, 4, MEM_WRITE,
481  } else {
482  /* Device present: */
483  unsigned int i;
484  struct maple_devinfo *di =
485  &d->device[port]->devinfo;
486  /* debug("[ dreamcast_maple: response="
487  "\"%s\" ]\n", di->di_product_name); */
488  response_code = MAPLE_RESPONSE_DEVINFO |
489  (((port << 6) | 0x20) << 8) |
490  ((port << 6) << 16) |
491  ((sizeof(struct maple_devinfo) /
492  sizeof(uint32_t)) << 24);
493  response_code = LE32_TO_HOST(response_code);
494  cpu->memory_rw(cpu, cpu->mem, receive_addr,
495  (unsigned char *) (void *) &response_code, 4, MEM_WRITE,
497  for (i=0; i<sizeof(struct maple_devinfo); i++)
498  cpu->memory_rw(cpu, cpu->mem,
499  receive_addr + 4 + i, (unsigned
500  char *) di + i, 1, MEM_WRITE,
502  }
503  break;
504 
506  cpu->memory_rw(cpu, cpu->mem, addr, (unsigned char *) (void *) &buf, 4,
508  cond = buf[3] + (buf[2] << 8) + (buf[1] << 16)
509  + (buf[0] << 24);
511  maple_getcond_controller_response(
512  d, cpu, port, receive_addr);
513  } else if (cond & MAPLE_FUNC(MAPLE_FN_KEYBOARD)) {
514  maple_getcond_keyboard_response(
515  d, cpu, port, receive_addr);
516  } else {
517  fatal("[ dreamcast_maple: WARNING: GETCOND: "
518  "UNIMPLEMENTED 0x%08" PRIx32" ]\n", cond);
519  exit(1);
520  }
521  break;
522 
524  fatal("[ dreamcast_maple: BWRITE: TODO ]\n");
525  break;
526 
527  default:fatal("[ dreamcast_maple: command %i: TODO ]\n", cmd);
528  exit(1);
529  }
530 
531  addr += datalen_cmd * 4;
532 
533  /* Last request? Then stop. */
534  if (last_message)
535  break;
536  }
537 
538  // TODO: Should the DMA address be updated?
539  d->dmaaddr = addr;
540 
541  /* Assert the SYSASIC_EVENT_MAPLE_DMADONE event: */
543 }
544 
545 
546 DEVICE_ACCESS(dreamcast_maple)
547 {
548  struct dreamcast_maple_data *d = (struct dreamcast_maple_data *) extra;
549  uint64_t idata = 0, odata = 0;
550 
551  if (writeflag == MEM_WRITE)
552  idata = memory_readmax64(cpu, data, len);
553 
554  switch (relative_addr) {
555 
556  case 0x04: /* MAPLE_DMAADDR */
557  if (writeflag == MEM_WRITE) {
558  d->dmaaddr = idata;
559  /* debug("[ dreamcast_maple: dmaaddr set to 0x%08x"
560  " ]\n", d->dmaaddr); */
561  } else {
562  fatal("[ dreamcast_maple: TODO: read from dmaaddr ]\n");
563  odata = d->dmaaddr;
564  exit(1);
565  }
566  break;
567 
568  case 0x10: /* MAPLE_RESET2 */
569  if (writeflag == MEM_WRITE && idata != 0)
570  fatal("[ dreamcast_maple: UNIMPLEMENTED reset2 value"
571  " 0x%08x ]\n", (int)idata);
572  break;
573 
574  case 0x14: /* MAPLE_ENABLE */
575  if (writeflag == MEM_WRITE)
576  d->enable = idata;
577  else
578  odata = d->enable;
579  break;
580 
581  case 0x18: /* MAPLE_STATE */
582  if (writeflag == MEM_WRITE) {
583  switch (idata) {
584  case 0: break;
585  case 1: maple_do_dma_xfer(cpu, d);
586  break;
587  default:fatal("[ dreamcast_maple: UNIMPLEMENTED "
588  "state value %i ]\n", (int)idata);
589  }
590  } else {
591  /* Always return 0 to indicate DMA xfer complete. */
592  odata = 0;
593  }
594  break;
595 
596  case 0x80: /* MAPLE_SPEED */
597  if (writeflag == MEM_WRITE) {
598  d->timeout = (idata >> 16) & 0xffff;
599  /* TODO: Bits 8..9 are "speed", but only the value
600  0 (indicating 2 Mbit/s) should be used. */
601  debug("[ dreamcast_maple: timeout set to %i ]\n",
602  d->timeout);
603  } else {
604  odata = d->timeout << 16;
605  }
606  break;
607 
608  case 0x8c: /* MAPLE_RESET */
609  if (writeflag == MEM_WRITE) {
610  if (idata != 0x6155404f && idata != 0x61557f00)
611  fatal("[ dreamcast_maple: UNIMPLEMENTED reset "
612  "value 0x%08x ]\n", (int)idata);
613  d->enable = 0;
614  }
615  break;
616 
617  case 0xe8: /* UNKNOWN_0xe8 */
618  if (writeflag == MEM_WRITE) {
619  // The Dreamcast PROM writes 1 here.
620  if (idata != 1) {
621  fatal("[ dreamcast_maple: UNIMPLEMENTED 0xe8 "
622  "value 0x%08x ]\n", (int)idata);
623  }
624  }
625  break;
626 
627  default:if (writeflag == MEM_READ) {
628  fatal("[ dreamcast_maple: UNIMPLEMENTED read from "
629  "addr 0x%x ]\n", (int)relative_addr);
630  } else {
631  fatal("[ dreamcast_maple: UNIMPLEMENTED write to addr "
632  "0x%x: 0x%x ]\n", (int)relative_addr, (int)idata);
633  }
634  }
635 
636  if (writeflag == MEM_READ)
637  memory_writemax64(cpu, data, len, odata);
638 
639  return 1;
640 }
641 
642 
643 DEVINIT(dreamcast_maple)
644 {
645  struct dreamcast_maple_data *d;
646 
647  CHECK_ALLOCATION(d = (struct dreamcast_maple_data *) malloc(sizeof(struct dreamcast_maple_data)));
648  memset(d, 0, sizeof(struct dreamcast_maple_data));
649 
651  0x5f6c00, 0x100, dev_dreamcast_maple_access, d, DM_DEFAULT, NULL);
652 
653  /* Devices connected to port A..D: */
655  d->device[1] = NULL;
656  d->device[2] = &maple_device_keyboard;
657  d->device[3] = NULL; /* TODO: &maple_device_mouse; */
658 
660  devinit->machine, "maple", 1);
662 
663  machine_add_tickfunction(devinit->machine, dev_maple_tick, d,
665 
666  return 1;
667 }
668 
dreamcast_maple_data::device
struct maple_device * device[N_MAPLE_PORTS]
Definition: dev_dreamcast_maple.cc:81
data
u_short data
Definition: siireg.h:79
dreamcast_sysasicvar.h
debug
#define debug
Definition: dev_adb.cc:57
MAPLE_TICK_SHIFT
#define MAPLE_TICK_SHIFT
Definition: dev_dreamcast_maple.cc:68
MAX_CHARS
#define MAX_CHARS
Definition: dev_dreamcast_maple.cc:65
MAPLE_COMMAND_BWRITE
#define MAPLE_COMMAND_BWRITE
Definition: dreamcast_maple.h:97
memory_device_register
void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
Definition: memory.cc:339
MEM_READ
#define MEM_READ
Definition: memory.h:116
console_start_slave_inputonly
int console_start_slave_inputonly(struct machine *machine, const char *consolename, int use_for_input)
Definition: console.cc:719
DM_DEFAULT
#define DM_DEFAULT
Definition: memory.h:130
devinit::machine
struct machine * machine
Definition: device.h:41
console.h
LE32_TO_HOST
#define LE32_TO_HOST(x)
Definition: misc.h:180
addr
uint32_t addr
Definition: tmp_arm_multi.cc:52
MAPLE_RESPONSE_DATATRF
#define MAPLE_RESPONSE_DATATRF
Definition: dreamcast_maple.h:93
DEVINIT
DEVINIT(dreamcast_maple)
Definition: dev_dreamcast_maple.cc:643
device.h
BE32_TO_HOST
#define BE32_TO_HOST(x)
Definition: misc.h:181
dreamcast_maple_data::controller_queue
uint16_t controller_queue[MAX_CONTROLLER_DATA]
Definition: dev_dreamcast_maple.cc:86
dreamcast_maple_data::char_queue_tail
int char_queue_tail
Definition: dev_dreamcast_maple.cc:87
cmd
Definition: debugger_cmds.cc:1189
MEM_WRITE
#define MEM_WRITE
Definition: memory.h:117
maple_devinfo
Definition: dreamcast_maple.h:115
dreamcast_maple_data::dmaaddr
uint32_t dmaaddr
Definition: dev_dreamcast_maple.cc:76
MAPLE_RESPONSE_DEVINFO
#define MAPLE_RESPONSE_DEVINFO
Definition: dreamcast_maple.h:90
machine_add_tickfunction
void machine_add_tickfunction(struct machine *machine, void(*func)(struct cpu *, void *), void *extra, int clockshift)
Definition: machine.cc:280
dreamcast_maple_data::timeout
int timeout
Definition: dev_dreamcast_maple.cc:78
PHYSICAL
#define PHYSICAL
Definition: memory.h:126
fatal
void fatal(const char *fmt,...)
Definition: main.cc:152
misc.h
memory_readmax64
uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len)
Definition: memory.cc:55
machine.h
dreamcast_maple_data::console_handle
int console_handle
Definition: dev_dreamcast_maple.cc:84
machine::main_console_handle
int main_console_handle
Definition: machine.h:128
MAPLE_COMMAND_DEVINFO
#define MAPLE_COMMAND_DEVINFO
Definition: dreamcast_maple.h:86
console_readchar
int console_readchar(int handle)
Definition: console.cc:390
devinit::name
char * name
Definition: device.h:43
MAX_CONTROLLER_DATA
#define MAX_CONTROLLER_DATA
Definition: dev_dreamcast_maple.cc:66
maple_device_controller
struct maple_device maple_device_controller
Definition: dev_dreamcast_maple.cc:97
N_MAPLE_PORTS
#define N_MAPLE_PORTS
Definition: dev_dreamcast_maple.cc:63
MAPLE_FN_CONTROLLER
#define MAPLE_FN_CONTROLLER
Definition: dreamcast_maple.h:102
DEVICE_ACCESS
DEVICE_ACCESS(dreamcast_maple)
Definition: dev_dreamcast_maple.cc:546
devinit
Definition: device.h:40
cpu.h
dreamcast_maple_data::controller_queue_tail
int controller_queue_tail
Definition: dev_dreamcast_maple.cc:88
cond
char * cond[16]
Definition: generate_arm_dpi.c:30
dreamcast_maple_data::char_queue_head
int char_queue_head
Definition: dev_dreamcast_maple.cc:87
dreamcast_maple_data::enable
int enable
Definition: dev_dreamcast_maple.cc:77
machine::memory
struct memory * memory
Definition: machine.h:126
cpu::mem
struct memory * mem
Definition: cpu.h:362
maple_device_keyboard
struct maple_device maple_device_keyboard
Definition: dev_dreamcast_maple.cc:109
dreamcast_maple_data::char_queue
uint8_t char_queue[MAX_CHARS]
Definition: dev_dreamcast_maple.cc:85
maple_device::devinfo
struct maple_devinfo devinfo
Definition: dev_dreamcast_maple.cc:71
SYSASIC_EVENT_MAPLE_DMADONE
#define SYSASIC_EVENT_MAPLE_DMADONE
Definition: dreamcast_sysasicvar.h:60
NO_EXCEPTIONS
#define NO_EXCEPTIONS
Definition: memory.h:125
maple_device
Definition: dev_dreamcast_maple.cc:70
MAPLE_FN_MOUSE
#define MAPLE_FN_MOUSE
Definition: dreamcast_maple.h:111
dreamcast_maple_data
Definition: dev_dreamcast_maple.cc:74
LE16_TO_HOST
#define LE16_TO_HOST(x)
Definition: misc.h:172
SYSASIC_TRIGGER_EVENT
#define SYSASIC_TRIGGER_EVENT(e)
Definition: dreamcast_sysasicvar.h:77
MAPLE_COMMAND_GETCOND
#define MAPLE_COMMAND_GETCOND
Definition: dreamcast_maple.h:94
memory_writemax64
void memory_writemax64(struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
Definition: memory.cc:89
cpu
Definition: cpu.h:326
MAPLE_FN_KEYBOARD
#define MAPLE_FN_KEYBOARD
Definition: dreamcast_maple.h:108
maple_do_dma_xfer
void maple_do_dma_xfer(struct cpu *cpu, struct dreamcast_maple_data *d)
Definition: dev_dreamcast_maple.cc:380
cpu::memory_rw
int(* memory_rw)(struct cpu *cpu, struct memory *mem, uint64_t vaddr, unsigned char *data, size_t len, int writeflag, int cache_flags)
Definition: cpu.h:368
DEVICE_TICK
DEVICE_TICK(maple)
Definition: dev_dreamcast_maple.cc:135
MAPLE_FUNC
#define MAPLE_FUNC(fn)
Definition: dreamcast_maple.h:113
dreamcast_maple.h
memory.h
dreamcast_maple_data::controller_queue_head
int controller_queue_head
Definition: dev_dreamcast_maple.cc:88
maple_device_mouse
struct maple_device maple_device_mouse
Definition: dev_dreamcast_maple.cc:121
CHECK_ALLOCATION
#define CHECK_ALLOCATION(ptr)
Definition: misc.h:239

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18