Exemple #1
0
/* Return zero on success. */
static __inline void oak_wait_not_req(struct ncr5380_softc *sc)
{
	int timo;
	for (timo = TIMEOUT; timo; timo--) {
		if ((NCR5380_READ(sc, sci_bus_csr) & SCI_BUS_REQ) == 0 ||
		    (NCR5380_READ(sc, sci_csr) & SCI_CSR_PHASE_MATCH) == 0 ||
		    SCI_BUSY(sc) == 0) {
			return;
		}
	}
	printf("%s: pdma not_req timeout\n", sc->sc_dev.dv_xname);
}
Exemple #2
0
/* Return zero on success. */
static inline int
sbc_wait_busy(struct ncr5380_softc *sc)
{
	int timo = sbc_wait_busy_timo;
	for (;;) {
		if (SCI_BUSY(sc)) {
			timo = 0;	/* return 0 */
			break;
		}
		if (--timo < 0)
			break;	/* return -1 */
		delay(2);
	}
	return (timo);
}
Exemple #3
0
static inline int
hcsc_ready(struct ncr5380_softc *sc)
{
	int i;

	for (i = TIMEOUT; i > 0; i--) {
		if ((NCR5380_READ(sc,sci_csr) &
		    (SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH)) ==
		    (SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH))
		    	return 1;

		if ((NCR5380_READ(sc, sci_csr) & SCI_CSR_PHASE_MATCH) == 0 ||
		    SCI_BUSY(sc) == 0)
			return 0;
	}
	printf("%s: ready timeout\n", device_xname(sc->sc_dev));
	return 0;
}
Exemple #4
0
static inline int
sbc_ready(struct ncr5380_softc *sc)
{
	int timo = sbc_ready_timo;

	for (;;) {
		if ((*sc->sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH))
		    == (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) {
			timo = 0;
			break;
		}
		if (((*sc->sci_csr & SCI_CSR_PHASE_MATCH) == 0)
		    || (SCI_BUSY(sc) == 0)) {
			timo = -1;
			break;
		}
		if (--timo < 0)
			break;	/* return -1 */
		delay(2);
	}
	return (timo);
}
Exemple #5
0
static __inline int
oak_ready(struct ncr5380_softc *sc)
{
	int i;
	int status;

	for (i = TIMEOUT; i > 0; i--) {
		status = NCR5380_READ(sc, sci_csr);
		    if ((status & (SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH)) ==
			(SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH))
		    	return(1);

		if ((status & SCI_CSR_PHASE_MATCH) == 0 ||
		    SCI_BUSY(sc) == 0)
			return(0);
	}
	printf("%s: ready timeout\n", sc->sc_dev.dv_xname);
	return(0);

#if 0 /* The Linux driver does this: */
	struct oak_softc *sc = (void *)ncr_sc;
	bus_space_tag_t pdmat = sc->sc_pdmat;
	bus_space_handle_t pdmah = sc->sc_pdmah;
	int i, status;

	for (i = TIMEOUT; i > 0; i--) {
		status = bus_space_read_2(pdmat, pdmah, OAK_PDMA_STATUS);
		if (status & 0x200)
			return(0);
		if (status & 0x100)
			return(1);
	}
	printf("%s: ready timeout, status = 0x%x\n", ncr_sc->sc_dev.dv_xname,
	    status);
	return(0);
#endif
}