From 3cadf6642a13eca02827e157ab53915310e37846 Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 25 Oct 2023 11:08:56 +0800 Subject: [PATCH] kernel: replace all usleep to nxsig_usleep in kernel space syscall cannot be called from kernel space Signed-off-by: chao an --- arch/arm/src/cxd56xx/cxd56_gnss.c | 2 +- arch/arm/src/nrf53/nrf53_rptun.c | 3 ++- arch/arm/src/nrf91/nrf91_modem_os.c | 3 ++- arch/arm/src/nrf91/nrf91_modem_sock.c | 3 ++- arch/arm/src/rp2040/rp2040_cyw43439.c | 5 +++-- arch/arm/src/rp2040/rp2040_ws2812.c | 3 ++- arch/arm/src/rtl8720c/ameba_hci.c | 3 ++- arch/arm/src/rtl8720c/amebaz_depend.c | 3 ++- arch/arm/src/rtl8720c/amebaz_driver.c | 5 +++-- arch/arm/src/sama5/sam_classd.c | 3 ++- arch/arm/src/sama5/sam_sdmmc.c | 11 ++++++----- arch/arm/src/samv7/sam_serial.c | 3 ++- arch/arm/src/stm32h7/stm32_rptun.c | 3 ++- arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c | 2 +- arch/risc-v/src/esp32c3/esp32c3_twai.c | 3 ++- arch/risc-v/src/mpfs/mpfs_dsn.c | 3 ++- arch/xtensa/src/esp32/esp32_ble_adapter.c | 2 +- arch/xtensa/src/esp32s3/esp32s3_ble_adapter.c | 2 +- boards/arm/cxd56xx/common/src/cxd56_bcm20706.c | 5 +++-- boards/arm/cxd56xx/spresense/src/cxd56_power.c | 5 +++-- boards/arm/samv7/same70-qmtech/src/sam_bringup.c | 3 ++- boards/arm/samv7/same70-xplained/src/sam_bringup.c | 3 ++- boards/arm/samv7/samv71-xult/src/sam_bringup.c | 3 ++- boards/arm/stm32/stm32f103-minimum/src/stm32_hyt271.c | 3 ++- .../esp32s3/esp32s3-devkit/src/esp32s3_st7735.c | 5 +++-- drivers/audio/audio_null.c | 3 ++- drivers/crypto/pnt/sm_timer.c | 4 +++- drivers/modem/alt1250/alt1250.c | 3 ++- drivers/motor/a4988.c | 6 ++++-- drivers/motor/drv8825.c | 5 +++-- drivers/rptun/rptun_ping.c | 3 ++- drivers/sensors/bmi160_uorb.c | 7 ++++--- drivers/sensors/wtgahrs2_uorb.c | 3 ++- drivers/usbmisc/fusb302.c | 3 ++- fs/rpmsgfs/rpmsgfs.c | 3 ++- 35 files changed, 81 insertions(+), 48 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c index 0c2ed0b2c2..9f56004f29 100644 --- a/arch/arm/src/cxd56xx/cxd56_gnss.c +++ b/arch/arm/src/cxd56xx/cxd56_gnss.c @@ -2719,7 +2719,7 @@ static int cxd56_gnss_open(struct file *filep) { /* GNSS requires stable RTC */ - usleep(100 * 1000); + nxsig_usleep(100 * 1000); } ret = nxmutex_lock(&priv->devlock); diff --git a/arch/arm/src/nrf53/nrf53_rptun.c b/arch/arm/src/nrf53/nrf53_rptun.c index 805c8b41bc..b97c66d791 100644 --- a/arch/arm/src/nrf53/nrf53_rptun.c +++ b/arch/arm/src/nrf53/nrf53_rptun.c @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -245,7 +246,7 @@ nrf53_rptun_get_resource(struct rptun_dev_s *dev) while (priv->shmem->base == 0) { - usleep(100); + nxsig_usleep(100); } } diff --git a/arch/arm/src/nrf91/nrf91_modem_os.c b/arch/arm/src/nrf91/nrf91_modem_os.c index 64e25163e8..dad289f25d 100644 --- a/arch/arm/src/nrf91/nrf91_modem_os.c +++ b/arch/arm/src/nrf91/nrf91_modem_os.c @@ -27,6 +27,7 @@ #include #include +#include #include @@ -385,7 +386,7 @@ int nrf_modem_os_sleep(uint32_t timeout) { /* Timeout in ms */ - usleep(timeout * 1000); + nxsig_usleep(timeout * 1000); return OK; } diff --git a/arch/arm/src/nrf91/nrf91_modem_sock.c b/arch/arm/src/nrf91/nrf91_modem_sock.c index 80c8638e03..d9b2bf327b 100644 --- a/arch/arm/src/nrf91/nrf91_modem_sock.c +++ b/arch/arm/src/nrf91/nrf91_modem_sock.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -682,7 +683,7 @@ static void nrf91_usrsock_poll_work(void *arg) { while (g_usrsock.sock[pollfd->fd].recvpending == true) { - usleep(100); + nxsig_usleep(100); } } diff --git a/arch/arm/src/rp2040/rp2040_cyw43439.c b/arch/arm/src/rp2040/rp2040_cyw43439.c index 21d9442f41..74a8cfd2d9 100644 --- a/arch/arm/src/rp2040/rp2040_cyw43439.c +++ b/arch/arm/src/rp2040/rp2040_cyw43439.c @@ -29,6 +29,7 @@ #include #include +#include #include #include "barriers.h" @@ -164,11 +165,11 @@ static int my_init(gspi_dev_t *gspi) rp2040_gpio_setdir(rp_io->gpio_data, true); rp2040_gpio_put(rp_io->gpio_data, false); - usleep(50000); /* Leave off for at least 50ms. */ + nxsig_usleep(50000); /* Leave off for at least 50ms. */ rp2040_gpio_put(rp_io->gpio_on, true); /* power on */ - usleep(50000); /* Wait a bit to let the power come up. */ + nxsig_usleep(50000); /* Wait a bit to let the power come up. */ /* Don't let anyone else grab a PIO while we are doing so. */ diff --git a/arch/arm/src/rp2040/rp2040_ws2812.c b/arch/arm/src/rp2040/rp2040_ws2812.c index a0f5622e2f..f2fd2b477e 100644 --- a/arch/arm/src/rp2040/rp2040_ws2812.c +++ b/arch/arm/src/rp2040/rp2040_ws2812.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -141,7 +142,7 @@ static void update_pixels(struct ws2812_dev_s *dev_data) if (time_delta < 50) { - usleep(50 - time_delta); + nxsig_usleep(50 - time_delta); } rp2040_dmastart(dma_handle, dma_complete, dev_data); diff --git a/arch/arm/src/rtl8720c/ameba_hci.c b/arch/arm/src/rtl8720c/ameba_hci.c index c35139ee3d..1ddb675d95 100644 --- a/arch/arm/src/rtl8720c/ameba_hci.c +++ b/arch/arm/src/rtl8720c/ameba_hci.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -327,7 +328,7 @@ static int hci_load_firmware(struct file *filep) command[1] = 0x20; command[2] = 0xfc; buffer_size = header_size + command[3]; - usleep(10); + nxsig_usleep(10); ret = hci_send(filep, command, buffer_size); if (ret != buffer_size) { diff --git a/arch/arm/src/rtl8720c/amebaz_depend.c b/arch/arm/src/rtl8720c/amebaz_depend.c index 71405ea308..524e938a73 100644 --- a/arch/arm/src/rtl8720c/amebaz_depend.c +++ b/arch/arm/src/rtl8720c/amebaz_depend.c @@ -25,6 +25,7 @@ #include "amebaz_depend.h" #include #include +#include #include /**************************************************************************** @@ -397,7 +398,7 @@ void rtw_yield_os(void) void rtw_usleep_os(int us) { - usleep(us); + nxsig_usleep(us); } void rtw_msleep_os(int ms) diff --git a/arch/arm/src/rtl8720c/amebaz_driver.c b/arch/arm/src/rtl8720c/amebaz_driver.c index cc5d11378e..e297610418 100644 --- a/arch/arm/src/rtl8720c/amebaz_driver.c +++ b/arch/arm/src/rtl8720c/amebaz_driver.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "amebaz_netdev.h" @@ -958,7 +959,7 @@ int amebaz_wl_set_mode(struct amebaz_dev_s *priv, struct iwreq *iwr) while (!rltk_wlan_running(priv->devnum)) { - usleep(1000); + nxsig_usleep(1000); } ret = amebaz_wl_disable_powersave(0); @@ -1125,7 +1126,7 @@ static int amebaz_wl_on(int mode) while (!rltk_wlan_running(gp_wlan_dev[i]->devnum)) { - usleep(1000); + nxsig_usleep(1000); } } diff --git a/arch/arm/src/sama5/sam_classd.c b/arch/arm/src/sama5/sam_classd.c index 49bbe59a89..74adb4fa31 100644 --- a/arch/arm/src/sama5/sam_classd.c +++ b/arch/arm/src/sama5/sam_classd.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -665,7 +666,7 @@ void classd_enable_audio(struct classd_dev_s *priv, bool pmc_clock_enable) /* wait for Audio PLL startup time */ - usleep(100); + nxsig_usleep(100); #endif } diff --git a/arch/arm/src/sama5/sam_sdmmc.c b/arch/arm/src/sama5/sam_sdmmc.c index 3e45a3267f..b22309e07c 100644 --- a/arch/arm/src/sama5/sam_sdmmc.c +++ b/arch/arm/src/sama5/sam_sdmmc.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -1578,7 +1579,7 @@ static void sam_reset(struct sdio_dev_s *dev) } timeout_ms--; - usleep(100); + nxsig_usleep(100); } mcinfo("Reset complete\n"); @@ -1964,7 +1965,7 @@ static void sam_clock(struct sdio_dev_s *dev, enum sdio_clock_e rate) if (wait_microseconds > 0) { - usleep(wait_microseconds); + nxsig_usleep(wait_microseconds); } } @@ -2674,7 +2675,7 @@ static int sam_recvshortcrc(struct sdio_dev_s *dev, uint32_t cmd, /* We need a short delay here to let the SDMMC peripheral respond */ - usleep(10); + nxsig_usleep(10); return ret; } @@ -3323,7 +3324,7 @@ static int sam_set_clock(struct sam_dev_s *priv, uint32_t clock) } timeout--; - usleep(100); + nxsig_usleep(100); } sam_putreg16(priv, 0, SAMA5_SDMMC_SYSCTL_OFFSET); @@ -3433,7 +3434,7 @@ static int sam_set_clock(struct sam_dev_s *priv, uint32_t clock) } timeout--; - usleep(100); + nxsig_usleep(100); } /* High Speed Mode? */ diff --git a/arch/arm/src/samv7/sam_serial.c b/arch/arm/src/samv7/sam_serial.c index 613ec09ef1..24987e18c8 100644 --- a/arch/arm/src/samv7/sam_serial.c +++ b/arch/arm/src/samv7/sam_serial.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -1711,7 +1712,7 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg) * waiting to improve CPU utilization */ - usleep((8 * 1000 * 1000) / priv->baud); + nxsig_usleep((8 * 1000 * 1000) / priv->baud); regval = sam_serialin(priv, SAM_UART_SR_OFFSET); } diff --git a/arch/arm/src/stm32h7/stm32_rptun.c b/arch/arm/src/stm32h7/stm32_rptun.c index d54252d892..818451f12e 100644 --- a/arch/arm/src/stm32h7/stm32_rptun.c +++ b/arch/arm/src/stm32h7/stm32_rptun.c @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -250,7 +251,7 @@ stm32_rptun_get_resource(struct rptun_dev_s *dev) while (priv->shmem->base == 0) { - usleep(100); + nxsig_usleep(100); } } diff --git a/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c b/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c index d05cd5a63b..79eddf60e9 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c +++ b/arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c @@ -2213,7 +2213,7 @@ int esp32c3_bt_controller_disable(void) while (!btdm_power_state_active()) { - usleep(1000); /* wait */ + nxsig_usleep(1000); /* wait */ } btdm_controller_disable(); diff --git a/arch/risc-v/src/esp32c3/esp32c3_twai.c b/arch/risc-v/src/esp32c3/esp32c3_twai.c index 2a70f142a6..b057fb6fd6 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_twai.c +++ b/arch/risc-v/src/esp32c3/esp32c3_twai.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "riscv_internal.h" @@ -1217,7 +1218,7 @@ struct can_dev_s *esp32c3_twaiinitialize(int port) modifyreg32(SYSTEM_PERIP_RST_EN0_REG, 0, SYSTEM_TWAI_RST_M); modifyreg32(SYSTEM_PERIP_CLK_EN0_REG, SYSTEM_TWAI_CLK_EN_M, 0); - usleep(1); + nxsig_usleep(1); modifyreg32(SYSTEM_PERIP_CLK_EN0_REG, 0, SYSTEM_TWAI_CLK_EN_M); modifyreg32(SYSTEM_PERIP_RST_EN0_REG, SYSTEM_TWAI_RST_M, 0); diff --git a/arch/risc-v/src/mpfs/mpfs_dsn.c b/arch/risc-v/src/mpfs/mpfs_dsn.c index e745976253..cedfd1b885 100644 --- a/arch/risc-v/src/mpfs/mpfs_dsn.c +++ b/arch/risc-v/src/mpfs/mpfs_dsn.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "mpfs_dsn.h" #include "riscv_internal.h" @@ -89,7 +90,7 @@ int mpfs_read_dsn(uint8_t *dsn, size_t len) while ((getreg32(SERVICES_SR) & SCBCTRL_SERVICESSR_BUSY) && --retries > 0) { leave_critical_section(flags); - usleep(1000); + nxsig_usleep(1000); flags = enter_critical_section(); } diff --git a/arch/xtensa/src/esp32/esp32_ble_adapter.c b/arch/xtensa/src/esp32/esp32_ble_adapter.c index 334b9a263d..f3232b8689 100644 --- a/arch/xtensa/src/esp32/esp32_ble_adapter.c +++ b/arch/xtensa/src/esp32/esp32_ble_adapter.c @@ -2529,7 +2529,7 @@ int esp32_bt_controller_disable(void) while (!btdm_power_state_active()) { - usleep(1000); /* wait */ + nxsig_usleep(1000); /* wait */ } btdm_controller_disable(); diff --git a/arch/xtensa/src/esp32s3/esp32s3_ble_adapter.c b/arch/xtensa/src/esp32s3/esp32s3_ble_adapter.c index 5e625f8c9a..24ce6cc182 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_ble_adapter.c +++ b/arch/xtensa/src/esp32s3/esp32s3_ble_adapter.c @@ -2658,7 +2658,7 @@ int esp32s3_bt_controller_disable(void) while (!btdm_power_state_active()) { - usleep(1000); /* wait */ + nxsig_usleep(1000); /* wait */ } btdm_controller_disable(); diff --git a/boards/arm/cxd56xx/common/src/cxd56_bcm20706.c b/boards/arm/cxd56xx/common/src/cxd56_bcm20706.c index 4c394f6933..3629c019a0 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_bcm20706.c +++ b/boards/arm/cxd56xx/common/src/cxd56_bcm20706.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "cxd56_gpio.h" @@ -116,9 +117,9 @@ int board_bluetooth_uart_pin_cfg(void) void board_bluetooth_reset(void) { cxd56_gpio_write(BCM20707_RST_N, false); - usleep(BCM20707_RST_DELAY); + nxsig_usleep(BCM20707_RST_DELAY); cxd56_gpio_write(BCM20707_RST_N, true); - usleep(BCM20707_RST_DELAY); + nxsig_usleep(BCM20707_RST_DELAY); } /**************************************************************************** diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_power.c b/boards/arm/cxd56xx/spresense/src/cxd56_power.c index c676206736..49111aba5e 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_power.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_power.c @@ -33,6 +33,7 @@ #include #include +#include #include "chip.h" #include "arm_internal.h" @@ -233,7 +234,7 @@ int board_power_control(int target, bool en) if (!g_rtc_enabled && (PMIC_GET_TYPE(target) == PMIC_TYPE_GPO)) { - usleep(1); + nxsig_usleep(1); } } @@ -271,7 +272,7 @@ int board_power_control_tristate(int target, int value) if (!g_rtc_enabled) { - usleep(1); + nxsig_usleep(1); } } else if (PMIC_GET_TYPE(target) == CHIP_TYPE_GPIO) diff --git a/boards/arm/samv7/same70-qmtech/src/sam_bringup.c b/boards/arm/samv7/same70-qmtech/src/sam_bringup.c index 53835364df..a67083fbbd 100644 --- a/boards/arm/samv7/same70-qmtech/src/sam_bringup.c +++ b/boards/arm/samv7/same70-qmtech/src/sam_bringup.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "same70-qmtech.h" @@ -172,7 +173,7 @@ int sam_bringup(void) { if (sam_cardinserted(HSMCI0_SLOTNO)) { - usleep(1000 * 1000); + nxsig_usleep(1000 * 1000); /* Mount the volume on HSMCI0 */ diff --git a/boards/arm/samv7/same70-xplained/src/sam_bringup.c b/boards/arm/samv7/same70-xplained/src/sam_bringup.c index 082da6c93c..4726dce67b 100644 --- a/boards/arm/samv7/same70-xplained/src/sam_bringup.c +++ b/boards/arm/samv7/same70-xplained/src/sam_bringup.c @@ -37,6 +37,7 @@ # include #endif +#include #include #include #include @@ -233,7 +234,7 @@ int sam_bringup(void) { if (sam_cardinserted(HSMCI0_SLOTNO)) { - usleep(1000 * 1000); + nxsig_usleep(1000 * 1000); /* Mount the volume on HSMCI0 */ diff --git a/boards/arm/samv7/samv71-xult/src/sam_bringup.c b/boards/arm/samv7/samv71-xult/src/sam_bringup.c index 0a93b62257..9339e54980 100644 --- a/boards/arm/samv7/samv71-xult/src/sam_bringup.c +++ b/boards/arm/samv7/samv71-xult/src/sam_bringup.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef CONFIG_USBMONITOR # include @@ -349,7 +350,7 @@ int sam_bringup(void) { if (sam_cardinserted(HSMCI0_SLOTNO)) { - usleep(1000 * 1000); + nxsig_usleep(1000 * 1000); /* Mount the volume on HSMCI0 */ diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_hyt271.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_hyt271.c index 627ba18b7e..aece55a6a5 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_hyt271.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_hyt271.c @@ -31,6 +31,7 @@ #include #include +#include #include #ifdef CONFIG_SENSORS_HYT271 # include @@ -110,7 +111,7 @@ static int stm32_i2c_power_reset(struct hyt271_bus_s *bus) } stm32_gpiowrite(BOARD_HYT271_POWOUT, false); - usleep(250000); + nxsig_usleep(250000); stm32_gpiowrite(BOARD_HYT271_POWOUT, true); while (1) diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_st7735.c b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_st7735.c index 0ef4f27c8f..3ad6f7471b 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_st7735.c +++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_st7735.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -84,9 +85,9 @@ int board_lcd_initialize(void) esp32s3_configgpio(GPIO_LCD_RST, OUTPUT); esp32s3_gpiowrite(GPIO_LCD_RST, false); - usleep(10000); + nxsig_usleep(10000); esp32s3_gpiowrite(GPIO_LCD_RST, true); - usleep(100000); + nxsig_usleep(100000); return OK; } diff --git a/drivers/audio/audio_null.c b/drivers/audio/audio_null.c index 7c3215321c..427f32bf23 100644 --- a/drivers/audio/audio_null.c +++ b/drivers/audio/audio_null.c @@ -42,6 +42,7 @@ #include #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -171,7 +172,7 @@ static int null_sleep(FAR struct audio_lowerhalf_s *dev, uint64_t sleep_time; sleep_time = USEC_PER_SEC * (uint64_t)apb->nbytes / priv->scaler; - usleep(sleep_time); + nxsig_usleep(sleep_time); #ifdef CONFIG_AUDIO_MULTI_SESSION priv->dev.upper(priv->dev.priv, AUDIO_CALLBACK_DEQUEUE, apb, OK, NULL); diff --git a/drivers/crypto/pnt/sm_timer.c b/drivers/crypto/pnt/sm_timer.c index 9d64497c05..fc49b580b6 100644 --- a/drivers/crypto/pnt/sm_timer.c +++ b/drivers/crypto/pnt/sm_timer.c @@ -26,11 +26,13 @@ #include +#include + /**************************************************************************** * Public Functions ****************************************************************************/ void sm_sleep(uint32_t msec) { - usleep(1000 * msec); + nxsig_usleep(1000 * msec); } diff --git a/drivers/modem/alt1250/alt1250.c b/drivers/modem/alt1250/alt1250.c index 63daca39c9..97a4e7e2a7 100644 --- a/drivers/modem/alt1250/alt1250.c +++ b/drivers/modem/alt1250/alt1250.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -1050,7 +1051,7 @@ static int altcom_recvthread(int argc, FAR char *argv[]) * does not accept any requests and must stay alive. */ - sleep(1); + nxsig_sleep(1); } } else if (ret == ALTMDM_RETURN_EXIT) diff --git a/drivers/motor/a4988.c b/drivers/motor/a4988.c index 84d6c625e3..471a67eee4 100644 --- a/drivers/motor/a4988.c +++ b/drivers/motor/a4988.c @@ -28,6 +28,8 @@ #include #include +#include + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -137,7 +139,7 @@ static int a4988_work(FAR struct stepper_lowerhalf_s *dev, if (priv->auto_idle) { priv->ops->idle(false); - usleep(USEC_PER_MSEC); + nxsig_usleep(USEC_PER_MSEC); } dev->status.state = STEPPER_STATE_RUN; @@ -197,7 +199,7 @@ static int a4988_idle(FAR struct stepper_lowerhalf_s *dev, uint8_t idle) else { priv->ops->idle(false); - usleep(USEC_PER_MSEC); + nxsig_usleep(USEC_PER_MSEC); dev->status.state = STEPPER_STATE_READY; } diff --git a/drivers/motor/drv8825.c b/drivers/motor/drv8825.c index b9245aea66..2aa7e705e1 100644 --- a/drivers/motor/drv8825.c +++ b/drivers/motor/drv8825.c @@ -27,6 +27,7 @@ #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -144,7 +145,7 @@ static int drv8825_work(FAR struct stepper_lowerhalf_s *dev, if (priv->auto_idle) { priv->ops->idle(false); - usleep(USEC_PER_MSEC * 2); + nxsig_usleep(USEC_PER_MSEC * 2); } dev->status.state = STEPPER_STATE_RUN; @@ -222,7 +223,7 @@ static int drv8825_idle(FAR struct stepper_lowerhalf_s *dev, uint8_t idle) else { priv->ops->idle(false); - usleep(USEC_PER_MSEC * 2); + nxsig_usleep(USEC_PER_MSEC * 2); dev->status.state = STEPPER_STATE_READY; } diff --git a/drivers/rptun/rptun_ping.c b/drivers/rptun/rptun_ping.c index 3146d4ed95..ea8302aeb2 100644 --- a/drivers/rptun/rptun_ping.c +++ b/drivers/rptun/rptun_ping.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "rptun.h" @@ -167,7 +168,7 @@ int rptun_ping(FAR struct rpmsg_endpoint *ept, max = MAX(max, tm); total += tm; - usleep(ping->sleep * USEC_PER_MSEC); + nxsig_usleep(ping->sleep * USEC_PER_MSEC); } syslog(LOG_INFO, "ping times: %d\n", ping->times); diff --git a/drivers/sensors/bmi160_uorb.c b/drivers/sensors/bmi160_uorb.c index bb83b43376..38595f6b0f 100644 --- a/drivers/sensors/bmi160_uorb.c +++ b/drivers/sensors/bmi160_uorb.c @@ -25,6 +25,7 @@ #include "bmi160_base.h" #include #include +#include #include #if defined(CONFIG_SENSORS_BMI160_UORB) @@ -206,7 +207,7 @@ static void bmi160_accel_enable(FAR struct bmi160_dev_uorb_s *priv, /* Set accel as normal mode. */ bmi160_putreg8(&priv->dev, BMI160_CMD, ACCEL_PM_NORMAL); - usleep(30000); + nxsig_usleep(30000); idx = bmi160_findodr(priv->interval, g_bmi160_accel_odr, nitems(g_bmi160_accel_odr)); @@ -257,7 +258,7 @@ static void bmi160_gyro_enable(FAR struct bmi160_dev_uorb_s *priv, /* Set gyro as normal mode. */ bmi160_putreg8(&priv->dev, BMI160_CMD, GYRO_PM_NORMAL); - usleep(30000); + nxsig_usleep(30000); idx = bmi160_findodr(priv->interval, g_bmi160_gyro_odr, nitems(g_bmi160_gyro_odr)); @@ -594,7 +595,7 @@ static int bmi160_register_accel(int devno, bmi160_getreg8(priv, 0x7f); bmi160_getreg8(priv, 0x7f); /* workaround: fail to switch SPI, run twice */ - usleep(200); + nxsig_usleep(200); #endif diff --git a/drivers/sensors/wtgahrs2_uorb.c b/drivers/sensors/wtgahrs2_uorb.c index ca06274ba4..f1b6d7d80c 100644 --- a/drivers/sensors/wtgahrs2_uorb.c +++ b/drivers/sensors/wtgahrs2_uorb.c @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -151,7 +152,7 @@ static void wtgahrs2_sendcmd(FAR struct wtgahrs2_dev_s *rtdata, const void *cmd) { file_write(&rtdata->file, cmd, WTGAHRS2_CMD_LENGTH); - usleep(10000); + nxsig_usleep(10000); } static int wtgahrs2_activate(FAR struct sensor_lowerhalf_s *lower, diff --git a/drivers/usbmisc/fusb302.c b/drivers/usbmisc/fusb302.c index 9ae45f7b8e..1ced8ee158 100644 --- a/drivers/usbmisc/fusb302.c +++ b/drivers/usbmisc/fusb302.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -644,7 +645,7 @@ void setmdac(struct fusb302_dev_s *priv, enum src_current_e thresh) regval |= MEASURE_MDAC(src_mdac_val[thresh]); fusb302_putreg(priv, FUSB302_MEASURE_REG, regval); - usleep(150); + nxsig_usleep(150); } /**************************************************************************** diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index d2c777b793..4881a07898 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "rpmsgfs.h" @@ -260,7 +261,7 @@ static void rpmsgfs_mkpath(FAR struct rpmsgfs_mountpt_s *fs, break; } - usleep(RPMSGFS_RETRY_DELAY_MS * USEC_PER_MSEC); + nxsig_usleep(RPMSGFS_RETRY_DELAY_MS * USEC_PER_MSEC); fs->timeout -= RPMSGFS_RETRY_DELAY_MS; } }