diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-08-23 21:13:24 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-08-23 21:13:24 +0000 |
commit | 2db793b02cfb4abeda23b9c837ac8ec50abe9eac (patch) | |
tree | 2ba22d172ac98576b286abda40aaef42faf48029 /nuttx/arch/arm/src/stm32 | |
parent | 020f5b27a85fe3a3d51a15cc9214bcd98eb54ad5 (diff) |
STM32 OTG FS host driver: Fix some bad NAK handling
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5049 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-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 9e6b2615a0..06d35a04ac 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); |