diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-08-23 21:13:24 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-08-23 21:13:24 +0000 |
commit | 426094c83cccb43f0d676ed72cc90090e1a406c8 (patch) | |
tree | 2ba22d172ac98576b286abda40aaef42faf48029 /nuttx/arch/arm/src | |
parent | 0eb7f1c368f653039b0745da7ab953d68ad7cd8c (diff) | |
download | px4-nuttx-426094c83cccb43f0d676ed72cc90090e1a406c8.tar.gz px4-nuttx-426094c83cccb43f0d676ed72cc90090e1a406c8.tar.bz2 px4-nuttx-426094c83cccb43f0d676ed72cc90090e1a406c8.zip |
STM32 OTG FS host driver: Fix some bad NAK handling
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5049 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_otgfshost.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c index 9e6b2615a..06d35a04a 100644 --- a/nuttx/arch/arm/src/stm32/stm32_otgfshost.c +++ b/nuttx/arch/arm/src/stm32/stm32_otgfshost.c @@ -1538,11 +1538,12 @@ static inline void stm32_gint_hcinisr(FAR struct stm32_usbhost_s *priv, /* Set the request I/O error result */ chan->result = EIO; - } - else /* if (chan->chreason == CHREASON_FRMOR) */ + else if (chan->chreason == CHREASON_NAK) { - /* Fetch the HCCHAR register and check for an interrupt endpoint. */ + /* Halt on NAK only happens on an INTR channel. Fetch the HCCHAR register + * and check for an interrupt endpoint. + */ regval = stm32_getreg(STM32_OTGFS_HCCHAR(chidx)); if ((regval & OTGFS_HCCHAR_EPTYP_MASK) == OTGFS_HCCHAR_EPTYP_INTR) @@ -1552,6 +1553,12 @@ static inline void stm32_gint_hcinisr(FAR struct stm32_usbhost_s *priv, chan->indata1 ^= true; } + /* Set the NAK error result */ + + chan->result = EAGAIN; + } + else /* if (chan->chreason == CHREASON_FRMOR) */ + { /* Set the frame overrun error result */ chan->result = EPIPE; @@ -1581,9 +1588,19 @@ static inline void stm32_gint_hcinisr(FAR struct stm32_usbhost_s *priv, else if ((pending & OTGFS_HCINT_NAK) != 0) { + /* Halt the interrupt channel */ + + if (chan->eptype == OTGFS_EPTYPE_CTRL) + { + /* Halt the channel -- the CHH interrrupt is expected next */ + + stm32_chan_halt(priv, chidx, CHREASON_NAK); + } + /* Re-activate CTRL and BULK channels */ - if (chan->eptype == OTGFS_EPTYPE_CTRL || chan->eptype == OTGFS_EPTYPE_BULK) + else if (chan->eptype == OTGFS_EPTYPE_CTRL || + chan->eptype == OTGFS_EPTYPE_BULK) { /* Re-activate the channel by clearing CHDIS and assuring that * CHENA is set @@ -1595,10 +1612,6 @@ static inline void stm32_gint_hcinisr(FAR struct stm32_usbhost_s *priv, stm32_putreg(STM32_OTGFS_HCCHAR(chidx), regval); } - /* Halt the channel -- the CHH interrrupt is expected next */ - - stm32_chan_halt(priv, chidx, CHREASON_NAK); - /* Clear the NAK condition */ stm32_putreg(STM32_OTGFS_HCINT(chidx), OTGFS_HCINT_NAK); |