--- trunk/src/devices/dev_asc.c 2007/10/08 16:20:26 28 +++ trunk/src/devices/dev_asc.c 2007/10/08 16:21:17 34 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2006 Anders Gavare. All rights reserved. + * Copyright (C) 2003-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: dev_asc.c,v 1.81 2006/07/21 16:55:41 debug Exp $ + * $Id: dev_asc.c,v 1.84 2006/12/31 21:35:26 debug Exp $ * * 'asc' SCSI controller for some DECstation/DECsystem models and PICA-61. * @@ -101,8 +101,8 @@ int mode; void *turbochannel; - int irq_nr; - int irq_caused_last_time; + struct interrupt irq; + int irq_asserted; /* Current state and transfer: */ int cur_state; @@ -155,9 +155,12 @@ DEVICE_TICK(asc) { struct asc_data *d = extra; + int new_assert = d->reg_ro[NCR_STAT] & NCRSTAT_INT; - if (d->reg_ro[NCR_STAT] & NCRSTAT_INT) - cpu_interrupt(cpu, d->irq_nr); + if (new_assert && !d->irq_asserted) + INTERRUPT_ASSERT(d->irq); + + d->irq_asserted = new_assert; } @@ -1196,7 +1199,8 @@ d->reg_ro[NCR_STAT] = PHASE_COMMAND; } - cpu_interrupt_ack(cpu, d->irq_nr); + INTERRUPT_DEASSERT(d->irq); + d->irq_asserted = 0; } if (regnr == NCR_CFG1) { @@ -1226,8 +1230,7 @@ * Register an 'asc' device. */ void dev_asc_init(struct machine *machine, struct memory *mem, - uint64_t baseaddr, int irq_nr, void *turbochannel, - int mode, + uint64_t baseaddr, char *irq_path, void *turbochannel, int mode, size_t (*dma_controller)(void *dma_controller_data, unsigned char *data, size_t len, int writeflag), void *dma_controller_data) @@ -1240,7 +1243,8 @@ exit(1); } memset(d, 0, sizeof(struct asc_data)); - d->irq_nr = irq_nr; + + INTERRUPT_CONNECT(irq_path, d->irq); d->turbochannel = turbochannel; d->mode = mode;