diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index 19f80bc43d..be9bbccf23 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -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->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 */ 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++) { FAR struct efm32_chan_s *chan = &priv->chan[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_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/lpc17xx/lpc17_usbhost.c b/arch/arm/src/lpc17xx/lpc17_usbhost.c index d8d02f629c..59268f94a5 100644 --- a/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * Gregory Nutt * @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -2262,10 +2263,12 @@ static int lpc17_epalloc(struct usbhost_driver_s *drvr, uinfo("EP%d CTRL:%08x\n", epdesc->addr, ed->hw.ctrl); /* 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_setprotocol(&priv->wdhsem, SEM_PRIO_NONE); /* 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->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 priv->ininterval = 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 *)TDTAIL, 0, sizeof(struct ohci_gtd_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_setprotocol(&EDCTRL->wdhsem, SEM_PRIO_NONE); /* Initialize user-configurable EDs */ diff --git a/arch/arm/src/lpc31xx/lpc31_ehci.c b/arch/arm/src/lpc31xx/lpc31_ehci.c index e37abe4997..345ec24dc6 100644 --- a/arch/arm/src/lpc31xx/lpc31_ehci.c +++ b/arch/arm/src/lpc31xx/lpc31_ehci.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -3931,7 +3932,13 @@ static int lpc31_epalloc(FAR struct usbhost_driver_s *drvr, epinfo->maxpacket = epdesc->mxpacketsize; epinfo->xfrtype = epdesc->xfrtype; 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_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE); /* Success.. return an opaque reference to the endpoint information structure * 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.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 */ 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.speed = USB_SPEED_FULL; 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_setprotocol(&rhport->iocsem, SEM_PRIO_NONE); /* Initialize the public port representation */ diff --git a/arch/arm/src/lpc43xx/lpc43_ehci.c b/arch/arm/src/lpc43xx/lpc43_ehci.c index ae462f80b4..2893369ced 100644 --- a/arch/arm/src/lpc43xx/lpc43_ehci.c +++ b/arch/arm/src/lpc43xx/lpc43_ehci.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -3768,7 +3769,13 @@ static int lpc43_epalloc(FAR struct usbhost_driver_s *drvr, epinfo->maxpacket = epdesc->mxpacketsize; epinfo->xfrtype = epdesc->xfrtype; 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_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE); /* Success.. return an opaque reference to the endpoint information structure * 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.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 */ 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.speed = USB_SPEED_FULL; 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_setprotocol(&rhport->ep0.iocsem, SEM_PRIO_NONE); /* Initialize the public port representation */ diff --git a/arch/arm/src/sama5/sam_ehci.c b/arch/arm/src/sama5/sam_ehci.c index 78135e3e8d..6065a04d50 100644 --- a/arch/arm/src/sama5/sam_ehci.c +++ b/arch/arm/src/sama5/sam_ehci.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -3752,7 +3753,13 @@ static int sam_epalloc(FAR struct usbhost_driver_s *drvr, epinfo->maxpacket = epdesc->mxpacketsize; epinfo->xfrtype = epdesc->xfrtype; 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_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE); /* Success.. return an opaque reference to the endpoint information structure * 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.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 */ 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.speed = USB_SPEED_FULL; 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_setprotocol(&rhport->ep0.iocsem, SEM_PRIO_NONE); /* Initialize the public port representation */ diff --git a/arch/arm/src/sama5/sam_ohci.c b/arch/arm/src/sama5/sam_ohci.c index 7d4533dca6..b4a6b03f92 100644 --- a/arch/arm/src/sama5/sam_ohci.c +++ b/arch/arm/src/sama5/sam_ohci.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -2664,6 +2665,12 @@ static int sam_epalloc(struct usbhost_driver_s *drvr, 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 * 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.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 g_ohci.ininterval = MAX_PERINTERVAL; g_ohci.outinterval = MAX_PERINTERVAL; diff --git a/arch/arm/src/stm32/stm32_otgfshost.c b/arch/arm/src/stm32/stm32_otgfshost.c index 9b3c48102d..3feb0924c0 100644 --- a/arch/arm/src/stm32/stm32_otgfshost.c +++ b/arch/arm/src/stm32/stm32_otgfshost.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -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->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 */ 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++) { FAR struct stm32_chan_s *chan = &priv->chan[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_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/stm32/stm32_otghshost.c b/arch/arm/src/stm32/stm32_otghshost.c index da0a114aa8..aec4fc37d5 100644 --- a/arch/arm/src/stm32/stm32_otghshost.c +++ b/arch/arm/src/stm32/stm32_otghshost.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -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->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 */ 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++) { FAR struct stm32_chan_s *chan = &priv->chan[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_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/stm32f7/stm32_otghost.c b/arch/arm/src/stm32f7/stm32_otghost.c index 37677a614d..12488c262f 100644 --- a/arch/arm/src/stm32f7/stm32_otghost.c +++ b/arch/arm/src/stm32f7/stm32_otghost.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -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->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 */ 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++) { FAR struct stm32_chan_s *chan = &priv->chan[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_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/stm32l4/stm32l4_otgfshost.c b/arch/arm/src/stm32l4/stm32l4_otgfshost.c index 428a7f80cf..d47295f429 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfshost.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfshost.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -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->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 */ 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++) { FAR struct stm32l4_chan_s *chan = &priv->chan[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_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } }