24.10.2014 Views

Writing Drivers for NetBSD - of index.html

Writing Drivers for NetBSD - of index.html

Writing Drivers for NetBSD - of index.html

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A RF.C 70<br />

i = (rf_sc->sc_state & RFS_DENS) == 0<br />

? RX2_BYTE_SD : RX2_BYTE_DD;<br />

disk_unbusy(&rf_sc->sc_disk, i, 1);<br />

bus_dmamap_unload(rfc_sc->sc_dmat, rfc_sc->sc_dmam);<br />

/* check <strong>for</strong> errors */<br />

if ((bus_space_read_2(rfc_sc->sc_iot, rfc_sc->sc_ioh,<br />

RX2CS) & RX2CS_ERR) != 0) {<br />

/* should do more verbose error reporting */<br />

printf("rfc_intr: Error while DMA: %x\n",<br />

bus_space_read_2(rfc_sc->sc_iot,<br />

rfc_sc->sc_ioh, RX2ES));<br />

rfc_sc->sc_curbuf->b_flags |= B_ERROR;<br />

break;<br />

}<br />

if (rfc_sc->sc_bytesleft > i) {<br />

rfc_sc->sc_bytesleft -= i;<br />

rfc_sc->sc_bufidx += i;<br />

} else {<br />

biodone(rfc_sc->sc_curbuf);<br />

rf_sc = get_new_buf( rfc_sc);<br />

if (rf_sc == NULL)<br />

return;<br />

}<br />

RFS_SETCMD(rf_sc->sc_state,<br />

(rfc_sc->sc_curbuf->b_flags & B_READ) != 0<br />

? RFS_RSEC : RFS_FBUF);<br />

break;<br />

case RFS_NOTINIT: /* Device is not open */<br />

case RFS_SMD: /* Set Media Density */<br />

case RFS_RSTAT: /* Read Status */<br />

case RFS_WDDS: /* Write Deleted Data Sector */<br />

case RFS_REC: /* Read Error Code */<br />

default:<br />

panic("Impossible state in rfc_intr(1).\n");<br />

}<br />

if ((rfc_sc->sc_curbuf->b_flags & B_ERROR) != 0) {<br />

/*<br />

* An error occured while processing this buffer.<br />

* Finish it and try to get a new buffer to process.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!