static void write_control_reg (struct hw *me, struct mn103ser *serial, unsigned_word serial_reg, const void *source, unsigned nr_bytes) { unsigned16 val = LE2H_2 (*(unsigned16 *)source); /* really allow 1 byte write, too */ if ( nr_bytes == 2 ) { if ( serial_reg == 2 && (val & 0x0C04) != 0 ) { hw_abort(me, "Cannot write to read-only bits of SC2CTR."); } else { serial->device[serial_reg].control = val; } } else { hw_abort (me, "bad read size of %d bytes from SC%dSTR.", nr_bytes, serial_reg); } }
static unsigned mn103cpu_io_write_buffer (struct hw *me, const void *source, int space, unsigned_word base, unsigned nr_bytes) { struct mn103cpu *controller = hw_data (me); unsigned16 val; enum mn103cpu_regs reg; if (nr_bytes != 2) hw_abort (me, "must be two byte write"); reg = decode_mn103cpu_addr (me, controller, base); val = LE2H_2 (* (unsigned16 *) source); switch (reg) { case IVR0_REG: case IVR1_REG: case IVR2_REG: case IVR3_REG: case IVR4_REG: case IVR5_REG: case IVR6_REG: controller->interrupt_vector[reg - IVR0_REG] = val; HW_TRACE ((me, "ivr%d = 0x%04lx", reg - IVR0_REG, (long) val)); break; default: /* just ignore the write */ break; } return nr_bytes; }