freemyipod r923 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r922‎ | r923 | r924 >
Date:21:41, 6 May 2014
Author:theseven
Status:new
Tags:
Comment:
emCORE: synopsysotg: ACK endpoint IRQs before calling the handler.
Otherwise a new transfer might already be in progress on the endpoint
by the time that the IRQ is acknowledged, causing a race condition.
Modified paths:
  • /emcore/trunk/usb/synopsysotg.c (modified) (history)

Diff [purge]

Index: emcore/trunk/usb/synopsysotg.c
@@ -364,9 +364,9 @@
365365 }
366366 union usb_endpoint_number epnum = { .direction = USB_ENDPOINT_DIRECTION_IN, .number = ep };
367367 int bytesleft = data->core->inep_regs[ep].dieptsiz.b.xfersize;
 368+ data->core->inep_regs[ep].diepint = epints;
368369 if (epints.b.timeout) usb_handle_timeout(instance, epnum, bytesleft);
369370 if (epints.b.xfercompl) usb_handle_xfer_complete(instance, epnum, bytesleft);
370 - data->core->inep_regs[ep].diepint = epints;
371371 }
372372 }
373373
@@ -378,6 +378,7 @@
379379 if (daint.ep.out & (1 << ep))
380380 {
381381 union synopsysotg_doepintn epints = data->core->outep_regs[ep].doepint;
 382+ data->core->outep_regs[ep].doepint = epints;
382383 union usb_endpoint_number epnum = { .direction = USB_ENDPOINT_DIRECTION_OUT, .number = ep };
383384 if (epints.b.setup)
384385 {
@@ -390,7 +391,6 @@
391392 int bytesleft = data->core->inep_regs[ep].dieptsiz.b.xfersize;
392393 usb_handle_xfer_complete(instance, epnum, bytesleft);
393394 }
394 - data->core->outep_regs[ep].doepint = epints;
395395 }
396396 }
397397