Download C - Oracle Documentation

Transcript
9
status = xsp->regp->csr;
if (!(status & INTERRUPTING)) {
mutex_exit(&xsp->mu);
return (DDI_INTR_UNCLAIMED);
}
/* Get the buf responsible for this interrupt */
bp = xsp->bp;
xsp->bp = NULL;
/*
* This example is for a simple device which either
* succeeds or fails the data transfer, indicated in the
* command/status register.
*/
if (status & DEVICE_ERROR) {
/* failure */
bp->b_resid = bp->b_bcount;
bioerror(bp, EIO);
} else {
/* success */
bp->b_resid = 0;
}
xsp->regp->csr = CLEAR_INTERRUPT;
/* Read the csr to flush any hardware store buffers */
temp = xsp->regp->csr;
/* The transfer has finished, successfully or not */
biodone(bp);
release any resources used in the transfer, such as DMA resources (ddi_dma_free(9F))
/* Let the next I/O thread have access to the device */
xsp->busy = 0;
mutex_exit(&xsp->mu);
(void) xxstart((caddr_t xsp);
return (DDI_INTR_CLAIMED);
}
Miscellaneous Entry Points
dump( )
The dump(9E) entry point is used to dump a portion of virtual address space
directly to the specified device in the case of a system failure.
188
Writing Device Drivers—August, 1994