Fixed bug #531.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7273 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
653a7e9ad0
commit
a8042eea48
|
@ -35,6 +35,7 @@
|
||||||
#define TRDT_VALUE 5
|
#define TRDT_VALUE 5
|
||||||
|
|
||||||
#define EP0_MAX_INSIZE 64
|
#define EP0_MAX_INSIZE 64
|
||||||
|
#define EP0_MAX_OUTSIZE 64
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver exported variables. */
|
/* Driver exported variables. */
|
||||||
|
@ -592,9 +593,25 @@ static void otg_epout_handler(USBDriver *usbp, usbep_t ep) {
|
||||||
}
|
}
|
||||||
if ((epint & DOEPINT_XFRC) && (otgp->DOEPMSK & DOEPMSK_XFRCM)) {
|
if ((epint & DOEPINT_XFRC) && (otgp->DOEPMSK & DOEPMSK_XFRCM)) {
|
||||||
/* Receive transfer complete.*/
|
/* Receive transfer complete.*/
|
||||||
|
USBOutEndpointState *osp = usbp->epc[ep]->out_state;
|
||||||
|
|
||||||
|
if (osp->rxsize < osp->totsize) {
|
||||||
|
/* In case the transaction covered only part of the total transfer
|
||||||
|
then another transaction is immediately started in order to
|
||||||
|
cover the remaining.*/
|
||||||
|
osp->rxsize = osp->totsize - osp->rxsize;
|
||||||
|
osp->rxcnt = 0;
|
||||||
|
usb_lld_prepare_receive(usbp, ep);
|
||||||
|
chSysLockFromIsr();
|
||||||
|
usb_lld_start_out(usbp, ep);
|
||||||
|
chSysUnlockFromIsr();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* End on OUT transfer.*/
|
||||||
_usb_isr_invoke_out_cb(usbp, ep);
|
_usb_isr_invoke_out_cb(usbp, ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief OTG shared ISR.
|
* @brief OTG shared ISR.
|
||||||
|
@ -1143,6 +1160,10 @@ void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep) {
|
||||||
USBOutEndpointState *osp = usbp->epc[ep]->out_state;
|
USBOutEndpointState *osp = usbp->epc[ep]->out_state;
|
||||||
|
|
||||||
/* Transfer initialization.*/
|
/* Transfer initialization.*/
|
||||||
|
osp->totsize = osp->rxsize;
|
||||||
|
if ((ep == 0) && (osp->rxsize > EP0_MAX_OUTSIZE))
|
||||||
|
osp->rxsize = EP0_MAX_OUTSIZE;
|
||||||
|
|
||||||
pcnt = (osp->rxsize + usbp->epc[ep]->out_maxsize - 1) /
|
pcnt = (osp->rxsize + usbp->epc[ep]->out_maxsize - 1) /
|
||||||
usbp->epc[ep]->out_maxsize;
|
usbp->epc[ep]->out_maxsize;
|
||||||
usbp->otg->oe[ep].DOEPTSIZ = DOEPTSIZ_STUPCNT(3) | DOEPTSIZ_PKTCNT(pcnt) |
|
usbp->otg->oe[ep].DOEPTSIZ = DOEPTSIZ_STUPCNT(3) | DOEPTSIZ_PKTCNT(pcnt) |
|
||||||
|
|
|
@ -262,6 +262,10 @@ typedef struct {
|
||||||
input_queue_t *rxqueue;
|
input_queue_t *rxqueue;
|
||||||
} queue;
|
} queue;
|
||||||
} mode;
|
} mode;
|
||||||
|
/**
|
||||||
|
* @brief Total transmit transfer size.
|
||||||
|
*/
|
||||||
|
size_t totsize;
|
||||||
} USBOutEndpointState;
|
} USBOutEndpointState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue