From a4455d07c1f577019c780de3bdec14f125fefacd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 30 Apr 2015 08:00:41 -0600 Subject: [PATCH] STM32 HUB: Fix more compilation errors when hub support is enabled --- arch/arm/src/efm32/Kconfig | 1 + arch/arm/src/efm32/efm32_usbhost.c | 10 ++++++---- arch/arm/src/stm32/Kconfig | 2 ++ arch/arm/src/stm32/stm32_otgfshost.c | 10 ++++++---- arch/arm/src/stm32/stm32_otghshost.c | 10 ++++++---- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/arch/arm/src/efm32/Kconfig b/arch/arm/src/efm32/Kconfig index 317b87b528..6684acf9ba 100644 --- a/arch/arm/src/efm32/Kconfig +++ b/arch/arm/src/efm32/Kconfig @@ -193,6 +193,7 @@ config EFM32_OTGFS bool "USB Full-Speed OTG" default n depends on EFM32_HAVE_OTGFS && EXPERIMENTAL + select USBHOST_HAVE_ASYNCH if USBHOST config EFM32_TIMER0 bool "TIMER0" diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index edc8babeea..e0db982239 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -199,6 +199,7 @@ struct efm32_chan_s sem_t waitsem; /* Channel wait semaphore */ volatile uint8_t result; /* The result of the transfer */ volatile uint8_t chreason; /* Channel halt reason. See enum efm32_chreason_e */ + uint8_t chidx; /* Channel index */ uint8_t epno; /* Device endpoint number (0-127) */ uint8_t eptype; /* See EFM32_USB_EPTYPE_* definitions */ uint8_t funcaddr; /* Device function address */ @@ -1031,7 +1032,7 @@ static int efm32_chan_waitsetup(FAR struct efm32_usbhost_s *priv, #ifdef CONFIG_USBHOST_ASYNCH static int efm32_chan_asynchsetup(FAR struct efm32_usbhost_s *priv, - FAR struct efm32_chan_s *chan. + FAR struct efm32_chan_s *chan, usbhost_asynch_t callback, FAR void *arg) { irqstate_t flags = irqsave(); @@ -1159,7 +1160,7 @@ static void efm32_chan_wakeup(FAR struct efm32_usbhost_s *priv, { /* Handle continuation of IN/OUT pipes */ - if (priv->in) + if (chan->in) { efm32_in_next(priv, chan); } @@ -1911,7 +1912,7 @@ static void efm32_in_next(FAR struct efm32_usbhost_s *priv, * endpoint type */ - ret = efm32_in_setup(priv, chidx); + ret = efm32_in_setup(priv, chan->chidx); if (ret >= 0) { return; @@ -2182,7 +2183,7 @@ static void efm32_out_next(FAR struct efm32_usbhost_s *priv, * endpoint type */ - ret = efm32_out_setup(priv, chidx); + ret = efm32_out_setup(priv, chan->chidx); if (ret >= 0) { return; @@ -4962,6 +4963,7 @@ static inline void efm32_sw_initialize(FAR struct efm32_usbhost_s *priv) for (i = 0; i < EFM32_MAX_TX_FIFOS; i++) { FAR struct efm32_chan_s *chan = &priv->chan[i]; + chan->chidx = i; sem_init(&chan->waitsem, 0, 0); } } diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index 9cfb2ab0ac..31927231ce 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -1393,11 +1393,13 @@ config STM32_OTGFS bool "OTG FS" default n depends on STM32_HAVE_OTGFS + select USBHOST_HAVE_ASYNCH if USBHOST config STM32_OTGHS bool "OTG HS" default n depends on STM32_STM32F207 || STM32_STM32F40XX || STM32_STM32F429 + select USBHOST_HAVE_ASYNCH if USBHOST config STM32_PWR bool "PWR" diff --git a/arch/arm/src/stm32/stm32_otgfshost.c b/arch/arm/src/stm32/stm32_otgfshost.c index c5886c3c08..3b1b639619 100644 --- a/arch/arm/src/stm32/stm32_otgfshost.c +++ b/arch/arm/src/stm32/stm32_otgfshost.c @@ -206,6 +206,7 @@ struct stm32_chan_s sem_t waitsem; /* Channel wait semaphore */ volatile uint8_t result; /* The result of the transfer */ volatile uint8_t chreason; /* Channel halt reason. See enum stm32_chreason_e */ + uint8_t chidx; /* Channel index */ uint8_t epno; /* Device endpoint number (0-127) */ uint8_t eptype; /* See OTGFS_EPTYPE_* definitions */ uint8_t funcaddr; /* Device function address */ @@ -1036,7 +1037,7 @@ static int stm32_chan_waitsetup(FAR struct stm32_usbhost_s *priv, #ifdef CONFIG_USBHOST_ASYNCH static int stm32_chan_asynchsetup(FAR struct stm32_usbhost_s *priv, - FAR struct stm32_chan_s *chan. + FAR struct stm32_chan_s *chan, usbhost_asynch_t callback, FAR void *arg) { irqstate_t flags = irqsave(); @@ -1164,7 +1165,7 @@ static void stm32_chan_wakeup(FAR struct stm32_usbhost_s *priv, { /* Handle continuation of IN/OUT pipes */ - if (priv->in) + if (chan->in) { stm32_in_next(priv, chan); } @@ -1916,7 +1917,7 @@ static void stm32_in_next(FAR struct stm32_usbhost_s *priv, * endpoint type */ - ret = stm32_in_setup(priv, chidx); + ret = stm32_in_setup(priv, chan->chidx); if (ret >= 0) { return; @@ -2187,7 +2188,7 @@ static void stm32_out_next(FAR struct stm32_usbhost_s *priv, * endpoint type */ - ret = stm32_out_setup(priv, chidx); + ret = stm32_out_setup(priv, chan->chidx); if (ret >= 0) { return; @@ -5007,6 +5008,7 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) for (i = 0; i < STM32_MAX_TX_FIFOS; i++) { FAR struct stm32_chan_s *chan = &priv->chan[i]; + chan->chidx = i; sem_init(&chan->waitsem, 0, 0); } } diff --git a/arch/arm/src/stm32/stm32_otghshost.c b/arch/arm/src/stm32/stm32_otghshost.c index 431781cd34..b688e6bf77 100644 --- a/arch/arm/src/stm32/stm32_otghshost.c +++ b/arch/arm/src/stm32/stm32_otghshost.c @@ -206,6 +206,7 @@ struct stm32_chan_s sem_t waitsem; /* Channel wait semaphore */ volatile uint8_t result; /* The result of the transfer */ volatile uint8_t chreason; /* Channel halt reason. See enum stm32_chreason_e */ + uint8_t chidx; /* Channel index */ uint8_t epno; /* Device endpoint number (0-127) */ uint8_t eptype; /* See OTGHS_EPTYPE_* definitions */ uint8_t funcaddr; /* Device function address */ @@ -1036,7 +1037,7 @@ static int stm32_chan_waitsetup(FAR struct stm32_usbhost_s *priv, #ifdef CONFIG_USBHOST_ASYNCH static int stm32_chan_asynchsetup(FAR struct stm32_usbhost_s *priv, - FAR struct stm32_chan_s *chan. + FAR struct stm32_chan_s *chan, usbhost_asynch_t callback, FAR void *arg) { irqstate_t flags = irqsave(); @@ -1164,7 +1165,7 @@ static void stm32_chan_wakeup(FAR struct stm32_usbhost_s *priv, { /* Handle continuation of IN/OUT pipes */ - if (priv->in) + if (chan->in) { stm32_in_next(priv, chan); } @@ -1916,7 +1917,7 @@ static void stm32_in_next(FAR struct stm32_usbhost_s *priv, * endpoint type */ - ret = stm32_in_setup(priv, chidx); + ret = stm32_in_setup(priv, chan->chidx); if (ret >= 0) { return; @@ -2187,7 +2188,7 @@ static void stm32_out_next(FAR struct stm32_usbhost_s *priv, * endpoint type */ - ret = stm32_out_setup(priv, chidx); + ret = stm32_out_setup(priv, chan->chidx); if (ret >= 0) { return; @@ -5007,6 +5008,7 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) for (i = 0; i < STM32_MAX_TX_FIFOS; i++) { FAR struct stm32_chan_s *chan = &priv->chan[i]; + chan->chidx = i; sem_init(&chan->waitsem, 0, 0); } }