--- trunk/src/devices/dev_dc7085.c 2007/10/08 16:22:20 41 +++ trunk/src/devices/dev_dc7085.c 2007/10/08 16:22:32 42 @@ -25,9 +25,9 @@ * SUCH DAMAGE. * * - * $Id: dev_dc7085.c,v 1.60 2006/12/31 21:35:26 debug Exp $ + * $Id: dev_dc7085.c,v 1.62 2007/06/15 18:44:19 debug Exp $ * - * DC7085 serial controller, used in some DECstation models. + * COMMENT: DC7085 serial controller, used in some DECstation models */ #include @@ -161,9 +161,9 @@ DEVICE_ACCESS(dc7085) { + struct dc_data *d = extra; uint64_t idata = 0, odata = 0; size_t i; - struct dc_data *d = extra; if (writeflag == MEM_WRITE) idata = memory_readmax64(cpu, data, len); @@ -172,6 +172,7 @@ d->regs.dc_csr &= ~CSR_CLR; switch (relative_addr) { + case 0x00: /* CSR: Control and Status */ if (writeflag == MEM_WRITE) { debug("[ dc7085 write to CSR: 0x%04x ]\n", idata); @@ -191,6 +192,7 @@ odata = d->regs.dc_csr; } break; + case 0x08: /* LPR: */ if (writeflag == MEM_WRITE) { debug("[ dc7085 write to LPR: 0x%04x ]\n", idata); @@ -226,6 +228,7 @@ d->just_transmitted_something = 4; } break; + case 0x10: /* TCR: */ if (writeflag == MEM_WRITE) { /* fatal("[ dc7085 write to TCR: 0x%04x) ]\n", @@ -241,6 +244,7 @@ odata = d->regs.dc_tcr; } break; + case 0x18: /* Modem status (R), transmit data (W) */ if (writeflag == MEM_WRITE) { int line_no = (d->regs.dc_csr >> @@ -262,6 +266,7 @@ odata = d->regs.dc_msr_tdr; } break; + default: if (writeflag==MEM_READ) { debug("[ dc7085 read from 0x%08lx ]\n", @@ -297,11 +302,7 @@ { struct dc_data *d; - d = malloc(sizeof(struct dc_data)); - if (d == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } + CHECK_ALLOCATION(d = malloc(sizeof(struct dc_data))); memset(d, 0, sizeof(struct dc_data)); INTERRUPT_CONNECT(irq_path, d->irq); @@ -317,7 +318,7 @@ memory_device_register(mem, "dc7085", baseaddr, DEV_DC7085_LENGTH, dev_dc7085_access, d, DM_DEFAULT, NULL); machine_add_tickfunction(machine, dev_dc7085_tick, d, - DC_TICK_SHIFT, 0.0); + DC_TICK_SHIFT); return d->console_handle; }