aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/OTGv1
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-11 17:35:59 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-11 17:35:59 +0000
commitf183c0aa6df9bbf16b9fb594bf8142adfc1e5d1b (patch)
tree3e7507aeb79ce18aab183188b7056d768e665038 /os/hal/platforms/STM32/OTGv1
parentd094e348c5d1a3785289c69c5185bbaca1257de8 (diff)
downloadChibiOS-f183c0aa6df9bbf16b9fb594bf8142adfc1e5d1b.tar.gz
ChibiOS-f183c0aa6df9bbf16b9fb594bf8142adfc1e5d1b.tar.bz2
ChibiOS-f183c0aa6df9bbf16b9fb594bf8142adfc1e5d1b.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4267 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/OTGv1')
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c
index fae5f500f..0f927cd85 100644
--- a/os/hal/platforms/STM32/OTGv1/usb_lld.c
+++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c
@@ -381,13 +381,6 @@ static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
usbp->epc[ep]->in_state->mode.linear.txbuf += n;
}
usbp->epc[ep]->in_state->txcnt += n;
- /* TODO: Potential issue, txcnt can be less than txsize after the planned
- number of packets have been received, better disable the interrupt
- at the end of the transaction in otg_epin_handler().*/
- if (usbp->epc[ep]->in_state->txcnt >= usbp->epc[ep]->in_state->txsize) {
- /* Transfer finished.*/
- OTG->DIEPEMPMSK &= ~DIEPEMPMSK_INEPTXFEM(ep);
- }
}
/**
@@ -401,20 +394,21 @@ static void otg_txfifo_handler(USBDriver *usbp, usbep_t ep) {
static void otg_epin_handler(USBDriver *usbp, usbep_t ep) {
uint32_t epint = OTG->ie[ep].DIEPINT;
- /* Resets all EP IRQ sources.*/
- OTG->ie[ep].DIEPINT = 0xFFFFFFFF;
-
+ if (epint & DIEPINT_TOC) {
+ /* Timeouts not handled yet, not sure how to handle.*/
+ OTG->ie[ep].DIEPINT = DIEPINT_TOC;
+ }
if (epint & DIEPINT_XFRC) {
/* Transmit transfer complete.*/
+ OTG->ie[ep].DIEPINT = DIEPINT_XFRC;
_usb_isr_invoke_in_cb(usbp, ep);
+ OTG->DIEPEMPMSK &= ~DIEPEMPMSK_INEPTXFEM(ep);
}
- if (epint & DIEPINT_TXFE) {
+ else if (epint & DIEPINT_TXFE) {
/* TX FIFO empty or emptying.*/
+ OTG->ie[ep].DIEPINT = DIEPINT_TXFE;
otg_txfifo_handler(usbp, ep);
}
- if (epint & DIEPINT_TOC) {
- /* Timeouts not handled yet, not sure how to handle.*/
- }
}
/**