CI check: fix nxstyle warning
nxstyle fixes to reduce the CI warnings Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
3fbdc213b7
commit
d938e2cd46
@ -276,7 +276,7 @@ void imxrt_usbhost_vbusdrive(int rhport, bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/*****************************************************************************
|
||||||
* Name: imxrt_setup_overcurrent
|
* Name: imxrt_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@ -291,7 +291,7 @@ void imxrt_usbhost_vbusdrive(int rhport, bool enable)
|
|||||||
* Zero (OK) returned on success; a negated errno value is returned on
|
* Zero (OK) returned on success; a negated errno value is returned on
|
||||||
* failure.
|
* failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if 0 /* Not ready yet */
|
#if 0 /* Not ready yet */
|
||||||
int imxrt_setup_overcurrent(xcpt_t handler, void *arg)
|
int imxrt_setup_overcurrent(xcpt_t handler, void *arg)
|
||||||
|
@ -274,7 +274,7 @@ void imxrt_usbhost_vbusdrive(int rhport, bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/*****************************************************************************
|
||||||
* Name: imxrt_setup_overcurrent
|
* Name: imxrt_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@ -289,7 +289,7 @@ void imxrt_usbhost_vbusdrive(int rhport, bool enable)
|
|||||||
* Zero (OK) returned on success; a negated errno value is returned on
|
* Zero (OK) returned on success; a negated errno value is returned on
|
||||||
* failure.
|
* failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if 0 /* Not ready yet */
|
#if 0 /* Not ready yet */
|
||||||
int imxrt_setup_overcurrent(xcpt_t handler, void *arg)
|
int imxrt_setup_overcurrent(xcpt_t handler, void *arg)
|
||||||
|
@ -302,7 +302,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -338,7 +338,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -291,7 +291,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -288,7 +288,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -337,7 +337,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -194,8 +194,8 @@ static int ehci_waiter(int argc, char *argv[])
|
|||||||
* USB Ports
|
* USB Ports
|
||||||
* The SAMA5D3 series-MB features three USB communication ports:
|
* The SAMA5D3 series-MB features three USB communication ports:
|
||||||
*
|
*
|
||||||
* 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with
|
* 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed
|
||||||
* USB Device High Speed Micro AB connector, J20
|
* with USB Device High Speed Micro AB connector, J20
|
||||||
*
|
*
|
||||||
* 2. Port B Host High Speed (EHCI) and Full Speed (OHCI) standard type A
|
* 2. Port B Host High Speed (EHCI) and Full Speed (OHCI) standard type A
|
||||||
* connector, J19 upper port
|
* connector, J19 upper port
|
||||||
|
@ -224,6 +224,7 @@ int stm32_usbhost_initialize(void)
|
|||||||
/* First, register all of the class drivers needed to support the drivers
|
/* First, register all of the class drivers needed to support the drivers
|
||||||
* that we care about:
|
* that we care about:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uinfo("Register class drivers\n");
|
uinfo("Register class drivers\n");
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST_MSC
|
#ifdef CONFIG_USBHOST_MSC
|
||||||
|
@ -109,7 +109,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -140,16 +140,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM3240G-EVAL board.
|
* USB-related GPIO pins for the STM3240G-EVAL board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -162,7 +166,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -224,21 +229,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -270,16 +278,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -294,10 +302,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -139,16 +139,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F4Discovery board.
|
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -161,7 +165,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -223,21 +228,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -269,16 +277,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -290,13 +298,13 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -136,16 +136,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the nucleo-144 board.
|
* USB-related GPIO pins for the nucleo-144 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -158,7 +162,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -253,21 +258,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -290,16 +298,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -311,13 +319,13 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -142,9 +142,13 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -153,7 +157,7 @@ void stm32_usbinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@ -161,7 +165,7 @@ void stm32_usbinitialize(void)
|
|||||||
* functionality. This function will start a thread that will monitor
|
* functionality. This function will start a thread that will monitor
|
||||||
* for device connection/disconnection events.
|
* for device connection/disconnection events.
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32_usbhost_initialize(void)
|
int stm32_usbhost_initialize(void)
|
||||||
|
@ -105,7 +105,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -136,16 +136,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F4Discovery board.
|
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG HS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG HS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGHS
|
#ifdef CONFIG_STM32_OTGHS
|
||||||
stm32_configgpio(GPIO_OTGHS_VBUS);
|
stm32_configgpio(GPIO_OTGHS_VBUS);
|
||||||
@ -158,7 +162,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -230,21 +235,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG HS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_HS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -276,16 +284,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -300,10 +308,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -138,16 +138,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F4Discovery board.
|
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, and Power On GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -160,7 +164,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -234,16 +239,16 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -258,21 +263,24 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -304,10 +312,10 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,17 +135,21 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usb_configure
|
* Name: stm32_usb_configure
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_boardinitialize very early in inialization to setup USB-related
|
* Called from stm32_usb_configure very early in inialization to setup
|
||||||
* GPIO pins for the Olimex STM32 P407 board.
|
* USB-related GPIO pins for the Olimex STM32 P407 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usb_configure(void)
|
void stm32_usb_configure(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
stm32_configgpio(GPIO_OTGFS_PWRON);
|
stm32_configgpio(GPIO_OTGFS_PWRON);
|
||||||
@ -157,7 +161,8 @@ void stm32_usb_configure(void)
|
|||||||
* Name: stm32_usbhost_setup
|
* Name: stm32_usbhost_setup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -251,21 +256,24 @@ int stm32_usbhost_setup(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -297,16 +305,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -321,10 +329,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -137,16 +137,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the Omnibusf4 board.
|
* USB-related GPIO pins for the Omnibusf4 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -157,7 +161,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -263,21 +268,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -309,16 +317,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -333,10 +341,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ static int wdog_daemon(int argc, char *argv[])
|
|||||||
ret = file_ioctl(&filestruct, WDIOC_START, 0);
|
ret = file_ioctl(&filestruct, WDIOC_START, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno);
|
wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno);
|
||||||
goto exit_close_dev;
|
goto exit_close_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@ -101,6 +101,7 @@ static int wdog_daemon(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit_close_dev:
|
exit_close_dev:
|
||||||
|
|
||||||
/* Close watchdog device and exit. */
|
/* Close watchdog device and exit. */
|
||||||
|
|
||||||
file_close(&filestruct);
|
file_close(&filestruct);
|
||||||
|
@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -139,16 +139,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM3240G-EVAL board.
|
* USB-related GPIO pins for the STM3240G-EVAL board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -161,7 +165,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -223,21 +228,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -269,16 +277,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -293,10 +301,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -139,17 +139,21 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM3220G-EVAL board.
|
* USB-related GPIO pins for the STM3220G-EVAL board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_USB
|
#ifdef HAVE_USB
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
stm32_configgpio(GPIO_OTGFS_PWRON);
|
stm32_configgpio(GPIO_OTGFS_PWRON);
|
||||||
@ -161,7 +165,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -223,21 +228,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -269,16 +277,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -293,10 +301,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -139,16 +139,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM3240G-EVAL board.
|
* USB-related GPIO pins for the STM3240G-EVAL board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -161,7 +165,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -223,21 +228,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -269,16 +277,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -293,10 +301,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,16 +135,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F411 Discovery board.
|
* USB-related GPIO pins for the STM32F411 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -157,7 +161,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -263,21 +268,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -309,16 +317,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -333,10 +341,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,16 +135,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F4Discovery board.
|
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG HS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG HS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGHS
|
#ifdef CONFIG_STM32_OTGHS
|
||||||
stm32_configgpio(GPIO_OTGHS_VBUS);
|
stm32_configgpio(GPIO_OTGHS_VBUS);
|
||||||
@ -157,7 +161,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -229,21 +234,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG HS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_HS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -275,16 +283,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -299,10 +307,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,16 +135,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F4Discovery board.
|
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_OTGFS
|
#ifdef CONFIG_STM32_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -157,7 +161,8 @@ void stm32_usbinitialize(void)
|
|||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -263,21 +268,24 @@ int stm32_usbhost_initialize(void)
|
|||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -309,16 +317,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -333,10 +341,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -92,7 +92,8 @@ struct viewtool_max3421elower_s
|
|||||||
*
|
*
|
||||||
* Interrupts should be configured on the falling edge of nINT.
|
* Interrupts should be configured on the falling edge of nINT.
|
||||||
*
|
*
|
||||||
* attach - Attach the ADS7843E interrupt handler to the GPIO interrupt
|
* attach - Attach the ADS7843E interrupt handler to the GPIO
|
||||||
|
* interrupt
|
||||||
* enable - Enable or disable the GPIO interrupt
|
* enable - Enable or disable the GPIO interrupt
|
||||||
* acknowledge - Acknowledge/clear any pending GPIO interrupt as necessary.
|
* acknowledge - Acknowledge/clear any pending GPIO interrupt as necessary.
|
||||||
*/
|
*/
|
||||||
@ -101,7 +102,8 @@ static int max3421e_attach(FAR const struct max3421e_lowerhalf_s *lower,
|
|||||||
xcpt_t isr, FAR void *arg);
|
xcpt_t isr, FAR void *arg);
|
||||||
static void max3421e_enable(FAR const struct max3421e_lowerhalf_s *lower,
|
static void max3421e_enable(FAR const struct max3421e_lowerhalf_s *lower,
|
||||||
bool enable);
|
bool enable);
|
||||||
static void max3421e_acknowledge(FAR const struct max3421e_lowerhalf_s *lower);
|
static void max3421e_acknowledge
|
||||||
|
(FAR const struct max3421e_lowerhalf_s *lower);
|
||||||
static void max3421e_power(FAR const struct max3421e_lowerhalf_s *lower,
|
static void max3421e_power(FAR const struct max3421e_lowerhalf_s *lower,
|
||||||
bool enable);
|
bool enable);
|
||||||
|
|
||||||
@ -149,7 +151,8 @@ static FAR struct usbhost_connection_s *g_usbconn;
|
|||||||
* interrupts should be configured on both rising and falling edges
|
* interrupts should be configured on both rising and falling edges
|
||||||
* so that contact and loss-of-contact events can be detected.
|
* so that contact and loss-of-contact events can be detected.
|
||||||
*
|
*
|
||||||
* attach - Attach the ADS7843E interrupt handler to the GPIO interrupt
|
* attach - Attach the ADS7843E interrupt handler to the GPIO
|
||||||
|
* interrupt
|
||||||
* enable - Enable or disable the GPIO interrupt
|
* enable - Enable or disable the GPIO interrupt
|
||||||
* acknowledge - Acknowledge/clear any pending GPIO interrupt as necessary.
|
* acknowledge - Acknowledge/clear any pending GPIO interrupt as necessary.
|
||||||
* power - Enable or disable 5V VBUS power
|
* power - Enable or disable 5V VBUS power
|
||||||
@ -223,7 +226,8 @@ static void max3421e_enable(FAR const struct max3421e_lowerhalf_s *lower,
|
|||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void max3421e_acknowledge(FAR const struct max3421e_lowerhalf_s *lower)
|
static void max3421e_acknowledge
|
||||||
|
(FAR const struct max3421e_lowerhalf_s *lower)
|
||||||
{
|
{
|
||||||
/* Does nothing */
|
/* Does nothing */
|
||||||
}
|
}
|
||||||
@ -238,7 +242,7 @@ static void max3421e_power(FAR const struct max3421e_lowerhalf_s *lower,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/****************************************************************************
|
||||||
* Name: usbhost_detect
|
* Name: usbhost_detect
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@ -251,7 +255,7 @@ static int usbhost_detect(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
uinfo("Starting USB detect thread\n");
|
uinfo("Starting USB detect thread\n");
|
||||||
|
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
CONN_WAIT(g_usbconn, &hport);
|
CONN_WAIT(g_usbconn, &hport);
|
||||||
|
|
||||||
@ -365,22 +369,20 @@ int stm32_max3421e_setup(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_RNDIS)
|
#if defined(CONFIG_RNDIS)
|
||||||
{
|
uint8_t mac[6];
|
||||||
uint8_t mac[6];
|
|
||||||
|
|
||||||
mac[0] = 0xa0; /* TODO */
|
mac[0] = 0xa0; /* TODO */
|
||||||
mac[1] = (CONFIG_NETINIT_MACADDR_2 >> (8 * 0)) & 0xff;
|
mac[1] = (CONFIG_NETINIT_MACADDR_2 >> (8 * 0)) & 0xff;
|
||||||
mac[2] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 3)) & 0xff;
|
mac[2] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 3)) & 0xff;
|
||||||
mac[3] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 2)) & 0xff;
|
mac[3] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 2)) & 0xff;
|
||||||
mac[4] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 1)) & 0xff;
|
mac[4] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 1)) & 0xff;
|
||||||
mac[5] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 0)) & 0xff;
|
mac[5] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 0)) & 0xff;
|
||||||
|
|
||||||
ret = usbdev_rndis_initialize(mac);
|
ret = usbdev_rndis_initialize(mac);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
uerr("ERROR: Failed to register RNDIS class: %d\n", ret);
|
uerr("ERROR: Failed to register RNDIS class: %d\n", ret);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_VIEWTOOL_MAX3421E_RST
|
#ifdef CONFIG_VIEWTOOL_MAX3421E_RST
|
||||||
|
@ -106,7 +106,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -137,16 +137,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the nucleo-144 board.
|
* USB-related GPIO pins for the nucleo-144 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_OTGFS
|
#ifdef CONFIG_STM32F7_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -155,15 +159,16 @@ void stm32_usbinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32_usbhost_initialize(void)
|
int stm32_usbhost_initialize(void)
|
||||||
@ -250,31 +255,34 @@ int stm32_usbhost_initialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||||
@ -291,16 +299,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -315,10 +323,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,16 +135,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the STM32F4Discovery board.
|
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_OTGFS
|
#ifdef CONFIG_STM32F7_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -156,15 +160,16 @@ void stm32_usbinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32_usbhost_initialize(void)
|
int stm32_usbhost_initialize(void)
|
||||||
@ -251,31 +256,34 @@ int stm32_usbhost_initialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||||
@ -301,16 +309,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -325,10 +333,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -136,16 +136,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the nucleo-144 board.
|
* USB-related GPIO pins for the nucleo-144 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32H7_OTGFS
|
#ifdef CONFIG_STM32H7_OTGFS
|
||||||
stm32_configgpio(GPIO_OTGFS_VBUS);
|
stm32_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -154,15 +158,16 @@ void stm32_usbinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32_usbhost_initialize(void)
|
int stm32_usbhost_initialize(void)
|
||||||
@ -249,31 +254,34 @@ int stm32_usbhost_initialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and status
|
||||||
|
* register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port, and
|
||||||
* clears this bit on an overcurrent condition."
|
* the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||||
@ -290,16 +298,16 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -314,10 +322,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uinfo("Running\n");
|
uinfo("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -137,16 +137,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32_usbinitialize
|
* Name: stm32_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
* Called from stm32_usbinitialize very early in inialization to setup
|
||||||
* GPIO pins for the nucleo-144 board.
|
* USB-related GPIO pins for the nucleo-144 board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32_usbinitialize(void)
|
void stm32_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Overcurrent GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32L4_OTGFS
|
#ifdef CONFIG_STM32L4_OTGFS
|
||||||
stm32l4_configgpio(GPIO_OTGFS_VBUS);
|
stm32l4_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -155,15 +159,16 @@ void stm32_usbinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_initialize
|
* Name: stm32_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32_usbhost_initialize(void)
|
int stm32_usbhost_initialize(void)
|
||||||
@ -250,31 +255,34 @@ int stm32_usbhost_initialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_usbhost_vbusdrive
|
* Name: stm32_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and status
|
||||||
|
* register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an overcurrent condition."
|
* and the core clears this bit on an overcurrent condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
void stm32_usbhost_vbusdrive(int iface, bool enable)
|
||||||
@ -291,23 +299,24 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32_setup_overcurrent
|
* Name: stm32_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an overcurrent condition is
|
* Setup to receive an interrupt-level callback if an overcurrent
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New overcurrent interrupt handler
|
* handler - New overcurrent interrupt handler
|
||||||
* arg - The argument provided for the interrupt handler
|
* arg - The argument provided for the interrupt handler
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is returned
|
* Zero (OK) is returned on success. Otherwise, a negated errno value
|
||||||
* to indicate the nature of the failure.
|
* is returned to indicate the nature of the failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
||||||
{
|
{
|
||||||
return stm32l4_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
|
return stm32l4_gpiosetevent(GPIO_OTGFS_OVER,
|
||||||
|
true, true, true, handler, arg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -315,10 +324,10 @@ int stm32_setup_overcurrent(xcpt_t handler, void *arg)
|
|||||||
* Name: stm32_usbsuspend
|
* Name: stm32_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uvdbg("Running\n");
|
uvdbg("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,16 +135,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32l4_usbinitialize
|
* Name: stm32l4_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32l4_usbinitialize very early in initialization to setup USB-related
|
* Called from stm32l4_usbinitialize very early in initialization to
|
||||||
* GPIO pins for the STM32L4Discovery board.
|
* setup USB-related GPIO pins for the STM32L4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32l4_usbinitialize(void)
|
void stm32l4_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Over current GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Over current GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32L4_OTGFS
|
#ifdef CONFIG_STM32L4_OTGFS
|
||||||
stm32l4_configgpio(GPIO_OTGFS_VBUS);
|
stm32l4_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -158,7 +162,7 @@ void stm32l4_usbinitialize(void)
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host
|
* Called at application startup time to initialize the USB host
|
||||||
* functionality.
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
@ -249,31 +253,33 @@ int stm32l4_usbhost_initialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32l4_usbhost_vbusdrive
|
* Name: stm32l4_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be provided
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* be each platform that implements the STM32 OTG FS host interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* pump or, if 5 V are available on the application board, a basic power
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* switch, must be added externally to drive the 5 V VBUS line. The
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* external charge pump can be driven by any GPIO output. When the
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* application decides to power on VBUS using the chosen GPIO, it must
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* also set the port power bit in the host port control and status
|
||||||
|
* register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an over current condition."
|
* and the core clears this bit on an over current condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
void stm32l4_usbhost_vbusdrive(int iface, bool enable)
|
void stm32l4_usbhost_vbusdrive(int iface, bool enable)
|
||||||
@ -299,8 +305,8 @@ void stm32l4_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32l4_setup_overcurrent
|
* Name: stm32l4_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an over current condition is
|
* Setup to receive an interrupt-level callback if an over current
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New over current interrupt handler
|
* handler - New over current interrupt handler
|
||||||
@ -322,10 +328,10 @@ xcpt_t stm32l4_setup_overcurrent(xcpt_t handler)
|
|||||||
* Name: stm32l4_usbsuspend
|
* Name: stm32l4_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32l4_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32l4_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
struct usbhost_hubport_s *hport;
|
struct usbhost_hubport_s *hport;
|
||||||
|
|
||||||
uvdbg("Running\n");
|
uvdbg("Running\n");
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
@ -135,16 +135,20 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
* Name: stm32l4_usbinitialize
|
* Name: stm32l4_usbinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called from stm32l4_usbinitialize very early in initialization to setup USB-related
|
* Called from stm32l4_usbinitialize very early in initialization to setup
|
||||||
* GPIO pins for the STM32L4Discovery board.
|
* USB-related GPIO pins for the STM32L4Discovery board.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void stm32l4_usbinitialize(void)
|
void stm32l4_usbinitialize(void)
|
||||||
{
|
{
|
||||||
/* The OTG FS has an internal soft pull-up. No GPIO configuration is required */
|
/* The OTG FS has an internal soft pull-up.
|
||||||
|
* No GPIO configuration is required
|
||||||
|
*/
|
||||||
|
|
||||||
/* Configure the OTG FS VBUS sensing GPIO, Power On, and Over current GPIOs */
|
/* Configure the OTG FS VBUS sensing GPIO,
|
||||||
|
* Power On, and Over current GPIOs
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32L4_OTGFS
|
#ifdef CONFIG_STM32L4_OTGFS
|
||||||
stm32l4_configgpio(GPIO_OTGFS_VBUS);
|
stm32l4_configgpio(GPIO_OTGFS_VBUS);
|
||||||
@ -153,15 +157,16 @@ void stm32l4_usbinitialize(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32l4_usbhost_initialize
|
* Name: stm32l4_usbhost_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called at application startup time to initialize the USB host functionality.
|
* Called at application startup time to initialize the USB host
|
||||||
|
* functionality.
|
||||||
* This function will start a thread that will monitor for device
|
* This function will start a thread that will monitor for device
|
||||||
* connection/disconnection events.
|
* connection/disconnection events.
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
int stm32l4_usbhost_initialize(void)
|
int stm32l4_usbhost_initialize(void)
|
||||||
@ -248,31 +253,34 @@ int stm32l4_usbhost_initialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32l4_usbhost_vbusdrive
|
* Name: stm32l4_usbhost_vbusdrive
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Enable/disable driving of VBUS 5V output. This function must be provided be
|
* Enable/disable driving of VBUS 5V output. This function must be
|
||||||
* each platform that implements the STM32 OTG FS host interface
|
* provided be each platform that implements the STM32 OTG FS host
|
||||||
|
* interface
|
||||||
*
|
*
|
||||||
* "On-chip 5 V VBUS generation is not supported. For this reason, a charge pump
|
* "On-chip 5 V VBUS generation is not supported. For this reason, a
|
||||||
* or, if 5 V are available on the application board, a basic power switch, must
|
* charge pump or, if 5 V are available on the application board, a
|
||||||
* be added externally to drive the 5 V VBUS line. The external charge pump can
|
* basic power switch, must be added externally to drive the 5 V VBUS
|
||||||
* be driven by any GPIO output. When the application decides to power on VBUS
|
* line. The external charge pump can be driven by any GPIO output.
|
||||||
* using the chosen GPIO, it must also set the port power bit in the host port
|
* When the application decides to power on VBUS using the chosen GPIO,
|
||||||
* control and status register (PPWR bit in OTG_FS_HPRT).
|
* it must also set the port power bit in the host port control and
|
||||||
|
* status register (PPWR bit in OTG_FS_HPRT).
|
||||||
*
|
*
|
||||||
* "The application uses this field to control power to this port, and the core
|
* "The application uses this field to control power to this port,
|
||||||
* clears this bit on an over current condition."
|
* and the core clears this bit on an over current condition."
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* iface - For future growth to handle multiple USB host interface. Should be zero.
|
* iface - For future growth to handle multiple USB host interface.
|
||||||
|
* Should be zero.
|
||||||
* enable - true: enable VBUS power; false: disable VBUS power
|
* enable - true: enable VBUS power; false: disable VBUS power
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST
|
#ifdef CONFIG_USBHOST
|
||||||
void stm32l4_usbhost_vbusdrive(int iface, bool enable)
|
void stm32l4_usbhost_vbusdrive(int iface, bool enable)
|
||||||
@ -298,8 +306,8 @@ void stm32l4_usbhost_vbusdrive(int iface, bool enable)
|
|||||||
* Name: stm32l4_setup_overcurrent
|
* Name: stm32l4_setup_overcurrent
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to receive an interrupt-level callback if an over current condition is
|
* Setup to receive an interrupt-level callback if an over current
|
||||||
* detected.
|
* condition is detected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* handler - New over current interrupt handler
|
* handler - New over current interrupt handler
|
||||||
@ -321,10 +329,10 @@ xcpt_t stm32l4_setup_overcurrent(xcpt_t handler)
|
|||||||
* Name: stm32l4_usbsuspend
|
* Name: stm32l4_usbsuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Board logic must provide the stm32l4_usbsuspend logic if the USBDEV driver is
|
* Board logic must provide the stm32l4_usbsuspend logic if the USBDEV
|
||||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
* driver is used. This function is called whenever the USB enters or
|
||||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
* leaves suspend mode. This is an opportunity for the board logic to
|
||||||
* while the USB is suspended.
|
* shutdown clocks, power, etc. while the USB is suspended.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -301,7 +301,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -66,7 +66,9 @@
|
|||||||
#define NSH_HAVEMMCSD 1
|
#define NSH_HAVEMMCSD 1
|
||||||
#define NSH_HAVEUSBHOST 1
|
#define NSH_HAVEUSBHOST 1
|
||||||
|
|
||||||
/* The Mikroelektronika PIC32MX7 MMB has one SD slot on board, connected to SPI 1. */
|
/* The Mikroelektronika PIC32MX7 MMB has one SD slot on board,
|
||||||
|
* connected to SPI 1.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_PIC32MX_MMCSDSPIPORTNO
|
#ifndef CONFIG_PIC32MX_MMCSDSPIPORTNO
|
||||||
# define CONFIG_PIC32MX_MMCSDSPIPORTNO 1
|
# define CONFIG_PIC32MX_MMCSDSPIPORTNO 1
|
||||||
@ -312,7 +314,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -331,6 +334,7 @@ static int nsh_usbhostinitialize(void)
|
|||||||
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
||||||
return pid < 0 ? -ENOEXEC : OK;
|
return pid < 0 ? -ENOEXEC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -307,7 +307,8 @@ static int nsh_usbhostinitialize(void)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR,
|
syslog(LOG_ERR,
|
||||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
"ERROR: Failed to register the CDC/ACM serial class: %d\n",
|
||||||
|
ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -327,6 +328,7 @@ static int nsh_usbhostinitialize(void)
|
|||||||
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
||||||
return pid < 0 ? -ENOEXEC : OK;
|
return pid < 0 ? -ENOEXEC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -196,13 +196,13 @@ int nxmu_start(int display, int plane)
|
|||||||
{
|
{
|
||||||
FAR char display_str[8];
|
FAR char display_str[8];
|
||||||
FAR char plane_str[8];
|
FAR char plane_str[8];
|
||||||
|
pid_t server;
|
||||||
FAR char * const argv[3] =
|
FAR char * const argv[3] =
|
||||||
{
|
{
|
||||||
(FAR char * const)display_str,
|
(FAR char * const)display_str,
|
||||||
(FAR char * const)plane_str,
|
(FAR char * const)plane_str,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
pid_t server;
|
|
||||||
|
|
||||||
/* Start the server kernel thread */
|
/* Start the server kernel thread */
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ int nxmu_start(int display, int plane)
|
|||||||
* this operation cannot be done from the IDLE thread!
|
* this operation cannot be done from the IDLE thread!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nxsig_usleep(50*1000);
|
nxsig_usleep(50 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -105,13 +105,13 @@ extern "C"
|
|||||||
int nxtask_create(FAR const char *name, int priority,
|
int nxtask_create(FAR const char *name, int priority,
|
||||||
int stack_size, main_t entry, FAR char * const argv[]);
|
int stack_size, main_t entry, FAR char * const argv[]);
|
||||||
|
|
||||||
/********************************************************************************
|
/****************************************************************************
|
||||||
* Name: kthread_create
|
* Name: kthread_create
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates and activates a kernel thread task with kernel-mode
|
* This function creates and activates a kernel thread task with
|
||||||
* privileges. It is identical to task_create() except that it configures the
|
* kernel-mode privileges. It is identical to task_create() except
|
||||||
* newly started thread to run in kernel model.
|
* that it configures the newly started thread to run in kernel model.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* name - Name of the new task
|
* name - Name of the new task
|
||||||
@ -127,7 +127,7 @@ int nxtask_create(FAR const char *name, int priority,
|
|||||||
* errno value to indicate the nature of any failure. If memory is
|
* errno value to indicate the nature of any failure. If memory is
|
||||||
* insufficient or the task cannot be created -ENOMEM will be returned.
|
* insufficient or the task cannot be created -ENOMEM will be returned.
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int kthread_create(FAR const char *name, int priority, int stack_size,
|
int kthread_create(FAR const char *name, int priority, int stack_size,
|
||||||
main_t entry, FAR char * const argv[]);
|
main_t entry, FAR char * const argv[]);
|
||||||
|
Loading…
Reference in New Issue
Block a user