diff --git a/drivers/modem/altair/altmdm_pm.c b/drivers/modem/altair/altmdm_pm.c index d52f9c4bd1..1268cb309a 100644 --- a/drivers/modem/altair/altmdm_pm.c +++ b/drivers/modem/altair/altmdm_pm.c @@ -43,7 +43,9 @@ #include #include +#include #include + #include "altmdm_sys.h" #include "altmdm_pm.h" #include "altmdm_pm_state.h" @@ -1277,7 +1279,8 @@ int altmdm_pm_uninit(FAR struct altmdm_dev_s *priv) { break; } - usleep(10); + + nxsig_usleep(10); } /* Delete event flags. */ diff --git a/drivers/modem/altair/altmdm_spi.c b/drivers/modem/altair/altmdm_spi.c index 2e137fd82d..c3c39807d9 100644 --- a/drivers/modem/altair/altmdm_spi.c +++ b/drivers/modem/altair/altmdm_spi.c @@ -41,8 +41,10 @@ #include #include +#include #include #include + #include "altmdm_sys.h" #include "altmdm_pm.h" #include "altmdm_pm_state.h" @@ -1943,7 +1945,7 @@ int altmdm_spi_uninit(FAR struct altmdm_dev_s *priv) break; } - usleep(10); + nxsig_usleep(10); } altmdm_sys_deletelock(&priv->spidev.tx_param.lock); @@ -2153,7 +2155,7 @@ again: break; case TRANS_OK_RCVBUFFUL: - usleep(100); + nxsig_usleep(100); goto again; break; diff --git a/drivers/mtd/gd25.c b/drivers/mtd/gd25.c index 0e44fbb5ed..930e57c71c 100644 --- a/drivers/mtd/gd25.c +++ b/drivers/mtd/gd25.c @@ -411,7 +411,7 @@ static uint8_t gd25_waitwritecomplete(FAR struct gd25_dev_s *priv) if (priv->prev_instr != GD25_PP && (status & GD25_SR_WIP) != 0) { gd25_unlock(priv->spi); - usleep(1000); + nxsig_usleep(1000); gd25_lock(priv->spi); } } diff --git a/drivers/mtd/gd5f.c b/drivers/mtd/gd5f.c index d4a48c7584..f9ee51c8ea 100644 --- a/drivers/mtd/gd5f.c +++ b/drivers/mtd/gd5f.c @@ -49,6 +49,7 @@ #include #include +#include #include #include #include @@ -327,7 +328,7 @@ static bool gd5f_waitstatus(FAR struct gd5f_dev_s *priv, uint8_t mask, bool succ /* Deselect the FLASH */ SPI_SELECT(priv->dev, SPIDEV_FLASH(priv->spi_devid), false); - usleep(1000); + nxsig_usleep(1000); } while ((status & GD5F_SR_OIP) != 0); diff --git a/drivers/mtd/mx35.c b/drivers/mtd/mx35.c index b86f55ce75..2f7a4a7ed3 100644 --- a/drivers/mtd/mx35.c +++ b/drivers/mtd/mx35.c @@ -2,7 +2,7 @@ * drivers/mtd/mx35.c * Driver for SPI-based MX35LFxGE4AB parts of 1 or 2GBit. * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016, 2019 Gregory Nutt. All rights reserved. * Author: Ekaterina Kovylova * * Copied from / based on mx25lx.c driver written by @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -379,7 +380,7 @@ static bool mx35_waitstatus(FAR struct mx35_dev_s *priv, uint8_t mask, bool succ * other peripherals to access the SPI bus. */ } - while (((status & MX35_SR_OIP) != 0) && (!usleep(1000))); + while (((status & MX35_SR_OIP) != 0) && (!nxsig_usleep(1000))); mx35info("Complete\n"); return successif ? ((status & mask) != 0) : ((status & mask) == 0); diff --git a/drivers/sensors/as726x.c b/drivers/sensors/as726x.c index 1ad92713c5..8b9f62abd6 100644 --- a/drivers/sensors/as726x.c +++ b/drivers/sensors/as726x.c @@ -226,7 +226,7 @@ static uint8_t as726x_read8(FAR struct as726x_dev_s *priv, uint8_t regaddr) break; /* If TX bit is clear, it is ok to write */ } - usleep(AS726X_POLLING_DELAY); + nxsig_usleep(AS726X_POLLING_DELAY); } /* Send the virtual register address (bit 7 should be 0 to indicate we are @@ -245,7 +245,7 @@ static uint8_t as726x_read8(FAR struct as726x_dev_s *priv, uint8_t regaddr) break; /* Read data is ready. */ } - usleep(AS726X_POLLING_DELAY); + nxsig_usleep(AS726X_POLLING_DELAY); } uint8_t incoming = read_register(priv, AS72XX_SLAVE_READ_REG); @@ -300,7 +300,7 @@ static void as726x_write8(FAR struct as726x_dev_s *priv, uint8_t regaddr, break; } - usleep(AS726X_POLLING_DELAY); + nxsig_usleep(AS726X_POLLING_DELAY); } /* Send the virtual register address (setting bit 7 to indicate we are @@ -321,7 +321,7 @@ static void as726x_write8(FAR struct as726x_dev_s *priv, uint8_t regaddr, break; } - usleep(AS726X_POLLING_DELAY); + nxsig_usleep(AS726X_POLLING_DELAY); } /* Send the data to complete the operation. */ diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c index 8fd4c17c27..be6297ef7d 100644 --- a/drivers/sensors/hts221.c +++ b/drivers/sensors/hts221.c @@ -37,16 +37,19 @@ ****************************************************************************/ #include + #include #include #include #include #include #include + #include #include #include #include +#include #include #include @@ -400,7 +403,7 @@ static int hts221_config_ctrl_reg2(FAR struct hts221_dev_s *priv, break; } - usleep(10 * 1000); + nxsig_usleep(10 * 1000); retries--; } while (retries); diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index 369d926be1..9ee740a32a 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/usbdev/usbmsc_scsi.c * - * Copyright (C) 2008-2010, 2012, 2016-2017 Gregory Nutt. All rights + * Copyright (C) 2008-2010, 2012, 2016-2017, 2019 Gregory Nutt. All rights * reserved. * Author: Gregory Nutt * @@ -71,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -2467,12 +2468,12 @@ static int usbmsc_cmdfinishstate(FAR struct usbmsc_dev_s *priv) * First, wait for the transfer to complete, then stall the endpoint */ - usleep (100000); + nxsig_usleep (100000); (void)EP_STALL(priv->epbulkin); /* now wait for stall to go away .... */ - usleep (100000); + nxsig_usleep (100000); #else (void)EP_STALL(priv->epbulkin); #endif diff --git a/drivers/usbhost/usbhost_max3421e.c b/drivers/usbhost/usbhost_max3421e.c index 822069ec76..4202e9a5c4 100644 --- a/drivers/usbhost/usbhost_max3421e.c +++ b/drivers/usbhost/usbhost_max3421e.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/usbhost/usbhost_max3421e.c * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Copyright (C) 2018, 2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -3295,7 +3295,7 @@ static void max3421e_int_wait(FAR struct max3421e_usbhost_s *priv, if (regval == 0 && usec > 0) { - usleep(usec); + nxsig_usleep(usec); } } while (regval == 0); @@ -4510,7 +4510,7 @@ static int max3421e_startsof(FAR struct max3421e_usbhost_s *priv) while ((max3421e_getreg(priv, MAX3421E_USBHOST_HCTL) & USBHOST_HCTL_BUSSAMPLE) == 0) { - usleep(5); + nxsig_usleep(5); } /* Check for low- or full-speed and start SOF (actually already started @@ -4579,7 +4579,7 @@ static int max3421e_startsof(FAR struct max3421e_usbhost_s *priv) /* Wait for the first SOF received and 20ms has passed */ max3421e_int_wait(priv, USBHOST_HIRQ_FRAMEIRQ, 0); - usleep(20*1000); + nxsig_usleep(20*1000); return OK; } diff --git a/drivers/video/isx012.c b/drivers/video/isx012.c index 981bc8988a..bc316e9def 100644 --- a/drivers/video/isx012.c +++ b/drivers/video/isx012.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -741,7 +742,7 @@ static int isx012_chk_int_state(isx012_dev_t *priv, volatile uint8_t data; uint32_t time = 0; - usleep(delay_time * 1000); + nxsig_usleep(delay_time * 1000); while (time < timeout) { data = isx012_getreg(priv, INTSTS0, sizeof(data)); @@ -752,7 +753,7 @@ static int isx012_chk_int_state(isx012_dev_t *priv, return ret; } - usleep(wait_time * 1000); + nxsig_usleep(wait_time * 1000); time += wait_time; } return ERROR; @@ -1107,10 +1108,10 @@ int init_isx012(FAR struct isx012_dev_s *priv) #ifdef ISX012_NOT_USE_NSTBY board_isx012_release_sleep(); board_isx012_release_reset(); - usleep(6000); + nxsig_usleep(6000); #else board_isx012_release_reset(); - usleep(6000); + nxsig_usleep(6000); #endif #ifdef ISX012_CHECK_IN_DETAIL diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c index 44d5618cb8..92e45f9455 100644 --- a/drivers/wireless/cc1101.c +++ b/drivers/wireless/cc1101.c @@ -111,6 +111,7 @@ #include #include +#include #include #include @@ -720,7 +721,7 @@ void cc1101_access_begin(FAR struct cc1101_dev_s *dev) } else { - usleep(150 * 1000); + nxsig_usleep(150 * 1000); } } diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c index 8c69927177..88f9a78807 100644 --- a/drivers/wireless/gs2200m.c +++ b/drivers/wireless/gs2200m.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -878,14 +879,14 @@ retry: { /* TODO: timeout */ - usleep(10); + nxsig_usleep(10); } /* NOTE: wait 100us - * workaround to avoid realy receiving an invalid frame response + * workaround to avoid really receiving an invalid frame response */ - up_udelay(100); + nxsig_usleep(100); /* Read frame response */ diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c index e4504c6076..6c3fb0e007 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -995,7 +996,7 @@ int bcmf_wl_enable(FAR struct bcmf_dev_s *priv, bool enable) /* TODO wait for WLC_E_RADIO event */ - usleep(3000); + nxsig_usleep(3000); if (ret == OK) { diff --git a/drivers/wireless/lpwan/sx127x/sx127x.c b/drivers/wireless/lpwan/sx127x/sx127x.c index a60271e03f..737fa45727 100644 --- a/drivers/wireless/lpwan/sx127x/sx127x.c +++ b/drivers/wireless/lpwan/sx127x/sx127x.c @@ -2977,7 +2977,7 @@ static int sx127x_lora_opmode_set(FAR struct sx127x_dev_s *dev, /* Wait for mode ready. REVISIT: do we need this ? */ - usleep(250); + nxsig_usleep(250); errout: return ret; @@ -3805,7 +3805,7 @@ static bool sx127x_channel_scan(FAR struct sx127x_dev_s *dev, /* Wait some time */ - usleep(1000); + nxsig_usleep(1000); } while (tstart.tv_sec + chanscan->stime > tnow.tv_sec); @@ -4160,7 +4160,7 @@ static int sx127x_calibration(FAR struct sx127x_dev_s *dev, uint32_t freq) { /* Wait 10ms */ - usleep(10000); + nxsig_usleep(10000); /* Get register */