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
This commit is contained in:
gdisirio 2013-05-13 14:51:25 +00:00
parent 48eca9d659
commit 16de43cd02
1 changed files with 9 additions and 6 deletions

View File

@ -398,19 +398,22 @@ CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) {
usb_packet_read_to_buffer(udp, usb_packet_read_to_buffer(udp,
epcp->out_state->mode.linear.rxbuf, epcp->out_state->mode.linear.rxbuf,
n); n);
epcp->out_state->mode.linear.rxbuf += n; epcp->out_state->mode.linear.rxbuf += n;
} }
/* Transaction data updated.*/ /* Transaction data updated.*/
epcp->out_state->rxcnt += n; epcp->out_state->rxcnt += n;
epcp->out_state->rxsize -= n; epcp->out_state->rxsize -= n;
epcp->out_state->rxpkts -= 1; epcp->out_state->rxpkts -= 1;
if (epcp->out_state->rxpkts > 0) {
/* Transfer not completed, there are more packets to receive.*/ /* The transaction is completed if the specified number of packets
EPR_SET_STAT_RX(ep, EPR_STAT_RX_VALID); 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 { else {
/* Transfer completed, invokes the callback.*/ /* Transfer not complete, there are more packets to receive.*/
_usb_isr_invoke_out_cb(usbp, ep); EPR_SET_STAT_RX(ep, EPR_STAT_RX_VALID);
} }
} }
} }