mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
arch: Disable priority inheritance on all semaphores used for signaling in all USB host drivers
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/usbhost_devaddr.h>
|
#include <nuttx/usb/usbhost_devaddr.h>
|
||||||
@@ -5157,6 +5158,12 @@ static inline void efm32_sw_initialize(FAR struct efm32_usbhost_s *priv)
|
|||||||
sem_init(&priv->pscsem, 0, 0);
|
sem_init(&priv->pscsem, 0, 0);
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&priv->pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the driver state data */
|
/* Initialize the driver state data */
|
||||||
|
|
||||||
priv->smstate = SMSTATE_DETACHED;
|
priv->smstate = SMSTATE_DETACHED;
|
||||||
@@ -5172,8 +5179,15 @@ static inline void efm32_sw_initialize(FAR struct efm32_usbhost_s *priv)
|
|||||||
for (i = 0; i < EFM32_MAX_TX_FIFOS; i++)
|
for (i = 0; i < EFM32_MAX_TX_FIFOS; i++)
|
||||||
{
|
{
|
||||||
FAR struct efm32_chan_s *chan = &priv->chan[i];
|
FAR struct efm32_chan_s *chan = &priv->chan[i];
|
||||||
|
|
||||||
chan->chidx = i;
|
chan->chidx = i;
|
||||||
|
|
||||||
|
/* The waitsem semaphore is used for signaling and, hence, should not
|
||||||
|
* have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&chan->waitsem, 0, 0);
|
sem_init(&chan->waitsem, 0, 0);
|
||||||
|
sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/lpc17xx/lpc17_usbhost.c
|
* arch/arm/src/lpc17xx/lpc17_usbhost.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010-2012, 2014-2016 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Rafael Noronha <rafael@pdsolucoes.com.br>
|
* Authors: Rafael Noronha <rafael@pdsolucoes.com.br>
|
||||||
* Gregory Nutt <gnutt@nuttx.org>
|
* Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/ohci.h>
|
#include <nuttx/usb/ohci.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
@@ -2262,10 +2263,12 @@ static int lpc17_epalloc(struct usbhost_driver_s *drvr,
|
|||||||
uinfo("EP%d CTRL:%08x\n", epdesc->addr, ed->hw.ctrl);
|
uinfo("EP%d CTRL:%08x\n", epdesc->addr, ed->hw.ctrl);
|
||||||
|
|
||||||
/* Initialize the semaphore that is used to wait for the endpoint
|
/* Initialize the semaphore that is used to wait for the endpoint
|
||||||
* WDH event.
|
* WDH event. The wdhsem semaphore is used for signaling and, hence,
|
||||||
|
* should not have priority inheritance enabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sem_init(&ed->wdhsem, 0, 0);
|
sem_init(&ed->wdhsem, 0, 0);
|
||||||
|
sem_setprotocol(&priv->wdhsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Link the common tail TD to the ED's TD list */
|
/* Link the common tail TD to the ED's TD list */
|
||||||
|
|
||||||
@@ -3639,6 +3642,12 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
|
|||||||
sem_init(&priv->pscsem, 0, 0);
|
sem_init(&priv->pscsem, 0, 0);
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&priv->pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
#ifndef CONFIG_USBHOST_INT_DISABLE
|
#ifndef CONFIG_USBHOST_INT_DISABLE
|
||||||
priv->ininterval = MAX_PERINTERVAL;
|
priv->ininterval = MAX_PERINTERVAL;
|
||||||
priv->outinterval = MAX_PERINTERVAL;
|
priv->outinterval = MAX_PERINTERVAL;
|
||||||
@@ -3719,7 +3728,13 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller)
|
|||||||
memset((void *)HCCA, 0, sizeof(struct ohci_hcca_s));
|
memset((void *)HCCA, 0, sizeof(struct ohci_hcca_s));
|
||||||
memset((void *)TDTAIL, 0, sizeof(struct ohci_gtd_s));
|
memset((void *)TDTAIL, 0, sizeof(struct ohci_gtd_s));
|
||||||
memset((void *)EDCTRL, 0, sizeof(struct lpc17_ed_s));
|
memset((void *)EDCTRL, 0, sizeof(struct lpc17_ed_s));
|
||||||
|
|
||||||
|
/* The EDCTRL wdhsem semaphore is used for signaling and, hence, should
|
||||||
|
* not have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&EDCTRL->wdhsem, 0, 0);
|
sem_init(&EDCTRL->wdhsem, 0, 0);
|
||||||
|
sem_setprotocol(&EDCTRL->wdhsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize user-configurable EDs */
|
/* Initialize user-configurable EDs */
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/ehci.h>
|
#include <nuttx/usb/ehci.h>
|
||||||
@@ -3931,7 +3932,13 @@ static int lpc31_epalloc(FAR struct usbhost_driver_s *drvr,
|
|||||||
epinfo->maxpacket = epdesc->mxpacketsize;
|
epinfo->maxpacket = epdesc->mxpacketsize;
|
||||||
epinfo->xfrtype = epdesc->xfrtype;
|
epinfo->xfrtype = epdesc->xfrtype;
|
||||||
epinfo->speed = hport->speed;
|
epinfo->speed = hport->speed;
|
||||||
|
|
||||||
|
/* The iocsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&epinfo->iocsem, 0, 0);
|
sem_init(&epinfo->iocsem, 0, 0);
|
||||||
|
sem_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Success.. return an opaque reference to the endpoint information structure
|
/* Success.. return an opaque reference to the endpoint information structure
|
||||||
* instance
|
* instance
|
||||||
@@ -4916,6 +4923,12 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
|
|||||||
sem_init(&g_ehci.exclsem, 0, 1);
|
sem_init(&g_ehci.exclsem, 0, 1);
|
||||||
sem_init(&g_ehci.pscsem, 0, 0);
|
sem_init(&g_ehci.pscsem, 0, 0);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&g_ehci.pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize EP0 */
|
/* Initialize EP0 */
|
||||||
|
|
||||||
sem_init(&g_ehci.ep0.iocsem, 0, 1);
|
sem_init(&g_ehci.ep0.iocsem, 0, 1);
|
||||||
@@ -4952,7 +4965,13 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
|
|||||||
rhport->ep0.xfrtype = USB_EP_ATTR_XFER_CONTROL;
|
rhport->ep0.xfrtype = USB_EP_ATTR_XFER_CONTROL;
|
||||||
rhport->ep0.speed = USB_SPEED_FULL;
|
rhport->ep0.speed = USB_SPEED_FULL;
|
||||||
rhport->ep0.maxpacket = 8;
|
rhport->ep0.maxpacket = 8;
|
||||||
|
|
||||||
|
/* The port iocsem semaphore is used for signaling and, hence,
|
||||||
|
* should not have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&rhport->ep0.iocsem, 0, 0);
|
sem_init(&rhport->ep0.iocsem, 0, 0);
|
||||||
|
sem_setprotocol(&rhport->iocsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the public port representation */
|
/* Initialize the public port representation */
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/ehci.h>
|
#include <nuttx/usb/ehci.h>
|
||||||
@@ -3768,7 +3769,13 @@ static int lpc43_epalloc(FAR struct usbhost_driver_s *drvr,
|
|||||||
epinfo->maxpacket = epdesc->mxpacketsize;
|
epinfo->maxpacket = epdesc->mxpacketsize;
|
||||||
epinfo->xfrtype = epdesc->xfrtype;
|
epinfo->xfrtype = epdesc->xfrtype;
|
||||||
epinfo->speed = hport->speed;
|
epinfo->speed = hport->speed;
|
||||||
|
|
||||||
|
/* The endpoint iocsem semaphore is used for signaling and, hence,
|
||||||
|
* should not have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&epinfo->iocsem, 0, 0);
|
sem_init(&epinfo->iocsem, 0, 0);
|
||||||
|
sem_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Success.. return an opaque reference to the endpoint information structure
|
/* Success.. return an opaque reference to the endpoint information structure
|
||||||
* instance
|
* instance
|
||||||
@@ -4747,6 +4754,12 @@ FAR struct usbhost_connection_s *lpc43_ehci_initialize(int controller)
|
|||||||
sem_init(&g_ehci.exclsem, 0, 1);
|
sem_init(&g_ehci.exclsem, 0, 1);
|
||||||
sem_init(&g_ehci.pscsem, 0, 0);
|
sem_init(&g_ehci.pscsem, 0, 0);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&g_ehci.pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize EP0 */
|
/* Initialize EP0 */
|
||||||
|
|
||||||
sem_init(&g_ehci.ep0.iocsem, 0, 1);
|
sem_init(&g_ehci.ep0.iocsem, 0, 1);
|
||||||
@@ -4783,7 +4796,13 @@ FAR struct usbhost_connection_s *lpc43_ehci_initialize(int controller)
|
|||||||
rhport->ep0.xfrtype = USB_EP_ATTR_XFER_CONTROL;
|
rhport->ep0.xfrtype = USB_EP_ATTR_XFER_CONTROL;
|
||||||
rhport->ep0.speed = USB_SPEED_FULL;
|
rhport->ep0.speed = USB_SPEED_FULL;
|
||||||
rhport->ep0.maxpacket = 8;
|
rhport->ep0.maxpacket = 8;
|
||||||
|
|
||||||
|
/* The EP0 iocsem semaphore is used for signaling and, hence, should
|
||||||
|
* not have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&rhport->ep0.iocsem, 0, 0);
|
sem_init(&rhport->ep0.iocsem, 0, 0);
|
||||||
|
sem_setprotocol(&rhport->ep0.iocsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the public port representation */
|
/* Initialize the public port representation */
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/ehci.h>
|
#include <nuttx/usb/ehci.h>
|
||||||
@@ -3752,7 +3753,13 @@ static int sam_epalloc(FAR struct usbhost_driver_s *drvr,
|
|||||||
epinfo->maxpacket = epdesc->mxpacketsize;
|
epinfo->maxpacket = epdesc->mxpacketsize;
|
||||||
epinfo->xfrtype = epdesc->xfrtype;
|
epinfo->xfrtype = epdesc->xfrtype;
|
||||||
epinfo->speed = hport->speed;
|
epinfo->speed = hport->speed;
|
||||||
|
|
||||||
|
/* The endpoint iocsem semaphore is used for signaling and, hence,
|
||||||
|
* should not have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&epinfo->iocsem, 0, 0);
|
sem_init(&epinfo->iocsem, 0, 0);
|
||||||
|
sem_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Success.. return an opaque reference to the endpoint information structure
|
/* Success.. return an opaque reference to the endpoint information structure
|
||||||
* instance
|
* instance
|
||||||
@@ -4787,6 +4794,12 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
|
|||||||
sem_init(&g_ehci.exclsem, 0, 1);
|
sem_init(&g_ehci.exclsem, 0, 1);
|
||||||
sem_init(&g_ehci.pscsem, 0, 0);
|
sem_init(&g_ehci.pscsem, 0, 0);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&g_ehci.pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize EP0 */
|
/* Initialize EP0 */
|
||||||
|
|
||||||
sem_init(&g_ehci.ep0.iocsem, 0, 1);
|
sem_init(&g_ehci.ep0.iocsem, 0, 1);
|
||||||
@@ -4823,7 +4836,13 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
|
|||||||
rhport->ep0.xfrtype = USB_EP_ATTR_XFER_CONTROL;
|
rhport->ep0.xfrtype = USB_EP_ATTR_XFER_CONTROL;
|
||||||
rhport->ep0.speed = USB_SPEED_FULL;
|
rhport->ep0.speed = USB_SPEED_FULL;
|
||||||
rhport->ep0.maxpacket = 8;
|
rhport->ep0.maxpacket = 8;
|
||||||
|
|
||||||
|
/* The endpoint 0 iocsem semaphore is used for signaling and, hence,
|
||||||
|
* should not have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&rhport->ep0.iocsem, 0, 0);
|
sem_init(&rhport->ep0.iocsem, 0, 0);
|
||||||
|
sem_setprotocol(&rhport->ep0.iocsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the public port representation */
|
/* Initialize the public port representation */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/sama5/sam_ohci.c
|
* arch/arm/src/sama5/sam_ohci.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/ohci.h>
|
#include <nuttx/usb/ohci.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
@@ -2664,6 +2665,12 @@ static int sam_epalloc(struct usbhost_driver_s *drvr,
|
|||||||
|
|
||||||
sem_init(&eplist->wdhsem, 0, 0);
|
sem_init(&eplist->wdhsem, 0, 0);
|
||||||
|
|
||||||
|
/* The wdhsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&eplist->wdhsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* We must have exclusive access to the ED pool, the bulk list, the periodic list
|
/* We must have exclusive access to the ED pool, the bulk list, the periodic list
|
||||||
* and the interrupt table.
|
* and the interrupt table.
|
||||||
*/
|
*/
|
||||||
@@ -3903,6 +3910,12 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller)
|
|||||||
sem_init(&g_ohci.pscsem, 0, 0);
|
sem_init(&g_ohci.pscsem, 0, 0);
|
||||||
sem_init(&g_ohci.exclsem, 0, 1);
|
sem_init(&g_ohci.exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&g_ohci.pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
#ifndef CONFIG_USBHOST_INT_DISABLE
|
#ifndef CONFIG_USBHOST_INT_DISABLE
|
||||||
g_ohci.ininterval = MAX_PERINTERVAL;
|
g_ohci.ininterval = MAX_PERINTERVAL;
|
||||||
g_ohci.outinterval = MAX_PERINTERVAL;
|
g_ohci.outinterval = MAX_PERINTERVAL;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/usbhost_devaddr.h>
|
#include <nuttx/usb/usbhost_devaddr.h>
|
||||||
@@ -5091,6 +5092,12 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv)
|
|||||||
sem_init(&priv->pscsem, 0, 0);
|
sem_init(&priv->pscsem, 0, 0);
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&priv->pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the driver state data */
|
/* Initialize the driver state data */
|
||||||
|
|
||||||
priv->smstate = SMSTATE_DETACHED;
|
priv->smstate = SMSTATE_DETACHED;
|
||||||
@@ -5106,8 +5113,15 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv)
|
|||||||
for (i = 0; i < STM32_MAX_TX_FIFOS; i++)
|
for (i = 0; i < STM32_MAX_TX_FIFOS; i++)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan = &priv->chan[i];
|
FAR struct stm32_chan_s *chan = &priv->chan[i];
|
||||||
|
|
||||||
chan->chidx = i;
|
chan->chidx = i;
|
||||||
|
|
||||||
|
/* The waitsem semaphore is used for signaling and, hence, should not
|
||||||
|
* have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&chan->waitsem, 0, 0);
|
sem_init(&chan->waitsem, 0, 0);
|
||||||
|
sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/usbhost_devaddr.h>
|
#include <nuttx/usb/usbhost_devaddr.h>
|
||||||
@@ -5091,6 +5092,12 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv)
|
|||||||
sem_init(&priv->pscsem, 0, 0);
|
sem_init(&priv->pscsem, 0, 0);
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&priv->pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the driver state data */
|
/* Initialize the driver state data */
|
||||||
|
|
||||||
priv->smstate = SMSTATE_DETACHED;
|
priv->smstate = SMSTATE_DETACHED;
|
||||||
@@ -5106,8 +5113,15 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv)
|
|||||||
for (i = 0; i < STM32_MAX_TX_FIFOS; i++)
|
for (i = 0; i < STM32_MAX_TX_FIFOS; i++)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan = &priv->chan[i];
|
FAR struct stm32_chan_s *chan = &priv->chan[i];
|
||||||
|
|
||||||
chan->chidx = i;
|
chan->chidx = i;
|
||||||
|
|
||||||
|
/* The waitsem semaphore is used for signaling and, hence, should not
|
||||||
|
* have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&chan->waitsem, 0, 0);
|
sem_init(&chan->waitsem, 0, 0);
|
||||||
|
sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/usbhost_devaddr.h>
|
#include <nuttx/usb/usbhost_devaddr.h>
|
||||||
@@ -5089,6 +5090,12 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv)
|
|||||||
sem_init(&priv->pscsem, 0, 0);
|
sem_init(&priv->pscsem, 0, 0);
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&priv->pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the driver state data */
|
/* Initialize the driver state data */
|
||||||
|
|
||||||
priv->smstate = SMSTATE_DETACHED;
|
priv->smstate = SMSTATE_DETACHED;
|
||||||
@@ -5104,8 +5111,15 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv)
|
|||||||
for (i = 0; i < STM32_MAX_TX_FIFOS; i++)
|
for (i = 0; i < STM32_MAX_TX_FIFOS; i++)
|
||||||
{
|
{
|
||||||
FAR struct stm32_chan_s *chan = &priv->chan[i];
|
FAR struct stm32_chan_s *chan = &priv->chan[i];
|
||||||
|
|
||||||
chan->chidx = i;
|
chan->chidx = i;
|
||||||
|
|
||||||
|
/* The waitsem semaphore is used for signaling and, hence, should not
|
||||||
|
* have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&chan->waitsem, 0, 0);
|
sem_init(&chan->waitsem, 0, 0);
|
||||||
|
sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/usbhost_devaddr.h>
|
#include <nuttx/usb/usbhost_devaddr.h>
|
||||||
@@ -5096,6 +5097,12 @@ static inline void stm32l4_sw_initialize(FAR struct stm32l4_usbhost_s *priv)
|
|||||||
sem_init(&priv->pscsem, 0, 0);
|
sem_init(&priv->pscsem, 0, 0);
|
||||||
sem_init(&priv->exclsem, 0, 1);
|
sem_init(&priv->exclsem, 0, 1);
|
||||||
|
|
||||||
|
/* The pscsem semaphore is used for signaling and, hence, should not have
|
||||||
|
* priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sem_setprotocol(&priv->pscsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
/* Initialize the driver state data */
|
/* Initialize the driver state data */
|
||||||
|
|
||||||
priv->smstate = SMSTATE_DETACHED;
|
priv->smstate = SMSTATE_DETACHED;
|
||||||
@@ -5111,8 +5118,15 @@ static inline void stm32l4_sw_initialize(FAR struct stm32l4_usbhost_s *priv)
|
|||||||
for (i = 0; i < STM32L4_MAX_TX_FIFOS; i++)
|
for (i = 0; i < STM32L4_MAX_TX_FIFOS; i++)
|
||||||
{
|
{
|
||||||
FAR struct stm32l4_chan_s *chan = &priv->chan[i];
|
FAR struct stm32l4_chan_s *chan = &priv->chan[i];
|
||||||
|
|
||||||
chan->chidx = i;
|
chan->chidx = i;
|
||||||
|
|
||||||
|
/* The waitsem semaphore is used for signaling and, hence, should not
|
||||||
|
* have priority inheritance enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
sem_init(&chan->waitsem, 0, 0);
|
sem_init(&chan->waitsem, 0, 0);
|
||||||
|
sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user