diff --git a/arch/arm/src/efm32/efm32_dma.c b/arch/arm/src/efm32/efm32_dma.c index d568626b29..34a1520353 100644 --- a/arch/arm/src/efm32/efm32_dma.c +++ b/arch/arm/src/efm32/efm32_dma.c @@ -274,8 +274,8 @@ void weak_function up_dmainitialize(void) /* Initialize the channel list */ - sem_init(&g_dmac.exclsem, 0, 1); - sem_init(&g_dmac.chansem, 0, EFM32_DMA_NCHANNELS); + nxsem_init(&g_dmac.exclsem, 0, 1); + nxsem_init(&g_dmac.chansem, 0, EFM32_DMA_NCHANNELS); for (i = 0; i < EFM32_DMA_NCHANNELS; i++) { diff --git a/arch/arm/src/efm32/efm32_i2c.c b/arch/arm/src/efm32/efm32_i2c.c index 6b14038a77..964ecc4fcd 100644 --- a/arch/arm/src/efm32/efm32_i2c.c +++ b/arch/arm/src/efm32/efm32_i2c.c @@ -673,14 +673,14 @@ static inline void efm32_i2c_sem_post(FAR struct efm32_i2c_priv_s *priv) static inline void efm32_i2c_sem_init(FAR struct efm32_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/efm32/efm32_spi.c b/arch/arm/src/efm32/efm32_spi.c index 01491669fd..13b3c1d220 100644 --- a/arch/arm/src/efm32/efm32_spi.c +++ b/arch/arm/src/efm32/efm32_spi.c @@ -1605,7 +1605,7 @@ static int spi_portinitialize(struct efm32_spidev_s *priv) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_EFM32_SPI_DMA /* Allocate two DMA channels... one for the RX and one for the TX side of @@ -1639,8 +1639,8 @@ static int spi_portinitialize(struct efm32_spidev_s *priv) /* Initialized semaphores used to wait for DMA completion */ - (void)sem_init(&priv->rxdmasem, 0, 0); - (void)sem_init(&priv->txdmasem, 0, 0); + (void)nxsem_init(&priv->rxdmasem, 0, 0); + (void)nxsem_init(&priv->txdmasem, 0, 0); /* These semaphores are used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/efm32/efm32_usbhost.c b/arch/arm/src/efm32/efm32_usbhost.c index e3c8c548a7..866af2af7b 100644 --- a/arch/arm/src/efm32/efm32_usbhost.c +++ b/arch/arm/src/efm32/efm32_usbhost.c @@ -5155,8 +5155,8 @@ static inline void efm32_sw_initialize(FAR struct efm32_usbhost_s *priv) /* Initialize semaphores */ - sem_init(&priv->pscsem, 0, 0); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->pscsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -5186,7 +5186,7 @@ static inline void efm32_sw_initialize(FAR struct efm32_usbhost_s *priv) * have priority inheritance enabled. */ - sem_init(&chan->waitsem, 0, 0); + nxsem_init(&chan->waitsem, 0, 0); sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/imx1/imx_spi.c b/arch/arm/src/imx1/imx_spi.c index 695d6b358f..2f4d6bdd3e 100644 --- a/arch/arm/src/imx1/imx_spi.c +++ b/arch/arm/src/imx1/imx_spi.c @@ -1122,10 +1122,10 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Initialize control register: min frequency, ignore ready, master mode, mode=0, 8-bit */ diff --git a/arch/arm/src/imx6/imx_ecspi.c b/arch/arm/src/imx6/imx_ecspi.c index 9b6b34ceff..9e94afa85e 100644 --- a/arch/arm/src/imx6/imx_ecspi.c +++ b/arch/arm/src/imx6/imx_ecspi.c @@ -1308,10 +1308,10 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Initialize control register: min frequency, ignore ready, master mode, mode=0, 8-bit */ diff --git a/arch/arm/src/kinetis/kinetis_i2c.c b/arch/arm/src/kinetis/kinetis_i2c.c index 6efc2ff09a..d645de2553 100644 --- a/arch/arm/src/kinetis/kinetis_i2c.c +++ b/arch/arm/src/kinetis/kinetis_i2c.c @@ -316,13 +316,13 @@ static void kinetis_i2c_putreg(struct kinetis_i2cdev_s *priv, uint8_t value, static inline void kinetis_i2c_sem_init(FAR struct kinetis_i2cdev_s *priv) { - sem_init(&priv->mutex, 0, 1); + nxsem_init(&priv->mutex, 0, 1); /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->wait, 0, 0); + nxsem_init(&priv->wait, 0, 0); sem_setprotocol(&priv->wait, SEM_PRIO_NONE); } diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index 4c8ffea18a..a1aa7209d4 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -2807,7 +2807,7 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno) /* Initialize the SDHC slot structure data structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/kinetis/kinetis_spi.c b/arch/arm/src/kinetis/kinetis_spi.c index 1c25bc9754..3027c2a45f 100644 --- a/arch/arm/src/kinetis/kinetis_spi.c +++ b/arch/arm/src/kinetis/kinetis_spi.c @@ -1234,7 +1234,7 @@ FAR struct spi_dev_s *kinetis_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->spidev; } diff --git a/arch/arm/src/kl/kl_spi.c b/arch/arm/src/kl/kl_spi.c index e9fb9947cd..bf64d1624e 100644 --- a/arch/arm/src/kl/kl_spi.c +++ b/arch/arm/src/kl/kl_spi.c @@ -689,7 +689,7 @@ FAR struct spi_dev_s *kl_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->spidev; } diff --git a/arch/arm/src/lc823450/lc823450_adc.c b/arch/arm/src/lc823450/lc823450_adc.c index 18721898b8..5c38dbfdd1 100644 --- a/arch/arm/src/lc823450/lc823450_adc.c +++ b/arch/arm/src/lc823450/lc823450_adc.c @@ -535,9 +535,9 @@ FAR struct adc_dev_s *lc823450_adcinitialize(void) inst->nchannels = CONFIG_ADC_NCHANNELS; inst->chanlist = lc823450_chanlist; - sem_init(&inst->sem_excl, 0, 1); + nxsem_init(&inst->sem_excl, 0, 1); #ifndef CONFIG_ADC_POLLED - sem_init(&inst->sem_isr, 0, 0); + nxsem_init(&inst->sem_isr, 0, 0); #endif lc823450_adc_sem_wait(inst); diff --git a/arch/arm/src/lc823450/lc823450_dma.c b/arch/arm/src/lc823450/lc823450_dma.c index 0e4f234236..104c1d2ac6 100644 --- a/arch/arm/src/lc823450/lc823450_dma.c +++ b/arch/arm/src/lc823450/lc823450_dma.c @@ -344,7 +344,7 @@ void up_dmainitialize(void) sq_init(&g_dma.phydmach[i].req_q); } - sem_init(&g_dma.exclsem, 0, 1); + nxsem_init(&g_dma.exclsem, 0, 1); if (irq_attach(LC823450_IRQ_DMAC, dma_interrupt, NULL) != 0) { diff --git a/arch/arm/src/lc823450/lc823450_i2c.c b/arch/arm/src/lc823450/lc823450_i2c.c index 5624f6f015..2366ae1f14 100644 --- a/arch/arm/src/lc823450/lc823450_i2c.c +++ b/arch/arm/src/lc823450/lc823450_i2c.c @@ -1114,9 +1114,9 @@ FAR struct i2c_master_s *lc823450_i2cbus_initialize(int port) if ((volatile int)priv->refs++ == 0) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); #endif (void)lc823450_i2c_init(priv, port); } diff --git a/arch/arm/src/lc823450/lc823450_mtd.c b/arch/arm/src/lc823450/lc823450_mtd.c index 03917f59ca..67b22ddba7 100644 --- a/arch/arm/src/lc823450/lc823450_mtd.c +++ b/arch/arm/src/lc823450/lc823450_mtd.c @@ -516,7 +516,7 @@ static FAR struct mtd_dev_s *lc823450_mtd_allocdev(uint32_t channel) return NULL; } - sem_init(&priv->sem, 0, 1); + nxsem_init(&priv->sem, 0, 1); priv->mtd.erase = lc823450_erase; priv->mtd.bread = lc823450_bread; diff --git a/arch/arm/src/lc823450/lc823450_sdc.c b/arch/arm/src/lc823450/lc823450_sdc.c index 24953a1c97..35e3238a90 100644 --- a/arch/arm/src/lc823450/lc823450_sdc.c +++ b/arch/arm/src/lc823450/lc823450_sdc.c @@ -644,7 +644,7 @@ int lc823450_sdc_locked(void) for (i = 0; i < 2; i++) { - (void)sem_getvalue(&_sdc_sem[i], &val); + (void)nxsem_getvalue(&_sdc_sem[i], &val); if (1 != val) { ret = 1; diff --git a/arch/arm/src/lc823450/lc823450_sddrv_dep.c b/arch/arm/src/lc823450/lc823450_sddrv_dep.c index 0d9a066f31..6ba4625db3 100644 --- a/arch/arm/src/lc823450/lc823450_sddrv_dep.c +++ b/arch/arm/src/lc823450/lc823450_sddrv_dep.c @@ -289,9 +289,9 @@ SINT_T sddep_os_init(struct SdDrCfg_s *cfg) #ifdef CONFIG_LC823450_SDC_DMA _hrdma[ch] = lc823450_dmachannel(DMA_CHANNEL_VIRTUAL); - sem_init(&_sem_rwait[ch], 0, 0); + nxsem_init(&_sem_rwait[ch], 0, 0); _hwdma[ch] = lc823450_dmachannel(DMA_CHANNEL_VIRTUAL); - sem_init(&_sem_wwait[ch], 0, 0); + nxsem_init(&_sem_wwait[ch], 0, 0); #endif /* CONFIG_LC823450_SDC_DMA */ return 0; } diff --git a/arch/arm/src/lc823450/lc823450_serial.c b/arch/arm/src/lc823450/lc823450_serial.c index 1ba4745e04..7a15232f59 100644 --- a/arch/arm/src/lc823450/lc823450_serial.c +++ b/arch/arm/src/lc823450/lc823450_serial.c @@ -1317,12 +1317,12 @@ void up_serialinit(void) #ifdef TTYS1_DEV (void)uart_register("/dev/ttyS1", &TTYS1_DEV); #ifdef CONFIG_HSUART - sem_init(&g_uart1priv.txdma_wait, 0, 1); + nxsem_init(&g_uart1priv.txdma_wait, 0, 1); g_uart1priv.htxdma = lc823450_dmachannel(DMA_CHANNEL_UART1TX); lc823450_dmarequest(g_uart1priv.htxdma, DMA_REQUEST_UART1TX); - sem_init(&g_uart1priv.rxdma_wait, 0, 0); + nxsem_init(&g_uart1priv.rxdma_wait, 0, 0); g_uart1priv.hrxdma = lc823450_dmachannel(DMA_CHANNEL_UART1RX); lc823450_dmarequest(g_uart1priv.hrxdma, DMA_REQUEST_UART1RX); diff --git a/arch/arm/src/lc823450/lc823450_spi.c b/arch/arm/src/lc823450/lc823450_spi.c index 4104b84744..1f889b75a5 100644 --- a/arch/arm/src/lc823450/lc823450_spi.c +++ b/arch/arm/src/lc823450/lc823450_spi.c @@ -537,7 +537,7 @@ FAR struct spi_dev_s *lc823450_spibus_initialize(int port) modifyreg32(MRSTCNTAPB, 0, MRSTCNTAPB_PORT5_RSTB); #ifndef CONFIG_SPI_OWNBUS - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #endif /* Initialize SPI mode. It must be done before starting SPI transfer */ @@ -556,7 +556,7 @@ FAR struct spi_dev_s *lc823450_spibus_initialize(int port) lc823450_spiinitialize(); #ifdef CONFIG_LC823450_SPI_DMA - sem_init(&priv->dma_wait, 0, 0); + nxsem_init(&priv->dma_wait, 0, 0); priv->hdma = lc823450_dmachannel(DMA_CHANNEL_SIOTX); lc823450_dmarequest(priv->hdma, DMA_REQUEST_SIOTX); diff --git a/arch/arm/src/lc823450/lc823450_timerisr.c b/arch/arm/src/lc823450/lc823450_timerisr.c index ae478c476a..317819ad89 100644 --- a/arch/arm/src/lc823450/lc823450_timerisr.c +++ b/arch/arm/src/lc823450/lc823450_timerisr.c @@ -387,7 +387,7 @@ int up_hrttimer_usleep(unsigned int usec) { struct hrt_s hrt; - sem_init(&hrt.sem, 0, 0); + nxsem_init(&hrt.sem, 0, 0); hrt.usec = usec; hrt_usleep_add(&hrt); diff --git a/arch/arm/src/lc823450/lc823450_usbdev.c b/arch/arm/src/lc823450/lc823450_usbdev.c index 45de4e88fd..9d0e893aa7 100644 --- a/arch/arm/src/lc823450/lc823450_usbdev.c +++ b/arch/arm/src/lc823450/lc823450_usbdev.c @@ -1430,7 +1430,7 @@ void up_usbinitialize(void) return; } - sem_init(&dma_wait, 0, 0); + nxsem_init(&dma_wait, 0, 0); hdma = lc823450_dmachannel(DMA_CHANNEL_USBDEV); lc823450_dmarequest(hdma, DMA_REQUEST_USBDEV); @@ -1697,7 +1697,7 @@ void usbdev_msc_read_enter() privep->epcmd &= ~USB_EPCMD_EMPTY_EN; epcmd_write(CONFIG_USBMSC_EPBULKIN, (privep->epcmd)); lc823450_dmareauest_dir(hdma, DMA_REQUEST_USBDEV, 1); - sem_init(&dma_wait, 0, 0); + nxsem_init(&dma_wait, 0, 0); } /**************************************************************************** @@ -1800,7 +1800,7 @@ void usbdev_msc_write_enter0(void) privep->epcmd &= ~USB_EPCMD_READY_EN; epcmd_write(CONFIG_USBMSC_EPBULKOUT, (privep->epcmd)); lc823450_dmareauest_dir(hdma, DMA_REQUEST_USBDEV, 0); - sem_init(&dma_wait, 0, 0); + nxsem_init(&dma_wait, 0, 0); } /**************************************************************************** diff --git a/arch/arm/src/lpc11xx/lpc11_i2c.c b/arch/arm/src/lpc11xx/lpc11_i2c.c index b9d2d10743..1d2bd9a449 100644 --- a/arch/arm/src/lpc11xx/lpc11_i2c.c +++ b/arch/arm/src/lpc11xx/lpc11_i2c.c @@ -564,8 +564,8 @@ struct i2c_master_s *lpc11_i2cbus_initialize(int port) /* Initialize semaphores */ - sem_init(&priv->mutex, 0, 1); - sem_init(&priv->wait, 0, 0); + nxsem_init(&priv->mutex, 0, 1); + nxsem_init(&priv->wait, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/lpc11xx/lpc11_spi.c b/arch/arm/src/lpc11xx/lpc11_spi.c index c3f9157fe5..287cfb0632 100644 --- a/arch/arm/src/lpc11xx/lpc11_spi.c +++ b/arch/arm/src/lpc11xx/lpc11_spi.c @@ -579,7 +579,7 @@ FAR struct spi_dev_s *lpc11_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->spidev; } diff --git a/arch/arm/src/lpc11xx/lpc11_ssp.c b/arch/arm/src/lpc11xx/lpc11_ssp.c index a5a66d862a..faeb5ff1bc 100644 --- a/arch/arm/src/lpc11xx/lpc11_ssp.c +++ b/arch/arm/src/lpc11xx/lpc11_ssp.c @@ -993,7 +993,7 @@ FAR struct spi_dev_s *lpc11_sspbus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Enable the SPI */ diff --git a/arch/arm/src/lpc17xx/lpc17_gpdma.c b/arch/arm/src/lpc17xx/lpc17_gpdma.c index 8fba6cbaad..7ef8384493 100644 --- a/arch/arm/src/lpc17xx/lpc17_gpdma.c +++ b/arch/arm/src/lpc17xx/lpc17_gpdma.c @@ -305,7 +305,7 @@ void weak_function up_dmainitialize(void) /* Initialize the DMA state structure */ - sem_init(&g_gpdma.exclsem, 0, 1); + nxsem_init(&g_gpdma.exclsem, 0, 1); for (i = 0; i < LPC17_NDMACH; i++) { diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.c b/arch/arm/src/lpc17xx/lpc17_i2c.c index 30763fe177..52d064a426 100644 --- a/arch/arm/src/lpc17xx/lpc17_i2c.c +++ b/arch/arm/src/lpc17xx/lpc17_i2c.c @@ -569,8 +569,8 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port) /* Initialize semaphores */ - sem_init(&priv->mutex, 0, 1); - sem_init(&priv->wait, 0, 0); + nxsem_init(&priv->mutex, 0, 1); + nxsem_init(&priv->wait, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.c b/arch/arm/src/lpc17xx/lpc17_sdcard.c index 56ab096578..7260e7837e 100644 --- a/arch/arm/src/lpc17xx/lpc17_sdcard.c +++ b/arch/arm/src/lpc17xx/lpc17_sdcard.c @@ -2718,7 +2718,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the SD card slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/lpc17xx/lpc17_spi.c b/arch/arm/src/lpc17xx/lpc17_spi.c index 6ddef3951f..5d28258d4c 100644 --- a/arch/arm/src/lpc17xx/lpc17_spi.c +++ b/arch/arm/src/lpc17xx/lpc17_spi.c @@ -570,7 +570,7 @@ FAR struct spi_dev_s *lpc17_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->spidev; } diff --git a/arch/arm/src/lpc17xx/lpc17_ssp.c b/arch/arm/src/lpc17xx/lpc17_ssp.c index d66abf4d9d..7cdfbcfe78 100644 --- a/arch/arm/src/lpc17xx/lpc17_ssp.c +++ b/arch/arm/src/lpc17xx/lpc17_ssp.c @@ -982,7 +982,7 @@ FAR struct spi_dev_s *lpc17_sspbus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Enable the SPI */ diff --git a/arch/arm/src/lpc17xx/lpc17_usbhost.c b/arch/arm/src/lpc17xx/lpc17_usbhost.c index 6bb48cd8f9..d5224b2e78 100644 --- a/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -2267,7 +2267,7 @@ static int lpc17_epalloc(struct usbhost_driver_s *drvr, * should not have priority inheritance enabled. */ - sem_init(&ed->wdhsem, 0, 0); + nxsem_init(&ed->wdhsem, 0, 0); sem_setprotocol(&ed->wdhsem, SEM_PRIO_NONE); /* Link the common tail TD to the ED's TD list */ @@ -3641,8 +3641,8 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller) /* Initialize semaphores */ - sem_init(&priv->pscsem, 0, 0); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->pscsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -3735,7 +3735,7 @@ struct usbhost_connection_s *lpc17_usbhost_initialize(int controller) * not have priority inheritance enabled. */ - sem_init(&EDCTRL->wdhsem, 0, 0); + nxsem_init(&EDCTRL->wdhsem, 0, 0); sem_setprotocol(&EDCTRL->wdhsem, SEM_PRIO_NONE); /* Initialize user-configurable EDs */ diff --git a/arch/arm/src/lpc2378/lpc23xx_i2c.c b/arch/arm/src/lpc2378/lpc23xx_i2c.c index 8191179f11..eebc910ef2 100644 --- a/arch/arm/src/lpc2378/lpc23xx_i2c.c +++ b/arch/arm/src/lpc2378/lpc23xx_i2c.c @@ -580,8 +580,8 @@ struct i2c_master_s *lpc2378_i2cbus_initialize(int port) /* Initialize semaphores */ - sem_init(&priv->mutex, 0, 1); - sem_init(&priv->wait, 0, 0); + nxsem_init(&priv->mutex, 0, 1); + nxsem_init(&priv->wait, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/lpc2378/lpc23xx_spi.c b/arch/arm/src/lpc2378/lpc23xx_spi.c index cf95f63a8b..55ec145335 100644 --- a/arch/arm/src/lpc2378/lpc23xx_spi.c +++ b/arch/arm/src/lpc2378/lpc23xx_spi.c @@ -582,7 +582,7 @@ FAR struct spi_dev_s *lpc23_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->spidev; } diff --git a/arch/arm/src/lpc31xx/lpc31_ehci.c b/arch/arm/src/lpc31xx/lpc31_ehci.c index 1884a41241..51becdda98 100644 --- a/arch/arm/src/lpc31xx/lpc31_ehci.c +++ b/arch/arm/src/lpc31xx/lpc31_ehci.c @@ -3937,7 +3937,7 @@ static int lpc31_epalloc(FAR struct usbhost_driver_s *drvr, * priority inheritance enabled. */ - sem_init(&epinfo->iocsem, 0, 0); + nxsem_init(&epinfo->iocsem, 0, 0); sem_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE); /* Success.. return an opaque reference to the endpoint information structure @@ -4920,8 +4920,8 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller) /* Initialize the EHCI state data structure */ - sem_init(&g_ehci.exclsem, 0, 1); - sem_init(&g_ehci.pscsem, 0, 0); + nxsem_init(&g_ehci.exclsem, 0, 1); + nxsem_init(&g_ehci.pscsem, 0, 0); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -4931,7 +4931,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller) /* Initialize EP0 */ - sem_init(&g_ehci.ep0.iocsem, 0, 1); + nxsem_init(&g_ehci.ep0.iocsem, 0, 1); /* Initialize the root hub port structures */ @@ -4970,7 +4970,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller) * should not have priority inheritance enabled. */ - sem_init(&rhport->ep0.iocsem, 0, 0); + nxsem_init(&rhport->ep0.iocsem, 0, 0); sem_setprotocol(&rhport->iocsem, SEM_PRIO_NONE); /* Initialize the public port representation */ diff --git a/arch/arm/src/lpc31xx/lpc31_i2c.c b/arch/arm/src/lpc31xx/lpc31_i2c.c index 8d79ac56e3..257ade4eb8 100644 --- a/arch/arm/src/lpc31xx/lpc31_i2c.c +++ b/arch/arm/src/lpc31xx/lpc31_i2c.c @@ -551,8 +551,8 @@ struct i2c_master_s *lpc31_i2cbus_initialize(int port) /* Initialize semaphores */ - sem_init(&priv->mutex, 0, 1); - sem_init(&priv->wait, 0, 0); + nxsem_init(&priv->mutex, 0, 1); + nxsem_init(&priv->wait, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/lpc31xx/lpc31_spi.c b/arch/arm/src/lpc31xx/lpc31_spi.c index 871eca69da..2c60c67e11 100644 --- a/arch/arm/src/lpc31xx/lpc31_spi.c +++ b/arch/arm/src/lpc31xx/lpc31_spi.c @@ -941,7 +941,7 @@ FAR struct spi_dev_s *lpc31_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Reset the SPI block */ diff --git a/arch/arm/src/lpc43xx/lpc43_ehci.c b/arch/arm/src/lpc43xx/lpc43_ehci.c index e9bb3ddcdc..4979d9e825 100644 --- a/arch/arm/src/lpc43xx/lpc43_ehci.c +++ b/arch/arm/src/lpc43xx/lpc43_ehci.c @@ -3774,7 +3774,7 @@ static int lpc43_epalloc(FAR struct usbhost_driver_s *drvr, * should not have priority inheritance enabled. */ - sem_init(&epinfo->iocsem, 0, 0); + nxsem_init(&epinfo->iocsem, 0, 0); sem_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE); /* Success.. return an opaque reference to the endpoint information structure @@ -4751,8 +4751,8 @@ FAR struct usbhost_connection_s *lpc43_ehci_initialize(int controller) /* Initialize the EHCI state data structure */ - sem_init(&g_ehci.exclsem, 0, 1); - sem_init(&g_ehci.pscsem, 0, 0); + nxsem_init(&g_ehci.exclsem, 0, 1); + nxsem_init(&g_ehci.pscsem, 0, 0); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -4762,7 +4762,7 @@ FAR struct usbhost_connection_s *lpc43_ehci_initialize(int controller) /* Initialize EP0 */ - sem_init(&g_ehci.ep0.iocsem, 0, 1); + nxsem_init(&g_ehci.ep0.iocsem, 0, 1); /* Initialize the root hub port structures */ @@ -4801,7 +4801,7 @@ FAR struct usbhost_connection_s *lpc43_ehci_initialize(int controller) * not have priority inheritance enabled. */ - sem_init(&rhport->ep0.iocsem, 0, 0); + nxsem_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/lpc43xx/lpc43_gpdma.c b/arch/arm/src/lpc43xx/lpc43_gpdma.c index 585bdb9db3..7175f9f40f 100644 --- a/arch/arm/src/lpc43xx/lpc43_gpdma.c +++ b/arch/arm/src/lpc43xx/lpc43_gpdma.c @@ -305,7 +305,7 @@ void weak_function up_dmainitialize(void) /* Initialize the DMA state structure */ - sem_init(&g_gpdma.exclsem, 0, 1); + nxsem_init(&g_gpdma.exclsem, 0, 1); for (i = 0; i < LPC43_NDMACH; i++) { diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.c b/arch/arm/src/lpc43xx/lpc43_i2c.c index fc0a25d1f1..763e03758c 100644 --- a/arch/arm/src/lpc43xx/lpc43_i2c.c +++ b/arch/arm/src/lpc43xx/lpc43_i2c.c @@ -526,8 +526,8 @@ struct i2c_master_s *lpc43_i2cbus_initialize(int port) /* Initialize semaphores */ - sem_init(&priv->mutex, 0, 1); - sem_init(&priv->wait, 0, 0); + nxsem_init(&priv->mutex, 0, 1); + nxsem_init(&priv->wait, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/lpc43xx/lpc43_spi.c b/arch/arm/src/lpc43xx/lpc43_spi.c index 43e7e08052..093aaf6f2d 100644 --- a/arch/arm/src/lpc43xx/lpc43_spi.c +++ b/arch/arm/src/lpc43xx/lpc43_spi.c @@ -540,7 +540,7 @@ static FAR struct spi_dev_s *lpc43_spiport_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->spidev; } #endif /* CONFIG_LPC43_SPI */ diff --git a/arch/arm/src/lpc43xx/lpc43_ssp.c b/arch/arm/src/lpc43xx/lpc43_ssp.c index c5af6124d5..4154bb9c0c 100644 --- a/arch/arm/src/lpc43xx/lpc43_ssp.c +++ b/arch/arm/src/lpc43xx/lpc43_ssp.c @@ -827,7 +827,7 @@ FAR struct spi_dev_s *lpc43_sspbus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Enable the SPI */ diff --git a/arch/arm/src/sam34/sam4cm_tc.c b/arch/arm/src/sam34/sam4cm_tc.c index 32e465cc77..4ded41568a 100644 --- a/arch/arm/src/sam34/sam4cm_tc.c +++ b/arch/arm/src/sam34/sam4cm_tc.c @@ -748,7 +748,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) tmrerr("ERROR: Initializing TC%d\n", chconfig->chan); memset(chan, 0, sizeof(struct sam_chan_s)); - sem_init(&chan->exclsem, 0, 1); + nxsem_init(&chan->exclsem, 0, 1); chan->base = chconfig->base; chan->pid = chconfig->pid; chan->irq = chconfig->irq; diff --git a/arch/arm/src/sam34/sam_aes.c b/arch/arm/src/sam34/sam_aes.c index 29634e69c7..ac9f0e70db 100644 --- a/arch/arm/src/sam34/sam_aes.c +++ b/arch/arm/src/sam34/sam_aes.c @@ -225,7 +225,7 @@ int aes_cypher(void *out, const void *in, uint32_t size, const void *iv, int up_aesinitialize() { - sem_init(&lock, 0, 1); + nxsem_init(&lock, 0, 1); sam_aes_enableclk(); putreg32(AES_CR_SWRST, SAM_AES_CR); return OK; diff --git a/arch/arm/src/sam34/sam_dmac.c b/arch/arm/src/sam34/sam_dmac.c index 6cd36cacf8..b9ad29636f 100644 --- a/arch/arm/src/sam34/sam_dmac.c +++ b/arch/arm/src/sam34/sam_dmac.c @@ -1382,8 +1382,8 @@ void weak_function up_dmainitialize(void) /* Initialize semaphores */ - sem_init(&g_chsem, 0, 1); - sem_init(&g_dsem, 0, CONFIG_SAM34_NLLDESC); + nxsem_init(&g_chsem, 0, 1); + nxsem_init(&g_dsem, 0, CONFIG_SAM34_NLLDESC); } /**************************************************************************** diff --git a/arch/arm/src/sam34/sam_hsmci.c b/arch/arm/src/sam34/sam_hsmci.c index e59d558fe4..faad8051f6 100644 --- a/arch/arm/src/sam34/sam_hsmci.c +++ b/arch/arm/src/sam34/sam_hsmci.c @@ -2681,7 +2681,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the HSMCI slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/sam34/sam_spi.c b/arch/arm/src/sam34/sam_spi.c index 899eb9bc2e..58e4c94dca 100644 --- a/arch/arm/src/sam34/sam_spi.c +++ b/arch/arm/src/sam34/sam_spi.c @@ -1878,7 +1878,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) * access to the SPI registers. */ - sem_init(&spi->spisem, 0, 1); + nxsem_init(&spi->spisem, 0, 1); spi->initialized = true; #ifdef CONFIG_SAM34_SPI_DMA @@ -1887,7 +1887,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&spics->dmawait, 0, 0); + nxsem_init(&spics->dmawait, 0, 0); sem_setprotocol(&spics->dmawait, SEM_PRIO_NONE); /* Create a watchdog time to catch DMA timeouts */ diff --git a/arch/arm/src/sam34/sam_twi.c b/arch/arm/src/sam34/sam_twi.c index 1b85275e8b..6663ca861c 100644 --- a/arch/arm/src/sam34/sam_twi.c +++ b/arch/arm/src/sam34/sam_twi.c @@ -967,8 +967,8 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Initialize semaphores */ - sem_init(&priv->exclsem, 0, 1); - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/sama5/sam_adc.c b/arch/arm/src/sama5/sam_adc.c index 6688899510..044f9e8150 100644 --- a/arch/arm/src/sama5/sam_adc.c +++ b/arch/arm/src/sama5/sam_adc.c @@ -2025,7 +2025,7 @@ struct adc_dev_s *sam_adc_initialize(void) /* Initialize the private ADC device data structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->cb = NULL; priv->dev = &g_adcdev; diff --git a/arch/arm/src/sama5/sam_can.c b/arch/arm/src/sama5/sam_can.c index 029a4df1c6..b611767650 100644 --- a/arch/arm/src/sama5/sam_can.c +++ b/arch/arm/src/sama5/sam_can.c @@ -1947,7 +1947,7 @@ FAR struct can_dev_s *sam_caninitialize(int port) priv->freemb = CAN_ALL_MAILBOXES; priv->initialized = true; - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); dev->cd_ops = &g_canops; dev->cd_priv = (FAR void *)priv; diff --git a/arch/arm/src/sama5/sam_dmac.c b/arch/arm/src/sama5/sam_dmac.c index a1002395db..49d110ed37 100644 --- a/arch/arm/src/sama5/sam_dmac.c +++ b/arch/arm/src/sama5/sam_dmac.c @@ -1879,8 +1879,8 @@ void sam_dmainitialize(struct sam_dmac_s *dmac) /* Initialize semaphores */ - sem_init(&dmac->chsem, 0, 1); - sem_init(&dmac->dsem, 0, SAM_NDMACHAN); + nxsem_init(&dmac->chsem, 0, 1); + nxsem_init(&dmac->dsem, 0, SAM_NDMACHAN); } /**************************************************************************** diff --git a/arch/arm/src/sama5/sam_ehci.c b/arch/arm/src/sama5/sam_ehci.c index 4070964863..d1d039c9c6 100644 --- a/arch/arm/src/sama5/sam_ehci.c +++ b/arch/arm/src/sama5/sam_ehci.c @@ -3758,7 +3758,7 @@ static int sam_epalloc(FAR struct usbhost_driver_s *drvr, * should not have priority inheritance enabled. */ - sem_init(&epinfo->iocsem, 0, 0); + nxsem_init(&epinfo->iocsem, 0, 0); sem_setprotocol(&epinfo->iocsem, SEM_PRIO_NONE); /* Success.. return an opaque reference to the endpoint information structure @@ -4791,8 +4791,8 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) /* Initialize the EHCI state data structure */ - sem_init(&g_ehci.exclsem, 0, 1); - sem_init(&g_ehci.pscsem, 0, 0); + nxsem_init(&g_ehci.exclsem, 0, 1); + nxsem_init(&g_ehci.pscsem, 0, 0); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -4802,7 +4802,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) /* Initialize EP0 */ - sem_init(&g_ehci.ep0.iocsem, 0, 1); + nxsem_init(&g_ehci.ep0.iocsem, 0, 1); /* Initialize the root hub port structures */ @@ -4841,7 +4841,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller) * should not have priority inheritance enabled. */ - sem_init(&rhport->ep0.iocsem, 0, 0); + nxsem_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_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index 7b4cee4749..3acdc5b4d0 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/arch/arm/src/sama5/sam_hsmci.c @@ -3298,7 +3298,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the HSMCI slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/sama5/sam_nand.c b/arch/arm/src/sama5/sam_nand.c index c7cf74f185..b5a2ec835e 100644 --- a/arch/arm/src/sama5/sam_nand.c +++ b/arch/arm/src/sama5/sam_nand.c @@ -2949,7 +2949,7 @@ struct mtd_dev_s *sam_nand_initialize(int cs) * priority inheritance enabled. */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); #endif @@ -2960,7 +2960,7 @@ struct mtd_dev_s *sam_nand_initialize(int cs) /* Initialize the global nand state structure */ #if NAND_NBANKS > 1 - sem_init(&g_nand.exclsem, 0, 1); + nxsem_init(&g_nand.exclsem, 0, 1); #endif #ifdef CONFIG_SAMA5_NAND_HSMCINTERRUPTS @@ -2968,7 +2968,7 @@ struct mtd_dev_s *sam_nand_initialize(int cs) * have priority inheritance enabled. */ - sem_init(&g_nand.waitsem, 0, 0); + nxsem_init(&g_nand.waitsem, 0, 0); sem_setprotocol(&g_nand.waitsem, SEM_PRIO_NONE); #endif diff --git a/arch/arm/src/sama5/sam_ohci.c b/arch/arm/src/sama5/sam_ohci.c index 8ecb6a0194..84f15f7351 100644 --- a/arch/arm/src/sama5/sam_ohci.c +++ b/arch/arm/src/sama5/sam_ohci.c @@ -2663,7 +2663,7 @@ static int sam_epalloc(struct usbhost_driver_s *drvr, /* Initialize the endpoint container */ - sem_init(&eplist->wdhsem, 0, 0); + nxsem_init(&eplist->wdhsem, 0, 0); /* The wdhsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -3907,8 +3907,8 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller) /* Initialize the state data structure */ - sem_init(&g_ohci.pscsem, 0, 0); - sem_init(&g_ohci.exclsem, 0, 1); + nxsem_init(&g_ohci.pscsem, 0, 0); + nxsem_init(&g_ohci.exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/sama5/sam_pmecc.c b/arch/arm/src/sama5/sam_pmecc.c index 0339068c4f..a7275209b4 100644 --- a/arch/arm/src/sama5/sam_pmecc.c +++ b/arch/arm/src/sama5/sam_pmecc.c @@ -988,7 +988,7 @@ static int pmecc_pagelayout(uint16_t datasize, uint16_t eccsize) #if NAND_NPMECC_BANKS > 1 void pmecc_initialize(void) { - sem_init(&g_pmecc.exclsem, 0, 1); + nxsem_init(&g_pmecc.exclsem, 0, 1); } #endif diff --git a/arch/arm/src/sama5/sam_spi.c b/arch/arm/src/sama5/sam_spi.c index cda2a36f97..7ca5159e44 100644 --- a/arch/arm/src/sama5/sam_spi.c +++ b/arch/arm/src/sama5/sam_spi.c @@ -1806,7 +1806,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) * access to the SPI registers. */ - sem_init(&spi->spisem, 0, 1); + nxsem_init(&spi->spisem, 0, 1); spi->initialized = true; #ifdef CONFIG_SAMA5_SPI_DMA @@ -1815,7 +1815,7 @@ struct spi_dev_s *sam_spibus_initialize(int port) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&spics->dmawait, 0, 0); + nxsem_init(&spics->dmawait, 0, 0); sem_setprotocol(&spics->dmawait, SEM_PRIO_NONE); /* Create a watchdog time to catch DMA timeouts */ diff --git a/arch/arm/src/sama5/sam_ssc.c b/arch/arm/src/sama5/sam_ssc.c index 8e4e66a032..b4351774ed 100644 --- a/arch/arm/src/sama5/sam_ssc.c +++ b/arch/arm/src/sama5/sam_ssc.c @@ -1037,7 +1037,7 @@ static void ssc_buf_initialize(struct sam_ssc_s *priv) int i; priv->freelist = NULL; - sem_init(&priv->bufsem, 0, CONFIG_SAMA5_SSC_MAXINFLIGHT); + nxsem_init(&priv->bufsem, 0, CONFIG_SAMA5_SSC_MAXINFLIGHT); for (i = 0; i < CONFIG_SAMA5_SSC_MAXINFLIGHT; i++) { @@ -3430,7 +3430,7 @@ struct i2s_dev_s *sam_ssc_initialize(int port) /* Initialize the common parts for the SSC device structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->dev.ops = &g_sscops; priv->sscno = port; diff --git a/arch/arm/src/sama5/sam_tc.c b/arch/arm/src/sama5/sam_tc.c index 2bdff628ca..142d277ccd 100644 --- a/arch/arm/src/sama5/sam_tc.c +++ b/arch/arm/src/sama5/sam_tc.c @@ -971,7 +971,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) /* Initialize the timer counter data structure. */ memset(tc, 0, sizeof(struct sam_tc_s)); - sem_init(&tc->exclsem, 0, 1); + nxsem_init(&tc->exclsem, 0, 1); tc->base = tcconfig->base; tc->tc = channel < 3 ? 0 : 1; tc->pid = tcconfig->pid; diff --git a/arch/arm/src/sama5/sam_trng.c b/arch/arm/src/sama5/sam_trng.c index fed9a347ac..806815160f 100644 --- a/arch/arm/src/sama5/sam_trng.c +++ b/arch/arm/src/sama5/sam_trng.c @@ -356,8 +356,8 @@ static int sam_rng_initialize(void) /* Initialize semphores */ - sem_init(&g_trngdev.exclsem, 0, 1); - sem_init(&g_trngdev.waitsem, 0, 0); + nxsem_init(&g_trngdev.exclsem, 0, 1); + nxsem_init(&g_trngdev.waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c index 403aa93f75..11e7649905 100644 --- a/arch/arm/src/sama5/sam_tsd.c +++ b/arch/arm/src/sama5/sam_tsd.c @@ -1674,7 +1674,7 @@ int sam_tsd_register(struct sam_adc_s *adc, int minor) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); /* Register the device as an input device */ diff --git a/arch/arm/src/sama5/sam_twi.c b/arch/arm/src/sama5/sam_twi.c index 117f29b445..f865104913 100644 --- a/arch/arm/src/sama5/sam_twi.c +++ b/arch/arm/src/sama5/sam_twi.c @@ -1268,8 +1268,8 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Initialize semaphores */ - (void)sem_init(&priv->exclsem, 0, 1); - (void)sem_init(&priv->waitsem, 0, 0); + (void)nxsem_init(&priv->exclsem, 0, 1); + (void)nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/sama5/sam_xdmac.c b/arch/arm/src/sama5/sam_xdmac.c index 458efcd82b..93ab306050 100644 --- a/arch/arm/src/sama5/sam_xdmac.c +++ b/arch/arm/src/sama5/sam_xdmac.c @@ -1906,8 +1906,8 @@ void sam_dmainitialize(struct sam_xdmac_s *xdmac) /* Initialize semaphores */ - sem_init(&xdmac->chsem, 0, 1); - sem_init(&xdmac->dsem, 0, SAM_NDMACHAN); + nxsem_init(&xdmac->chsem, 0, 1); + nxsem_init(&xdmac->dsem, 0, SAM_NDMACHAN); } /**************************************************************************** diff --git a/arch/arm/src/samdl/sam_dmac.c b/arch/arm/src/samdl/sam_dmac.c index 20501ecc0e..77763c5404 100644 --- a/arch/arm/src/samdl/sam_dmac.c +++ b/arch/arm/src/samdl/sam_dmac.c @@ -774,9 +774,9 @@ void weak_function up_dmainitialize(void) /* Initialize global semaphores */ - sem_init(&g_chsem, 0, 1); + nxsem_init(&g_chsem, 0, 1); #if CONFIG_SAMDL_DMAC_NDESC > 0 - sem_init(&g_dsem, 0, CONFIG_SAMDL_DMAC_NDESC); + nxsem_init(&g_dsem, 0, CONFIG_SAMDL_DMAC_NDESC); #endif /* Initialized the DMA channel table */ diff --git a/arch/arm/src/samdl/sam_i2c_master.c b/arch/arm/src/samdl/sam_i2c_master.c index b377f1580a..ef07603e1f 100644 --- a/arch/arm/src/samdl/sam_i2c_master.c +++ b/arch/arm/src/samdl/sam_i2c_master.c @@ -1344,8 +1344,8 @@ struct i2c_master_s *sam_i2c_master_initialize(int bus) priv->dev.ops = &g_i2cops; priv->flags = 0; - (void)sem_init(&priv->exclsem, 0, 1); - (void)sem_init(&priv->waitsem, 0, 0); + (void)nxsem_init(&priv->exclsem, 0, 1); + (void)nxsem_init(&priv->waitsem, 0, 0); /* Perform repeatable I2C hardware initialization */ diff --git a/arch/arm/src/samv7/sam_hsmci.c b/arch/arm/src/samv7/sam_hsmci.c index 544cae9524..7e5c0d0fe0 100644 --- a/arch/arm/src/samv7/sam_hsmci.c +++ b/arch/arm/src/samv7/sam_hsmci.c @@ -3330,7 +3330,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the HSMCI slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/samv7/sam_mcan.c b/arch/arm/src/samv7/sam_mcan.c index 3abe2ce926..245bea0ee8 100644 --- a/arch/arm/src/samv7/sam_mcan.c +++ b/arch/arm/src/samv7/sam_mcan.c @@ -1441,7 +1441,7 @@ static void mcan_buffer_reserve(FAR struct sam_mcan_s *priv) flags = enter_critical_section(); txfqs1 = mcan_getreg(priv, SAM_MCAN_TXFQS_OFFSET); - (void)sem_getvalue(&priv->txfsem, &sval); + (void)nxsem_getvalue(&priv->txfsem, &sval); txfqs2 = mcan_getreg(priv, SAM_MCAN_TXFQS_OFFSET); /* If the semaphore count and the TXFQS samples are in @@ -1477,7 +1477,7 @@ static void mcan_buffer_reserve(FAR struct sam_mcan_s *priv) if (sval > 0) { canerr("ERROR: TX FIFOQ full but txfsem is %d\n", sval); - sem_reset(&priv->txfsem, 0); + nxsem_reset(&priv->txfsem, 0); } } @@ -1542,7 +1542,7 @@ static void mcan_buffer_reserve(FAR struct sam_mcan_s *priv) /* Reset the semaphore count to the Tx FIFO free level. */ - sem_reset(&priv->txfsem, tffl); + nxsem_reset(&priv->txfsem, tffl); } #endif @@ -1587,7 +1587,7 @@ static void mcan_buffer_release(FAR struct sam_mcan_s *priv) * many times. */ - (void)sem_getvalue(&priv->txfsem, &sval); + (void)nxsem_getvalue(&priv->txfsem, &sval); if (sval < priv->config->ntxfifoq) { sem_post(&priv->txfsem); @@ -2270,7 +2270,7 @@ static void mcan_reset(FAR struct can_dev_s *dev) */ sem_destroy(&priv->txfsem); - sem_init(&priv->txfsem, 0, config->ntxfifoq); + nxsem_init(&priv->txfsem, 0, config->ntxfifoq); /* Disable peripheral clocking to the MCAN controller */ @@ -2949,7 +2949,7 @@ static bool mcan_txready(FAR struct can_dev_s *dev) * the TX FIFO/queue. Make sure that they are consistent. */ - (void)sem_getvalue(&priv->txfsem, &sval); + (void)nxsem_getvalue(&priv->txfsem, &sval); DEBUGASSERT(((notfull && sval > 0) || (!notfull && sval <= 0)) && (sval <= priv->config->ntxfifoq)); #endif @@ -3016,7 +3016,7 @@ static bool mcan_txempty(FAR struct can_dev_s *dev) * elements, then there is no transfer in progress. */ - (void)sem_getvalue(&priv->txfsem, &sval); + (void)nxsem_getvalue(&priv->txfsem, &sval); DEBUGASSERT(sval > 0 && sval <= priv->config->ntxfifoq); empty = (sval == priv->config->ntxfifoq); @@ -4014,8 +4014,8 @@ FAR struct can_dev_s *sam_mcan_initialize(int port) /* Initialize semaphores */ - sem_init(&priv->locksem, 0, 1); - sem_init(&priv->txfsem, 0, config->ntxfifoq); + nxsem_init(&priv->locksem, 0, 1); + nxsem_init(&priv->txfsem, 0, config->ntxfifoq); dev->cd_ops = &g_mcanops; dev->cd_priv = (FAR void *)priv; diff --git a/arch/arm/src/samv7/sam_progmem.c b/arch/arm/src/samv7/sam_progmem.c index 535817bdff..c04f18c860 100644 --- a/arch/arm/src/samv7/sam_progmem.c +++ b/arch/arm/src/samv7/sam_progmem.c @@ -363,7 +363,7 @@ void sam_progmem_initialize(void) * page buffer. */ - sem_init(&g_page_sem, 0, 1); + nxsem_init(&g_page_sem, 0, 1); } /**************************************************************************** diff --git a/arch/arm/src/samv7/sam_qspi.c b/arch/arm/src/samv7/sam_qspi.c index 3e51bee751..caf3b7c64f 100644 --- a/arch/arm/src/samv7/sam_qspi.c +++ b/arch/arm/src/samv7/sam_qspi.c @@ -1775,7 +1775,7 @@ struct qspi_dev_s *sam_qspi_initialize(int intf) * access to the QSPI registers. */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_SAMV7_QSPI_DMA /* Pre-allocate DMA channels. */ @@ -1795,7 +1795,7 @@ struct qspi_dev_s *sam_qspi_initialize(int intf) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&priv->dmawait, 0, 0); + nxsem_init(&priv->dmawait, 0, 0); sem_setprotocol(&priv->dmawait, SEM_PRIO_NONE); /* Create a watchdog time to catch DMA timeouts */ diff --git a/arch/arm/src/samv7/sam_spi.c b/arch/arm/src/samv7/sam_spi.c index 583cb7aca5..3e51b844ec 100644 --- a/arch/arm/src/samv7/sam_spi.c +++ b/arch/arm/src/samv7/sam_spi.c @@ -2162,7 +2162,7 @@ FAR struct spi_dev_s *sam_spibus_initialize(int port) * access to the SPI registers. */ - sem_init(&spi->spisem, 0, 1); + nxsem_init(&spi->spisem, 0, 1); spi->escape_lastxfer = false; spi->initialized = true; @@ -2172,7 +2172,7 @@ FAR struct spi_dev_s *sam_spibus_initialize(int port) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&spics->dmawait, 0, 0); + nxsem_init(&spics->dmawait, 0, 0); sem_setprotocol(&spics->dmawait, SEM_PRIO_NONE); /* Create a watchdog time to catch DMA timeouts */ diff --git a/arch/arm/src/samv7/sam_spi_slave.c b/arch/arm/src/samv7/sam_spi_slave.c index 6b68769ab8..fe486b3428 100644 --- a/arch/arm/src/samv7/sam_spi_slave.c +++ b/arch/arm/src/samv7/sam_spi_slave.c @@ -1198,7 +1198,7 @@ struct spi_sctrlr_s *sam_spi_slave_initialize(int port) * access to the SPI registers. */ - sem_init(&priv->spisem, 0, 1); + nxsem_init(&priv->spisem, 0, 1); priv->nss = true; priv->initialized = true; diff --git a/arch/arm/src/samv7/sam_ssc.c b/arch/arm/src/samv7/sam_ssc.c index 11ae76c9f0..d7c7111fb7 100644 --- a/arch/arm/src/samv7/sam_ssc.c +++ b/arch/arm/src/samv7/sam_ssc.c @@ -1011,7 +1011,7 @@ static void ssc_buf_initialize(struct sam_ssc_s *priv) int i; priv->freelist = NULL; - sem_init(&priv->bufsem, 0, CONFIG_SAMV7_SSC_MAXINFLIGHT); + nxsem_init(&priv->bufsem, 0, CONFIG_SAMV7_SSC_MAXINFLIGHT); for (i = 0; i < CONFIG_SAMV7_SSC_MAXINFLIGHT; i++) { @@ -3406,7 +3406,7 @@ struct i2s_dev_s *sam_ssc_initialize(int port) /* Initialize the common parts for the SSC device structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->dev.ops = &g_sscops; priv->sscno = port; diff --git a/arch/arm/src/samv7/sam_tc.c b/arch/arm/src/samv7/sam_tc.c index 91b0e36f5f..9bf28704fd 100644 --- a/arch/arm/src/samv7/sam_tc.c +++ b/arch/arm/src/samv7/sam_tc.c @@ -1187,7 +1187,7 @@ static inline struct sam_chan_s *sam_tc_initialize(int channel) /* Initialize the timer counter data structure. */ memset(tc, 0, sizeof(struct sam_tc_s)); - sem_init(&tc->exclsem, 0, 1); + nxsem_init(&tc->exclsem, 0, 1); tc->base = tcconfig->base; tc->tc = tcconfig->tc; diff --git a/arch/arm/src/samv7/sam_trng.c b/arch/arm/src/samv7/sam_trng.c index e8eae34f99..f2649e50e6 100644 --- a/arch/arm/src/samv7/sam_trng.c +++ b/arch/arm/src/samv7/sam_trng.c @@ -357,8 +357,8 @@ static int sam_rng_initialize(void) /* Initialize semaphores */ - sem_init(&g_trngdev.exclsem, 0, 1); - sem_init(&g_trngdev.waitsem, 0, 0); + nxsem_init(&g_trngdev.exclsem, 0, 1); + nxsem_init(&g_trngdev.waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/samv7/sam_twihs.c b/arch/arm/src/samv7/sam_twihs.c index 05fa92cd71..c9a4e23c4f 100644 --- a/arch/arm/src/samv7/sam_twihs.c +++ b/arch/arm/src/samv7/sam_twihs.c @@ -1433,8 +1433,8 @@ struct i2c_master_s *sam_i2cbus_initialize(int bus) /* Initialize semaphores */ - (void)sem_init(&priv->exclsem, 0, 1); - (void)sem_init(&priv->waitsem, 0, 0); + (void)nxsem_init(&priv->exclsem, 0, 1); + (void)nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/arch/arm/src/samv7/sam_xdmac.c b/arch/arm/src/samv7/sam_xdmac.c index cae694a68e..49db5ea719 100644 --- a/arch/arm/src/samv7/sam_xdmac.c +++ b/arch/arm/src/samv7/sam_xdmac.c @@ -1586,8 +1586,8 @@ void sam_dmainitialize(struct sam_xdmac_s *xdmac) /* Initialize semaphores */ - sem_init(&xdmac->chsem, 0, 1); - sem_init(&xdmac->dsem, 0, SAMV7_NDMACHAN); + nxsem_init(&xdmac->chsem, 0, 1); + nxsem_init(&xdmac->dsem, 0, SAMV7_NDMACHAN); } /**************************************************************************** diff --git a/arch/arm/src/stm32/stm32_1wire.c b/arch/arm/src/stm32/stm32_1wire.c index b43769577a..2fb86b112e 100644 --- a/arch/arm/src/stm32/stm32_1wire.c +++ b/arch/arm/src/stm32/stm32_1wire.c @@ -708,8 +708,8 @@ static int stm32_1wire_deinit(FAR struct stm32_1wire_priv_s *priv) static inline void stm32_1wire_sem_init(FAR struct stm32_1wire_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_isr, 0, 0); /* The sem_isr semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/stm32/stm32_aes.c b/arch/arm/src/stm32/stm32_aes.c index 88e3a236c8..9c751c34d2 100644 --- a/arch/arm/src/stm32/stm32_aes.c +++ b/arch/arm/src/stm32/stm32_aes.c @@ -293,7 +293,7 @@ int up_aesinitialize(void) { uint32_t regval; - sem_init(&aes_lock, 0, 1); + nxsem_init(&aes_lock, 0, 1); regval = getreg32(STM32_RCC_AHBENR); regval |= RCC_AHBENR_AESEN; diff --git a/arch/arm/src/stm32/stm32_bbsram.c b/arch/arm/src/stm32/stm32_bbsram.c index f1e0b6d311..eba87b5f85 100644 --- a/arch/arm/src/stm32/stm32_bbsram.c +++ b/arch/arm/src/stm32/stm32_bbsram.c @@ -698,7 +698,7 @@ static int stm32_bbsram_probe(int *ent, struct stm32_bbsram_s pdev[]) pdev[i].bbf = pf; pf = (struct bbsramfh_s *)((uint8_t *)pf + alloc); - sem_init(&g_bbsram[i].exclsem, 0, 1); + nxsem_init(&g_bbsram[i].exclsem, 0, 1); } avail -= alloc; diff --git a/arch/arm/src/stm32/stm32_dma2d.c b/arch/arm/src/stm32/stm32_dma2d.c index a6508f8245..327b050d63 100644 --- a/arch/arm/src/stm32/stm32_dma2d.c +++ b/arch/arm/src/stm32/stm32_dma2d.c @@ -2160,14 +2160,14 @@ int up_dma2dinitialize(void) * to the driver */ - sem_init(&g_lock, 0, 1); + nxsem_init(&g_lock, 0, 1); /* Initialize the semaphore for interrupt handling. This waitsem * semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(g_interrupt.sem, 0, 0); + nxsem_init(g_interrupt.sem, 0, 0); sem_setprotocol(g_interrupt.sem, SEM_PRIO_NONE); #ifdef CONFIG_STM32_DMA2D_L8 diff --git a/arch/arm/src/stm32/stm32_hrtim.c b/arch/arm/src/stm32/stm32_hrtim.c index 5d587188e4..d1bc279190 100644 --- a/arch/arm/src/stm32/stm32_hrtim.c +++ b/arch/arm/src/stm32/stm32_hrtim.c @@ -4802,7 +4802,7 @@ int hrtim_register(FAR const char *path, FAR struct hrtim_dev_s *dev) /* Initialize semaphores */ - sem_init(&dev->hd_closesem, 0, 1); + nxsem_init(&dev->hd_closesem, 0, 1); /* Register the HRTIM character driver */ diff --git a/arch/arm/src/stm32/stm32_i2c.c b/arch/arm/src/stm32/stm32_i2c.c index 99b923eb15..d551810f9d 100644 --- a/arch/arm/src/stm32/stm32_i2c.c +++ b/arch/arm/src/stm32/stm32_i2c.c @@ -772,14 +772,14 @@ static inline void stm32_i2c_sem_post(struct stm32_i2c_priv_s *priv) static inline void stm32_i2c_sem_init(FAR struct stm32_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32/stm32_i2c_alt.c b/arch/arm/src/stm32/stm32_i2c_alt.c index 9c6ea4f831..6684059bbb 100644 --- a/arch/arm/src/stm32/stm32_i2c_alt.c +++ b/arch/arm/src/stm32/stm32_i2c_alt.c @@ -780,14 +780,14 @@ static inline void stm32_i2c_sem_post(FAR struct stm32_i2c_priv_s *priv) static inline void stm32_i2c_sem_init(FAR struct stm32_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32/stm32_i2s.c b/arch/arm/src/stm32/stm32_i2s.c index 60d4a8174b..8616119133 100644 --- a/arch/arm/src/stm32/stm32_i2s.c +++ b/arch/arm/src/stm32/stm32_i2s.c @@ -773,7 +773,7 @@ static void i2s_buf_initialize(struct stm32_i2s_s *priv) int i; priv->freelist = NULL; - sem_init(&priv->bufsem, 0, CONFIG_STM32_I2S_MAXINFLIGHT); + nxsem_init(&priv->bufsem, 0, CONFIG_STM32_I2S_MAXINFLIGHT); for (i = 0; i < CONFIG_STM32_I2S_MAXINFLIGHT; i++) { @@ -2598,7 +2598,7 @@ FAR struct i2s_dev_s *stm32_i2sdev_initialize(int port) /* Initialize the common parts for the I2S device structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->dev.ops = &g_i2sops; priv->i2sno = port; diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index 283bc92ef4..55dee088e9 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -1286,14 +1286,14 @@ static void stm32_global_configure(void) { /* Initialize the LTDC semaphore that enforces mutually exclusive access */ - sem_init(&g_lock, 0, 1); + nxsem_init(&g_lock, 0, 1); /* Initialize the semaphore for interrupt handling. This waitsem * semaphore is used for signaling and, hence, should not have priority * inheritance enabled. */ - sem_init(g_interrupt.sem, 0, 0); + nxsem_init(g_interrupt.sem, 0, 0); sem_setprotocol(g_interrupt.sem, SEM_PRIO_NONE); /* Attach LTDC interrupt vector */ diff --git a/arch/arm/src/stm32/stm32_otgfshost.c b/arch/arm/src/stm32/stm32_otgfshost.c index ed31cac037..3ef54e3cb5 100644 --- a/arch/arm/src/stm32/stm32_otgfshost.c +++ b/arch/arm/src/stm32/stm32_otgfshost.c @@ -5186,8 +5186,8 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) /* Initialize semaphores */ - sem_init(&priv->pscsem, 0, 0); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->pscsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -5217,7 +5217,7 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) * have priority inheritance enabled. */ - sem_init(&chan->waitsem, 0, 0); + nxsem_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 1836808764..3d2c66df01 100644 --- a/arch/arm/src/stm32/stm32_otghshost.c +++ b/arch/arm/src/stm32/stm32_otghshost.c @@ -5189,8 +5189,8 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) /* Initialize semaphores */ - sem_init(&priv->pscsem, 0, 0); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->pscsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -5220,7 +5220,7 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) * have priority inheritance enabled. */ - sem_init(&chan->waitsem, 0, 0); + nxsem_init(&chan->waitsem, 0, 0); sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/stm32/stm32_rng.c b/arch/arm/src/stm32/stm32_rng.c index 6d198341e3..b480e99a68 100644 --- a/arch/arm/src/stm32/stm32_rng.c +++ b/arch/arm/src/stm32/stm32_rng.c @@ -119,7 +119,7 @@ static int stm32_rng_initialize(void) memset(&g_rngdev, 0, sizeof(struct rng_dev_s)); - sem_init(&g_rngdev.rd_devsem, 0, 1); + nxsem_init(&g_rngdev.rd_devsem, 0, 1); if (irq_attach(STM32_IRQ_RNG, stm32_interrupt, NULL)) { @@ -262,7 +262,7 @@ static ssize_t stm32_read(struct file *filep, char *buffer, size_t buflen) * enabled. */ - sem_init(&g_rngdev.rd_readsem, 0, 0); + nxsem_init(&g_rngdev.rd_readsem, 0, 0); sem_setprotocol(&g_rngdev.rd_readsem, SEM_PRIO_NONE); g_rngdev.rd_buflen = buflen; diff --git a/arch/arm/src/stm32/stm32_sdio.c b/arch/arm/src/stm32/stm32_sdio.c index e5d3c22ecb..175d2127dc 100644 --- a/arch/arm/src/stm32/stm32_sdio.c +++ b/arch/arm/src/stm32/stm32_sdio.c @@ -2963,7 +2963,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the SDIO slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/stm32/stm32_spi.c b/arch/arm/src/stm32/stm32_spi.c index 89859f6763..00ef10761f 100644 --- a/arch/arm/src/stm32/stm32_spi.c +++ b/arch/arm/src/stm32/stm32_spi.c @@ -1722,7 +1722,7 @@ static void spi_bus_initialize(FAR struct stm32_spidev_s *priv) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_STM32_SPI_DMA /* Initialize the SPI semaphores that is used to wait for DMA completion. @@ -1730,8 +1730,8 @@ static void spi_bus_initialize(FAR struct stm32_spidev_s *priv) * priority inheritance enabled. */ - sem_init(&priv->rxsem, 0, 0); - sem_init(&priv->txsem, 0, 0); + nxsem_init(&priv->rxsem, 0, 0); + nxsem_init(&priv->txsem, 0, 0); sem_setprotocol(&priv->rxsem, SEM_PRIO_NONE); sem_setprotocol(&priv->txsem, SEM_PRIO_NONE); diff --git a/arch/arm/src/stm32/stm32f10xxx_dma.c b/arch/arm/src/stm32/stm32f10xxx_dma.c index 65136a450f..4c7625b0f6 100644 --- a/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -348,7 +348,7 @@ void weak_function up_dmainitialize(void) for (chndx = 0; chndx < DMA_NCHANNELS; chndx++) { dmach = &g_dma[chndx]; - sem_init(&dmach->sem, 0, 1); + nxsem_init(&dmach->sem, 0, 1); /* Attach DMA interrupt vectors */ diff --git a/arch/arm/src/stm32/stm32f20xxx_dma.c b/arch/arm/src/stm32/stm32f20xxx_dma.c index 6fb9d33cee..d1df805670 100644 --- a/arch/arm/src/stm32/stm32f20xxx_dma.c +++ b/arch/arm/src/stm32/stm32f20xxx_dma.c @@ -478,7 +478,7 @@ void weak_function up_dmainitialize(void) for (stream = 0; stream < DMA_NSTREAMS; stream++) { dmast = &g_dma[stream]; - sem_init(&dmast->sem, 0, 1); + nxsem_init(&dmast->sem, 0, 1); /* Attach DMA interrupt vectors */ diff --git a/arch/arm/src/stm32/stm32f30xxx_i2c.c b/arch/arm/src/stm32/stm32f30xxx_i2c.c index e779c040ed..d3e1326d71 100644 --- a/arch/arm/src/stm32/stm32f30xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f30xxx_i2c.c @@ -888,14 +888,14 @@ static inline void stm32_i2c_sem_post(FAR struct stm32_i2c_priv_s *priv) static inline void stm32_i2c_sem_init(FAR struct stm32_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32/stm32f33xxx_dma.c b/arch/arm/src/stm32/stm32f33xxx_dma.c index af8601a0fb..d2852088ce 100644 --- a/arch/arm/src/stm32/stm32f33xxx_dma.c +++ b/arch/arm/src/stm32/stm32f33xxx_dma.c @@ -296,7 +296,7 @@ void weak_function up_dmainitialize(void) for (chndx = 0; chndx < DMA_NCHANNELS; chndx++) { dmach = &g_dma[chndx]; - sem_init(&dmach->sem, 0, 1); + nxsem_init(&dmach->sem, 0, 1); /* Attach DMA interrupt vectors */ diff --git a/arch/arm/src/stm32/stm32f40xxx_dma.c b/arch/arm/src/stm32/stm32f40xxx_dma.c index 54a0a97845..b6042790ad 100644 --- a/arch/arm/src/stm32/stm32f40xxx_dma.c +++ b/arch/arm/src/stm32/stm32f40xxx_dma.c @@ -477,7 +477,7 @@ void weak_function up_dmainitialize(void) for (stream = 0; stream < DMA_NSTREAMS; stream++) { dmast = &g_dma[stream]; - sem_init(&dmast->sem, 0, 1); + nxsem_init(&dmast->sem, 0, 1); /* Attach DMA interrupt vectors */ diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c index ec5bc02d1e..be5627b4e4 100644 --- a/arch/arm/src/stm32/stm32f40xxx_i2c.c +++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c @@ -829,14 +829,14 @@ static inline void stm32_i2c_sem_post(struct stm32_i2c_priv_s *priv) static inline void stm32_i2c_sem_init(FAR struct stm32_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32f0/stm32f0_i2c.c b/arch/arm/src/stm32f0/stm32f0_i2c.c index 69c5a1b53f..385db94d1d 100644 --- a/arch/arm/src/stm32f0/stm32f0_i2c.c +++ b/arch/arm/src/stm32f0/stm32f0_i2c.c @@ -829,14 +829,14 @@ static inline void stm32f0_i2c_sem_post(FAR struct stm32f0_i2c_priv_s *priv) static inline void stm32f0_i2c_sem_init(FAR struct stm32f0_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32f7/stm32_bbsram.c b/arch/arm/src/stm32f7/stm32_bbsram.c index 62905f8326..0e615e6b5b 100644 --- a/arch/arm/src/stm32f7/stm32_bbsram.c +++ b/arch/arm/src/stm32f7/stm32_bbsram.c @@ -699,7 +699,7 @@ static int stm32_bbsram_probe(int *ent, struct stm32_bbsram_s pdev[]) pdev[i].bbf = pf; pf = (struct bbsramfh_s *)((uint8_t *)pf + alloc); - sem_init(&g_bbsram[i].exclsem, 0, 1); + nxsem_init(&g_bbsram[i].exclsem, 0, 1); } avail -= alloc; diff --git a/arch/arm/src/stm32f7/stm32_dma.c b/arch/arm/src/stm32f7/stm32_dma.c index 92e8cb2437..ed3d02bb47 100644 --- a/arch/arm/src/stm32f7/stm32_dma.c +++ b/arch/arm/src/stm32f7/stm32_dma.c @@ -478,7 +478,7 @@ void weak_function up_dmainitialize(void) for (stream = 0; stream < DMA_NSTREAMS; stream++) { dmast = &g_dma[stream]; - sem_init(&dmast->sem, 0, 1); + nxsem_init(&dmast->sem, 0, 1); /* Attach DMA interrupt vectors */ diff --git a/arch/arm/src/stm32f7/stm32_dma2d.c b/arch/arm/src/stm32f7/stm32_dma2d.c index dcd5f7b8a2..233f6089ee 100644 --- a/arch/arm/src/stm32f7/stm32_dma2d.c +++ b/arch/arm/src/stm32f7/stm32_dma2d.c @@ -2152,14 +2152,14 @@ int up_dma2dinitialize(void) * to the driver */ - sem_init(&g_lock, 0, 1); + nxsem_init(&g_lock, 0, 1); /* Initialize the semaphore for interrupt handling. This waitsem * semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(g_interrupt.sem, 0, 0); + nxsem_init(g_interrupt.sem, 0, 0); sem_setprotocol(g_interrupt.sem, SEM_PRIO_NONE); #ifdef CONFIG_STM32F7_DMA2D_L8 diff --git a/arch/arm/src/stm32f7/stm32_i2c.c b/arch/arm/src/stm32f7/stm32_i2c.c index 1b5600b5e9..ec287e24ea 100644 --- a/arch/arm/src/stm32f7/stm32_i2c.c +++ b/arch/arm/src/stm32f7/stm32_i2c.c @@ -1074,14 +1074,14 @@ static inline void stm32_i2c_sem_post(FAR struct i2c_master_s *dev) static inline void stm32_i2c_sem_init(FAR struct i2c_master_s *dev) { - sem_init(&((struct stm32_i2c_inst_s *)dev)->priv->sem_excl, 0, 1); + nxsem_init(&((struct stm32_i2c_inst_s *)dev)->priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&((struct stm32_i2c_inst_s *)dev)->priv->sem_isr, 0, 0); + nxsem_init(&((struct stm32_i2c_inst_s *)dev)->priv->sem_isr, 0, 0); sem_setprotocol(&((struct stm32_i2c_inst_s *)dev)->priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32f7/stm32_ltdc.c b/arch/arm/src/stm32f7/stm32_ltdc.c index 218546a883..897a354681 100644 --- a/arch/arm/src/stm32f7/stm32_ltdc.c +++ b/arch/arm/src/stm32f7/stm32_ltdc.c @@ -1285,14 +1285,14 @@ static void stm32_global_configure(void) { /* Initialize the LTDC semaphore that enforces mutually exclusive access */ - sem_init(&g_lock, 0, 1); + nxsem_init(&g_lock, 0, 1); /* Initialize the semaphore for interrupt handling. This waitsem * semaphore is used for signaling and, hence, should not have priority * inheritance enabled. */ - sem_init(g_interrupt.sem, 0, 0); + nxsem_init(g_interrupt.sem, 0, 0); sem_setprotocol(g_interrupt.sem, SEM_PRIO_NONE); /* Attach LTDC interrupt vector */ diff --git a/arch/arm/src/stm32f7/stm32_otghost.c b/arch/arm/src/stm32f7/stm32_otghost.c index 59d8bd076e..b7d259a6d7 100644 --- a/arch/arm/src/stm32f7/stm32_otghost.c +++ b/arch/arm/src/stm32f7/stm32_otghost.c @@ -5183,8 +5183,8 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) /* Initialize semaphores */ - sem_init(&priv->pscsem, 0, 0); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->pscsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -5214,7 +5214,7 @@ static inline void stm32_sw_initialize(FAR struct stm32_usbhost_s *priv) * have priority inheritance enabled. */ - sem_init(&chan->waitsem, 0, 0); + nxsem_init(&chan->waitsem, 0, 0); sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/stm32f7/stm32_rng.c b/arch/arm/src/stm32f7/stm32_rng.c index 7b746dc522..df6e759abf 100644 --- a/arch/arm/src/stm32f7/stm32_rng.c +++ b/arch/arm/src/stm32f7/stm32_rng.c @@ -118,7 +118,7 @@ static int stm32_rng_initialize(void) memset(&g_rngdev, 0, sizeof(struct rng_dev_s)); - sem_init(&g_rngdev.rd_devsem, 0, 1); + nxsem_init(&g_rngdev.rd_devsem, 0, 1); if (irq_attach(STM32_IRQ_RNG, stm32_rnginterrupt, NULL)) { @@ -283,7 +283,7 @@ static ssize_t stm32_rngread(struct file *filep, char *buffer, size_t buflen) * enabled. */ - sem_init(&g_rngdev.rd_readsem, 0, 0); + nxsem_init(&g_rngdev.rd_readsem, 0, 0); sem_setprotocol(&g_rngdev.rd_readsem, SEM_PRIO_NONE); g_rngdev.rd_buflen = buflen; diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index 49a70d63fa..d64fd739a6 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -3204,7 +3204,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the SDIO slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/stm32f7/stm32_spi.c b/arch/arm/src/stm32f7/stm32_spi.c index d6b4cb9e9c..c379bbf04b 100644 --- a/arch/arm/src/stm32f7/stm32_spi.c +++ b/arch/arm/src/stm32f7/stm32_spi.c @@ -1696,7 +1696,7 @@ static void spi_bus_initialize(FAR struct stm32_spidev_s *priv) /* Initialize the SPI semaphore that enforces mutually exclusive access. */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_STM32F7_SPI_DMA /* Initialize the SPI semaphores that is used to wait for DMA completion. @@ -1704,8 +1704,8 @@ static void spi_bus_initialize(FAR struct stm32_spidev_s *priv) * priority inheritance enabled. */ - sem_init(&priv->rxsem, 0, 0); - sem_init(&priv->txsem, 0, 0); + nxsem_init(&priv->rxsem, 0, 0); + nxsem_init(&priv->txsem, 0, 0); sem_setprotocol(&priv->rxsem, SEM_PRIO_NONE); sem_setprotocol(&priv->txsem, SEM_PRIO_NONE); diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.c b/arch/arm/src/stm32l4/stm32l4_i2c.c index 47597c875b..1b22fc2477 100644 --- a/arch/arm/src/stm32l4/stm32l4_i2c.c +++ b/arch/arm/src/stm32l4/stm32l4_i2c.c @@ -862,14 +862,14 @@ static inline void stm32l4_i2c_sem_post(FAR struct stm32l4_i2c_priv_s *priv) static inline void stm32l4_i2c_sem_init(FAR struct stm32l4_i2c_priv_s *priv) { - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->sem_isr, 0, 0); + nxsem_init(&priv->sem_isr, 0, 0); sem_setprotocol(&priv->sem_isr, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/stm32l4/stm32l4_otgfshost.c b/arch/arm/src/stm32l4/stm32l4_otgfshost.c index aadae1721c..b648379227 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfshost.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfshost.c @@ -5189,8 +5189,8 @@ static inline void stm32l4_sw_initialize(FAR struct stm32l4_usbhost_s *priv) /* Initialize semaphores */ - sem_init(&priv->pscsem, 0, 0); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->pscsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); /* The pscsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -5220,7 +5220,7 @@ static inline void stm32l4_sw_initialize(FAR struct stm32l4_usbhost_s *priv) * have priority inheritance enabled. */ - sem_init(&chan->waitsem, 0, 0); + nxsem_init(&chan->waitsem, 0, 0); sem_setprotocol(&chan->waitsem, SEM_PRIO_NONE); } } diff --git a/arch/arm/src/stm32l4/stm32l4_qspi.c b/arch/arm/src/stm32l4/stm32l4_qspi.c index be7cbd3769..57202ec4c2 100644 --- a/arch/arm/src/stm32l4/stm32l4_qspi.c +++ b/arch/arm/src/stm32l4/stm32l4_qspi.c @@ -2487,7 +2487,7 @@ struct qspi_dev_s *stm32l4_qspi_initialize(int intf) * access to the QSPI registers. */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_STM32L4_QSPI_DMA /* Pre-allocate DMA channels. */ @@ -2507,7 +2507,7 @@ struct qspi_dev_s *stm32l4_qspi_initialize(int intf) * signaling and, hence, should not have priority inheritance enabled. */ - sem_init(&priv->dmawait, 0, 0); + nxsem_init(&priv->dmawait, 0, 0); sem_setprotocol(&priv->dmawait, SEM_PRIO_NONE); /* Create a watchdog time to catch DMA timeouts */ @@ -2535,7 +2535,7 @@ struct qspi_dev_s *stm32l4_qspi_initialize(int intf) * priority inheritance enabled. */ - sem_init(&priv->op_sem, 0, 0); + nxsem_init(&priv->op_sem, 0, 0); sem_setprotocol(&priv->op_sem, SEM_PRIO_NONE); #endif diff --git a/arch/arm/src/stm32l4/stm32l4_rng.c b/arch/arm/src/stm32l4/stm32l4_rng.c index 3334d86ec0..0ca0f52a30 100644 --- a/arch/arm/src/stm32l4/stm32l4_rng.c +++ b/arch/arm/src/stm32l4/stm32l4_rng.c @@ -115,7 +115,7 @@ static int stm32l4_rng_initialize(void) memset(&g_rngdev, 0, sizeof(struct rng_dev_s)); - sem_init(&g_rngdev.rd_devsem, 0, 1); + nxsem_init(&g_rngdev.rd_devsem, 0, 1); if (irq_attach(STM32L4_IRQ_RNG, stm32l4_rnginterrupt, NULL)) { @@ -266,7 +266,7 @@ static ssize_t stm32l4_rngread(struct file *filep, char *buffer, size_t buflen) * enabled. */ - sem_init(&g_rngdev.rd_readsem, 0, 0); + nxsem_init(&g_rngdev.rd_readsem, 0, 0); sem_setprotocol(&g_rngdev.rd_readsem, SEM_PRIO_NONE); g_rngdev.rd_buflen = buflen; diff --git a/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c b/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c index 1abb96583e..2e14ff6719 100644 --- a/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c +++ b/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c @@ -573,7 +573,7 @@ static int stm32l4_rdalarm(FAR struct rtc_lowerhalf_s *lower, FAR struct rtc_lowerhalf_s *stm32l4_rtc_lowerhalf(void) { - sem_init(&g_rtc_lowerhalf.devsem, 0, 1); + nxsem_init(&g_rtc_lowerhalf.devsem, 0, 1); return (FAR struct rtc_lowerhalf_s *)&g_rtc_lowerhalf; } diff --git a/arch/arm/src/stm32l4/stm32l4_sai.c b/arch/arm/src/stm32l4/stm32l4_sai.c index f57f2ee593..126ded3028 100644 --- a/arch/arm/src/stm32l4/stm32l4_sai.c +++ b/arch/arm/src/stm32l4/stm32l4_sai.c @@ -1274,7 +1274,7 @@ static void sai_buf_initialize(struct stm32l4_sai_s *priv) int i; priv->freelist = NULL; - sem_init(&priv->bufsem, 0, CONFIG_STM32L4_SAI_MAXINFLIGHT); + nxsem_init(&priv->bufsem, 0, CONFIG_STM32L4_SAI_MAXINFLIGHT); for (i = 0; i < CONFIG_STM32L4_SAI_MAXINFLIGHT; i++) { @@ -1300,7 +1300,7 @@ static void sai_portinitialize(struct stm32l4_sai_s *priv) { sai_dump_regs(priv, "Before initialization"); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Create a watchdog timer to catch transfer timeouts */ diff --git a/arch/arm/src/stm32l4/stm32l4_sdmmc.c b/arch/arm/src/stm32l4/stm32l4_sdmmc.c index 4b866db736..b1dfc08fb2 100644 --- a/arch/arm/src/stm32l4/stm32l4_sdmmc.c +++ b/arch/arm/src/stm32l4/stm32l4_sdmmc.c @@ -3187,7 +3187,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno) /* Initialize the SDIO slot structure */ /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/stm32l4/stm32l4_spi.c b/arch/arm/src/stm32l4/stm32l4_spi.c index 856de17230..526582c13f 100644 --- a/arch/arm/src/stm32l4/stm32l4_spi.c +++ b/arch/arm/src/stm32l4/stm32l4_spi.c @@ -1510,13 +1510,13 @@ static void spi_bus_initialize(FAR struct stm32l4_spidev_s *priv) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_STM32L4_SPI_DMA /* Initialize the SPI semaphores that is used to wait for DMA completion */ - sem_init(&priv->rxsem, 0, 0); - sem_init(&priv->txsem, 0, 0); + nxsem_init(&priv->rxsem, 0, 0); + nxsem_init(&priv->txsem, 0, 0); /* These semaphores are used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/arm/src/stm32l4/stm32l4x6xx_dma.c b/arch/arm/src/stm32l4/stm32l4x6xx_dma.c index e63c73be4f..f0660aa5f6 100644 --- a/arch/arm/src/stm32l4/stm32l4x6xx_dma.c +++ b/arch/arm/src/stm32l4/stm32l4x6xx_dma.c @@ -347,7 +347,7 @@ void weak_function up_dmainitialize(void) for (chndx = 0; chndx < DMA_NCHANNELS; chndx++) { dmach = &g_dma[chndx]; - sem_init(&dmach->sem, 0, 1); + nxsem_init(&dmach->sem, 0, 1); /* Attach DMA interrupt vectors */ diff --git a/arch/arm/src/tiva/tiva_adclow.c b/arch/arm/src/tiva/tiva_adclow.c index 46943a07ba..f8481d1920 100644 --- a/arch/arm/src/tiva/tiva_adclow.c +++ b/arch/arm/src/tiva/tiva_adclow.c @@ -802,7 +802,7 @@ static struct tiva_adc_s *tiva_adc_struct_init(struct tiva_adc_cfg_s *cfg) { sse->adc = cfg->adc; sse->num = s; - sem_init(&sse->exclsem, SEM_PROCESS_PRIVATE, 1); + nxsem_init(&sse->exclsem, SEM_PROCESS_PRIVATE, 1); sse->ena = false; sse->cfg = true; } diff --git a/arch/arm/src/tiva/tiva_i2c.c b/arch/arm/src/tiva/tiva_i2c.c index 6cc2d5fbe1..22345b378c 100644 --- a/arch/arm/src/tiva/tiva_i2c.c +++ b/arch/arm/src/tiva/tiva_i2c.c @@ -851,14 +851,14 @@ static inline void tiva_i2c_sem_post(struct tiva_i2c_priv_s *priv) static inline void tiva_i2c_sem_init(struct tiva_i2c_priv_s *priv) { - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifndef CONFIG_I2C_POLLED /* This semaphore is used for signaling and, hence, should not have * priority inheritance enabled. */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); #endif } diff --git a/arch/arm/src/tiva/tiva_ssi.c b/arch/arm/src/tiva/tiva_ssi.c index 9930c6184f..b264d8d240 100644 --- a/arch/arm/src/tiva/tiva_ssi.c +++ b/arch/arm/src/tiva/tiva_ssi.c @@ -1640,10 +1640,10 @@ FAR struct spi_dev_s *tiva_ssibus_initialize(int port) * priority inheritance enabled. */ - sem_init(&priv->xfrsem, 0, 0); + nxsem_init(&priv->xfrsem, 0, 0); sem_setprotocol(&priv->xfrsem, SEM_PRIO_NONE); #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Set all CR1 fields to reset state. This will be master mode. */ diff --git a/arch/avr/src/avr/up_spi.c b/arch/avr/src/avr/up_spi.c index bf6eda418e..d24d3b12cc 100644 --- a/arch/avr/src/avr/up_spi.c +++ b/arch/avr/src/avr/up_spi.c @@ -492,7 +492,7 @@ FAR struct spi_dev_s *avr_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); leave_critical_section(flags); return &priv->spidev; diff --git a/arch/mips/src/pic32mx/pic32mx-spi.c b/arch/mips/src/pic32mx/pic32mx-spi.c index 1cfd0164d5..cccd98cdbe 100644 --- a/arch/mips/src/pic32mx/pic32mx-spi.c +++ b/arch/mips/src/pic32mx/pic32mx-spi.c @@ -948,7 +948,7 @@ FAR struct spi_dev_s *pic32mx_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_PIC32MX_SPI_INTERRUPTS /* Enable interrupts at the SPI controller */ diff --git a/arch/mips/src/pic32mz/pic32mz-spi.c b/arch/mips/src/pic32mz/pic32mz-spi.c index ff56c7f527..b0d8c36632 100644 --- a/arch/mips/src/pic32mz/pic32mz-spi.c +++ b/arch/mips/src/pic32mz/pic32mz-spi.c @@ -1349,7 +1349,7 @@ FAR struct spi_dev_s *pic32mz_spibus_initialize(int port) /* Initialize the SPI semaphore that enforces mutually exclusive access */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_PIC32MZ_SPI_INTERRUPTS /* Enable interrupts at the SPI controller */ diff --git a/arch/sim/src/up_touchscreen.c b/arch/sim/src/up_touchscreen.c index b8b864c89b..9a63017e41 100644 --- a/arch/sim/src/up_touchscreen.c +++ b/arch/sim/src/up_touchscreen.c @@ -657,8 +657,8 @@ int sim_tsc_initialize(int minor) /* Initialize semaphores */ - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ /* The waitsem semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/arch/sim/src/up_uartwait.c b/arch/sim/src/up_uartwait.c index 681e87dcdd..5e35e22faa 100644 --- a/arch/sim/src/up_uartwait.c +++ b/arch/sim/src/up_uartwait.c @@ -63,7 +63,7 @@ void simuart_initialize(void) * have priority inheritance enabled. */ - sem_init(&g_uartavail, 0, 0); + nxsem_init(&g_uartavail, 0, 0); sem_setprotocol(&g_uartavail, SEM_PRIO_NONE); } diff --git a/arch/z16/src/z16f/z16f_espi.c b/arch/z16/src/z16f/z16f_espi.c index 312b2276e4..d8ec62f78d 100644 --- a/arch/z16/src/z16f/z16f_espi.c +++ b/arch/z16/src/z16f/z16f_espi.c @@ -809,7 +809,7 @@ FAR struct spi_dev_s *z16_spibus_initialize(int port) flags = enter_critical_section(); priv->spi.ops = &g_epsiops; - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Set up the SPI pin configuration (board-specific logic is required to * configure and manage all chip selects). diff --git a/arch/z80/src/ez80/ez80_i2c.c b/arch/z80/src/ez80/ez80_i2c.c index 0e4bdb1b28..0205b0ea03 100644 --- a/arch/z80/src/ez80/ez80_i2c.c +++ b/arch/z80/src/ez80/ez80_i2c.c @@ -948,7 +948,7 @@ FAR struct i2c_master_s *ez80_i2cbus_initialize(int port) /* This semaphore enforces serialized access for I2C transfers */ - sem_init(&g_i2csem, 0, 1); + nxsem_init(&g_i2csem, 0, 1); /* Enable I2C -- but not interrupts */ diff --git a/arch/z80/src/z8/z8_i2c.c b/arch/z80/src/z8/z8_i2c.c index e8c2a0e046..3ac3ca77da 100644 --- a/arch/z80/src/z8/z8_i2c.c +++ b/arch/z80/src/z8/z8_i2c.c @@ -661,7 +661,7 @@ FAR struct i2c_master_s *z8_i2cbus_initialize(int port) /* This semaphore enforces serialized access for I2C transfers */ - sem_init(&g_i2csem, 0, 1); + nxsem_init(&g_i2csem, 0, 1); /* Enable I2C -- no interrupts */ diff --git a/audio/audio.c b/audio/audio.c index b8194908ab..f5b7ee52a2 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -891,7 +891,7 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev) /* Initialize the Audio device structure (it was already zeroed by kmm_zalloc()) */ - sem_init(&upper->exclsem, 0, 1); + nxsem_init(&upper->exclsem, 0, 1); upper->dev = dev; #ifdef CONFIG_AUDIO_CUSTOM_DEV_PATH diff --git a/binfmt/libbuiltin/libbuiltin_getname.c b/binfmt/libbuiltin/libbuiltin_getname.c index d1e3958b32..8ca6c24452 100644 --- a/binfmt/libbuiltin/libbuiltin_getname.c +++ b/binfmt/libbuiltin/libbuiltin_getname.c @@ -48,26 +48,6 @@ #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/binfmt/libbuiltin/libbuiltin_isavail.c b/binfmt/libbuiltin/libbuiltin_isavail.c index 7a480c0f3b..8deefa63e9 100644 --- a/binfmt/libbuiltin/libbuiltin_isavail.c +++ b/binfmt/libbuiltin/libbuiltin_isavail.c @@ -52,26 +52,6 @@ #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/binfmt/pcode.c b/binfmt/pcode.c index 700d9d3deb..05459c22fb 100644 --- a/binfmt/pcode.c +++ b/binfmt/pcode.c @@ -541,7 +541,7 @@ int pcode_initialize(void) /* Initialize globals */ - sem_init(&g_pcode_handoff.exclsem, 0, 1); + nxsem_init(&g_pcode_handoff.exclsem, 0, 1); /* Mount the test file system */ diff --git a/configs/mikroe-stm32f4/src/stm32_touchscreen.c b/configs/mikroe-stm32f4/src/stm32_touchscreen.c index ea863e8f3d..7420ee07eb 100644 --- a/configs/mikroe-stm32f4/src/stm32_touchscreen.c +++ b/configs/mikroe-stm32f4/src/stm32_touchscreen.c @@ -1541,8 +1541,8 @@ int board_tsc_setup(int minor) /* Initialize the touchscreen device driver instance */ memset(priv, 0, sizeof(struct tc_dev_s)); - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ /* Register the device as an input device */ diff --git a/configs/pic32mx7mmb/src/pic32_touchscreen.c b/configs/pic32mx7mmb/src/pic32_touchscreen.c index 95b51479e7..56847448d5 100644 --- a/configs/pic32mx7mmb/src/pic32_touchscreen.c +++ b/configs/pic32mx7mmb/src/pic32_touchscreen.c @@ -1397,8 +1397,8 @@ int board_tsc_setup(int minor) /* Initialize the touchscreen device driver instance */ memset(priv, 0, sizeof(struct tc_dev_s)); - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ /* Register the device as an input device */ diff --git a/configs/samv71-xult/src/sam_ili9488.c b/configs/samv71-xult/src/sam_ili9488.c index 313dcac419..c19674081a 100644 --- a/configs/samv71-xult/src/sam_ili9488.c +++ b/configs/samv71-xult/src/sam_ili9488.c @@ -1545,7 +1545,7 @@ int board_lcd_initialize(void) /* Initialize the LCD state structure */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); /* Allocate a DMA channel */ diff --git a/configs/stm32butterfly2/src/stm32_mmcsd.c b/configs/stm32butterfly2/src/stm32_mmcsd.c index a244a5b5ff..4f2b9a7fcd 100644 --- a/configs/stm32butterfly2/src/stm32_mmcsd.c +++ b/configs/stm32butterfly2/src/stm32_mmcsd.c @@ -198,7 +198,7 @@ int stm32_mmcsd_initialize(int minor) (void)stm32_gpiosetevent(GPIO_SD_CD, true, true, true, stm32_cd, NULL); - sem_init(&g_cdsem, 0, 0); + nxsem_init(&g_cdsem, 0, 0); pthread_attr_init(&pattr); #ifdef CONFIG_DEBUG_FS diff --git a/crypto/random_pool.c b/crypto/random_pool.c index f6a53d7119..6c6070bf28 100644 --- a/crypto/random_pool.c +++ b/crypto/random_pool.c @@ -370,7 +370,7 @@ static void rng_init(void) cryptinfo("Initializing RNG\n"); memset(&g_rng, 0, sizeof(struct rng_s)); - sem_init(&g_rng.rd_sem, 0, 1); + nxsem_init(&g_rng.rd_sem, 0, 1); /* We do not initialize output here because this is called * quite early in boot and there may not be enough entropy. diff --git a/drivers/analog/adc.c b/drivers/analog/adc.c index 1fbc580558..c57e9d6f82 100644 --- a/drivers/analog/adc.c +++ b/drivers/analog/adc.c @@ -620,8 +620,8 @@ int adc_register(FAR const char *path, FAR struct adc_dev_s *dev) /* Initialize semaphores */ - sem_init(&dev->ad_recv.af_sem, 0, 0); - sem_init(&dev->ad_closesem, 0, 1); + nxsem_init(&dev->ad_recv.af_sem, 0, 0); + nxsem_init(&dev->ad_closesem, 0, 1); /* The receive semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/drivers/analog/comp.c b/drivers/analog/comp.c index 3dc9b48c3a..a9d24f66ad 100644 --- a/drivers/analog/comp.c +++ b/drivers/analog/comp.c @@ -436,10 +436,10 @@ int comp_register(FAR const char *path, FAR struct comp_dev_s *dev) /* Initialize semaphores */ - sem_init(&dev->ad_sem, 0, 1); + nxsem_init(&dev->ad_sem, 0, 1); (void)sem_setprotocol(&dev->ad_sem, SEM_PRIO_NONE); - sem_init(&dev->ad_readsem, 0, 0); + nxsem_init(&dev->ad_readsem, 0, 0); (void)sem_setprotocol(&dev->ad_readsem, SEM_PRIO_NONE); /* Bind the upper-half callbacks to the lower half COMP driver */ diff --git a/drivers/analog/dac.c b/drivers/analog/dac.c index 131b7e800f..a743170b1e 100644 --- a/drivers/analog/dac.c +++ b/drivers/analog/dac.c @@ -499,7 +499,7 @@ int dac_txdone(FAR struct dac_dev_s *dev) { /* Inform any waiting threads that new xmit space is available */ - ret = sem_getvalue(&dev->ad_xmit.af_sem, &sval); + ret = nxsem_getvalue(&dev->ad_xmit.af_sem, &sval); if (ret == OK && sval <= 0) { ret = sem_post(&dev->ad_xmit.af_sem); @@ -518,8 +518,8 @@ int dac_register(FAR const char *path, FAR struct dac_dev_s *dev) /* Initialize semaphores */ - sem_init(&dev->ad_xmit.af_sem, 0, 0); - sem_init(&dev->ad_closesem, 0, 1); + nxsem_init(&dev->ad_xmit.af_sem, 0, 0); + nxsem_init(&dev->ad_closesem, 0, 1); /* The transmit semaphore is used for signaling and, hence, should not have * priority inheritance enabled. diff --git a/drivers/analog/ltc1867l.c b/drivers/analog/ltc1867l.c index 0f5bf1a758..36236a9791 100644 --- a/drivers/analog/ltc1867l.c +++ b/drivers/analog/ltc1867l.c @@ -237,7 +237,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg) int32_t dataToPost; int ret = OK; - if(cmd == ANIOC_TRIGGER) + if (cmd == ANIOC_TRIGGER) { while (sem_wait(&priv->sem) != OK); @@ -344,11 +344,11 @@ int ltc1867l_register(FAR const char *devpath, FAR struct spi_dev_s *spi, adcpriv->channel_config = channel_config; adcpriv->channel_config_count = channel_config_count; - ret = sem_init(&adcpriv->sem, 1, 1); - if(ret == -1) + ret = nxsem_init(&adcpriv->sem, 1, 1); + if (ret < 0) { kmm_free(adcpriv); - return -errno; + return ret; } adcdev = (FAR struct adc_dev_s *)kmm_malloc(sizeof(struct adc_dev_s)); diff --git a/drivers/analog/opamp.c b/drivers/analog/opamp.c index 666b19a8ce..fc18e35d82 100644 --- a/drivers/analog/opamp.c +++ b/drivers/analog/opamp.c @@ -229,7 +229,7 @@ int opamp_register(FAR const char *path, FAR struct opamp_dev_s *dev) /* Initialize semaphores */ - sem_init(&dev->ad_closesem, 0, 1); + nxsem_init(&dev->ad_closesem, 0, 1); /* Register the OPAMP character driver */ diff --git a/drivers/audio/cs43l22.c b/drivers/audio/cs43l22.c index 239144c6da..263d2109f2 100644 --- a/drivers/audio/cs43l22.c +++ b/drivers/audio/cs43l22.c @@ -1920,7 +1920,7 @@ FAR struct audio_lowerhalf_s *cs43l22_initialize(FAR struct i2c_master_s *i2c, priv->i2c = i2c; priv->i2s = i2s; - sem_init(&priv->pendsem, 0, 1); + nxsem_init(&priv->pendsem, 0, 1); dq_init(&priv->pendq); dq_init(&priv->doneq); diff --git a/drivers/audio/i2schar.c b/drivers/audio/i2schar.c index 2701a67dc2..3b6d2aed5c 100644 --- a/drivers/audio/i2schar.c +++ b/drivers/audio/i2schar.c @@ -393,7 +393,7 @@ int i2schar_register(FAR struct i2s_dev_s *i2s, int minor) /* Initialize the I2S character device structure */ priv->i2s = i2s; - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Create the character device name */ diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c index f9b5393f73..2d003da22e 100644 --- a/drivers/audio/tone.c +++ b/drivers/audio/tone.c @@ -962,7 +962,7 @@ int tone_register(FAR const char *path, FAR struct pwm_lowerhalf_s *tone, * kmm_zalloc()). */ - sem_init(&upper->exclsem, 0, 1); + nxsem_init(&upper->exclsem, 0, 1); upper->devtone = tone; upper->oneshot = oneshot; #ifdef CONFIG_PWM_MULTICHAN diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c index 9c41e9fd78..9656f70406 100644 --- a/drivers/audio/vs1053.c +++ b/drivers/audio/vs1053.c @@ -1835,7 +1835,7 @@ struct audio_lowerhalf_s *vs1053_initialize(FAR struct spi_dev_s *spi, dev->bass = 0; dev->treble = 0; #endif - sem_init(&dev->apbq_sem, 0, 1); + nxsem_init(&dev->apbq_sem, 0, 1); dq_init(&dev->apbq); /* Reset the VS1053 chip */ diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index 23da3ce9a9..5b6c552371 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -2508,7 +2508,7 @@ FAR struct audio_lowerhalf_s * priv->i2c = i2c; priv->i2s = i2s; - sem_init(&priv->pendsem, 0, 1); + nxsem_init(&priv->pendsem, 0, 1); dq_init(&priv->pendq); dq_init(&priv->doneq); diff --git a/drivers/bch/bchlib_setup.c b/drivers/bch/bchlib_setup.c index be20613fdc..d4a37a49ba 100644 --- a/drivers/bch/bchlib_setup.c +++ b/drivers/bch/bchlib_setup.c @@ -118,7 +118,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle) /* Save the geometry info and complete initialization of the structure */ - sem_init(&bch->sem, 0, 1); + nxsem_init(&bch->sem, 0, 1); bch->nsectors = geo.geo_nsectors; bch->sectsize = geo.geo_sectorsize; bch->sector = (size_t)-1; diff --git a/drivers/can/can.c b/drivers/can/can.c index 730d7e84b5..be6b4bc703 100644 --- a/drivers/can/can.c +++ b/drivers/can/can.c @@ -1169,11 +1169,11 @@ int can_register(FAR const char *path, FAR struct can_dev_s *dev) /* Initialize semaphores */ - sem_init(&dev->cd_xmit.tx_sem, 0, 1); - sem_init(&dev->cd_recv.rx_sem, 0, 1); - sem_init(&dev->cd_closesem, 0, 1); + nxsem_init(&dev->cd_xmit.tx_sem, 0, 1); + nxsem_init(&dev->cd_recv.rx_sem, 0, 1); + nxsem_init(&dev->cd_closesem, 0, 1); #ifndef CONFIG_DISABLE_POLL - sem_init(&dev->cd_pollsem, 0, 1); + nxsem_init(&dev->cd_pollsem, 0, 1); #endif for (i = 0; i < CONFIG_CAN_NPENDINGRTR; i++) @@ -1182,7 +1182,7 @@ int can_register(FAR const char *path, FAR struct can_dev_s *dev) * and should not have priority inheritance enabled. */ - sem_init(&dev->cd_rtr[i].cr_sem, 0, 0); + nxsem_init(&dev->cd_rtr[i].cr_sem, 0, 0); sem_setprotocol(&dev->cd_rtr[i].cr_sem, SEM_PRIO_NONE); dev->cd_rtr[i].cr_msg = NULL; } diff --git a/drivers/can/mcp2515.c b/drivers/can/mcp2515.c index df1092bfaa..f943febb41 100644 --- a/drivers/can/mcp2515.c +++ b/drivers/can/mcp2515.c @@ -1144,7 +1144,7 @@ static void mcp2515_reset_lowlevel(FAR struct mcp2515_can_s *priv) */ sem_destroy(&priv->txfsem); - sem_init(&priv->txfsem, 0, config->ntxbuffers); + nxsem_init(&priv->txfsem, 0, config->ntxbuffers); /* Define the current state and unlock */ @@ -2516,8 +2516,8 @@ FAR struct mcp2515_can_s *mcp2515_instantiate(FAR struct mcp2515_config_s *confi /* Initialize semaphores */ - sem_init(&priv->locksem, 0, 1); - sem_init(&priv->txfsem, 0, config->ntxbuffers); + nxsem_init(&priv->locksem, 0, 1); + nxsem_init(&priv->txfsem, 0, config->ntxbuffers); /* And put the hardware in the initial state */ diff --git a/drivers/eeprom/spi_xx25xx.c b/drivers/eeprom/spi_xx25xx.c index 5fb5a37fdd..bdbf77310c 100644 --- a/drivers/eeprom/spi_xx25xx.c +++ b/drivers/eeprom/spi_xx25xx.c @@ -800,7 +800,7 @@ int ee25xx_initialize(FAR struct spi_dev_s *dev, FAR char *devname, return -ENOMEM; } - sem_init(&eedev->sem, 0, 1); + nxsem_init(&eedev->sem, 0, 1); eedev->spi = dev; eedev->size = 128 << g_ee25xx_devices[devtype].bytes; diff --git a/drivers/i2c/i2c_driver.c b/drivers/i2c/i2c_driver.c index 79f3bb98e6..541e696712 100644 --- a/drivers/i2c/i2c_driver.c +++ b/drivers/i2c/i2c_driver.c @@ -405,7 +405,7 @@ int i2c_register(FAR struct i2c_master_s *i2c, int bus) priv->i2c = i2c; #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #endif /* Create the character device name */ diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index 5b8dc4f542..514aab9d31 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -1190,8 +1190,8 @@ int ads7843e_register(FAR struct spi_dev_s *spi, /* Initialize semaphores */ - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ /* The pen event semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/input/ajoystick.c b/drivers/input/ajoystick.c index 76c93e43c7..beeced01a6 100644 --- a/drivers/input/ajoystick.c +++ b/drivers/input/ajoystick.c @@ -873,7 +873,7 @@ int ajoy_register(FAR const char *devname, /* Initialize the new ajoystick driver instance */ priv->au_lower = lower; - sem_init(&priv->au_exclsem, 0, 1); + nxsem_init(&priv->au_exclsem, 0, 1); DEBUGASSERT(lower->al_buttons); priv->au_sample = lower->al_buttons(lower); diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c index 816cf01c4a..9db9e2dc4c 100644 --- a/drivers/input/button_upper.c +++ b/drivers/input/button_upper.c @@ -855,7 +855,7 @@ int btn_register(FAR const char *devname, /* Initialize the new button driver instance */ priv->bu_lower = lower; - sem_init(&priv->bu_exclsem, 0, 1); + nxsem_init(&priv->bu_exclsem, 0, 1); DEBUGASSERT(lower->bl_buttons); priv->bu_sample = lower->bl_buttons(lower); diff --git a/drivers/input/cypress_mbr3108.c b/drivers/input/cypress_mbr3108.c index d1b29f672c..a08493cbfe 100644 --- a/drivers/input/cypress_mbr3108.c +++ b/drivers/input/cypress_mbr3108.c @@ -1136,7 +1136,7 @@ int cypress_mbr3108_register(FAR const char *devpath, priv->board = board_config; priv->sensor_conf = sensor_conf; - sem_init(&priv->devsem, 0, 1); + nxsem_init(&priv->devsem, 0, 1); ret = register_driver(devpath, &g_mbr3108_fileops, 0666, priv); if (ret < 0) diff --git a/drivers/input/djoystick.c b/drivers/input/djoystick.c index c0559208fb..28cfb55be4 100644 --- a/drivers/input/djoystick.c +++ b/drivers/input/djoystick.c @@ -869,7 +869,7 @@ int djoy_register(FAR const char *devname, /* Initialize the new djoystick driver instance */ priv->du_lower = lower; - sem_init(&priv->du_exclsem, 0, 1); + nxsem_init(&priv->du_exclsem, 0, 1); DEBUGASSERT(lower->dl_sample); priv->du_sample = lower->dl_sample(lower); diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c index e190b5bc2e..d6ec935869 100644 --- a/drivers/input/max11802.c +++ b/drivers/input/max11802.c @@ -1193,8 +1193,8 @@ int max11802_register(FAR struct spi_dev_s *spi, /* Initialize semaphores */ - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ /* The pen event semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c index c7364fa383..65beeb41fb 100644 --- a/drivers/input/mxt.c +++ b/drivers/input/mxt.c @@ -1905,8 +1905,8 @@ int mxt_register(FAR struct i2c_master_s *i2c, /* Initialize semaphores */ - sem_init(&priv->devsem, 0, 1); /* Initialize device semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize event wait semaphore */ /* The event wait semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/input/stmpe811_base.c b/drivers/input/stmpe811_base.c index 62b86a420f..ecf7ee3257 100644 --- a/drivers/input/stmpe811_base.c +++ b/drivers/input/stmpe811_base.c @@ -297,7 +297,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev, /* Initialize the device state structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->config = config; #ifdef CONFIG_STMPE811_SPI diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c index fb82cc0557..2141a780eb 100644 --- a/drivers/input/tsc2007.c +++ b/drivers/input/tsc2007.c @@ -1255,8 +1255,8 @@ int tsc2007_register(FAR struct i2c_master_s *dev, memset(priv, 0, sizeof(struct tsc2007_dev_s)); priv->i2c = dev; /* Save the I2C device handle */ priv->config = config; /* Save the board configuration */ - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ - sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */ /* Make sure that interrupts are disabled */ diff --git a/drivers/ioexpander/pca9555.c b/drivers/ioexpander/pca9555.c index c250fb6e82..8009566744 100644 --- a/drivers/ioexpander/pca9555.c +++ b/drivers/ioexpander/pca9555.c @@ -951,7 +951,7 @@ FAR struct ioexpander_dev_s *pca9555_initialize(FAR struct i2c_master_s *i2cdev, pcadev->config->enable(pcadev->config, TRUE); #endif - sem_init(&pcadev->exclsem, 0, 1); + nxsem_init(&pcadev->exclsem, 0, 1); return &pcadev->dev; } diff --git a/drivers/ioexpander/pcf8574.c b/drivers/ioexpander/pcf8574.c index 4171017c2f..0d85d1a3e2 100644 --- a/drivers/ioexpander/pcf8574.c +++ b/drivers/ioexpander/pcf8574.c @@ -1130,7 +1130,7 @@ FAR struct ioexpander_dev_s *pcf8574_initialize(FAR struct i2c_master_s *i2c, priv->config->enable(config, true); #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->dev; } diff --git a/drivers/ioexpander/skeleton.c b/drivers/ioexpander/skeleton.c index 77e390a2f9..d4ec128e98 100644 --- a/drivers/ioexpander/skeleton.c +++ b/drivers/ioexpander/skeleton.c @@ -760,7 +760,7 @@ FAR struct ioexpander_dev_s *skel_initialize(void) #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->dev; } diff --git a/drivers/ioexpander/tca64xx.c b/drivers/ioexpander/tca64xx.c index c23b428cf2..ff3c827e1f 100644 --- a/drivers/ioexpander/tca64xx.c +++ b/drivers/ioexpander/tca64xx.c @@ -1405,7 +1405,7 @@ FAR struct ioexpander_dev_s *tca64_initialize(FAR struct i2c_master_s *i2c, priv->config->enable(config, true); #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); return &priv->dev; } diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c index 6979539c48..a69deb153f 100644 --- a/drivers/lcd/pcf8574_lcd_backpack.c +++ b/drivers/lcd/pcf8574_lcd_backpack.c @@ -1595,7 +1595,7 @@ int pcf8574_lcd_backpack_register(FAR const char *devpath, priv->bl_bit = priv->cfg.bl_active_high ? 0 : (1 << priv->cfg.bl); priv->refs = 0; priv->unlinked = false; - sem_init(&priv->sem_excl, 0, 1); + nxsem_init(&priv->sem_excl, 0, 1); /* Initialize */ diff --git a/drivers/leds/rgbled.c b/drivers/leds/rgbled.c index b918f367ff..cb8f86badf 100644 --- a/drivers/leds/rgbled.c +++ b/drivers/leds/rgbled.c @@ -454,7 +454,7 @@ int rgbled_register(FAR const char *path, FAR struct pwm_lowerhalf_s *ledr, * kmm_zalloc()) */ - sem_init(&upper->exclsem, 0, 1); + nxsem_init(&upper->exclsem, 0, 1); upper->devledr = ledr; upper->devledg = ledg; upper->devledb = ledb; diff --git a/drivers/leds/userled_upper.c b/drivers/leds/userled_upper.c index dbf8f919c1..76a7948393 100644 --- a/drivers/leds/userled_upper.c +++ b/drivers/leds/userled_upper.c @@ -555,7 +555,7 @@ int userled_register(FAR const char *devname, /* Initialize the new LED driver instance */ priv->lu_lower = lower; - sem_init(&priv->lu_exclsem, 0, 1); + nxsem_init(&priv->lu_exclsem, 0, 1); DEBUGASSERT(lower && lower->ll_supported); priv->lu_supported = lower->ll_supported(lower); diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c index 65d9f9e9cd..b850c3144d 100644 --- a/drivers/loop/losetup.c +++ b/drivers/loop/losetup.c @@ -413,7 +413,7 @@ int losetup(FAR const char *devname, FAR const char *filename, /* Initialize the loop device structure. */ - sem_init(&dev->sem, 0, 1); + nxsem_init(&dev->sem, 0, 1); dev->nsectors = (sb.st_size - offset) / sectsize; dev->sectsize = sectsize; dev->offset = offset; diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 1411a6d5f5..7065cf3e7e 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -3288,7 +3288,7 @@ int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev) /* Initialize the MMC/SD state structure */ memset(priv, 0, sizeof(struct mmcsd_state_s)); - sem_init(&priv->sem, 0, 1); + nxsem_init(&priv->sem, 0, 1); /* Bind the MMCSD driver to the MMCSD state structure */ diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c index 9a7de84fb3..4e31d21a95 100644 --- a/drivers/mmcsd/mmcsd_spi.c +++ b/drivers/mmcsd/mmcsd_spi.c @@ -1933,7 +1933,7 @@ int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi) slot = &g_mmcsdslot[slotno]; memset(slot, 0, sizeof(struct mmcsd_slot_s)); - sem_init(&slot->sem, 0, 1); + nxsem_init(&slot->sem, 0, 1); #ifdef CONFIG_DEBUG_FEATURES if (slot->spi) diff --git a/drivers/mtd/mtd_config.c b/drivers/mtd/mtd_config.c index 2566efedc8..3021d604a7 100644 --- a/drivers/mtd/mtd_config.c +++ b/drivers/mtd/mtd_config.c @@ -1394,7 +1394,7 @@ int mtdconfig_register(FAR struct mtd_dev_s *mtd) /* Initialize the mtdconfig device structure */ dev->mtd = mtd; - sem_init(&dev->exclsem, 0, 1); + nxsem_init(&dev->exclsem, 0, 1); /* Get the device geometry. (casting to uintptr_t first eliminates * complaints on some architectures where the sizeof long is different diff --git a/drivers/mtd/mtd_nand.c b/drivers/mtd/mtd_nand.c index b5872e6854..78887a4cb1 100644 --- a/drivers/mtd/mtd_nand.c +++ b/drivers/mtd/mtd_nand.c @@ -967,7 +967,7 @@ FAR struct mtd_dev_s *nand_initialize(FAR struct nand_raw_s *raw) nand->mtd.ioctl = nand_ioctl; nand->raw = raw; - sem_init(&nand->exclsem, 0, 1); + nxsem_init(&nand->exclsem, 0, 1); /* Scan the device for bad blocks */ diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 36eefbef95..9b077b0468 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -956,7 +956,7 @@ int slip_initialize(int intf, FAR const char *devname) /* Initialize the wait semaphore */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); /* Put the interface in the down state. This usually amounts to resetting diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 9e16d11328..2913479c7e 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -777,7 +777,7 @@ static int telnet_session(FAR struct telnet_session_s *session) /* Initialize the allocated driver instance */ - sem_init(&priv->td_exclsem, 0, 1); + nxsem_init(&priv->td_exclsem, 0, 1); priv->td_state = STATE_NORMAL; priv->td_crefs = 0; diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 1bef4351cc..87fccebb35 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -872,8 +872,8 @@ static int tun_dev_init(FAR struct tun_device_s *priv, FAR struct file *filep, /* Initialize the mutual exlcusion and wait semaphore */ - sem_init(&priv->waitsem, 0, 1); - sem_init(&priv->read_wait_sem, 0, 0); + nxsem_init(&priv->waitsem, 0, 1); + nxsem_init(&priv->read_wait_sem, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have * priority inheritance enabled. @@ -1272,7 +1272,7 @@ static int tun_ioctl(FAR struct file *filep, int cmd, unsigned long arg) int tun_initialize(void) { - sem_init(&g_tun.waitsem, 0, 1); + nxsem_init(&g_tun.waitsem, 0, 1); g_tun.free_tuns = (1 << CONFIG_TUN_NINTERFACES) - 1; diff --git a/drivers/pipes/pipe_common.c b/drivers/pipes/pipe_common.c index 263058ec25..8eab11ac28 100644 --- a/drivers/pipes/pipe_common.c +++ b/drivers/pipes/pipe_common.c @@ -169,9 +169,9 @@ FAR struct pipe_dev_s *pipecommon_allocdev(size_t bufsize) /* Initialize the private structure */ memset(dev, 0, sizeof(struct pipe_dev_s)); - sem_init(&dev->d_bfsem, 0, 1); - sem_init(&dev->d_rdsem, 0, 0); - sem_init(&dev->d_wrsem, 0, 0); + nxsem_init(&dev->d_bfsem, 0, 1); + nxsem_init(&dev->d_rdsem, 0, 0); + nxsem_init(&dev->d_wrsem, 0, 0); /* The read/write wait semaphores are used for signaling and, hence, * should not have priority inheritance enabled. @@ -254,7 +254,7 @@ int pipecommon_open(FAR struct file *filep) if (dev->d_nwriters == 1) { - while (sem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) + while (nxsem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) { sem_post(&dev->d_rdsem); } @@ -349,7 +349,7 @@ int pipecommon_close(FAR struct file *filep) if (--dev->d_nwriters <= 0) { - while (sem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) + while (nxsem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) { sem_post(&dev->d_rdsem); } @@ -494,7 +494,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len) /* Notify all waiting writers that bytes have been removed from the buffer */ - while (sem_getvalue(&dev->d_wrsem, &sval) == 0 && sval < 0) + while (nxsem_getvalue(&dev->d_wrsem, &sval) == 0 && sval < 0) { sem_post(&dev->d_wrsem); } @@ -580,7 +580,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, { /* Yes.. Notify all of the waiting readers that more data is available */ - while (sem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) + while (nxsem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) { sem_post(&dev->d_rdsem); } @@ -603,7 +603,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, { /* Yes.. Notify all of the waiting readers that more data is available */ - while (sem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) + while (nxsem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0) { sem_post(&dev->d_rdsem); } diff --git a/drivers/power/bq2425x.c b/drivers/power/bq2425x.c index 7e6e7dbd72..a93116b46f 100644 --- a/drivers/power/bq2425x.c +++ b/drivers/power/bq2425x.c @@ -787,7 +787,7 @@ FAR struct battery_charger_dev_s * { /* Initialize the BQ2425x device structure */ - sem_init(&priv->batsem, 0, 1); + nxsem_init(&priv->batsem, 0, 1); priv->ops = &g_bq2425xops; priv->i2c = i2c; priv->addr = addr; diff --git a/drivers/power/bq2429x.c b/drivers/power/bq2429x.c index 675a6eccd7..7aa91eab8e 100644 --- a/drivers/power/bq2429x.c +++ b/drivers/power/bq2429x.c @@ -1209,7 +1209,7 @@ FAR struct battery_charger_dev_s * { /* Initialize the BQ2429x device structure */ - sem_init(&priv->batsem, 0, 1); + nxsem_init(&priv->batsem, 0, 1); priv->ops = &g_bq2429xops; priv->i2c = i2c; priv->addr = addr; diff --git a/drivers/power/max1704x.c b/drivers/power/max1704x.c index 00f98fc189..6fde917a53 100644 --- a/drivers/power/max1704x.c +++ b/drivers/power/max1704x.c @@ -542,7 +542,7 @@ FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c { /* Initialize the MAX1704x device structure */ - sem_init(&priv->batsem, 0, 1); + nxsem_init(&priv->batsem, 0, 1); priv->ops = &g_max1704xops; priv->i2c = i2c; priv->addr = addr; diff --git a/drivers/power/pm_initialize.c b/drivers/power/pm_initialize.c index 1ac5878861..52518d2f29 100644 --- a/drivers/power/pm_initialize.c +++ b/drivers/power/pm_initialize.c @@ -86,7 +86,7 @@ void pm_initialize(void) */ sq_init(&g_pmglobals.registry); - sem_init(&g_pmglobals.regsem, 0, 1); + nxsem_init(&g_pmglobals.regsem, 0, 1); } #endif /* CONFIG_PM */ diff --git a/drivers/power/powerled.c b/drivers/power/powerled.c index 354221bfde..46375affc5 100644 --- a/drivers/power/powerled.c +++ b/drivers/power/powerled.c @@ -425,7 +425,7 @@ int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev, FAR /* Initialize semaphores */ - sem_init(&dev->closesem, 0, 1); + nxsem_init(&dev->closesem, 0, 1); /* Connect POWERLED driver with lower level interface */ diff --git a/drivers/power/smps.c b/drivers/power/smps.c index 1fa5e2a103..e9cd30ba6b 100644 --- a/drivers/power/smps.c +++ b/drivers/power/smps.c @@ -518,7 +518,7 @@ int smps_register(FAR const char *path, FAR struct smps_dev_s *dev, FAR void *lo /* Initialize semaphores */ - sem_init(&dev->closesem, 0, 1); + nxsem_init(&dev->closesem, 0, 1); /* Connect SMPS driver with lower level interface */ diff --git a/drivers/pwm.c b/drivers/pwm.c index 24c5ae4105..a5dfe3c7b6 100644 --- a/drivers/pwm.c +++ b/drivers/pwm.c @@ -599,9 +599,9 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev) /* Initialize the PWM device structure (it was already zeroed by kmm_zalloc()) */ - sem_init(&upper->exclsem, 0, 1); + nxsem_init(&upper->exclsem, 0, 1); #ifdef CONFIG_PWM_PULSECOUNT - sem_init(&upper->waitsem, 0, 0); + nxsem_init(&upper->waitsem, 0, 0); /* The wait semaphore is used for signaling and, hence, should not have priority * inheritance enabled. diff --git a/drivers/rwbuffer.c b/drivers/rwbuffer.c index b1f2838042..293794de59 100644 --- a/drivers/rwbuffer.c +++ b/drivers/rwbuffer.c @@ -657,7 +657,7 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb) /* Initialize the write buffer access semaphore */ - sem_init(&rwb->wrsem, 0, 1); + nxsem_init(&rwb->wrsem, 0, 1); /* Initialize write buffer parameters */ @@ -688,7 +688,7 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb) /* Initialize the read-ahead buffer access semaphore */ - sem_init(&rwb->rhsem, 0, 1); + nxsem_init(&rwb->rhsem, 0, 1); /* Initialize read-ahead buffer parameters */ diff --git a/drivers/sensors/adxl345_base.c b/drivers/sensors/adxl345_base.c index 93ebf9cf45..f94398ef9b 100644 --- a/drivers/sensors/adxl345_base.c +++ b/drivers/sensors/adxl345_base.c @@ -407,7 +407,7 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev, /* Initialize the device state structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->config = config; #ifdef CONFIG_ADXL345_SPI diff --git a/drivers/sensors/bmg160.c b/drivers/sensors/bmg160.c index a8d95094ad..77209253cd 100644 --- a/drivers/sensors/bmg160.c +++ b/drivers/sensors/bmg160.c @@ -560,7 +560,7 @@ int bmg160_register(FAR const char *devpath, FAR struct spi_dev_s *spi, /* Initialize sensor data access semaphore */ - sem_init(&priv->datasem, 0, 1); + nxsem_init(&priv->datasem, 0, 1); /* Setup SPI frequency and mode */ diff --git a/drivers/sensors/hc_sr04.c b/drivers/sensors/hc_sr04.c index 297795a4d1..cae43b57d1 100644 --- a/drivers/sensors/hc_sr04.c +++ b/drivers/sensors/hc_sr04.c @@ -121,7 +121,7 @@ static int hcsr04_read_distance(FAR struct hcsr04_dev_s *priv) { int done; - sem_getvalue(&priv->conv_donesem, &done); + nxsem_getvalue(&priv->conv_donesem, &done); if (done == 0) { @@ -273,7 +273,7 @@ static bool hcsr04_sample(FAR struct hcsr04_dev_s *priv) { int done; - sem_getvalue(&priv->conv_donesem, &done); + nxsem_getvalue(&priv->conv_donesem, &done); return (done == 0); } @@ -446,8 +446,8 @@ int hcsr04_register(FAR const char *devpath, } priv->config = config; - sem_init(&priv->devsem, 0, 1); - sem_init(&priv->conv_donesem, 0, 0); + nxsem_init(&priv->devsem, 0, 1); + nxsem_init(&priv->conv_donesem, 0, 0); ret = register_driver(devpath, &g_hcsr04ops, 0666, priv); if (ret < 0) diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c index e2a08147c5..0e466f5a93 100644 --- a/drivers/sensors/hts221.c +++ b/drivers/sensors/hts221.c @@ -1105,7 +1105,7 @@ int hts221_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, priv->addr = addr; priv->i2c = i2c; priv->config = config; - sem_init(&priv->devsem, 0, 1); + nxsem_init(&priv->devsem, 0, 1); ret = hts221_load_calibration_data(priv); if (ret < 0) diff --git a/drivers/sensors/kxtj9.c b/drivers/sensors/kxtj9.c index 365c3dbb48..e58f42e8f9 100644 --- a/drivers/sensors/kxtj9.c +++ b/drivers/sensors/kxtj9.c @@ -670,7 +670,7 @@ int kxtj9_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, priv->i2c = i2c; priv->address = address; - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Register the character driver */ diff --git a/drivers/sensors/l3gd20.c b/drivers/sensors/l3gd20.c index 10bcbeb77a..91f2d56141 100644 --- a/drivers/sensors/l3gd20.c +++ b/drivers/sensors/l3gd20.c @@ -617,7 +617,7 @@ int l3gd20_register(FAR const char *devpath, FAR struct spi_dev_s *spi, /* Initialize sensor data access semaphore */ - sem_init(&priv->datasem, 0, 1); + nxsem_init(&priv->datasem, 0, 1); /* Setup SPI frequency and mode */ diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c index db6af58e4b..1bf4173398 100644 --- a/drivers/sensors/lis2dh.c +++ b/drivers/sensors/lis2dh.c @@ -2015,7 +2015,7 @@ int lis2dh_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, return -ENOMEM; } - sem_init(&priv->devsem, 0, 1); + nxsem_init(&priv->devsem, 0, 1); priv->fifo_used = false; #ifdef LIS2DH_COUNT_INTS diff --git a/drivers/sensors/lis3dsh.c b/drivers/sensors/lis3dsh.c index 8e8ed4885c..c455327c9c 100644 --- a/drivers/sensors/lis3dsh.c +++ b/drivers/sensors/lis3dsh.c @@ -560,7 +560,7 @@ int lis3dsh_register(FAR const char *devpath, FAR struct spi_dev_s *spi, priv->config = config; priv->work.worker = NULL; - sem_init(&priv->datasem, 0, 1); /* Initialize sensor data access + nxsem_init(&priv->datasem, 0, 1); /* Initialize sensor data access * semaphore */ /* Setup SPI frequency and mode */ diff --git a/drivers/sensors/lis3mdl.c b/drivers/sensors/lis3mdl.c index 18c0e21f8b..4dda4d979f 100644 --- a/drivers/sensors/lis3mdl.c +++ b/drivers/sensors/lis3mdl.c @@ -600,7 +600,7 @@ int lis3mdl_register(FAR const char *devpath, FAR struct spi_dev_s *spi, priv->work.worker = NULL; - sem_init(&priv->datasem, 0, 1); /* Initialize sensor data access + nxsem_init(&priv->datasem, 0, 1); /* Initialize sensor data access * semaphore */ /* Setup SPI frequency and mode */ diff --git a/drivers/sensors/lps25h.c b/drivers/sensors/lps25h.c index 1eb762af0a..afcc4954fc 100644 --- a/drivers/sensors/lps25h.c +++ b/drivers/sensors/lps25h.c @@ -771,8 +771,8 @@ int lps25h_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, return -ENOMEM; } - sem_init(&dev->devsem, 0, 1); - sem_init(&dev->waitsem, 0, 0); + nxsem_init(&dev->devsem, 0, 1); + nxsem_init(&dev->waitsem, 0, 0); dev->addr = addr; dev->i2c = i2c; diff --git a/drivers/sensors/mlx90393.c b/drivers/sensors/mlx90393.c index f50d657527..5db0801d98 100644 --- a/drivers/sensors/mlx90393.c +++ b/drivers/sensors/mlx90393.c @@ -589,7 +589,7 @@ int mlx90393_register(FAR const char *devpath, FAR struct spi_dev_s *spi, priv->work.worker = NULL; - sem_init(&priv->datasem, 0, 1); /* Initialize sensor data access + nxsem_init(&priv->datasem, 0, 1); /* Initialize sensor data access * semaphore */ /* Setup SPI frequency and mode */ diff --git a/drivers/sensors/qencoder.c b/drivers/sensors/qencoder.c index 894581664f..6f1871d249 100644 --- a/drivers/sensors/qencoder.c +++ b/drivers/sensors/qencoder.c @@ -376,7 +376,7 @@ int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower) /* Initialize the PWM device structure (it was already zeroed by kmm_zalloc()) */ - sem_init(&upper->exclsem, 0, 1); + nxsem_init(&upper->exclsem, 0, 1); upper->lower = lower; /* Register the PWM device */ diff --git a/drivers/sensors/xen1210.c b/drivers/sensors/xen1210.c index bb7858ae39..b8bb660ceb 100644 --- a/drivers/sensors/xen1210.c +++ b/drivers/sensors/xen1210.c @@ -301,7 +301,7 @@ XEN1210_HANDLE xen1210_instantiate(FAR struct spi_dev_s *dev, /* Initialize the device state structure */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); priv->config = config; priv->spi = dev; diff --git a/drivers/sensors/zerocross.c b/drivers/sensors/zerocross.c index 770ca55690..7a3460ce71 100644 --- a/drivers/sensors/zerocross.c +++ b/drivers/sensors/zerocross.c @@ -526,7 +526,7 @@ int zc_register(FAR const char *devname, FAR struct zc_lowerhalf_s *lower) /* Initialize the new zero cross driver instance */ priv->lower = lower; - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* And register the zero cross driver */ diff --git a/drivers/serial/ptmx.c b/drivers/serial/ptmx.c index 6a8a3359ce..4ea9b69c4f 100644 --- a/drivers/serial/ptmx.c +++ b/drivers/serial/ptmx.c @@ -310,7 +310,7 @@ int ptmx_register(void) { /* Initialize driver state */ - sem_init(&g_ptmx.px_exclsem, 0, 1); + nxsem_init(&g_ptmx.px_exclsem, 0, 1); /* Register the PTMX driver */ diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c index 4c27cd89bb..c145a2988a 100644 --- a/drivers/serial/pty.c +++ b/drivers/serial/pty.c @@ -777,7 +777,7 @@ static int pty_ioctl(FAR struct file *filep, int cmd, unsigned long arg) do { - DEBUGVERIFY(sem_getvalue(&devpair->pp_slavesem, &sval)); + DEBUGVERIFY(nxsem_getvalue(&devpair->pp_slavesem, &sval)); if (sval < 0) { sem_post(&devpair->pp_slavesem); @@ -1019,8 +1019,8 @@ int pty_register(int minor) /* Initialize semaphores */ - sem_init(&devpair->pp_slavesem, 0, 0); - sem_init(&devpair->pp_exclsem, 0, 1); + nxsem_init(&devpair->pp_slavesem, 0, 0); + nxsem_init(&devpair->pp_exclsem, 0, 1); /* The pp_slavesem semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 0852789630..923397b97f 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -650,12 +650,12 @@ static int uart_close(FAR struct file *filep) * a thread currently blocking on any of them. */ - sem_reset(&dev->xmitsem, 0); - sem_reset(&dev->recvsem, 0); - sem_reset(&dev->xmit.sem, 1); - sem_reset(&dev->recv.sem, 1); + nxsem_reset(&dev->xmitsem, 0); + nxsem_reset(&dev->recvsem, 0); + nxsem_reset(&dev->xmit.sem, 1); + nxsem_reset(&dev->recv.sem, 1); #ifndef CONFIG_DISABLE_POLL - sem_reset(&dev->pollsem, 1); + nxsem_reset(&dev->pollsem, 1); #endif uart_givesem(&dev->closesem); @@ -1532,13 +1532,13 @@ int uart_register(FAR const char *path, FAR uart_dev_t *dev) { /* Initialize semaphores */ - sem_init(&dev->xmit.sem, 0, 1); - sem_init(&dev->recv.sem, 0, 1); - sem_init(&dev->closesem, 0, 1); - sem_init(&dev->xmitsem, 0, 0); - sem_init(&dev->recvsem, 0, 0); + nxsem_init(&dev->xmit.sem, 0, 1); + nxsem_init(&dev->recv.sem, 0, 1); + nxsem_init(&dev->closesem, 0, 1); + nxsem_init(&dev->xmitsem, 0, 0); + nxsem_init(&dev->recvsem, 0, 0); #ifndef CONFIG_DISABLE_POLL - sem_init(&dev->pollsem, 0, 1); + nxsem_init(&dev->pollsem, 0, 1); #endif /* The recvsem and xmitsem are used for signaling and, hence, should not have diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 0e502f6c37..039f37ad09 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c @@ -551,7 +551,7 @@ FAR struct spi_dev_s *spi_create_bitbang(FAR const struct spi_bitbang_ops_s *low priv->nbits = 8; #endif - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Select an initial state of mode 0, 8-bits, and 400KHz */ diff --git a/drivers/spi/spi_driver.c b/drivers/spi/spi_driver.c index 5f14827c03..a30de61eb4 100644 --- a/drivers/spi/spi_driver.c +++ b/drivers/spi/spi_driver.c @@ -384,7 +384,7 @@ int spi_register(FAR struct spi_dev_s *spi, int bus) priv->spi = spi; #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #endif /* Create the character device name */ diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c index b81a7df6a7..5db97388ed 100644 --- a/drivers/syslog/ramlog.c +++ b/drivers/syslog/ramlog.c @@ -694,9 +694,9 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen) { /* Initialize the non-zero values in the RAM logging device structure */ - sem_init(&priv->rl_exclsem, 0, 1); + nxsem_init(&priv->rl_exclsem, 0, 1); #ifndef CONFIG_RAMLOG_NONBLOCKING - sem_init(&priv->rl_waitsem, 0, 0); + nxsem_init(&priv->rl_waitsem, 0, 0); /* The rl_waitsem semaphore is used for signaling and, hence, should * not have priority inheritance enabled. diff --git a/drivers/syslog/syslog_device.c b/drivers/syslog/syslog_device.c index a9f4596e78..7247fda48a 100644 --- a/drivers/syslog/syslog_device.c +++ b/drivers/syslog/syslog_device.c @@ -405,7 +405,7 @@ int syslog_dev_initialize(FAR const char *devpath, int oflags, int mode) /* The SYSLOG device is open and ready for writing. */ - sem_init(&g_syslog_dev.sl_sem, 0, 1); + nxsem_init(&g_syslog_dev.sl_sem, 0, 1); g_syslog_dev.sl_holder = NO_HOLDER; g_syslog_dev.sl_state = SYSLOG_OPENED; return OK; diff --git a/drivers/timers/oneshot.c b/drivers/timers/oneshot.c index 518071d19d..56556aaa38 100644 --- a/drivers/timers/oneshot.c +++ b/drivers/timers/oneshot.c @@ -365,7 +365,7 @@ int oneshot_register(FAR const char *devname, /* Initialize the new oneshot timer driver instance */ priv->od_lower = lower; - sem_init(&priv->od_exclsem, 0, 1); + nxsem_init(&priv->od_exclsem, 0, 1); /* And register the oneshot timer driver */ diff --git a/drivers/timers/watchdog.c b/drivers/timers/watchdog.c index 7ccab15a06..0d69892799 100644 --- a/drivers/timers/watchdog.c +++ b/drivers/timers/watchdog.c @@ -479,7 +479,7 @@ FAR void *watchdog_register(FAR const char *path, * by kmm_zalloc()). */ - sem_init(&upper->exclsem, 0, 1); + nxsem_init(&upper->exclsem, 0, 1); upper->lower = lower; /* Copy the registration path */ diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index d755881918..ba0293017c 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -1358,9 +1358,9 @@ int usbmsc_configure(unsigned int nluns, void **handle) /* Initialize semaphores */ - sem_init(&priv->thsynch, 0, 0); - sem_init(&priv->thlock, 0, 1); - sem_init(&priv->thwaitsem, 0, 0); + nxsem_init(&priv->thsynch, 0, 0); + nxsem_init(&priv->thlock, 0, 1); + nxsem_init(&priv->thwaitsem, 0, 0); /* The thsynch and thwaitsem semaphores are used for signaling and, hence, * should not have priority inheritance enabled. diff --git a/drivers/usbhost/usbhost_cdcacm.c b/drivers/usbhost/usbhost_cdcacm.c index 4b0a9e5c42..4c719beb66 100644 --- a/drivers/usbhost/usbhost_cdcacm.c +++ b/drivers/usbhost/usbhost_cdcacm.c @@ -1901,7 +1901,7 @@ usbhost_create(FAR struct usbhost_hubport_s *hport, /* Initialize semaphores (this works okay in the interrupt context) */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Set up the serial lower-half interface */ diff --git a/drivers/usbhost/usbhost_devaddr.c b/drivers/usbhost/usbhost_devaddr.c index 1b51a08926..803e547bac 100644 --- a/drivers/usbhost/usbhost_devaddr.c +++ b/drivers/usbhost/usbhost_devaddr.c @@ -254,7 +254,7 @@ void usbhost_devaddr_initialize(FAR struct usbhost_roothubport_s *rhport) devgen = &rhport->devgen; memset(devgen, 0, sizeof(struct usbhost_devaddr_s)); - sem_init(&devgen->exclsem, 0, 1); + nxsem_init(&devgen->exclsem, 0, 1); devgen->next = 1; } diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c index 6a5be0e9ba..ab79d2b107 100644 --- a/drivers/usbhost/usbhost_hidkbd.c +++ b/drivers/usbhost/usbhost_hidkbd.c @@ -1862,8 +1862,8 @@ static FAR struct usbhost_class_s * /* Initialize semaphores */ - sem_init(&priv->exclsem, 0, 1); - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should * not have priority inheritance enabled. @@ -2427,8 +2427,8 @@ int usbhost_kbdinit(void) { /* Perform any one-time initialization of the class implementation */ - sem_init(&g_exclsem, 0, 1); - sem_init(&g_syncsem, 0, 0); + nxsem_init(&g_exclsem, 0, 1); + nxsem_init(&g_syncsem, 0, 0); /* The g_syncsem semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c index dbd0033920..ec04a3ea79 100644 --- a/drivers/usbhost/usbhost_hidmouse.c +++ b/drivers/usbhost/usbhost_hidmouse.c @@ -1932,8 +1932,8 @@ static FAR struct usbhost_class_s * /* Initialize semaphores */ - sem_init(&priv->exclsem, 0, 1); - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should * not have priority inheritance enabled. @@ -2557,8 +2557,8 @@ int usbhost_mouse_init(void) { /* Perform any one-time initialization of the class implementation */ - sem_init(&g_exclsem, 0, 1); - sem_init(&g_syncsem, 0, 0); + nxsem_init(&g_exclsem, 0, 1); + nxsem_init(&g_syncsem, 0, 0); /* The g_syncsem semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/usbhost/usbhost_hub.c b/drivers/usbhost/usbhost_hub.c index add1455ca3..a3a54ccd07 100644 --- a/drivers/usbhost/usbhost_hub.c +++ b/drivers/usbhost/usbhost_hub.c @@ -1302,7 +1302,7 @@ static FAR struct usbhost_class_s * /* Initialize semaphores (this works okay in the interrupt context) */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Initialize per-port data */ diff --git a/drivers/usbhost/usbhost_skeleton.c b/drivers/usbhost/usbhost_skeleton.c index a03d1101f7..1f89359fdf 100644 --- a/drivers/usbhost/usbhost_skeleton.c +++ b/drivers/usbhost/usbhost_skeleton.c @@ -889,7 +889,7 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_hubport_s * /* Initialize semaphores (this works okay in the interrupt context) */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Return the instance of the USB class driver */ diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c index c7df71a7f4..24bb7bd736 100644 --- a/drivers/usbhost/usbhost_storage.c +++ b/drivers/usbhost/usbhost_storage.c @@ -1703,7 +1703,7 @@ usbhost_create(FAR struct usbhost_hubport_s *hport, /* Initialize semaphores (this works okay in the interrupt context) */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* NOTE: We do not yet know the geometry of the USB mass storage device */ diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c index 6fcf49d6a8..984064087c 100644 --- a/drivers/usbhost/usbhost_xboxcontroller.c +++ b/drivers/usbhost/usbhost_xboxcontroller.c @@ -1574,8 +1574,8 @@ static FAR struct usbhost_class_s *usbhost_create(FAR struct usbhost_hubport_s * /* Initialize semaphores (this works okay in the interrupt context) */ - sem_init(&priv->exclsem, 0, 1); - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->waitsem, 0, 0); /* The waitsem semaphore is used for signaling and, hence, should * not have priority inheritance enabled. @@ -2213,8 +2213,8 @@ int usbhost_xboxcontroller_init(void) /* Perform any one-time initialization of the class implementation */ - sem_init(&g_exclsem, 0, 1); - sem_init(&g_syncsem, 0, 0); + nxsem_init(&g_exclsem, 0, 1); + nxsem_init(&g_syncsem, 0, 0); /* The g_syncsem semaphore is used for signaling and, hence, should not * have priority inheritance enabled. diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c index c106c0470b..47d0571b9a 100644 --- a/drivers/usbmisc/fusb301.c +++ b/drivers/usbmisc/fusb301.c @@ -830,7 +830,7 @@ int fusb301_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, /* Initialize device structure semaphore */ - sem_init(&priv->devsem, 0, 1); + nxsem_init(&priv->devsem, 0, 1); priv->int_pending = false; priv->i2c = i2c; diff --git a/drivers/wireless/cc3000/cc3000.c b/drivers/wireless/cc3000/cc3000.c index f290f96789..f4a9fdb24d 100644 --- a/drivers/wireless/cc3000/cc3000.c +++ b/drivers/wireless/cc3000/cc3000.c @@ -503,7 +503,7 @@ static void *select_thread_func(FAR void *arg) int count; do { - sem_getvalue(&priv->sockets[s].semwait, &count); + nxsem_getvalue(&priv->sockets[s].semwait, &count); if (count < 0) { /* Release the waiting threads */ @@ -714,7 +714,7 @@ static void *cc3000_worker(FAR void *arg) ninfo("Completed S:%d irq :%d\n", priv->state, priv->config->irq_read(priv->config)); - sem_getvalue(&priv->irqsem, &count); + nxsem_getvalue(&priv->irqsem, &count); if (priv->config->irq_read(priv->config) && count == 0) { sem_post(&priv->irqsem); @@ -816,9 +816,9 @@ static int cc3000_open(FAR struct file *filep) { /* Initialize semaphores */ - sem_init(&priv->waitsem, 0, 0); /* Initialize event wait semaphore */ - sem_init(&priv->irqsem, 0, 0); /* Initialize IRQ Ready semaphore */ - sem_init(&priv->readysem, 0, 0); /* Initialize Device Ready semaphore */ + nxsem_init(&priv->waitsem, 0, 0); /* Initialize event wait semaphore */ + nxsem_init(&priv->irqsem, 0, 0); /* Initialize IRQ Ready semaphore */ + nxsem_init(&priv->readysem, 0, 0); /* Initialize Device Ready semaphore */ /* These semaphores are all used for signaling and, hence, should * not have priority inheritance enabled. @@ -830,7 +830,7 @@ static int cc3000_open(FAR struct file *filep) #ifdef CONFIG_CC3000_MT priv->accepting_socket.acc.sd = FREE_SLOT; - sem_init(&priv->accepting_socket.acc.semwait, 0, 0); + nxsem_init(&priv->accepting_socket.acc.semwait, 0, 0); sem_setprotocol(&priv->accepting_socket.acc.semwait, SEM_PRIO_NONE); for (s = 0; s < CONFIG_WL_MAX_SOCKETS; s++) @@ -839,7 +839,7 @@ static int cc3000_open(FAR struct file *filep) priv->sockets[s].received_closed_event = false; priv->sockets[s].emptied_and_remotely_closed = false; - sem_init(&priv->sockets[s].semwait, 0, 0); + nxsem_init(&priv->sockets[s].semwait, 0, 0); sem_setprotocol(&priv->sockets[s].semwait, SEM_PRIO_NONE); } #endif @@ -889,7 +889,7 @@ static int cc3000_open(FAR struct file *filep) param.sched_priority = CONFIG_CC3000_SELECT_THREAD_PRIORITY; pthread_attr_setschedparam(&tattr, ¶m); - sem_init(&priv->selectsem, 0, 0); + nxsem_init(&priv->selectsem, 0, 0); sem_setprotocol(&priv->selectsem, SEM_PRIO_NONE); ret = pthread_create(&priv->selecttid, &tattr, select_thread_func, @@ -1551,7 +1551,7 @@ int cc3000_register(FAR struct spi_dev_s *spi, priv->rx_buffer_max_len = config->max_rx_size; - sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ + nxsem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */ (void)snprintf(semname, SEM_NAMELEN, SEM_FORMAT, minor); priv->wrkwaitsem = sem_open(semname, O_CREAT, 0, 0); /* Initialize Worker Wait semaphore */ diff --git a/drivers/wireless/cc3000/cc3000drv.c b/drivers/wireless/cc3000/cc3000drv.c index 6327371a47..0a099a9c9f 100644 --- a/drivers/wireless/cc3000/cc3000drv.c +++ b/drivers/wireless/cc3000/cc3000drv.c @@ -242,7 +242,7 @@ void cc3000_open(gcSpiHandleRx pfRxHandler) spiconf.cc3000fd = fd; spiconf.run = true; - sem_init(&spiconf.unsoliced_thread_wakesem, 0, 0); + nxsem_init(&spiconf.unsoliced_thread_wakesem, 0, 0); pthread_attr_t attr; struct sched_param param; diff --git a/drivers/wireless/ieee80211/bcmf_driver.c b/drivers/wireless/ieee80211/bcmf_driver.c index d9c389f820..ae63d19cdf 100644 --- a/drivers/wireless/ieee80211/bcmf_driver.c +++ b/drivers/wireless/ieee80211/bcmf_driver.c @@ -137,12 +137,12 @@ FAR struct bcmf_dev_s *bcmf_allocate_device(void) /* Init control frames mutex and timeout signal */ - if ((ret = sem_init(&priv->control_mutex, 0, 1)) != OK) + if ((ret = nxsem_init(&priv->control_mutex, 0, 1)) != OK) { goto exit_free_priv; } - if ((ret = sem_init(&priv->control_timeout, 0, 0)) != OK) + if ((ret = nxsem_init(&priv->control_timeout, 0, 0)) != OK) { goto exit_free_priv; } @@ -154,7 +154,7 @@ FAR struct bcmf_dev_s *bcmf_allocate_device(void) /* Init authentication signal semaphore */ - if ((ret = sem_init(&priv->auth_signal, 0, 0)) != OK) + if ((ret = nxsem_init(&priv->auth_signal, 0, 0)) != OK) { goto exit_free_priv; } diff --git a/drivers/wireless/ieee80211/bcmf_sdio.c b/drivers/wireless/ieee80211/bcmf_sdio.c index dcef6fc66e..bad60094b2 100644 --- a/drivers/wireless/ieee80211/bcmf_sdio.c +++ b/drivers/wireless/ieee80211/bcmf_sdio.c @@ -581,7 +581,7 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv, /* Init transmit frames queue */ - if ((ret = sem_init(&sbus->queue_mutex, 0, 1)) != OK) + if ((ret = nxsem_init(&sbus->queue_mutex, 0, 1)) != OK) { goto exit_free_bus; } @@ -600,7 +600,7 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv, /* Init thread semaphore */ - if ((ret = sem_init(&sbus->thread_signal, 0, 0)) != OK) + if ((ret = nxsem_init(&sbus->thread_signal, 0, 0)) != OK) { goto exit_free_bus; } diff --git a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c index 1fe4250d3a..a99a01496f 100644 --- a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c +++ b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c @@ -1492,8 +1492,8 @@ FAR struct ieee802154_radio_s *at86rf23x_init(FAR struct spi_dev_s *spi, return NULL; } - sem_init(&dev->ieee.rxsem, 0, 0); - sem_init(&dev->ieee.txsem, 0, 0); + nxsem_init(&dev->ieee.rxsem, 0, 0); + nxsem_init(&dev->ieee.txsem, 0, 0); /* Initialize device */ diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c b/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c index 2d1fc5ffe6..55f026ce7e 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c @@ -448,7 +448,7 @@ FAR struct ieee802154_radio_s *mrf24j40_init(FAR struct spi_dev_s *spi, /* Allow exclusive access to the privmac struct */ - sem_init(&dev->exclsem, 0, 1); + nxsem_init(&dev->exclsem, 0, 1); dev->radio.bind = mrf24j40_bind; dev->radio.reset = mrf24j40_reset; diff --git a/drivers/wireless/ieee802154/xbee/xbee.c b/drivers/wireless/ieee802154/xbee/xbee.c index 81a9a6f852..97c4ce6b49 100644 --- a/drivers/wireless/ieee802154/xbee/xbee.c +++ b/drivers/wireless/ieee802154/xbee/xbee.c @@ -862,7 +862,7 @@ XBEEHANDLE xbee_init(FAR struct spi_dev_s *spi, /* Allow exclusive access to the struct */ - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); /* Initialize the data indication and notifcation allocation pools */ @@ -1135,7 +1135,7 @@ void xbee_query_firmwareversion(FAR struct xbee_priv_s *priv) struct xbee_respwaiter_s respwaiter; respwaiter.resp_id = XBEE_RESP_AT_FIRMWAREVERSION; - sem_init(&respwaiter.sem, 0, 0); + nxsem_init(&respwaiter.sem, 0, 0); sem_setprotocol(&respwaiter.sem, SEM_PRIO_NONE); xbee_register_respwaiter(priv, &respwaiter); @@ -1162,7 +1162,7 @@ void xbee_query_panid(FAR struct xbee_priv_s *priv) struct xbee_respwaiter_s respwaiter; respwaiter.resp_id = XBEE_RESP_AT_NETWORKID; - sem_init(&respwaiter.sem, 0, 0); + nxsem_init(&respwaiter.sem, 0, 0); sem_setprotocol(&respwaiter.sem, SEM_PRIO_NONE); xbee_register_respwaiter(priv, &respwaiter); @@ -1189,7 +1189,7 @@ void xbee_query_eaddr(FAR struct xbee_priv_s *priv) struct xbee_respwaiter_s respwaiter; respwaiter.resp_id = XBEE_RESP_AT_SERIALHIGH; - sem_init(&respwaiter.sem, 0, 0); + nxsem_init(&respwaiter.sem, 0, 0); sem_setprotocol(&respwaiter.sem, SEM_PRIO_NONE); xbee_register_respwaiter(priv, &respwaiter); @@ -1220,7 +1220,7 @@ void xbee_query_saddr(FAR struct xbee_priv_s *priv) struct xbee_respwaiter_s respwaiter; respwaiter.resp_id = XBEE_RESP_AT_SOURCEADDR; - sem_init(&respwaiter.sem, 0, 0); + nxsem_init(&respwaiter.sem, 0, 0); sem_setprotocol(&respwaiter.sem, SEM_PRIO_NONE); xbee_register_respwaiter(priv, &respwaiter); @@ -1247,7 +1247,7 @@ void xbee_query_chan(FAR struct xbee_priv_s *priv) struct xbee_respwaiter_s respwaiter; respwaiter.resp_id = XBEE_RESP_AT_CHAN; - sem_init(&respwaiter.sem, 0, 0); + nxsem_init(&respwaiter.sem, 0, 0); sem_setprotocol(&respwaiter.sem, SEM_PRIO_NONE); xbee_register_respwaiter(priv, &respwaiter); diff --git a/drivers/wireless/ieee802154/xbee/xbee_dataind.c b/drivers/wireless/ieee802154/xbee/xbee_dataind.c index fe2c155263..f800aefd3d 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_dataind.c +++ b/drivers/wireless/ieee802154/xbee/xbee_dataind.c @@ -115,7 +115,7 @@ void xbee_dataindpool_init(FAR struct xbee_priv_s *priv) remaining--; } - sem_init(&priv->dataind_sem, 0, CONFIG_XBEE_NDATAIND); + nxsem_init(&priv->dataind_sem, 0, CONFIG_XBEE_NDATAIND); } /**************************************************************************** diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index 7e0b30ce14..d0dc387b73 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -1455,7 +1455,7 @@ int xbee_netdev_register(XBEEHANDLE xbee) /* Setup a locking semaphore for exclusive device driver access */ - sem_init(&priv->xd_exclsem, 0, 1); + nxsem_init(&priv->xd_exclsem, 0, 1); DEBUGASSERT(priv->xd_txpoll != NULL); @@ -1472,7 +1472,7 @@ int xbee_netdev_register(XBEEHANDLE xbee) /* Initialize fields related to MAC event handling */ priv->xd_eventpending = false; - sem_init(&priv->xd_eventsem, 0, 0); + nxsem_init(&priv->xd_eventsem, 0, 0); sem_setprotocol(&priv->xd_eventsem, SEM_PRIO_NONE); priv->xd_eventhead = NULL; diff --git a/drivers/wireless/ieee802154/xbee/xbee_notif.c b/drivers/wireless/ieee802154/xbee/xbee_notif.c index a59a1e3a20..2748a23b4d 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_notif.c +++ b/drivers/wireless/ieee802154/xbee/xbee_notif.c @@ -120,7 +120,7 @@ void xbee_notifpool_init(FAR struct xbee_priv_s *priv) remaining--; } - sem_init(&priv->notif_sem, 0, CONFIG_XBEE_NNOTIF); + nxsem_init(&priv->notif_sem, 0, CONFIG_XBEE_NNOTIF); } /**************************************************************************** diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index 463857e2ef..7d54738fb3 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -863,8 +863,8 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, /* Wait for IRQ (TX_DS or MAX_RT) - but don't hang on lost IRQ */ - result = sem_tickwait(&dev->sem_tx, clock_systimer(), - MSEC2TICK(NRF24L01_MAX_TX_IRQ_WAIT)); + result = nxsem_tickwait(&dev->sem_tx, clock_systimer(), + MSEC2TICK(NRF24L01_MAX_TX_IRQ_WAIT)); /* Re-acquire the SPI bus */ @@ -1468,14 +1468,14 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, dev->en_aa = 0; dev->ce_enabled = false; - sem_init(&(dev->devsem), 0, 1); + nxsem_init(&(dev->devsem), 0, 1); dev->nopens = 0; #ifndef CONFIG_DISABLE_POLL dev->pfd = NULL; #endif - sem_init(&dev->sem_tx, 0, 0); + nxsem_init(&dev->sem_tx, 0, 0); sem_setprotocol(&dev->sem_tx, SEM_PRIO_NONE); #ifdef CONFIG_WL_NRF24L01_RXSUPPORT @@ -1490,8 +1490,8 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, dev->nxt_write = 0; dev->fifo_len = 0; - sem_init(&(dev->sem_fifo), 0, 1); - sem_init(&(dev->sem_rx), 0, 0); + nxsem_init(&(dev->sem_fifo), 0, 1); + nxsem_init(&(dev->sem_rx), 0, 0); sem_setprotocol(&dev->sem_rx, SEM_PRIO_NONE); #endif diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index d9c43bd6af..a01ae167b2 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -2797,8 +2797,8 @@ int spirit_netdev_initialize(FAR struct spi_dev_s *spi, DEBUGASSERT(priv->txpoll != NULL && priv->txtimeout != NULL); - sem_init(&priv->rxsem, 0, 1); /* Access to RX packet queue */ - sem_init(&priv->txsem, 0, 1); /* Access to TX packet queue */ + nxsem_init(&priv->rxsem, 0, 1); /* Access to RX packet queue */ + nxsem_init(&priv->txsem, 0, 1); /* Access to TX packet queue */ /* Initialize the IEEE 802.15.4 network device fields */ diff --git a/fs/aio/aio_initialize.c b/fs/aio/aio_initialize.c index 8d30d6f54a..5c3fd00a5f 100644 --- a/fs/aio/aio_initialize.c +++ b/fs/aio/aio_initialize.c @@ -108,8 +108,8 @@ void aio_initialize(void) /* Initialize counting semaphores */ - (void)sem_init(&g_aioc_freesem, 0, CONFIG_FS_NAIOC); - (void)sem_init(&g_aio_exclsem, 0, 1); + (void)nxsem_init(&g_aioc_freesem, 0, CONFIG_FS_NAIOC); + (void)nxsem_init(&g_aio_exclsem, 0, 1); g_aio_holder = INVALID_PROCESS_ID; diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c index 7c0c610332..b9a743ff07 100644 --- a/fs/fat/fs_fat32.c +++ b/fs/fat/fs_fat32.c @@ -1948,8 +1948,8 @@ static int fat_bind(FAR struct inode *blkdriver, FAR const void *data, * have to addref() here (but does have to release in unbind(). */ - fs->fs_blkdriver = blkdriver; /* Save the block driver reference */ - sem_init(&fs->fs_sem, 0, 0); /* Initialize the semaphore that controls access */ + fs->fs_blkdriver = blkdriver; /* Save the block driver reference */ + nxsem_init(&fs->fs_sem, 0, 0); /* Initialize the semaphore that controls access */ /* Then get information about the FAT32 filesystem on the devices managed * by this block driver. diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c index 057544f698..4bb789b49e 100644 --- a/fs/hostfs/hostfs.c +++ b/fs/hostfs/hostfs.c @@ -874,7 +874,7 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data, { /* Initialize the semaphore that controls access */ - sem_init(&g_sem, 0, 0); + nxsem_init(&g_sem, 0, 0); g_seminitialized = TRUE; } else diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c index 92e93a2936..328949b0d1 100644 --- a/fs/inode/fs_files.c +++ b/fs/inode/fs_files.c @@ -151,7 +151,7 @@ void files_initlist(FAR struct filelist *list) /* Initialize the list access mutex */ - (void)sem_init(&list->fl_sem, 0, 1); + (void)nxsem_init(&list->fl_sem, 0, 1); } /**************************************************************************** diff --git a/fs/inode/fs_inode.c b/fs/inode/fs_inode.c index 8bbeb3f4ec..160e2e00e7 100644 --- a/fs/inode/fs_inode.c +++ b/fs/inode/fs_inode.c @@ -98,7 +98,7 @@ void inode_initialize(void) * inode tree). */ - (void)sem_init(&g_inode_sem.sem, 0, 1); + (void)nxsem_init(&g_inode_sem.sem, 0, 1); g_inode_sem.holder = NO_HOLDER; g_inode_sem.count = 0; diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c index 5fe71478f5..a12feb2b34 100644 --- a/fs/mmap/fs_rammap.c +++ b/fs/mmap/fs_rammap.c @@ -84,7 +84,7 @@ void rammap_initialize(void) { if (!g_rammaps.initialized) { - sem_init(&g_rammaps.exclsem, 0, 1); + nxsem_init(&g_rammaps.exclsem, 0, 1); g_rammaps.initialized = true; } } diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c index f042e78137..f7ac4093e8 100644 --- a/fs/nfs/nfs_vfsops.c +++ b/fs/nfs/nfs_vfsops.c @@ -1838,7 +1838,7 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR const void *data, * incrementing the count to one. */ - sem_init(&nmp->nm_sem, 0, 0); /* Initialize the semaphore that controls access */ + nxsem_init(&nmp->nm_sem, 0, 0); /* Initialize the semaphore that controls access */ /* Initialize NFS */ diff --git a/fs/nxffs/nxffs_initialize.c b/fs/nxffs/nxffs_initialize.c index bf511c8186..f2518569fe 100644 --- a/fs/nxffs/nxffs_initialize.c +++ b/fs/nxffs/nxffs_initialize.c @@ -180,8 +180,8 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd) volume->mtd = mtd; volume->cblock = (off_t)-1; - sem_init(&volume->exclsem, 0, 1); - sem_init(&volume->wrsem, 0, 1); + nxsem_init(&volume->exclsem, 0, 1); + nxsem_init(&volume->wrsem, 0, 1); /* Get the volume geometry. (casting to uintptr_t first eliminates * complaints on some architectures where the sizeof long is different diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c index 083f5760d0..439fcc2b0b 100644 --- a/fs/romfs/fs_romfs.c +++ b/fs/romfs/fs_romfs.c @@ -992,7 +992,7 @@ static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, * have to addref() here (but does have to release in ubind(). */ - sem_init(&rm->rm_sem, 0, 0); /* Initialize the semaphore that controls access */ + nxsem_init(&rm->rm_sem, 0, 0); /* Initialize the semaphore that controls access */ rm->rm_blkdriver = blkdriver; /* Save the block driver reference */ /* Get the hardware configuration and setup buffering appropriately */ diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index 4055b66ba7..4bc91daeb0 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -239,7 +239,7 @@ FAR sem_t *sem_open (FAR const char *name, int oflags, ...) /* Initialize the semaphore */ - sem_init(&nsem->ns_sem, 0, value); + nxsem_init(&nsem->ns_sem, 0, value); /* Return a reference to the semaphore */ diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c index db358e4ae6..3516c4b28f 100644 --- a/fs/smartfs/smartfs_smart.c +++ b/fs/smartfs/smartfs_smart.c @@ -1564,7 +1564,7 @@ static int smartfs_bind(FAR struct inode *blkdriver, const void *data, fs->fs_sem = &g_sem; if (!g_seminitialized) { - sem_init(&g_sem, 0, 0); /* Initialize the semaphore that controls access */ + nxsem_init(&g_sem, 0, 0); /* Initialize the semaphore that controls access */ g_seminitialized = TRUE; } else diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c index 4da971f3c0..c27ba9400a 100644 --- a/fs/tmpfs/fs_tmpfs.c +++ b/fs/tmpfs/fs_tmpfs.c @@ -634,7 +634,7 @@ static FAR struct tmpfs_file_s *tmpfs_alloc_file(void) tfo->tfo_exclsem.ts_holder = getpid(); tfo->tfo_exclsem.ts_count = 1; - sem_init(&tfo->tfo_exclsem.ts_sem, 0, 0); + nxsem_init(&tfo->tfo_exclsem.ts_sem, 0, 0); return tfo; } @@ -792,7 +792,7 @@ static FAR struct tmpfs_directory_s *tmpfs_alloc_directory(void) tdo->tdo_exclsem.ts_holder = TMPFS_NO_HOLDER; tdo->tdo_exclsem.ts_count = 0; - sem_init(&tdo->tdo_exclsem.ts_sem, 0, 1); + nxsem_init(&tdo->tdo_exclsem.ts_sem, 0, 1); return tdo; } @@ -2014,7 +2014,7 @@ static int tmpfs_bind(FAR struct inode *blkdriver, FAR const void *data, fs->tfs_exclsem.ts_holder = TMPFS_NO_HOLDER; fs->tfs_exclsem.ts_count = 0; - sem_init(&fs->tfs_exclsem.ts_sem, 0, 1); + nxsem_init(&fs->tfs_exclsem.ts_sem, 0, 1); /* Return the new file system handle */ diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index 41ba128c9b..f5b2a9be96 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -2593,7 +2593,7 @@ int unionfs_mount(FAR const char *fspath1, FAR const char *prefix1, return -ENOMEM; } - sem_init(&ui->ui_exclsem, 0, 1); + nxsem_init(&ui->ui_exclsem, 0, 1); /* Get the inodes associated with fspath1 and fspath2 */ diff --git a/fs/vfs/fs_fdopen.c b/fs/vfs/fs_fdopen.c index ebacc4c5ff..81e535756c 100644 --- a/fs/vfs/fs_fdopen.c +++ b/fs/vfs/fs_fdopen.c @@ -226,7 +226,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb) #ifndef CONFIG_STDIO_DISABLE_BUFFERING /* Initialize the semaphore the manages access to the buffer */ - (void)sem_init(&stream->fs_sem, 0, 1); + (void)nxsem_init(&stream->fs_sem, 0, 1); #if CONFIG_STDIO_BUFFER_SIZE > 0 /* Allocate the IO buffer at the appropriate privilege level for diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index 13b82635bc..1095d875e4 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/vfs/fs_poll.c * - * Copyright (C) 2008-2009, 2012-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -397,7 +397,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout) * priority inheritance enabled. */ - sem_init(&sem, 0, 0); + nxsem_init(&sem, 0, 0); sem_setprotocol(&sem, SEM_PRIO_NONE); ret = poll_setup(fds, nfds, &sem); @@ -434,11 +434,11 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout) * or for the specified timeout to elapse with no event. * * NOTE: If a poll event is pending (i.e., the semaphore has already - * been incremented), sem_tickwait() will not wait, but will return + * been incremented), nxsem_tickwait() will not wait, but will return * immediately. */ - ret = sem_tickwait(&sem, clock_systimer(), ticks); + ret = nxsem_tickwait(&sem, clock_systimer(), ticks); if (ret < 0) { if (ret == -ETIMEDOUT) diff --git a/graphics/nxterm/nxterm_register.c b/graphics/nxterm/nxterm_register.c index a83e84cffc..2dfcfc2f51 100644 --- a/graphics/nxterm/nxterm_register.c +++ b/graphics/nxterm/nxterm_register.c @@ -89,7 +89,7 @@ FAR struct nxterm_state_s * priv->minor = minor; memcpy(&priv->wndo, wndo, sizeof(struct nxterm_window_s)); - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #ifdef CONFIG_DEBUG_FEATURES priv->holder = NO_HOLDER; #endif @@ -99,7 +99,7 @@ FAR struct nxterm_state_s * * priority inheritance enabled. */ - sem_init(&priv->waitsem, 0, 0); + nxsem_init(&priv->waitsem, 0, 0); sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); #endif diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index 5517a30e9f..00b171b70b 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -443,8 +443,8 @@ static int vnc_start_server(int display) ginfo("Starting the VNC server for display %d\n", display); g_fbstartup[display].result = -EBUSY; - sem_reset(&g_fbstartup[display].fbinit, 0); - sem_reset(&g_fbstartup[display].fbconnect, 0); + nxsem_reset(&g_fbstartup[display].fbinit, 0); + nxsem_reset(&g_fbstartup[display].fbconnect, 0); /* Format the kernel thread arguments (ASCII.. yech) */ diff --git a/graphics/vnc/server/vnc_server.c b/graphics/vnc/server/vnc_server.c index 99fb929014..c5e94dcd8b 100644 --- a/graphics/vnc/server/vnc_server.c +++ b/graphics/vnc/server/vnc_server.c @@ -131,8 +131,8 @@ static void vnc_reset_session(FAR struct vnc_session_s *session, /* Set the INITIALIZED state */ - sem_reset(&session->freesem, CONFIG_VNCSERVER_NUPDATES); - sem_reset(&session->queuesem, 0); + nxsem_reset(&session->freesem, CONFIG_VNCSERVER_NUPDATES); + nxsem_reset(&session->queuesem, 0); session->fb = fb; session->display = display; @@ -291,8 +291,8 @@ int vnc_server(int argc, FAR char *argv[]) } g_vnc_sessions[display] = session; - sem_init(&session->freesem, 0, CONFIG_VNCSERVER_NUPDATES); - sem_init(&session->queuesem, 0, 0); + nxsem_init(&session->freesem, 0, CONFIG_VNCSERVER_NUPDATES); + nxsem_init(&session->queuesem, 0, 0); /* Inform any waiter that we have started */ @@ -311,7 +311,7 @@ int vnc_server(int argc, FAR char *argv[]) vnc_reset_session(session, fb, display); g_fbstartup[display].result = -EBUSY; - sem_reset(&g_fbstartup[display].fbconnect, 0); + nxsem_reset(&g_fbstartup[display].fbconnect, 0); /* Establish a connection with the VNC client */ diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index a0c23a0c02..f42d1f93ef 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -585,7 +585,7 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, curr = (FAR struct vnc_fbupdate_s *)session->updqueue.head; sq_init(&session->updqueue); - sem_reset(&session->queuesem, 0); + nxsem_reset(&session->queuesem, 0); for (; curr != NULL; curr = next) { diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h index fce15b1134..0613e01dbf 100644 --- a/include/nuttx/semaphore.h +++ b/include/nuttx/semaphore.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/semaphore.h * - * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -98,7 +98,34 @@ extern "C" ****************************************************************************/ /**************************************************************************** - * Name: sem_tickwait + * Name: nxsem_init + * + * Description: + * This function initializes the UNAMED semaphore sem. Following a + * successful call to nxsem_init(), the semaphore may be used in subsequent + * calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore + * remains usable until it is destroyed. + * + * Only sem itself may be used for performing synchronization. The result + * of referring to copies of sem in calls to sem_wait(), sem_trywait(), + * sem_post(), and sem_destroy() is undefined. + * + * Parameters: + * sem - Semaphore to be initialized + * pshared - Process sharing (not used) + * value - Semaphore initialization value + * + * Return Value: + * This is an internal OS interface and should not be used byapplications. + * It follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. + * + ****************************************************************************/ + +int nxsem_init(FAR sem_t *sem, int pshared, unsigned int value); + +/**************************************************************************** + * Name: nxsem_tickwait * * Description: * This function is a lighter weight version of sem_timedwait(). It is @@ -115,19 +142,49 @@ extern "C" * to sem_trywait(). * * Return Value: - * Zero (OK) is returned on success. A negated errno value is returned on - * failure. -ETIMEDOUT is returned on the timeout condition. + * This is an internal OS interface, not available to applications, and + * hence follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. + * -ETIMEDOUT is returned on the timeout condition. * ****************************************************************************/ -int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay); +int nxsem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay); /**************************************************************************** - * Name: sem_reset + * Name: nxsem_getvalue + * + * Description: + * This function updates the location referenced by 'sval' argument to + * have the value of the semaphore referenced by 'sem' without effecting + * the state of the semaphore. The updated value represents the actual + * semaphore value that occurred at some unspecified time during the call, + * but may not reflect the actual value of the semaphore when it is + * returned to the calling task. + * + * If 'sem' is locked, the value return by nxsem_getvalue() will either be + * zero or a negative number whose absolute value represents the number + * of tasks waiting for the semaphore. + * + * Parameters: + * sem - Semaphore descriptor + * sval - Buffer by which the value is returned + * + * Return Value: + * This is an internal OS interface and should not be used by applications. + * It follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. + * + ****************************************************************************/ + +int nxsem_getvalue(FAR sem_t *sem, FAR int *sval); + +/**************************************************************************** + * Name: nxsem_reset * * Description: * Reset a semaphore count to a specific value. This is similar to part - * of the operation of sem_init(). But sem_reset() may need to wake up + * of the operation of nxsem_init(). But nxsem_reset() may need to wake up * tasks waiting on a count. This kind of operation is sometimes required * within the OS (only) for certain error handling conditions. * @@ -136,11 +193,13 @@ int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay); * count - The requested semaphore count * * Return Value: - * 0 (OK) or a negated errno value if unsuccessful + * This is an internal OS interface, not available to applications, and + * hence follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. * ****************************************************************************/ -int sem_reset(FAR sem_t *sem, int16_t count); +int nxsem_reset(FAR sem_t *sem, int16_t count); /**************************************************************************** * Name: sem_getprotocol @@ -155,8 +214,9 @@ int sem_reset(FAR sem_t *sem, int16_t count); * value. * * Return Value: - * 0 if successful. Otherwise, -1 is returned and the errno value is set - * appropriately. + * This function is exposed as a non-standard application interface. It + * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and + * the errno value is set appropriately. * ****************************************************************************/ @@ -193,8 +253,9 @@ int sem_getprotocol(FAR sem_t *sem, FAR int *protocol); * protocol - The new protocol to use * * Return Value: - * 0 if successful. Otherwise, -1 is returned and the errno value is set - * appropriately. + * This function is exposed as a non-standard application interface. It + * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and + * the errno value is set appropriately. * ****************************************************************************/ diff --git a/libc/audio/lib_buffer.c b/libc/audio/lib_buffer.c index 6ad506aa6e..35e92eead4 100644 --- a/libc/audio/lib_buffer.c +++ b/libc/audio/lib_buffer.c @@ -148,7 +148,7 @@ int apb_alloc(FAR struct audio_buf_desc_s *bufdesc) apb->session = bufdesc->session; #endif - sem_init(&apb->sem, 0, 1); + nxsem_init(&apb->sem, 0, 1); ret = sizeof(struct audio_buf_desc_s); } diff --git a/libc/misc/lib_filesem.c b/libc/misc/lib_filesem.c index 1ea8717146..88b0df355b 100644 --- a/libc/misc/lib_filesem.c +++ b/libc/misc/lib_filesem.c @@ -65,7 +65,7 @@ void lib_sem_initialize(FAR struct file_struct *stream) * to private data sets. */ - (void)sem_init(&stream->fs_sem, 0, 1); + (void)nxsem_init(&stream->fs_sem, 0, 1); stream->fs_holder = -1; stream->fs_counts = 0; diff --git a/libc/misc/lib_stream.c b/libc/misc/lib_stream.c index 4ed0343345..04149e5809 100644 --- a/libc/misc/lib_stream.c +++ b/libc/misc/lib_stream.c @@ -83,7 +83,7 @@ void lib_stream_initialize(FAR struct task_group_s *group) /* Initialize the list access mutex */ - (void)sem_init(&list->sl_sem, 0, 1); + (void)nxsem_init(&list->sl_sem, 0, 1); /* Initialize each FILE structure */ diff --git a/libc/netdb/lib_dnsinit.c b/libc/netdb/lib_dnsinit.c index b6e0f8d0e0..3b58826133 100644 --- a/libc/netdb/lib_dnsinit.c +++ b/libc/netdb/lib_dnsinit.c @@ -94,7 +94,7 @@ bool dns_initialize(void) if (!g_dns_initialized) { - sem_init(&g_dns_sem, 0, 1); + nxsem_init(&g_dns_sem, 0, 1); g_dns_initialized = true; } diff --git a/libc/pthread/pthread_barrierinit.c b/libc/pthread/pthread_barrierinit.c index 6f8d427dfe..63f548cec6 100644 --- a/libc/pthread/pthread_barrierinit.c +++ b/libc/pthread/pthread_barrierinit.c @@ -95,7 +95,7 @@ int pthread_barrier_init(FAR pthread_barrier_t *barrier, } else { - sem_init(&barrier->sem, 0, 0); + nxsem_init(&barrier->sem, 0, 0); barrier->count = count; } diff --git a/libc/pthread/pthread_barrierwait.c b/libc/pthread/pthread_barrierwait.c index 8ba29d1d94..dccd83c148 100644 --- a/libc/pthread/pthread_barrierwait.c +++ b/libc/pthread/pthread_barrierwait.c @@ -109,7 +109,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier) /* Find out how many threads are already waiting at the barrier */ - ret = sem_getvalue(&barrier->sem, &semcount); + ret = nxsem_getvalue(&barrier->sem, &semcount); if (ret != OK) { sched_unlock(); @@ -125,7 +125,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier) while (semcount < 0) { (void)sem_post(&barrier->sem); - (void)sem_getvalue(&barrier->sem, &semcount); + (void)nxsem_getvalue(&barrier->sem, &semcount); } /* Then return PTHREAD_BARRIER_SERIAL_THREAD to the final thread */ diff --git a/libc/pthread/pthread_condinit.c b/libc/pthread/pthread_condinit.c index 81a31ea57f..e757817f14 100644 --- a/libc/pthread/pthread_condinit.c +++ b/libc/pthread/pthread_condinit.c @@ -81,7 +81,7 @@ int pthread_cond_init(FAR pthread_cond_t *cond, FAR const pthread_condattr_t *at * initial count = 0 */ - else if (sem_init((FAR sem_t *)&cond->sem, 0, 0) != OK) + else if (nxsem_init((FAR sem_t *)&cond->sem, 0, 0) != OK) { ret = EINVAL; } diff --git a/libc/semaphore/sem_getprotocol.c b/libc/semaphore/sem_getprotocol.c index a9e8a837e1..308f1ea520 100644 --- a/libc/semaphore/sem_getprotocol.c +++ b/libc/semaphore/sem_getprotocol.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/semaphore/sem_getprotocol.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -60,8 +60,9 @@ * value. * * Return Value: - * 0 if successful. Otherwise, -1 is returned and the errno value is set - * appropriately. + * This function is exposed as a non-standard application interface. It + * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and + * the errno value is set appropriately. * ****************************************************************************/ diff --git a/libc/semaphore/sem_getvalue.c b/libc/semaphore/sem_getvalue.c index f1c77aa6f0..120dae1372 100644 --- a/libc/semaphore/sem_getvalue.c +++ b/libc/semaphore/sem_getvalue.c @@ -43,30 +43,49 @@ #include #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Type Declarations - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ +#include /**************************************************************************** * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: nxsem_getvalue + * + * Description: + * This function updates the location referenced by 'sval' argument to + * have the value of the semaphore referenced by 'sem' without effecting + * the state of the semaphore. The updated value represents the actual + * semaphore value that occurred at some unspecified time during the call, + * but may not reflect the actual value of the semaphore when it is + * returned to the calling task. + * + * If 'sem' is locked, the value return by nxsem_getvalue() will either be + * zero or a negative number whose absolute value represents the number + * of tasks waiting for the semaphore. + * + * Parameters: + * sem - Semaphore descriptor + * sval - Buffer by which the value is returned + * + * Return Value: + * This is an internal OS interface and should not be used by applications. + * It follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. + * + ****************************************************************************/ + +int nxsem_getvalue(FAR sem_t *sem, FAR int *sval) +{ + if (sem && sval) + { + *sval = sem->semcount; + return OK; + } + + return -EINVAL; +} + /**************************************************************************** * Name: sem_getvalue * @@ -86,23 +105,21 @@ * sem - Semaphore descriptor * sval - Buffer by which the value is returned * - * Return Value: - * 0 (OK), or -1 (ERROR) if unsuccessful - * - * Assumptions: + * This returns zero (OK) if successful. Otherwise, -1 (ERROR) is + * returned and the errno value is set appropriately. * ****************************************************************************/ int sem_getvalue(FAR sem_t *sem, FAR int *sval) { - if (sem && sval) + int ret; + + ret = nxsem_getvalue(sem, sval); + if (ret < 0) { - *sval = sem->semcount; - return OK; - } - else - { - set_errno(EINVAL); - return ERROR; + set_errno(-ret); + ret = ERROR; } + + return ret; } diff --git a/libc/semaphore/sem_init.c b/libc/semaphore/sem_init.c index e10e83f1fa..4f9812157b 100644 --- a/libc/semaphore/sem_init.c +++ b/libc/semaphore/sem_init.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/sem/sem_init.c * - * Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,16 +44,18 @@ #include #include +#include + /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: sem_init + * Name: nxsem_init * * Description: * This function initializes the UNAMED semaphore sem. Following a - * successful call to sem_init(), the semaophore may be used in subsequent + * successful call to nxsem_init(), the semaphore may be used in subsequent * calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore * remains usable until it is destroyed. * @@ -67,19 +69,19 @@ * value - Semaphore initialization value * * Return Value: - * 0 (OK), or -1 (ERROR) if unsuccessful. - * - * Assumptions: + * This is an internal OS interface and should not be used by applications. + * It follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. * ****************************************************************************/ -int sem_init(FAR sem_t *sem, int pshared, unsigned int value) +int nxsem_init(FAR sem_t *sem, int pshared, unsigned int value) { /* Verify that a semaphore was provided and the count is within the valid * range. */ - if (sem && value <= SEM_VALUE_MAX) + if (sem != NULL && value <= SEM_VALUE_MAX) { /* Initialize the seamphore count */ @@ -100,9 +102,44 @@ int sem_init(FAR sem_t *sem, int pshared, unsigned int value) #endif return OK; } - else - { - set_errno(EINVAL); - return ERROR; - } + + return -EINVAL; +} + +/**************************************************************************** + * Name: sem_init + * + * Description: + * This function initializes the UNAMED semaphore sem. Following a + * successful call to sem_init(), the semaphore may be used in subsequent + * calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore + * remains usable until it is destroyed. + * + * Only sem itself may be used for performing synchronization. The result + * of referring to copies of sem in calls to sem_wait(), sem_trywait(), + * sem_post(), and sem_destroy() is undefined. + * + * Parameters: + * sem - Semaphore to be initialized + * pshared - Process sharing (not used) + * value - Semaphore initialization value + * + * Return Value: + * This returns zero (OK) if successful. Otherwise, -1 (ERROR) is + * returned and the errno value is set appropriately. + * + ****************************************************************************/ + +int sem_init(FAR sem_t *sem, int pshared, unsigned int value) +{ + int ret; + + ret = nxsem_init(sem, pshared, value); + if (ret < 0) + { + set_errno(-ret); + ret = ERROR; + } + + return ret; } diff --git a/libc/semaphore/sem_setprotocol.c b/libc/semaphore/sem_setprotocol.c index b687d72280..ede41272d7 100644 --- a/libc/semaphore/sem_setprotocol.c +++ b/libc/semaphore/sem_setprotocol.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/semaphore/sem_setprotocol.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -81,8 +81,9 @@ * protocol - The new protocol to use * * Return Value: - * 0 if successful. Otherwise, -1 is returned and the errno value is set - * appropriately. + * This function is exposed as a non-standard application interface. It + * returns zero (OK) if successful. Otherwise, -1 (ERROR) is returned and + * the errno value is set appropriately. * ****************************************************************************/ diff --git a/libc/wqueue/work_usrthread.c b/libc/wqueue/work_usrthread.c index 0f489a7258..833aaf91e5 100644 --- a/libc/wqueue/work_usrthread.c +++ b/libc/wqueue/work_usrthread.c @@ -350,7 +350,7 @@ int work_usrstart(void) { /* Set up the work queue lock */ - (void)sem_init(&g_usrsem, 0, 1); + (void)nxsem_init(&g_usrsem, 0, 1); /* Start a user-mode worker thread for use by applications. */ diff --git a/libnx/nxfonts/nxfonts_cache.c b/libnx/nxfonts/nxfonts_cache.c index b2cdf74da0..0a274ab04a 100644 --- a/libnx/nxfonts/nxfonts_cache.c +++ b/libnx/nxfonts/nxfonts_cache.c @@ -748,7 +748,7 @@ FCACHE nxf_cache_connect(enum nx_fontid_e fontid, /* Initialize the mutual exclusion semaphore */ - sem_init(&priv->fsem, 0, 1); + nxsem_init(&priv->fsem, 0, 1); /* Add the new font cache to the list of font caches */ diff --git a/libnx/nxmu/nx_bitmap.c b/libnx/nxmu/nx_bitmap.c index 9c69291572..f8a0464fa9 100644 --- a/libnx/nxmu/nx_bitmap.c +++ b/libnx/nxmu/nx_bitmap.c @@ -115,7 +115,7 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest, if (ret != OK) { - gerr("ERROR: sem_init failed: %d\n", errno); + gerr("ERROR: nxsem_init failed: %d\n", errno); return ret; } diff --git a/libnx/nxmu/nx_getrectangle.c b/libnx/nxmu/nx_getrectangle.c index 9420d02df5..f84f262943 100644 --- a/libnx/nxmu/nx_getrectangle.c +++ b/libnx/nxmu/nx_getrectangle.c @@ -105,11 +105,11 @@ int nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, /* Create a semaphore for tracking command completion */ outmsg.sem_done = &sem_done; - ret = sem_init(&sem_done, 0, 0); - if (ret != OK) + ret = sem_init(&sem_done, 0, 0); + if (ret < 0) { - gerr("ERROR: sem_init failed: %d\n", errno); + gerr("ERROR: nxsem_init failed: %d\n", errno); return ret; } diff --git a/mm/iob/iob_initialize.c b/mm/iob/iob_initialize.c index b11d2f005c..d9ef23154c 100644 --- a/mm/iob/iob_initialize.c +++ b/mm/iob/iob_initialize.c @@ -132,9 +132,9 @@ void iob_initialize(void) g_iob_committed = NULL; - sem_init(&g_iob_sem, 0, CONFIG_IOB_NBUFFERS); + nxsem_init(&g_iob_sem, 0, CONFIG_IOB_NBUFFERS); #if CONFIG_IOB_THROTTLE > 0 - sem_init(&g_throttle_sem, 0, CONFIG_IOB_NBUFFERS - CONFIG_IOB_THROTTLE); + nxsem_init(&g_throttle_sem, 0, CONFIG_IOB_NBUFFERS - CONFIG_IOB_THROTTLE); #endif #if CONFIG_IOB_NCHAINS > 0 @@ -152,7 +152,7 @@ void iob_initialize(void) g_iob_qcommitted = NULL; - sem_init(&g_qentry_sem, 0, CONFIG_IOB_NCHAINS); + nxsem_init(&g_qentry_sem, 0, CONFIG_IOB_NCHAINS); #endif initialized = true; } diff --git a/mm/mm_gran/mm_graninit.c b/mm/mm_gran/mm_graninit.c index 03cde59b11..87a7992dd7 100644 --- a/mm/mm_gran/mm_graninit.c +++ b/mm/mm_gran/mm_graninit.c @@ -135,7 +135,7 @@ gran_common_initialize(FAR void *heapstart, size_t heapsize, uint8_t log2gran, /* Initialize mutual exclusion support */ #ifndef CONFIG_GRAN_INTR - sem_init(&priv->exclsem, 0, 1); + nxsem_init(&priv->exclsem, 0, 1); #endif } diff --git a/mm/mm_heap/mm_sem.c b/mm/mm_heap/mm_sem.c index 49083da213..65bd6e54e7 100644 --- a/mm/mm_heap/mm_sem.c +++ b/mm/mm_heap/mm_sem.c @@ -43,6 +43,7 @@ #include #include +#include #include /**************************************************************************** @@ -87,7 +88,7 @@ void mm_seminitialize(FAR struct mm_heap_s *heap) * private data sets). */ - (void)sem_init(&heap->mm_semaphore, 0, 1); + (void)nxsem_init(&heap->mm_semaphore, 0, 1); heap->mm_holder = -1; heap->mm_counts_held = 0; diff --git a/mm/shm/shm_initialize.c b/mm/shm/shm_initialize.c index f20e7b0873..633ad556c8 100644 --- a/mm/shm/shm_initialize.c +++ b/mm/shm/shm_initialize.c @@ -87,7 +87,7 @@ void shm_initialize(void) /* Initialize the shared memory region list */ - sem_init(&g_shminfo.si_sem, 0, 1); + nxsem_init(&g_shminfo.si_sem, 0, 1); #if 0 /* Initialize each shared memory region */ diff --git a/mm/shm/shmget.c b/mm/shm/shmget.c index 460850605a..4a961b241b 100644 --- a/mm/shm/shmget.c +++ b/mm/shm/shmget.c @@ -122,7 +122,7 @@ static int shm_reserve(key_t key, int shmflg) region->sr_key = key; region->sr_flags = SRFLAG_INUSE; - sem_init(®ion->sr_sem, 0, 1); + nxsem_init(®ion->sr_sem, 0, 1); /* Set the low-order nine bits of shm_perm.mode to the low-order * nine bits of shmflg. diff --git a/net/arp/arp_notify.c b/net/arp/arp_notify.c index e59bca3a55..5ebc809667 100644 --- a/net/arp/arp_notify.c +++ b/net/arp/arp_notify.c @@ -94,7 +94,7 @@ void arp_wait_setup(in_addr_t ipaddr, FAR struct arp_notify_s *notify) * priority inheritance enabled. */ - (void)sem_init(¬ify->nt_sem, 0, 0); + (void)nxsem_init(¬ify->nt_sem, 0, 0); sem_setprotocol(¬ify->nt_sem, SEM_PRIO_NONE); /* Add the wait structure to the list with interrupts disabled */ diff --git a/net/arp/arp_send.c b/net/arp/arp_send.c index 9f3416cca3..134a5d720e 100644 --- a/net/arp/arp_send.c +++ b/net/arp/arp_send.c @@ -290,7 +290,7 @@ int arp_send(in_addr_t ipaddr) * priority inheritance enabled. */ - (void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE); state.snd_retries = 0; /* No retries yet */ diff --git a/net/icmp/icmp_ping.c b/net/icmp/icmp_ping.c index fbf781a211..c977d5f65d 100644 --- a/net/icmp/icmp_ping.c +++ b/net/icmp/icmp_ping.c @@ -365,7 +365,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen, * priority inheritance enabled. */ - sem_init(&state.png_sem, 0, 0); + nxsem_init(&state.png_sem, 0, 0); sem_setprotocol(&state.png_sem, SEM_PRIO_NONE); state.png_ticks = DSEC2TICK(dsecs); /* System ticks to wait */ diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index a295d58163..ea9e590d49 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -212,7 +212,7 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise) * priority inheritance enabled. */ - (void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE); /* Remember the routing device name */ diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c index 64d8ac70bf..6c5e6e1839 100644 --- a/net/icmpv6/icmpv6_neighbor.c +++ b/net/icmpv6/icmpv6_neighbor.c @@ -300,7 +300,7 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr) * priority inheritance enabled. */ - (void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE); state.snd_retries = 0; /* No retries yet */ diff --git a/net/icmpv6/icmpv6_notify.c b/net/icmpv6/icmpv6_notify.c index 2a0ce43690..5a192b2adc 100644 --- a/net/icmpv6/icmpv6_notify.c +++ b/net/icmpv6/icmpv6_notify.c @@ -107,7 +107,7 @@ void icmpv6_wait_setup(const net_ipv6addr_t ipaddr, * priority inheritance enabled. */ - (void)sem_init(¬ify->nt_sem, 0, 0); + (void)nxsem_init(¬ify->nt_sem, 0, 0); sem_setprotocol(¬ify->nt_sem, SEM_PRIO_NONE); /* Add the wait structure to the list with interrupts disabled */ diff --git a/net/icmpv6/icmpv6_ping.c b/net/icmpv6/icmpv6_ping.c index 43427f3cc6..79d718a328 100644 --- a/net/icmpv6/icmpv6_ping.c +++ b/net/icmpv6/icmpv6_ping.c @@ -439,7 +439,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno, * priority inheritance enabled. */ - sem_init(&state.png_sem, 0, 0); + nxsem_init(&state.png_sem, 0, 0); sem_setprotocol(&state.png_sem, SEM_PRIO_NONE); state.png_ticks = DSEC2TICK(dsecs); /* System ticks to wait */ diff --git a/net/icmpv6/icmpv6_rnotify.c b/net/icmpv6/icmpv6_rnotify.c index 74409ccd3c..b2e0df5ae1 100644 --- a/net/icmpv6/icmpv6_rnotify.c +++ b/net/icmpv6/icmpv6_rnotify.c @@ -171,7 +171,7 @@ void icmpv6_rwait_setup(FAR struct net_driver_s *dev, * priority inheritance enabled. */ - (void)sem_init(¬ify->rn_sem, 0, 0); + (void)nxsem_init(¬ify->rn_sem, 0, 0); sem_setprotocol(¬ify->rn_sem, SEM_PRIO_NONE); /* Add the wait structure to the list with interrupts disabled */ diff --git a/net/ieee802154/ieee802154_recvfrom.c b/net/ieee802154/ieee802154_recvfrom.c index 3f13ab98f6..b1ee51500b 100644 --- a/net/ieee802154/ieee802154_recvfrom.c +++ b/net/ieee802154/ieee802154_recvfrom.c @@ -380,7 +380,7 @@ ssize_t ieee802154_recvfrom(FAR struct socket *psock, FAR void *buf, * hence, should not have priority inheritance enabled. */ - (void)sem_init(&state.ir_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.ir_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&state.ir_sem, SEM_PRIO_NONE); /* Set the socket state to receiving */ diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index cd00576b86..b251213b9e 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -487,7 +487,7 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf, * priority inheritance enabled. */ - (void)sem_init(&state.is_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.is_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&state.is_sem, SEM_PRIO_NONE); state.is_sock = psock; /* Socket descriptor to use */ diff --git a/net/igmp/igmp_group.c b/net/igmp/igmp_group.c index 74039fb578..c61e83f6ec 100644 --- a/net/igmp/igmp_group.c +++ b/net/igmp/igmp_group.c @@ -135,7 +135,7 @@ FAR struct igmp_group_s *igmp_grpalloc(FAR struct net_driver_s *dev, * priority inheritance enabled. */ - sem_init(&group->sem, 0, 0); + nxsem_init(&group->sem, 0, 0); sem_setprotocol(&group->sem, SEM_PRIO_NONE); /* Initialize the group timer (but don't start it yet) */ diff --git a/net/inet/inet_close.c b/net/inet/inet_close.c index 12f6b44896..f69db30d2e 100644 --- a/net/inet/inet_close.c +++ b/net/inet/inet_close.c @@ -388,7 +388,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock) * priority inheritance enabled. */ - sem_init(&state.cl_sem, 0, 0); + nxsem_init(&state.cl_sem, 0, 0); sem_setprotocol(&state.cl_sem, SEM_PRIO_NONE); /* Record the time that we started the wait (in ticks) */ diff --git a/net/inet/inet_recvfrom.c b/net/inet/inet_recvfrom.c index 7035d71a5f..bcba9124d3 100644 --- a/net/inet/inet_recvfrom.c +++ b/net/inet/inet_recvfrom.c @@ -1087,7 +1087,7 @@ static void inet_recvfrom_initialize(FAR struct socket *psock, FAR void *buf, * priority inheritance enabled. */ - (void)sem_init(&pstate->ir_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&pstate->ir_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&pstate->ir_sem, SEM_PRIO_NONE); pstate->ir_buflen = len; diff --git a/net/local/local_conn.c b/net/local/local_conn.c index e70f8df7ab..e1e7ba0af7 100644 --- a/net/local/local_conn.c +++ b/net/local/local_conn.c @@ -99,7 +99,7 @@ FAR struct local_conn_s *local_alloc(void) * priority inheritance enabled. */ - sem_init(&conn->lc_waitsem, 0, 0); + nxsem_init(&conn->lc_waitsem, 0, 0); sem_setprotocol(&conn->lc_waitsem, SEM_PRIO_NONE); #ifdef HAVE_LOCAL_POLL diff --git a/net/local/local_connect.c b/net/local/local_connect.c index 99e28ff8dc..3044551707 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -184,7 +184,7 @@ static int inline local_stream_connect(FAR struct local_conn_s *client, client->lc_state = LOCAL_STATE_ACCEPT; local_accept_pollnotify(server, POLLIN); - if (sem_getvalue(&server->lc_waitsem, &sval) >= 0 && sval < 1) + if (nxsem_getvalue(&server->lc_waitsem, &sval) >= 0 && sval < 1) { _local_semgive(&server->lc_waitsem); } diff --git a/net/pkt/pkt_conn.c b/net/pkt/pkt_conn.c index cc4954a1ec..55e6ffa9c7 100644 --- a/net/pkt/pkt_conn.c +++ b/net/pkt/pkt_conn.c @@ -128,7 +128,7 @@ void pkt_initialize(void) dq_init(&g_free_pkt_connections); dq_init(&g_active_pkt_connections); - sem_init(&g_free_sem, 0, 1); + nxsem_init(&g_free_sem, 0, 1); for (i = 0; i < CONFIG_NET_PKT_CONNS; i++) { diff --git a/net/pkt/pkt_recvfrom.c b/net/pkt/pkt_recvfrom.c index bb5523c349..8f612a0368 100644 --- a/net/pkt/pkt_recvfrom.c +++ b/net/pkt/pkt_recvfrom.c @@ -264,7 +264,7 @@ static void pkt_recvfrom_initialize(FAR struct socket *psock, FAR void *buf, * priority inheritance enabled. */ - (void)sem_init(&pstate->pr_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&pstate->pr_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&pstate->pr_sem, SEM_PRIO_NONE); pstate->pr_buflen = len; diff --git a/net/pkt/pkt_send.c b/net/pkt/pkt_send.c index f2197ac340..e979296fb7 100644 --- a/net/pkt/pkt_send.c +++ b/net/pkt/pkt_send.c @@ -209,7 +209,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf, * priority inheritance enabled. */ - (void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE); state.snd_sock = psock; /* Socket descriptor to use */ diff --git a/net/route/net_cacheroute.c b/net/route/net_cacheroute.c index 6dcd17bdbe..4c62435148 100644 --- a/net/route/net_cacheroute.c +++ b/net/route/net_cacheroute.c @@ -517,12 +517,12 @@ void net_init_cacheroute(void) /* Initialize the routing table cash and the free list */ #ifdef CONFIG_ROUTE_IPv4_CACHEROUTE - sem_init(&g_ipv4_cachelock, 0, 1); + nxsem_init(&g_ipv4_cachelock, 0, 1); net_reset_ipv4_cache(); #endif #ifdef CONFIG_ROUTE_IPv6_CACHEROUTE - sem_init(&g_ipv6_cachelock, 0, 1); + nxsem_init(&g_ipv6_cachelock, 0, 1); net_reset_ipv6_cache(); #endif } diff --git a/net/route/net_fileroute.c b/net/route/net_fileroute.c index 3865916749..bc3b7ab2cd 100644 --- a/net/route/net_fileroute.c +++ b/net/route/net_fileroute.c @@ -233,11 +233,11 @@ void net_init_fileroute(void) /* Initialize semaphores */ #ifdef CONFIG_ROUTE_IPv4_FILEROUTE - sem_init(&g_ipv4_exclsem, 0, 1); + nxsem_init(&g_ipv4_exclsem, 0, 1); #endif #ifdef CONFIG_ROUTE_IPv6_FILEROUTE - sem_init(&g_ipv6_exclsem, 0, 1); + nxsem_init(&g_ipv6_exclsem, 0, 1); #endif } diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index 3fe52d0743..01dbc02c30 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -281,7 +281,7 @@ int sixlowpan_send(FAR struct net_driver_s *dev, /* Initialize the send state structure */ - sem_init(&sinfo.s_waitsem, 0, 0); + nxsem_init(&sinfo.s_waitsem, 0, 0); (void)sem_setprotocol(&sinfo.s_waitsem, SEM_PRIO_NONE); sinfo.s_result = -EBUSY; diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index 612031a81d..115e60f262 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -662,7 +662,7 @@ static int sixlowpan_send_packet(FAR struct socket *psock, /* Initialize the send state structure */ - sem_init(&sinfo.s_waitsem, 0, 0); + nxsem_init(&sinfo.s_waitsem, 0, 0); (void)sem_setprotocol(&sinfo.s_waitsem, SEM_PRIO_NONE); sinfo.s_sock = psock; diff --git a/net/socket/net_sockets.c b/net/socket/net_sockets.c index a614af3bdc..2403b7d09a 100644 --- a/net/socket/net_sockets.c +++ b/net/socket/net_sockets.c @@ -99,7 +99,7 @@ void net_initlist(FAR struct socketlist *list) { /* Initialize the list access mutex */ - (void)sem_init(&list->sl_sem, 0, 1); + (void)nxsem_init(&list->sl_sem, 0, 1); } /**************************************************************************** diff --git a/net/tcp/tcp_accept.c b/net/tcp/tcp_accept.c index 45fd7c1309..8c3572fb3c 100644 --- a/net/tcp/tcp_accept.c +++ b/net/tcp/tcp_accept.c @@ -285,7 +285,7 @@ int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr, * priority inheritance enabled. */ - sem_init(&state.acpt_sem, 0, 0); + nxsem_init(&state.acpt_sem, 0, 0); sem_setprotocol(&state.acpt_sem, SEM_PRIO_NONE); /* Set up the callback in the connection */ diff --git a/net/tcp/tcp_connect.c b/net/tcp/tcp_connect.c index 80317d4427..2eeaf7cb4c 100644 --- a/net/tcp/tcp_connect.c +++ b/net/tcp/tcp_connect.c @@ -106,7 +106,7 @@ static inline int psock_setup_callbacks(FAR struct socket *psock, * priority inheritance enabled. */ - (void)sem_init(&pstate->tc_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&pstate->tc_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&pstate->tc_sem, SEM_PRIO_NONE); pstate->tc_conn = conn; diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index e9d687c75a..faa713f2e1 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -792,7 +792,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, * priority inheritance enabled. */ - (void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ + (void)nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ (void)sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE); state.snd_sock = psock; /* Socket descriptor to use */ diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c index ae48e2284a..fa00769b4c 100644 --- a/net/tcp/tcp_sendfile.c +++ b/net/tcp/tcp_sendfile.c @@ -619,7 +619,7 @@ ssize_t tcp_sendfile(FAR struct socket *psock, FAR struct file *infile, * priority inheritance enabled. */ - sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ + nxsem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */ sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE); state.snd_sock = psock; /* Socket descriptor to use */ diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c index 29fba3ddce..a8da18091e 100644 --- a/net/tcp/tcp_wrbuffer.c +++ b/net/tcp/tcp_wrbuffer.c @@ -114,7 +114,7 @@ void tcp_wrbuffer_initialize(void) sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers); } - sem_init(&g_wrbuffer.sem, 0, CONFIG_NET_TCP_NWRBCHAINS); + nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_TCP_NWRBCHAINS); } /**************************************************************************** @@ -211,7 +211,7 @@ void tcp_wrbuffer_release(FAR struct tcp_wrbuffer_s *wrb) int tcp_wrbuffer_test(void) { int val = 0; - sem_getvalue(&g_wrbuffer.sem, &val); + nxsem_getvalue(&g_wrbuffer.sem, &val); return val > 0 ? OK : ERROR; } diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index 210ce351e0..c6a85dfa96 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -445,7 +445,7 @@ void udp_initialize(void) dq_init(&g_free_udp_connections); dq_init(&g_active_udp_connections); - sem_init(&g_free_sem, 0, 1); + nxsem_init(&g_free_sem, 0, 1); for (i = 0; i < CONFIG_NET_UDP_CONNS; i++) { diff --git a/net/udp/udp_psock_sendto.c b/net/udp/udp_psock_sendto.c index 4a8eb83b2a..6ba4055975 100644 --- a/net/udp/udp_psock_sendto.c +++ b/net/udp/udp_psock_sendto.c @@ -397,7 +397,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf, * priority inheritance enabled. */ - sem_init(&state.st_sem, 0, 0); + nxsem_init(&state.st_sem, 0, 0); sem_setprotocol(&state.st_sem, SEM_PRIO_NONE); state.st_buflen = len; diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c index b22762b3d5..5ea9db9c36 100644 --- a/net/usrsock/usrsock_conn.c +++ b/net/usrsock/usrsock_conn.c @@ -256,7 +256,7 @@ int usrsock_setup_request_callback(FAR struct usrsock_conn_s *conn, { int ret = -EBUSY; - (void)sem_init(&pstate->recvsem, 0, 0); + (void)nxsem_init(&pstate->recvsem, 0, 0); pstate->conn = conn; pstate->result = -EAGAIN; pstate->completed = false; @@ -324,7 +324,7 @@ void usrsock_initialize(void) dq_init(&g_free_usrsock_connections); dq_init(&g_active_usrsock_connections); - sem_init(&g_free_sem, 0, 1); + nxsem_init(&g_free_sem, 0, 1); for (i = 0; i < CONFIG_NET_USRSOCK_CONNS; i++) { diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c index 0bf4a949d4..ca6b5f2160 100644 --- a/net/usrsock/usrsock_dev.c +++ b/net/usrsock/usrsock_dev.c @@ -1260,9 +1260,9 @@ void usrsockdev_register(void) g_usrsockdev.ocount = 0; g_usrsockdev.req.nbusy = 0; - sem_init(&g_usrsockdev.devsem, 0, 1); - sem_init(&g_usrsockdev.req.sem, 0, 1); - sem_init(&g_usrsockdev.req.acksem, 0, 0); + nxsem_init(&g_usrsockdev.devsem, 0, 1); + nxsem_init(&g_usrsockdev.req.sem, 0, 1); + nxsem_init(&g_usrsockdev.req.acksem, 0, 0); (void)register_driver("/dev/usrsock", &g_usrsockdevops, 0666, &g_usrsockdev); } diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c index 482933238e..47701a3ec7 100644 --- a/net/utils/net_lock.c +++ b/net/utils/net_lock.c @@ -104,7 +104,7 @@ static void _net_takesem(void) void net_lockinitialize(void) { - sem_init(&g_netlock, 0, 1); + nxsem_init(&g_netlock, 0, 1); } /**************************************************************************** diff --git a/sched/group/group_create.c b/sched/group/group_create.c index b3c36a1a02..d35b4a55d4 100644 --- a/sched/group/group_create.c +++ b/sched/group/group_create.c @@ -245,7 +245,7 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype) #ifndef CONFIG_DISABLE_PTHREAD /* Initialize the pthread join semaphore */ - (void)sem_init(&group->tg_joinsem, 0, 1); + (void)nxsem_init(&group->tg_joinsem, 0, 1); #endif #if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) @@ -255,7 +255,7 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype) * priority inheritance enabled. */ - (void)sem_init(&group->tg_exitsem, 0, 0); + (void)nxsem_init(&group->tg_exitsem, 0, 0); (void)sem_setprotocol(&group->tg_exitsem, SEM_PRIO_NONE); #endif diff --git a/sched/init/os_start.c b/sched/init/os_start.c index ab129440e4..5f64f4d937 100644 --- a/sched/init/os_start.c +++ b/sched/init/os_start.c @@ -543,7 +543,7 @@ void os_start(void) * because many subsystems depend upon fully functional semaphores. */ - sem_initialize(); + nxsem_initialize(); #if defined(MM_KERNEL_USRHEAP_INIT) || defined(CONFIG_MM_KERNEL_HEAP) || \ defined(CONFIG_MM_PGALLOC) diff --git a/sched/pthread/pthread_completejoin.c b/sched/pthread/pthread_completejoin.c index c8ef85c5d4..d355719d36 100644 --- a/sched/pthread/pthread_completejoin.c +++ b/sched/pthread/pthread_completejoin.c @@ -72,14 +72,14 @@ static bool pthread_notifywaiters(FAR struct join_s *pjoin) /* Are any tasks waiting for our exit value? */ - status = sem_getvalue(&pjoin->exit_sem, &ntasks_waiting); + status = nxsem_getvalue(&pjoin->exit_sem, &ntasks_waiting); if (status == OK && ntasks_waiting < 0) { /* Set the data semaphore so that this thread will be * awakened when all waiting tasks receive the data */ - (void)sem_init(&pjoin->data_sem, 0, (ntasks_waiting + 1)); + (void)nxsem_init(&pjoin->data_sem, 0, (ntasks_waiting + 1)); /* Post the semaphore to restart each thread that is waiting * on the semaphore @@ -90,7 +90,7 @@ static bool pthread_notifywaiters(FAR struct join_s *pjoin) status = pthread_sem_give(&pjoin->exit_sem); if (status == OK) { - status = sem_getvalue(&pjoin->exit_sem, &ntasks_waiting); + status = nxsem_getvalue(&pjoin->exit_sem, &ntasks_waiting); } } while (ntasks_waiting < 0 && status == OK); diff --git a/sched/pthread/pthread_condbroadcast.c b/sched/pthread/pthread_condbroadcast.c index de637c9e1e..0fddd76927 100644 --- a/sched/pthread/pthread_condbroadcast.c +++ b/sched/pthread/pthread_condbroadcast.c @@ -88,7 +88,7 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond) /* Get the current value of the semaphore */ - if (sem_getvalue((FAR sem_t *)&cond->sem, &sval) != OK) + if (nxsem_getvalue((FAR sem_t *)&cond->sem, &sval) != OK) { ret = EINVAL; } diff --git a/sched/pthread/pthread_condsignal.c b/sched/pthread/pthread_condsignal.c index e5f9af31af..5826a425de 100644 --- a/sched/pthread/pthread_condsignal.c +++ b/sched/pthread/pthread_condsignal.c @@ -80,7 +80,7 @@ int pthread_cond_signal(FAR pthread_cond_t *cond) { /* Get the current value of the semaphore */ - if (sem_getvalue((FAR sem_t *)&cond->sem, &sval) != OK) + if (nxsem_getvalue((FAR sem_t *)&cond->sem, &sval) != OK) { ret = EINVAL; } diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 4cde28f789..9d2fcf5080 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -501,10 +501,15 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, /* Initialize the semaphores in the join structure to zero. */ - ret = sem_init(&pjoin->data_sem, 0, 0); + ret = nxsem_init(&pjoin->data_sem, 0, 0); if (ret == OK) { - ret = sem_init(&pjoin->exit_sem, 0, 0); + ret = nxsem_init(&pjoin->exit_sem, 0, 0); + } + + if (ret < 0) + { + ret = -ret; } /* Thse semaphores are used for signaling and, hence, should not have @@ -514,11 +519,16 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, if (ret == OK) { ret = sem_setprotocol(&pjoin->data_sem, SEM_PRIO_NONE); - } - if (ret == OK) - { - ret = sem_setprotocol(&pjoin->exit_sem, SEM_PRIO_NONE); + if (ret == OK) + { + ret = sem_setprotocol(&pjoin->exit_sem, SEM_PRIO_NONE); + } + + if (ret < 0) + { + ret = get_errno(); + } } /* If the priority of the new pthread is lower than the priority of the @@ -538,6 +548,10 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, if (ptcb->cmn.sched_priority < parent->sched_priority) { ret = sched_setpriority(&ptcb->cmn, parent->sched_priority); + if (ret < 0) + { + ret = get_errno(); + } } } @@ -547,6 +561,10 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, if (ret == OK) { ret = task_activate((FAR struct tcb_s *)ptcb); + if (ret < 0) + { + ret = get_errno(); + } } if (ret == OK) diff --git a/sched/pthread/pthread_mutexconsistent.c b/sched/pthread/pthread_mutexconsistent.c index dac4fcf043..c00331d1f9 100644 --- a/sched/pthread/pthread_mutexconsistent.c +++ b/sched/pthread/pthread_mutexconsistent.c @@ -128,7 +128,7 @@ int pthread_mutex_consistent(FAR pthread_mutex_t *mutex) * dead task had called pthread_mutex_unlock(). */ - status = sem_reset((FAR sem_t *)&mutex->sem, 1); + status = nxsem_reset((FAR sem_t *)&mutex->sem, 1); ret = (status != OK) ? get_errno() : OK; } diff --git a/sched/pthread/pthread_mutexdestroy.c b/sched/pthread/pthread_mutexdestroy.c index 23905fd407..f1a91853b7 100644 --- a/sched/pthread/pthread_mutexdestroy.c +++ b/sched/pthread/pthread_mutexdestroy.c @@ -112,7 +112,7 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex) * destruction of the semaphore impossible here. */ - status = sem_reset((FAR sem_t *)&mutex->sem, 1); + status = nxsem_reset((FAR sem_t *)&mutex->sem, 1); if (status < 0) { ret = -status; @@ -147,7 +147,7 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex) /* Destroy the semaphore * * REVISIT: What if there are threads waiting on the semaphore? - * Perhaps this logic should all sem_reset() first? + * Perhaps this logic should all nxsem_reset() first? */ status = sem_destroy((FAR sem_t *)&mutex->sem); diff --git a/sched/pthread/pthread_mutexinit.c b/sched/pthread/pthread_mutexinit.c index ec84fef609..69fa05eb47 100644 --- a/sched/pthread/pthread_mutexinit.c +++ b/sched/pthread/pthread_mutexinit.c @@ -118,7 +118,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex, /* Initialize the mutex like a semaphore with initial count = 1 */ - status = sem_init((FAR sem_t *)&mutex->sem, pshared, 1); + status = nxsem_init((FAR sem_t *)&mutex->sem, pshared, 1); if (status != OK) { ret = get_errno(); diff --git a/sched/semaphore/sem_destroy.c b/sched/semaphore/sem_destroy.c index 7518382bb9..706112e782 100644 --- a/sched/semaphore/sem_destroy.c +++ b/sched/semaphore/sem_destroy.c @@ -53,11 +53,11 @@ * * Description: * This function is used to destroy the un-named semaphore indicated by - * 'sem'. Only a semaphore that was created using sem_init() may be + * 'sem'. Only a semaphore that was created using nxsem_init() may be * destroyed using sem_destroy(); the effect of calling sem_destroy() with * a named semaphore is undefined. The effect of subsequent use of the * semaphore sem is undefined until sem is re-initialized by another call - * to sem_init(). + * to nxsem_init(). * * The effect of destroying a semaphore upon which other processes are * currently blocked is undefined. @@ -95,7 +95,7 @@ int sem_destroy (FAR sem_t *sem) /* Release holders of the semaphore */ - sem_destroyholder(sem); + nxsem_destroyholder(sem); return OK; } else diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index 7046ab756a..dca9e98b78 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/semaphore/sem_holder.c * - * Copyright (C) 2009-2011, 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011, 2013, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -79,10 +79,10 @@ static FAR struct semholder_s *g_freeholders; #endif /**************************************************************************** - * Name: sem_allocholder + * Name: nxsem_allocholder ****************************************************************************/ -static inline FAR struct semholder_s *sem_allocholder(sem_t *sem) +static inline FAR struct semholder_s *nxsem_allocholder(sem_t *sem) { FAR struct semholder_s *pholder; @@ -130,11 +130,11 @@ static inline FAR struct semholder_s *sem_allocholder(sem_t *sem) } /**************************************************************************** - * Name: sem_findholder + * Name: nxsem_findholder ****************************************************************************/ -static FAR struct semholder_s *sem_findholder(sem_t *sem, - FAR struct tcb_s *htcb) +static FAR struct semholder_s *nxsem_findholder(sem_t *sem, + FAR struct tcb_s *htcb) { FAR struct semholder_s *pholder; @@ -176,26 +176,27 @@ static FAR struct semholder_s *sem_findholder(sem_t *sem, } /**************************************************************************** - * Name: sem_findorallocateholder + * Name: nxsem_findorallocateholder ****************************************************************************/ static inline FAR struct semholder_s * -sem_findorallocateholder(sem_t *sem, FAR struct tcb_s *htcb) +nxsem_findorallocateholder(sem_t *sem, FAR struct tcb_s *htcb) { - FAR struct semholder_s *pholder = sem_findholder(sem, htcb); + FAR struct semholder_s *pholder = nxsem_findholder(sem, htcb); if (!pholder) { - pholder = sem_allocholder(sem); + pholder = nxsem_allocholder(sem); } return pholder; } /**************************************************************************** - * Name: sem_freeholder + * Name: nxsem_freeholder ****************************************************************************/ -static inline void sem_freeholder(sem_t *sem, FAR struct semholder_s *pholder) +static inline void nxsem_freeholder(sem_t *sem, + FAR struct semholder_s *pholder) { #if CONFIG_SEM_PREALLOCHOLDERS > 0 FAR struct semholder_s *curr; @@ -236,29 +237,29 @@ static inline void sem_freeholder(sem_t *sem, FAR struct semholder_s *pholder) } /**************************************************************************** - * Name: sem_findandfreeholder + * Name: nxsem_findandfreeholder ****************************************************************************/ -static inline void sem_findandfreeholder(sem_t *sem, FAR struct tcb_s *htcb) +static inline void nxsem_findandfreeholder(sem_t *sem, FAR struct tcb_s *htcb) { - FAR struct semholder_s *pholder = sem_findholder(sem, htcb); + FAR struct semholder_s *pholder = nxsem_findholder(sem, htcb); /* When no more counts are held, remove the holder from the list. The - * count was decremented in sem_releaseholder. + * count was decremented in nxsem_releaseholder. */ if (pholder != NULL && pholder->counts <= 0) { - sem_freeholder(sem, pholder); + nxsem_freeholder(sem, pholder); } } /**************************************************************************** - * Name: sem_foreachholder + * Name: nxsem_foreachholder ****************************************************************************/ -static int sem_foreachholder(FAR sem_t *sem, holderhandler_t handler, - FAR void *arg) +static int nxsem_foreachholder(FAR sem_t *sem, holderhandler_t handler, + FAR void *arg) { FAR struct semholder_s *pholder; int ret = 0; @@ -307,24 +308,24 @@ static int sem_foreachholder(FAR sem_t *sem, holderhandler_t handler, } /**************************************************************************** - * Name: sem_recoverholders + * Name: nxsem_recoverholders ****************************************************************************/ #if CONFIG_SEM_PREALLOCHOLDERS > 0 -static int sem_recoverholders(FAR struct semholder_s *pholder, - FAR sem_t *sem, FAR void *arg) +static int nxsem_recoverholders(FAR struct semholder_s *pholder, + FAR sem_t *sem, FAR void *arg) { - sem_freeholder(sem, pholder); + nxsem_freeholder(sem, pholder); return 0; } #endif /**************************************************************************** - * Name: sem_boostholderprio + * Name: nxsem_boostholderprio ****************************************************************************/ -static int sem_boostholderprio(FAR struct semholder_s *pholder, - FAR sem_t *sem, FAR void *arg) +static int nxsem_boostholderprio(FAR struct semholder_s *pholder, + FAR sem_t *sem, FAR void *arg) { FAR struct tcb_s *htcb = (FAR struct tcb_s *)pholder->htcb; FAR struct tcb_s *rtcb = (FAR struct tcb_s *)arg; @@ -339,7 +340,7 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder, { serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb); DEBUGPANIC(); - sem_freeholder(sem, pholder); + nxsem_freeholder(sem, pholder); } #if CONFIG_SEM_NNESTPRIO > 0 @@ -432,12 +433,12 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder, } /**************************************************************************** - * Name: sem_verifyholder + * Name: nxsem_verifyholder ****************************************************************************/ #ifdef CONFIG_DEBUG_ASSERTIONS -static int sem_verifyholder(FAR struct semholder_s *pholder, FAR sem_t *sem, - FAR void *arg) +static int nxsem_verifyholder(FAR struct semholder_s *pholder, + FAR sem_t *sem, FAR void *arg) { #if 0 /* Need to revisit this, but these assumptions seem to be untrue -- \ * OR there is a bug??? */ @@ -458,12 +459,12 @@ static int sem_verifyholder(FAR struct semholder_s *pholder, FAR sem_t *sem, #endif /**************************************************************************** - * Name: sem_dumpholder + * Name: nxsem_dumpholder ****************************************************************************/ #if defined(CONFIG_DEBUG_INFO) && defined(CONFIG_SEM_PHDEBUG) -static int sem_dumpholder(FAR struct semholder_s *pholder, FAR sem_t *sem, - FAR void *arg) +static int nxsem_dumpholder(FAR struct semholder_s *pholder, FAR sem_t *sem, + FAR void *arg) { #if CONFIG_SEM_PREALLOCHOLDERS > 0 _info(" %08x: %08x %08x %04x\n", @@ -476,11 +477,11 @@ static int sem_dumpholder(FAR struct semholder_s *pholder, FAR sem_t *sem, #endif /**************************************************************************** - * Name: sem_restoreholderprio + * Name: nxsem_restoreholderprio ****************************************************************************/ -static int sem_restoreholderprio(FAR struct tcb_s *htcb, - FAR sem_t *sem, FAR void *arg) +static int nxsem_restoreholderprio(FAR struct tcb_s *htcb, + FAR sem_t *sem, FAR void *arg) { FAR struct semholder_s *pholder = 0; #if CONFIG_SEM_NNESTPRIO > 0 @@ -500,10 +501,10 @@ static int sem_restoreholderprio(FAR struct tcb_s *htcb, { serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb); DEBUGPANIC(); - pholder = sem_findholder(sem, htcb); + pholder = nxsem_findholder(sem, htcb); if (pholder != NULL) { - sem_freeholder(sem, pholder); + nxsem_freeholder(sem, pholder); } } @@ -624,49 +625,49 @@ static int sem_restoreholderprio(FAR struct tcb_s *htcb, } /**************************************************************************** - * Name: sem_restoreholderprioall + * Name: nxsem_restoreholderprioall * * Description: * Reprioritize all holders * ****************************************************************************/ -static int sem_restoreholderprioall(FAR struct semholder_s *pholder, - FAR sem_t *sem, FAR void *arg) +static int nxsem_restoreholderprioall(FAR struct semholder_s *pholder, + FAR sem_t *sem, FAR void *arg) { - return sem_restoreholderprio(pholder->htcb, sem, arg); + return nxsem_restoreholderprio(pholder->htcb, sem, arg); } /**************************************************************************** - * Name: sem_restoreholderprioA + * Name: nxsem_restoreholderprioA * * Description: * Reprioritize all holders except the currently executing task * ****************************************************************************/ -static int sem_restoreholderprioA(FAR struct semholder_s *pholder, - FAR sem_t *sem, FAR void *arg) +static int nxsem_restoreholderprioA(FAR struct semholder_s *pholder, + FAR sem_t *sem, FAR void *arg) { FAR struct tcb_s *rtcb = this_task(); if (pholder->htcb != rtcb) { - return sem_restoreholderprio(pholder->htcb, sem, arg); + return nxsem_restoreholderprio(pholder->htcb, sem, arg); } return 0; } /**************************************************************************** - * Name: sem_restoreholderprioB + * Name: nxsem_restoreholderprioB * * Description: * Reprioritize only the currently executing task * ****************************************************************************/ -static int sem_restoreholderprioB(FAR struct semholder_s *pholder, - FAR sem_t *sem, FAR void *arg) +static int nxsem_restoreholderprioB(FAR struct semholder_s *pholder, + FAR sem_t *sem, FAR void *arg) { FAR struct tcb_s *rtcb = this_task(); @@ -682,9 +683,9 @@ static int sem_restoreholderprioB(FAR struct semholder_s *pholder, * causes a context switch. */ - sem_findandfreeholder(sem, rtcb); + nxsem_findandfreeholder(sem, rtcb); #endif - (void)sem_restoreholderprio(rtcb, sem, arg); + (void)nxsem_restoreholderprio(rtcb, sem, arg); return 1; } @@ -692,7 +693,7 @@ static int sem_restoreholderprioB(FAR struct semholder_s *pholder, } /**************************************************************************** - * Name: sem_restorebaseprio_irq + * Name: nxsem_restorebaseprio_irq * * Description: * This function is called after the an interrupt handler posts a count on @@ -723,8 +724,8 @@ static int sem_restoreholderprioB(FAR struct semholder_s *pholder, * ****************************************************************************/ -static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb, - FAR sem_t *sem) +static inline void nxsem_restorebaseprio_irq(FAR struct tcb_s *stcb, + FAR sem_t *sem) { /* Perform the following actions only if a new thread was given a count. * The thread that received the count should be the highest priority @@ -737,7 +738,7 @@ static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb, { /* Drop the priority of all holder threads */ - (void)sem_foreachholder(sem, sem_restoreholderprioall, stcb); + (void)nxsem_foreachholder(sem, nxsem_restoreholderprioall, stcb); } /* If there are no tasks waiting for available counts, then all holders @@ -747,13 +748,13 @@ static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb, #ifdef CONFIG_DEBUG_ASSERTIONS else { - (void)sem_foreachholder(sem, sem_verifyholder, NULL); + (void)nxsem_foreachholder(sem, nxsem_verifyholder, NULL); } #endif } /**************************************************************************** - * Name: sem_restorebaseprio_task + * Name: nxsem_restorebaseprio_task * * Description: * This function is called after the current running task releases a @@ -784,8 +785,8 @@ static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb, * ****************************************************************************/ -static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb, - FAR sem_t *sem) +static inline void nxsem_restorebaseprio_task(FAR struct tcb_s *stcb, + FAR sem_t *sem) { FAR struct tcb_s *rtcb = this_task(); @@ -807,11 +808,11 @@ static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb, * except for the running thread. */ - (void)sem_foreachholder(sem, sem_restoreholderprioA, stcb); + (void)nxsem_foreachholder(sem, nxsem_restoreholderprioA, stcb); /* Now, find an reprioritize only the ready to run task */ - (void)sem_foreachholder(sem, sem_restoreholderprioB, stcb); + (void)nxsem_foreachholder(sem, nxsem_restoreholderprioB, stcb); } /* If there are no tasks waiting for available counts, then all holders @@ -821,7 +822,7 @@ static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb, #ifdef CONFIG_DEBUG_ASSERTIONS else { - (void)sem_foreachholder(sem, sem_verifyholder, NULL); + (void)nxsem_foreachholder(sem, nxsem_verifyholder, NULL); } #endif @@ -830,7 +831,7 @@ static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb, * counts, then we need to remove it from the list of holders. */ - sem_findandfreeholder(sem, rtcb); + nxsem_findandfreeholder(sem, rtcb); } /**************************************************************************** @@ -838,10 +839,10 @@ static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb, ****************************************************************************/ /**************************************************************************** - * Name: sem_initholders + * Name: nxsem_initholders * * Description: - * Called from sem_initialize() to set up semaphore holder information. + * Called from nxsem_initialize() to set up semaphore holder information. * * Parameters: * None @@ -853,7 +854,7 @@ static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb, * ****************************************************************************/ -void sem_initholders(void) +void nxsem_initholders(void) { #if CONFIG_SEM_PREALLOCHOLDERS > 0 int i; @@ -871,11 +872,11 @@ void sem_initholders(void) } /**************************************************************************** - * Name: sem_destroyholder + * Name: nxsem_destroyholder * * Description: - * Called from sem_destroyholder() to handle any holders of a semaphore when - * it is destroyed. + * Called from nxsem_destroyholder() to handle any holders of a semaphore + * when it is destroyed. * * Parameters: * sem - A reference to the semaphore being destroyed @@ -887,7 +888,7 @@ void sem_initholders(void) * ****************************************************************************/ -void sem_destroyholder(FAR sem_t *sem) +void nxsem_destroyholder(FAR sem_t *sem) { /* It is an error if a semaphore is destroyed while there are any holders * (except perhaps the thread release the semaphore itself). Hmmm.. but @@ -905,7 +906,7 @@ void sem_destroyholder(FAR sem_t *sem) { serr("ERROR: Semaphore destroyed with holders\n"); DEBUGPANIC(); - (void)sem_foreachholder(sem, sem_recoverholders, NULL); + (void)nxsem_foreachholder(sem, nxsem_recoverholders, NULL); } #else @@ -921,7 +922,7 @@ void sem_destroyholder(FAR sem_t *sem) } /**************************************************************************** - * Name: sem_addholder_tcb + * Name: nxsem_addholder_tcb * * Description: * Called from sem_wait() when the calling thread obtains the semaphore; @@ -939,7 +940,7 @@ void sem_destroyholder(FAR sem_t *sem) * ****************************************************************************/ -void sem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem) +void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem) { FAR struct semholder_s *pholder; @@ -952,7 +953,7 @@ void sem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem) { /* Find or allocate a container for this new holder */ - pholder = sem_findorallocateholder(sem, htcb); + pholder = nxsem_findorallocateholder(sem, htcb); if (pholder != NULL) { /* Then set the holder and increment the number of counts held by this @@ -966,7 +967,7 @@ void sem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem) } /**************************************************************************** - * Name: sem_addholder + * Name: nxsem_addholder * * Description: * Called from sem_wait() when the calling thread obtains the semaphore @@ -982,13 +983,13 @@ void sem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem) * ****************************************************************************/ -void sem_addholder(FAR sem_t *sem) +void nxsem_addholder(FAR sem_t *sem) { - sem_addholder_tcb(this_task(), sem); + nxsem_addholder_tcb(this_task(), sem); } /**************************************************************************** - * Name: void sem_boostpriority(sem_t *sem) + * Name: void nxsem_boostpriority(sem_t *sem) * * Description: * @@ -1003,7 +1004,7 @@ void sem_addholder(FAR sem_t *sem) * ****************************************************************************/ -void sem_boostpriority(FAR sem_t *sem) +void nxsem_boostpriority(FAR sem_t *sem) { FAR struct tcb_s *rtcb = this_task(); @@ -1012,11 +1013,11 @@ void sem_boostpriority(FAR sem_t *sem) * count. */ - (void)sem_foreachholder(sem, sem_boostholderprio, rtcb); + (void)nxsem_foreachholder(sem, nxsem_boostholderprio, rtcb); } /**************************************************************************** - * Name: sem_releaseholder + * Name: nxsem_releaseholder * * Description: * Called from sem_post() after a thread releases one count on the @@ -1032,18 +1033,18 @@ void sem_boostpriority(FAR sem_t *sem) * ****************************************************************************/ -void sem_releaseholder(FAR sem_t *sem) +void nxsem_releaseholder(FAR sem_t *sem) { FAR struct tcb_s *rtcb = this_task(); FAR struct semholder_s *pholder; /* Find the container for this holder */ - pholder = sem_findholder(sem, rtcb); + pholder = nxsem_findholder(sem, rtcb); if (pholder != NULL && pholder->counts > 0) { /* Decrement the counts on this holder -- the holder will be freed - * later in sem_restorebaseprio. + * later in nxsem_restorebaseprio. */ pholder->counts--; @@ -1051,7 +1052,7 @@ void sem_releaseholder(FAR sem_t *sem) } /**************************************************************************** - * Name: sem_restorebaseprio + * Name: nxsem_restorebaseprio * * Description: * This function is called after the current running task releases a @@ -1083,7 +1084,7 @@ void sem_releaseholder(FAR sem_t *sem) * ****************************************************************************/ -void sem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem) +void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem) { /* Check our assumptions */ @@ -1100,19 +1101,19 @@ void sem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem) if (up_interrupt_context()) { - sem_restorebaseprio_irq(stcb, sem); + nxsem_restorebaseprio_irq(stcb, sem); } else { - sem_restorebaseprio_task(stcb, sem); + nxsem_restorebaseprio_task(stcb, sem); } } /**************************************************************************** - * Name: sem_canceled + * Name: nxsem_canceled * * Description: - * Called from sem_waitirq() after a thread that was waiting for a semaphore + * Called from nxsem_waitirq() after a thread that was waiting for a semaphore * count was awakened because of a signal and the semaphore wait has been * cancelled. This function restores the correct thread priority of each * holder of the semaphore. @@ -1128,7 +1129,7 @@ void sem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem) ****************************************************************************/ #ifndef CONFIG_DISABLE_SIGNALS -void sem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem) +void nxsem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem) { /* Check our assumptions */ @@ -1136,7 +1137,7 @@ void sem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem) /* Adjust the priority of every holder as necessary */ - (void)sem_foreachholder(sem, sem_restoreholderprioall, stcb); + (void)nxsem_foreachholder(sem, nxsem_restoreholderprioall, stcb); } #endif @@ -1160,13 +1161,13 @@ void sem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem) void sem_enumholders(FAR sem_t *sem) { #ifdef CONFIG_DEBUG_INFO - (void)sem_foreachholder(sem, sem_dumpholder, NULL); + (void)nxsem_foreachholder(sem, nxsem_dumpholder, NULL); #endif } #endif /**************************************************************************** - * Name: sem_nfreeholders + * Name: nxsem_nfreeholders * * Description: * Return the number of available holder containers. This is a good way @@ -1183,7 +1184,7 @@ void sem_enumholders(FAR sem_t *sem) ****************************************************************************/ #if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_SEM_PHDEBUG) -int sem_nfreeholders(void) +int nxsem_nfreeholders(void) { #if CONFIG_SEM_PREALLOCHOLDERS > 0 FAR struct semholder_s *pholder; diff --git a/sched/semaphore/sem_initialize.c b/sched/semaphore/sem_initialize.c index d91a8602fe..672ed86350 100644 --- a/sched/semaphore/sem_initialize.c +++ b/sched/semaphore/sem_initialize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * sched/semaphore/sem_initialize.c + * sched/semaphore/nxsem_initialize.c * * Copyright (C) 2007, 2009, 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -50,11 +50,11 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_initialize + * Name: nxsem_initialize * * Description: * The control structures for all semaphores may be initialized by calling - * sem_initialize(). This should be done once at power-on. + * nxsem_initialize(). This should be done once at power-on. * * Parameters: * None @@ -67,11 +67,11 @@ * ****************************************************************************/ -void sem_initialize(void) +void nxsem_initialize(void) { /* Initialize holder structures needed to support priority inheritance */ - sem_initholders(); + nxsem_initholders(); } #endif /* CONFIG_PRIORITY_INHERITANCE */ diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index 47487db42a..4309e482f3 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -103,7 +103,7 @@ int sem_post(FAR sem_t *sem) * * NOTE: When semaphores are used for signaling purposes, the holder * of the semaphore may not be this thread! In this case, - * sem_releaseholder() will do nothing. + * nxsem_releaseholder() will do nothing. * * In the case of a mutex this could be simply resolved since there is * only one holder but for the case of counting semaphores, there may @@ -116,7 +116,7 @@ int sem_post(FAR sem_t *sem) */ ASSERT(sem->semcount < SEM_VALUE_MAX); - sem_releaseholder(sem); + nxsem_releaseholder(sem); sem->semcount++; #ifdef CONFIG_PRIORITY_INHERITANCE @@ -152,7 +152,7 @@ int sem_post(FAR sem_t *sem) * it is awakened. */ - sem_addholder_tcb(stcb, sem); + nxsem_addholder_tcb(stcb, sem); /* It is, let the task take the semaphore */ @@ -170,7 +170,7 @@ int sem_post(FAR sem_t *sem) */ #ifdef CONFIG_PRIORITY_INHERITANCE - sem_restorebaseprio(stcb, sem); + nxsem_restorebaseprio(stcb, sem); sched_unlock(); #endif ret = OK; diff --git a/sched/semaphore/sem_recover.c b/sched/semaphore/sem_recover.c index 8b2d105b39..edeb30e037 100644 --- a/sched/semaphore/sem_recover.c +++ b/sched/semaphore/sem_recover.c @@ -50,7 +50,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_recover + * Name: nxsem_recover * * Description: * This function is called from task_recover() when a task is deleted via @@ -75,13 +75,13 @@ * ****************************************************************************/ -void sem_recover(FAR struct tcb_s *tcb) +void nxsem_recover(FAR struct tcb_s *tcb) { irqstate_t flags; /* The task is being deleted. If it is waiting for a semphore, then * increment the count on the semaphores. This logic is almost identical - * to what you see in sem_waitirq() except that no attempt is made to + * to what you see in nxsem_waitirq() except that no attempt is made to * restart the exiting task. * * NOTE: In the case that the task is waiting we can assume: (1) That the @@ -102,7 +102,7 @@ void sem_recover(FAR struct tcb_s *tcb) * to this semaphore. */ - sem_canceled(tcb, sem); + nxsem_canceled(tcb, sem); /* And increment the count on the semaphore. This releases the count * that was taken by sem_post(). This count decremented the semaphore diff --git a/sched/semaphore/sem_reset.c b/sched/semaphore/sem_reset.c index 4f98d4e8e3..7682671c2e 100644 --- a/sched/semaphore/sem_reset.c +++ b/sched/semaphore/sem_reset.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/semaphore/sem_reset.c * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -52,11 +52,11 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_reset + * Name: nxsem_reset * * Description: * Reset a semaphore count to a specific value. This is similar to part - * of the operation of sem_init(). But sem_reset() may need to wake up + * of the operation of nxsem_init(). But nxsem_reset() may need to wake up * tasks waiting on a count. This kind of operation is sometimes required * within the OS (only) for certain error handling conditions. * @@ -65,11 +65,13 @@ * count - The requested semaphore count * * Return Value: - * 0 (OK) or a negated errno value if unsuccessful + * This is an internal OS interface, not available to applications, and + * hence follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. * ****************************************************************************/ -int sem_reset(FAR sem_t *sem, int16_t count) +int nxsem_reset(FAR sem_t *sem, int16_t count) { irqstate_t flags; diff --git a/sched/semaphore/sem_setprotocol.c b/sched/semaphore/sem_setprotocol.c index 6f015bea4c..a991f70f0c 100644 --- a/sched/semaphore/sem_setprotocol.c +++ b/sched/semaphore/sem_setprotocol.c @@ -103,7 +103,7 @@ int sem_setprotocol(FAR sem_t *sem, int protocol) /* Remove any current holders */ - sem_destroyholder(sem); + nxsem_destroyholder(sem); return OK; case SEM_PRIO_INHERIT: diff --git a/sched/semaphore/sem_tickwait.c b/sched/semaphore/sem_tickwait.c index a76308154a..8904ad92ce 100644 --- a/sched/semaphore/sem_tickwait.c +++ b/sched/semaphore/sem_tickwait.c @@ -1,7 +1,7 @@ /**************************************************************************** - * sched/semaphore/sem_tickdwait.c + * sched/semaphore/sem_tickwait.c * - * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -59,7 +59,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_tickwait + * Name: nxsem_tickwait * * Description: * This function is a lighter weight version of sem_timedwait(). It is @@ -76,12 +76,14 @@ * to sem_trywait(). * * Return Value: - * Zero (OK) is returned on success. A negated errno value is returned on - * failure. -ETIMEDOUT is returned on the timeout condition. + * This is an internal OS interface, not available to applications, and + * hence follows the NuttX internal error return policy: Zero (OK) is + * returned on success. A negated errno value is returned on failure. + * -ETIMEDOUT is returned on the timeout condition. * ****************************************************************************/ -int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay) +int nxsem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay) { FAR struct tcb_s *rtcb = this_task(); irqstate_t flags; @@ -147,7 +149,8 @@ int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay) /* Start the watchdog with interrupts still disabled */ - (void)wd_start(rtcb->waitdog, delay, (wdentry_t)sem_timeout, 1, getpid()); + (void)wd_start(rtcb->waitdog, delay, (wdentry_t)nxsem_timeout, + 1, getpid()); /* Now perform the blocking wait */ diff --git a/sched/semaphore/sem_timedwait.c b/sched/semaphore/sem_timedwait.c index 2ab32f6b86..f3348b5929 100644 --- a/sched/semaphore/sem_timedwait.c +++ b/sched/semaphore/sem_timedwait.c @@ -185,7 +185,8 @@ int sem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime) /* Start the watchdog */ - (void)wd_start(rtcb->waitdog, ticks, (wdentry_t)sem_timeout, 1, getpid()); + (void)wd_start(rtcb->waitdog, ticks, (wdentry_t)nxsem_timeout, + 1, getpid()); /* Now perform the blocking wait */ diff --git a/sched/semaphore/sem_timeout.c b/sched/semaphore/sem_timeout.c index 542724a94c..1d9c86d4f1 100644 --- a/sched/semaphore/sem_timeout.c +++ b/sched/semaphore/sem_timeout.c @@ -53,7 +53,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_timeout + * Name: nxsem_timeout * * Description: * This function is called if the timeout elapses before before a @@ -71,7 +71,7 @@ * ****************************************************************************/ -void sem_timeout(int argc, wdparm_t pid) +void nxsem_timeout(int argc, wdparm_t pid) { FAR struct tcb_s *wtcb; irqstate_t flags; @@ -94,7 +94,7 @@ void sem_timeout(int argc, wdparm_t pid) { /* Cancel the semaphore wait */ - sem_waitirq(wtcb, ETIMEDOUT); + nxsem_waitirq(wtcb, ETIMEDOUT); } /* Interrupts may now be enabled. */ diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c index c51cdcb1f0..2efd2719e7 100644 --- a/sched/semaphore/sem_wait.c +++ b/sched/semaphore/sem_wait.c @@ -121,7 +121,7 @@ int sem_wait(FAR sem_t *sem) /* It is, let the task take the semaphore. */ sem->semcount--; - sem_addholder(sem); + nxsem_addholder(sem); rtcb->waitsem = NULL; ret = OK; } @@ -161,7 +161,7 @@ int sem_wait(FAR sem_t *sem) * semaphore. */ - sem_boostpriority(sem); + nxsem_boostpriority(sem); #endif /* Add the TCB to the prioritized semaphore wait queue */ @@ -177,7 +177,7 @@ int sem_wait(FAR sem_t *sem) * a timeout, certain semaphore clean-up operations have already been * performed (see sem_waitirq.c). Specifically: * - * - sem_canceled() was called to restore the priority of all threads + * - nxsem_canceled() was called to restore the priority of all threads * that hold a reference to the semaphore, * - The semaphore count was decremented, and * - tcb->waitsem was nullifed. @@ -192,7 +192,7 @@ int sem_wait(FAR sem_t *sem) { /* Not awakened by a signal or a timeout... * - * NOTE that in this case sem_addholder() was called by logic + * NOTE that in this case nxsem_addholder() was called by logic * in sem_wait() fore this thread was restarted. */ diff --git a/sched/semaphore/sem_waitirq.c b/sched/semaphore/sem_waitirq.c index 5ddafa62e0..ec74860c48 100644 --- a/sched/semaphore/sem_waitirq.c +++ b/sched/semaphore/sem_waitirq.c @@ -52,7 +52,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_waitirq + * Name: nxsem_waitirq * * Description: * This function is called when either: @@ -77,7 +77,7 @@ * ****************************************************************************/ -void sem_waitirq(FAR struct tcb_s *wtcb, int errcode) +void nxsem_waitirq(FAR struct tcb_s *wtcb, int errcode) { irqstate_t flags; @@ -101,7 +101,7 @@ void sem_waitirq(FAR struct tcb_s *wtcb, int errcode) * to this semaphore. */ - sem_canceled(wtcb, sem); + nxsem_canceled(wtcb, sem); /* And increment the count on the semaphore. This releases the count * that was taken by sem_post(). This count decremented the semaphore diff --git a/sched/semaphore/semaphore.h b/sched/semaphore/semaphore.h index cc7a929816..f59345c9ce 100644 --- a/sched/semaphore/semaphore.h +++ b/sched/semaphore/semaphore.h @@ -64,49 +64,49 @@ extern "C" /* Common semaphore logic */ #ifdef CONFIG_PRIORITY_INHERITANCE -void sem_initialize(void); +void nxsem_initialize(void); #else -# define sem_initialize() +# define nxsem_initialize() #endif /* Wake up a thread that is waiting on semaphore */ -void sem_waitirq(FAR struct tcb_s *wtcb, int errcode); +void nxsem_waitirq(FAR struct tcb_s *wtcb, int errcode); /* Handle semaphore timer expiration */ -void sem_timeout(int argc, wdparm_t pid); +void nxsem_timeout(int argc, wdparm_t pid); /* Recover semaphore resources with a task or thread is destroyed */ -void sem_recover(FAR struct tcb_s *tcb); +void nxsem_recover(FAR struct tcb_s *tcb); /* Special logic needed only by priority inheritance to manage collections of * holders of semaphores. */ #ifdef CONFIG_PRIORITY_INHERITANCE -void sem_initholders(void); -void sem_destroyholder(FAR sem_t *sem); -void sem_addholder(FAR sem_t *sem); -void sem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem); -void sem_boostpriority(FAR sem_t *sem); -void sem_releaseholder(FAR sem_t *sem); -void sem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem); +void nxsem_initholders(void); +void nxsem_destroyholder(FAR sem_t *sem); +void nxsem_addholder(FAR sem_t *sem); +void nxsem_addholder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem); +void nxsem_boostpriority(FAR sem_t *sem); +void nxsem_releaseholder(FAR sem_t *sem); +void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem); # ifndef CONFIG_DISABLE_SIGNALS -void sem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem); +void nxsem_canceled(FAR struct tcb_s *stcb, FAR sem_t *sem); # else -# define sem_canceled(stcb, sem) +# define nxsem_canceled(stcb, sem) # endif #else -# define sem_initholders() -# define sem_destroyholder(sem) -# define sem_addholder(sem) -# define sem_addholder_tcb(htcb,sem) -# define sem_boostpriority(sem) -# define sem_releaseholder(sem) -# define sem_restorebaseprio(stcb,sem) -# define sem_canceled(stcb,sem) +# define nxsem_initholders() +# define nxsem_destroyholder(sem) +# define nxsem_addholder(sem) +# define nxsem_addholder_tcb(htcb,sem) +# define nxsem_boostpriority(sem) +# define nxsem_releaseholder(sem) +# define nxsem_restorebaseprio(stcb,sem) +# define nxsem_canceled(stcb,sem) #endif #undef EXTERN diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index c69c6388f6..f3f01d8767 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -409,7 +409,7 @@ int sig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) if (stcb->task_state == TSTATE_WAIT_SEM) { - sem_waitirq(stcb, EINTR); + nxsem_waitirq(stcb, EINTR); } /* If the task is blocked waiting on a message queue, then that task diff --git a/sched/task/task_cancelpt.c b/sched/task/task_cancelpt.c index 5aa6fa785f..ce194547d3 100644 --- a/sched/task/task_cancelpt.c +++ b/sched/task/task_cancelpt.c @@ -302,7 +302,7 @@ void notify_cancellation(FAR struct tcb_s *tcb) if (tcb->task_state == TSTATE_WAIT_SEM) { - sem_waitirq(tcb, ECANCELED); + nxsem_waitirq(tcb, ECANCELED); } /* If the thread is blocked waiting on a message queue, then the diff --git a/sched/task/task_recover.c b/sched/task/task_recover.c index b474eba995..8f563cf122 100644 --- a/sched/task/task_recover.c +++ b/sched/task/task_recover.c @@ -84,7 +84,7 @@ void task_recover(FAR struct tcb_s *tcb) * then release the counts. */ - sem_recover(tcb); + nxsem_recover(tcb); #ifndef CONFIG_DISABLE_MQUEUE /* Handle cases where the thread was waiting for a message queue event */ diff --git a/wireless/ieee802154/mac802154.c b/wireless/ieee802154/mac802154.c index fc16cba0ec..58937a3f20 100644 --- a/wireless/ieee802154/mac802154.c +++ b/wireless/ieee802154/mac802154.c @@ -130,7 +130,7 @@ static void mac802154_resetqueues(FAR struct ieee802154_privmac_s *priv) sq_addlast((FAR sq_entry_t *)&priv->txdesc_pool[i], &priv->txdesc_queue); } - sem_init(&priv->txdesc_sem, 0, CONFIG_MAC802154_NTXDESC); + nxsem_init(&priv->txdesc_sem, 0, CONFIG_MAC802154_NTXDESC); /* Initialize the notifcation allocation pool */ @@ -1963,11 +1963,11 @@ MACHANDLE mac802154_create(FAR struct ieee802154_radio_s *radiodev) /* Allow exclusive access to the privmac struct */ - sem_init(&mac->exclsem, 0, 1); + nxsem_init(&mac->exclsem, 0, 1); /* Allow exclusive access to the dedicated command transaction */ - sem_init(&mac->opsem, 0, 1); + nxsem_init(&mac->opsem, 0, 1); /* Initialize fields */ diff --git a/wireless/ieee802154/mac802154_device.c b/wireless/ieee802154/mac802154_device.c index d3c689d933..99ea797e8b 100644 --- a/wireless/ieee802154/mac802154_device.c +++ b/wireless/ieee802154/mac802154_device.c @@ -898,17 +898,17 @@ int mac802154dev_register(MACHANDLE mac, int minor) /* Initialize the new mac driver instance */ dev->md_mac = mac; - sem_init(&dev->md_exclsem, 0, 1); /* Allow the device to be opened once - * before blocking */ + nxsem_init(&dev->md_exclsem, 0, 1); /* Allow the device to be opened once + * before blocking */ - sem_init(&dev->readsem, 0, 0); + nxsem_init(&dev->readsem, 0, 0); sem_setprotocol(&dev->readsem, SEM_PRIO_NONE); dev->readpending = false; sq_init(&dev->dataind_queue); dev->geteventpending = false; - sem_init(&dev->geteventsem, 0, 0); + nxsem_init(&dev->geteventsem, 0, 0); sem_setprotocol(&dev->geteventsem, SEM_PRIO_NONE); dev->event_head = NULL; diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 54f4d8f942..f65e298b87 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -1460,7 +1460,7 @@ int mac802154netdev_register(MACHANDLE mac) /* Setup a locking semaphore for exclusive device driver access */ - sem_init(&priv->md_exclsem, 0, 1); + nxsem_init(&priv->md_exclsem, 0, 1); DEBUGASSERT(priv->md_txpoll != NULL); @@ -1477,7 +1477,7 @@ int mac802154netdev_register(MACHANDLE mac) /* Initialize fields related to MAC event handling */ priv->md_eventpending = false; - sem_init(&priv->md_eventsem, 0, 0); + nxsem_init(&priv->md_eventsem, 0, 0); sem_setprotocol(&priv->md_eventsem, SEM_PRIO_NONE); priv->md_eventhead = NULL; diff --git a/wireless/ieee802154/mac802154_notif.c b/wireless/ieee802154/mac802154_notif.c index 0d2727c0e1..ebad344f38 100644 --- a/wireless/ieee802154/mac802154_notif.c +++ b/wireless/ieee802154/mac802154_notif.c @@ -124,7 +124,7 @@ void mac802154_notifpool_init(FAR struct ieee802154_privmac_s *priv) remaining--; } - sem_init(&priv->notif_sem, 0, CONFIG_MAC802154_NNOTIF); + nxsem_init(&priv->notif_sem, 0, CONFIG_MAC802154_NNOTIF); } /**************************************************************************** diff --git a/wireless/pktradio/pktradio_metadata.c b/wireless/pktradio/pktradio_metadata.c index be819d19aa..1f9d198639 100644 --- a/wireless/pktradio/pktradio_metadata.c +++ b/wireless/pktradio/pktradio_metadata.c @@ -120,7 +120,7 @@ void pktradio_metadata_initialize(void) /* Initialize the mutual exclusion semaphore */ - sem_init(&g_metadata_sem, 0, 1); + nxsem_init(&g_metadata_sem, 0, 1); g_metadata_initialized = true; } }