aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-05-13 14:51:25 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-05-13 14:51:25 +0000
commit16de43cd0240d02a35dad104bc71a454fc8dd63a (patch)
treeadf5b50be2d982ca87e8fddcc9d67701b7560bf4 /os
parent48eca9d65922553ce7bc36581aa709e4c4b27ed4 (diff)
downloadChibiOS-16de43cd0240d02a35dad104bc71a454fc8dd63a.tar.gz
ChibiOS-16de43cd0240d02a35dad104bc71a454fc8dd63a.tar.bz2
ChibiOS-16de43cd0240d02a35dad104bc71a454fc8dd63a.zip
Tentative fix for OUT transactions, not complete.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5733 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/platforms/STM32/USBv1/usb_lld.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.c b/os/hal/platforms/STM32/USBv1/usb_lld.c
index f3ee4d1fd..eac014de0 100644
--- a/os/hal/platforms/STM32/USBv1/usb_lld.c
+++ b/os/hal/platforms/STM32/USBv1/usb_lld.c
@@ -398,19 +398,22 @@ CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) {
usb_packet_read_to_buffer(udp,
epcp->out_state->mode.linear.rxbuf,
n);
- epcp->out_state->mode.linear.rxbuf += n;
+ epcp->out_state->mode.linear.rxbuf += n;
}
/* Transaction data updated.*/
epcp->out_state->rxcnt += n;
epcp->out_state->rxsize -= n;
epcp->out_state->rxpkts -= 1;
- if (epcp->out_state->rxpkts > 0) {
- /* Transfer not completed, there are more packets to receive.*/
- EPR_SET_STAT_RX(ep, EPR_STAT_RX_VALID);
+
+ /* The transaction is completed if the specified number of packets
+ has been received or the current packet is a short packet.*/
+ if ((n < epcp->out_maxsize) || (epcp->out_state->rxpkts == 0)) {
+ /* Transfer complete, invokes the callback.*/
+ _usb_isr_invoke_out_cb(usbp, ep);
}
else {
- /* Transfer completed, invokes the callback.*/
- _usb_isr_invoke_out_cb(usbp, ep);
+ /* Transfer not complete, there are more packets to receive.*/
+ EPR_SET_STAT_RX(ep, EPR_STAT_RX_VALID);
}
}
}