more updates for the STM32 OTG FS device driver

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4585 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-04-10 22:36:45 +00:00
parent a94b51d07e
commit 09eb157d83
+11 -11
View File
@@ -793,7 +793,7 @@ static void stm32_ep0in_activate(void)
/* Clear global IN NAK */ /* Clear global IN NAK */
regval = stm32_getreg(STM32_OTGFS_DIEPCTL0); regval = stm32_getreg(STM32_OTGFS_DCTL);
regval |= OTGFS_DCTL_CGINAK; regval |= OTGFS_DCTL_CGINAK;
stm32_putreg(regval, STM32_OTGFS_DCTL); stm32_putreg(regval, STM32_OTGFS_DCTL);
} }
@@ -3199,23 +3199,25 @@ static void stm32_enablegonak(FAR struct stm32_ep_s *privep)
regval |= OTGFS_DCTL_SGONAK; regval |= OTGFS_DCTL_SGONAK;
stm32_putreg(regval, STM32_OTGFS_DCTL); stm32_putreg(regval, STM32_OTGFS_DCTL);
#if 0
/* Wait for the GONAKEFF interrupt that indicates that the OUT NAK /* Wait for the GONAKEFF interrupt that indicates that the OUT NAK
* mode is in effect. When the interrupt handler pops the OUTNAK word * mode is in effect. When the interrupt handler pops the OUTNAK word
* from the RxFIFO, the core sets the GONAKEFF interrupt. * from the RxFIFO, the core sets the GONAKEFF interrupt.
*/ */
#if 0
while ((stm32_getreg(STM32_OTGFS_GINTSTS) & OTGFS_GINT_GONAKEFF) == 0); while ((stm32_getreg(STM32_OTGFS_GINTSTS) & OTGFS_GINT_GONAKEFF) == 0);
stm32_putreg(OTGFS_GINT_GONAKEFF, STM32_OTGFS_GINTSTS); stm32_putreg(OTGFS_GINT_GONAKEFF, STM32_OTGFS_GINTSTS);
#else
/* Since we are in the interrupt handler, we cannot wait inline for the /* Since we are in the interrupt handler, we cannot wait inline for the
* GONAKEFF because it cannot occur until service th RXFLVL global interrupt * GONAKEFF because it cannot occur until service th RXFLVL global interrupt
* and pop the OUTNAK word from the RxFIFO. * and pop the OUTNAK word from the RxFIFO.
*
* Perhaps it is sufficient to wait for Global OUT NAK status to be reported
* in OTGFS DCTL register?
*/ */
#else while ((stm32_getreg(STM32_OTGFS_DCTL) & OTGFS_DCTL_GONSTS) == 0);
#warning "REVISIT"
up_mdelay(50);
#endif #endif
} }
@@ -3231,10 +3233,10 @@ static void stm32_disablegonak(FAR struct stm32_ep_s *privep)
{ {
uint32_t regval; uint32_t regval;
/* Clear the Global OUT NAK bit to disable global OUT NAK mode */ /* Set the "Clear the Global OUT NAK bit" to disable global OUT NAK mode */
regval = stm32_getreg(STM32_OTGFS_DCTL); regval = stm32_getreg(STM32_OTGFS_DCTL);
regval &= ~OTGFS_DCTL_SGONAK; regval |= OTGFS_DCTL_CGONAK;
stm32_putreg(regval, STM32_OTGFS_DCTL); stm32_putreg(regval, STM32_OTGFS_DCTL);
} }
@@ -3885,7 +3887,7 @@ static int stm32_ep_cancel(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *
static int stm32_epout_setstall(FAR struct stm32_ep_s *privep) static int stm32_epout_setstall(FAR struct stm32_ep_s *privep)
{ {
#if 0 #if 1
/* This implementation follows the requirements from the STM32 F4 reference /* This implementation follows the requirements from the STM32 F4 reference
* manual. * manual.
*/ */
@@ -3933,9 +3935,7 @@ static int stm32_epout_setstall(FAR struct stm32_ep_s *privep)
uint32_t regaddr; uint32_t regaddr;
uint32_t regval; uint32_t regval;
/* Disable and STALL the OUT endpoint by setting the STALL bit /* Stall the OUT endpoint by setting the STALL bit in the DOECPTL register. */
* int DOECPTL register.
*/
regaddr = STM32_OTGFS_DOEPCTL(privep->epphy); regaddr = STM32_OTGFS_DOEPCTL(privep->epphy);
regval = stm32_getreg(regaddr); regval = stm32_getreg(regaddr);