Fixed bug 3569374.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4692 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2012-09-19 09:46:15 +00:00
parent 7956d88851
commit 1d47a1a5a6
2 changed files with 7 additions and 5 deletions

View File

@ -290,7 +290,6 @@ CH_IRQ_HANDLER(STM32_USB1_HP_HANDLER) {
*/ */
CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) { CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) {
uint32_t istr; uint32_t istr;
size_t n;
USBDriver *usbp = &USBD1; USBDriver *usbp = &USBD1;
CH_IRQ_PROLOGUE(); CH_IRQ_PROLOGUE();
@ -339,17 +338,19 @@ CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) {
/* Endpoint events handling.*/ /* Endpoint events handling.*/
while (istr & ISTR_CTR) { while (istr & ISTR_CTR) {
size_t n;
uint32_t ep; uint32_t ep;
uint32_t epr = STM32_USB->EPR[ep = istr & ISTR_EP_ID_MASK]; uint32_t epr = STM32_USB->EPR[ep = istr & ISTR_EP_ID_MASK];
const USBEndpointConfig *epcp = usbp->epc[ep]; const USBEndpointConfig *epcp = usbp->epc[ep];
if (epr & EPR_CTR_TX) { if (epr & EPR_CTR_TX) {
size_t transmitted;
/* IN endpoint, transmission.*/ /* IN endpoint, transmission.*/
EPR_CLEAR_CTR_TX(ep); EPR_CLEAR_CTR_TX(ep);
n = (size_t)USB_GET_DESCRIPTOR(ep)->TXCOUNT0; transmitted = (size_t)USB_GET_DESCRIPTOR(ep)->TXCOUNT0;
epcp->in_state->txcnt += n; epcp->in_state->txcnt += transmitted;
epcp->in_state->txsize -= n; epcp->in_state->txsize -= transmitted;
if (epcp->in_state->txsize > 0) { if (epcp->in_state->txsize > 0) {
/* Transfer not completed, there are more packets to send.*/ /* Transfer not completed, there are more packets to send.*/
if (epcp->in_state->txsize > epcp->in_maxsize) if (epcp->in_state->txsize > epcp->in_maxsize)
@ -362,7 +363,7 @@ CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) {
epcp->in_state->mode.queue.txqueue, epcp->in_state->mode.queue.txqueue,
n); n);
else { else {
epcp->in_state->mode.linear.txbuf += n; epcp->in_state->mode.linear.txbuf += transmitted;
usb_packet_write_from_buffer(USB_GET_DESCRIPTOR(ep), usb_packet_write_from_buffer(USB_GET_DESCRIPTOR(ep),
epcp->in_state->mode.linear.txbuf, epcp->in_state->mode.linear.txbuf,
n); n);

View File

@ -83,6 +83,7 @@
***************************************************************************** *****************************************************************************
*** 2.5.1 *** *** 2.5.1 ***
- FIX: Fixed problem in STM32F1xx USB driver after revision 4598 (bug 3569374).
- FIX: Fixed GPIO glitch during PAL initialization (bug 3569347)(backported - FIX: Fixed GPIO glitch during PAL initialization (bug 3569347)(backported
to 2.4.3). to 2.4.3).
- FIX: Fixed Data available event not generated in serial_usb driver (bug - FIX: Fixed Data available event not generated in serial_usb driver (bug