mirror of
https://github.com/apache/nuttx.git
synced 2026-09-24 00:42:03 +08:00
STM32 HUB: Fix more compilation errors when hub support is enabled
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1490,7 +1490,17 @@ Where <subdir> is one of the following:
|
||||
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
|
||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||
|
||||
3. This example supports the PWM test (apps/examples/pwm) but this must
|
||||
3. To use this configuration with the STM32F4DIS-BB baseboard you
|
||||
should:
|
||||
|
||||
- Select the STM32F4DIS-BB baseboard in the board configuration
|
||||
menu
|
||||
- Disable UART2 and select USART6 in the STM32 peripheral selection
|
||||
menu
|
||||
- Select USART6 as the serial console at 115200 8N1 in the
|
||||
Drivers menus
|
||||
|
||||
4. This example supports the PWM test (apps/examples/pwm) but this must
|
||||
be manually enabled by selecting:
|
||||
|
||||
CONFIG_PWM=y : Enable the generic PWM infrastructure
|
||||
@@ -1674,6 +1684,36 @@ Where <subdir> is one of the following:
|
||||
|
||||
nsh> umount /mnt/stuff
|
||||
|
||||
11. I used this configuration to test the USB hub class. I did this
|
||||
testing with the following changes to the configuration (in addition
|
||||
to those listed above for base USB host/mass storage class support):
|
||||
|
||||
Drivers -> USB Host Driver Support
|
||||
CONFIG_USBHOST_HUB=y : Enable the hub class
|
||||
CONFIG_USBHOST_ASYNCH=y : Asynchonous I/O supported needed for hubs
|
||||
|
||||
System Type -> USB host configuration
|
||||
To be determined
|
||||
|
||||
RTOS Features -> Work Queue Support
|
||||
CONFIG_SCHED_LPWORK=y : Low priority queue support is needed
|
||||
CONFIG_SCHED_LPNTHREADS=1
|
||||
CONFIG_SCHED_LPWORKSTACKSIZE=1024
|
||||
|
||||
NOTES:
|
||||
|
||||
1. It is necessary to perform work on the low-priority work queue
|
||||
(vs. the high priority work queue) because deferred hub-related
|
||||
work requires some delays and waiting that is not appropriate on
|
||||
the high priority work queue.
|
||||
|
||||
2. Stack usage make increase when USB hub support is enabled because
|
||||
the nesting depth of certain USB host class logic can increase.
|
||||
|
||||
STATUS:
|
||||
2015-04-30
|
||||
Just beginning to test.
|
||||
|
||||
nxlines:
|
||||
------
|
||||
An example using the NuttX graphics system (NX). This example focuses on
|
||||
|
||||
Reference in New Issue
Block a user