diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2007-02-25 01:49:28 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2007-02-25 01:49:28 +0000 |
commit | 4c91ec43bcbf710667a2b965a62ca7f3bb4fd274 (patch) | |
tree | 4aade6e6d5b31107726218b6b3ca2f025c180146 /sys/arch | |
parent | 74defb1f5fa21c2074de0971c6893dd1f5ac0909 (diff) |
add missing USBD_FORCE_SHORT_XFER checks, put back some code I had for a
while but removed incorrectly, some minor cleanup.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/xscale/pxa27x_udc.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/sys/arch/arm/xscale/pxa27x_udc.c b/sys/arch/arm/xscale/pxa27x_udc.c index 3e70dc7ac97..9fa8085174c 100644 --- a/sys/arch/arm/xscale/pxa27x_udc.c +++ b/sys/arch/arm/xscale/pxa27x_udc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa27x_udc.c,v 1.18 2007/02/24 22:16:14 drahn Exp $ */ +/* $OpenBSD: pxa27x_udc.c,v 1.19 2007/02/25 01:49:27 drahn Exp $ */ /* * Copyright (c) 2007 Dale Rahn <drahn@openbsd.org> @@ -553,13 +553,7 @@ again: p = xfer->buffer + xfer->actlen; csr = CSR_READ_4(sc, USBDC_UDCCSR(ep)); -#if 0 - if ((csr & (USBDC_UDCCSR_SP|USBDC_UDCCSR_PC)) == - (USBDC_UDCCSR_SP|USBDC_UDCCSR_PC) - && count == 0) -#else if ((csr & USBDC_UDCCSR_PC) && count == 0) -#endif { #ifdef DEBUG_RX printf("trans1 complete\n"); @@ -696,9 +690,20 @@ pxaudc_write(struct pxaudc_softc *sc, usbf_xfer_handle xfer) * send a zero packet to indicate termiation. */ if ((xfer->actlen % maxp) == 0 && - xfer->status != USBF_NORMAL_COMPLETION) { - if (CSR_READ_4(sc, USBDC_UDCCSR(ep)) & USBDC_UDCCSR_BNF) { - CSR_SET_4(sc, USBDC_UDCCSR(ep), USBDC_UDCCSR_SP); + xfer->status != USBF_NORMAL_COMPLETION && + xfer->flags & USBD_FORCE_SHORT_XFER) { + if (CSR_READ_4(sc, USBDC_UDCCSR(ep)) + & USBDC_UDCCSR_BNF) { + CSR_SET_4(sc, USBDC_UDCCSR(ep), + USBDC_UDCCSR_SP); + /* + * if we send a zero packet, we are 'done', but + * dont to usbf_transfer_complete() just yet + * because the short packet will cause another + * interrupt. + */ + xfer->status = USBF_NORMAL_COMPLETION; + return; } else { printf("fifo full when trying to set short packet\n"); } @@ -760,15 +765,18 @@ pxaudc_write(struct pxaudc_softc *sc, usbf_xfer_handle xfer) printf("whoa, write_ep called, but no free space\n"); } #endif - if (xfer->actlen >= xfer->length) { + if (xfer->actlen == xfer->length) { if ((xfer->actlen % maxp) != 0) { - CSR_SET_4(sc, USBDC_UDCCSR(ep), USBDC_UDCCSR_SP); + if (xfer->flags & USBD_FORCE_SHORT_XFER) { + CSR_SET_4(sc, USBDC_UDCCSR(ep), USBDC_UDCCSR_SP); #ifdef DEBUG_TX - printf("setting short packet on %x csr\n", ep, - CSR_READ_4(sc, USBDC_UDCCSR(ep))); + printf("setting short packet on %x csr\n", ep, + CSR_READ_4(sc, USBDC_UDCCSR(ep))); #endif + } else { + /* fill buffer to maxpacket size??? */ + } } - xfer->actlen = xfer->length; /* no overflow */ } } |