From 24816cb08b0742ca055ebeb9a362148c9230d011 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 10 Mar 2017 10:25:11 -0600 Subject: [PATCH] All STM32 host drivers. In IN endpoint retry, delay for a clock tick to give some breathing space for the CPU. EXPERIMENTAL change. --- arch/arm/src/stm32/stm32_otgfshost.c | 8 ++++++++ arch/arm/src/stm32/stm32_otghshost.c | 8 ++++++++ arch/arm/src/stm32f7/stm32_otghost.c | 8 ++++++++ arch/arm/src/stm32l4/stm32l4_otgfshost.c | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/arch/arm/src/stm32/stm32_otgfshost.c b/arch/arm/src/stm32/stm32_otgfshost.c index 2c6bda6773..7451289b27 100644 --- a/arch/arm/src/stm32/stm32_otgfshost.c +++ b/arch/arm/src/stm32/stm32_otgfshost.c @@ -1906,6 +1906,14 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx, return (ssize_t)ret; } + + /* Wait a bit before retrying after a NAK. + * + * REVISIT: This is intended to give the CPU a break from + * the tight polling loop. But are there performance issues? + */ + + usleep(1000); } } else diff --git a/arch/arm/src/stm32/stm32_otghshost.c b/arch/arm/src/stm32/stm32_otghshost.c index 71f46ff4a3..85092d89a9 100644 --- a/arch/arm/src/stm32/stm32_otghshost.c +++ b/arch/arm/src/stm32/stm32_otghshost.c @@ -1911,6 +1911,14 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx, return (ssize_t)ret; } + + /* Wait a bit before retrying after a NAK. + * + * REVISIT: This is intended to give the CPU a break from + * the tight polling loop. But are there performance issues? + */ + + usleep(1000); } } else diff --git a/arch/arm/src/stm32f7/stm32_otghost.c b/arch/arm/src/stm32f7/stm32_otghost.c index 48e4418539..a89be679b9 100644 --- a/arch/arm/src/stm32f7/stm32_otghost.c +++ b/arch/arm/src/stm32f7/stm32_otghost.c @@ -1905,6 +1905,14 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx, return (ssize_t)ret; } + + /* Wait a bit before retrying after a NAK. + * + * REVISIT: This is intended to give the CPU a break from + * the tight polling loop. But are there performance issues? + */ + + usleep(1000); } } else diff --git a/arch/arm/src/stm32l4/stm32l4_otgfshost.c b/arch/arm/src/stm32l4/stm32l4_otgfshost.c index 33f283e167..a488825b9c 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfshost.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfshost.c @@ -1910,6 +1910,14 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv, return (ssize_t)ret; } + + /* Wait a bit before retrying after a NAK. + * + * REVISIT: This is intended to give the CPU a break from + * the tight polling loop. But are there performance issues? + */ + + usleep(1000); } } else