Adds new OS internal functions nxsig_sleep() and nxsig_usleep. These differ from the standard sleep() and usleep() in that (1) they don't cause cancellation points, and (2) don't set the errno variable (if applicable). All calls to sleep() and usleep() changed to calls to nxsig_sleep() and nxsig_usleep().

Squashed commit of the following:

    Change all calls to usleep() in the OS proper to calls to nxsig_usleep()

    sched/signal:  Add a new OS internal function nxsig_usleep() that is functionally equivalent to usleep() but does not cause a cancellaption point and does not modify the errno variable.

    sched/signal:  Add a new OS internal function nxsig_sleep() that is functionally equivalent to sleep() but does not cause a cancellaption point.
This commit is contained in:
Gregory Nutt
2017-10-06 10:15:01 -06:00
parent fdd0dcc0b6
commit 936df1bcb5
85 changed files with 569 additions and 189 deletions
+3 -2
View File
@@ -52,6 +52,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -2251,7 +2252,7 @@ static ssize_t efm32_out_transfer(FAR struct efm32_usbhost_s *priv, int chidx,
* using the same buffer pointer and length.
*/
usleep(20*1000);
nxsig_usleep(20*1000);
}
else
{
@@ -3915,7 +3916,7 @@ static int efm32_rh_enumerate(FAR struct efm32_usbhost_s *priv,
/* USB 2.0 spec says at least 50ms delay before port reset. We wait 100ms. */
usleep(100*1000);
nxsig_usleep(100*1000);
/* Reset the host port */
+5 -3
View File
@@ -55,6 +55,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
@@ -1679,8 +1680,9 @@ static inline int kinetis_initphy(struct kinetis_driver_s *priv)
retries = 0;
do
{
usleep(LINK_WAITUS);
ninfo("%s: Read PHYID1, retries=%d\n", BOARD_PHY_NAME, retries + 1);
nxsig_usleep(LINK_WAITUS);
ninfo("%s: Read PHYID1, retries=%d\n",
BOARD_PHY_NAME, retries + 1);
phydata = 0xffff;
ret = kinetis_readmii(priv, phyaddr, MII_PHYID1, &phydata);
}
@@ -1758,7 +1760,7 @@ static inline int kinetis_initphy(struct kinetis_driver_s *priv)
break;
}
usleep(LINK_WAITUS);
nxsig_usleep(LINK_WAITUS);
}
if (phydata & MII_MSR_ANEGCOMPLETE)
+2 -1
View File
@@ -56,6 +56,7 @@
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/i2c/i2c_master.h>
@@ -1043,7 +1044,7 @@ static int lc823450_i2c_transfer(FAR struct i2c_master_s *dev,
* transaction, STOP condition for write transaction
*/
usleep(10 * 1000);
nxsig_usleep(10 * 1000);
}
else
{
+9 -7
View File
@@ -40,16 +40,18 @@
* Included Files
****************************************************************************/
#include <errno.h>
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/clock.h>
#include <semaphore.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include "up_arch.h"
#include "lc823450_sddrv_type.h"
@@ -193,7 +195,7 @@ SINT_T sddep1_hw_init(struct SdDrCfg_s *cfg)
/* wait 15ms */
usleep(15000);
nxsig_usleep(15000);
irqstate_t flags = enter_critical_section();
@@ -286,7 +288,7 @@ void sddep_voltage_switch(struct SdDrCfg_s *cfg)
lc823450_gpio_config(GPIO_PORT0 | GPIO_PIN6 |
GPIO_MODE_OUTPUT | GPIO_VALUE_ONE);
usleep(200 * 1000);
nxsig_usleep(200 * 1000);
#endif
}
@@ -345,7 +347,7 @@ SINT_T sddep_wait(UI_32 ms, struct SdDrCfg_s *cfg)
}
else
{
usleep(ms * 1000);
nxsig_usleep(ms * 1000);
}
#endif
+2 -1
View File
@@ -56,6 +56,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbdev_trace.h>
@@ -1560,7 +1561,7 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
putreg32(~USB_DEVS_SOF, USB_DEVS);
usleep(100000);
nxsig_usleep(100000);
/* SOF is not arrived & D+/D- is HIGH */
+3 -2
View File
@@ -51,6 +51,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/ohci.h>
@@ -2057,7 +2058,7 @@ static int lpc17_rh_enumerate(struct usbhost_connection_s *conn,
/* USB 2.0 spec says at least 50ms delay before port reset */
(void)usleep(100*1000);
(void)nxsig_usleep(100*1000);
/* Put RH port 1 in reset (the LPC176x supports only a single downstream port) */
@@ -2070,7 +2071,7 @@ static int lpc17_rh_enumerate(struct usbhost_connection_s *conn,
/* Release RH port 1 from reset and wait a bit */
lpc17_putreg(OHCI_RHPORTST_PRSC, LPC17_USBHOST_RHPORTST1);
(void)usleep(200*1000);
(void)nxsig_usleep(200*1000);
return OK;
}
+4 -3
View File
@@ -52,6 +52,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -3569,7 +3570,7 @@ static int lpc31_rh_enumerate(FAR struct usbhost_connection_s *conn,
* reset for 50Msec, not wait 50Msec before resetting.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Paragraph 2.3.9:
*
@@ -3672,7 +3673,7 @@ static int lpc31_rh_enumerate(FAR struct usbhost_connection_s *conn,
* 50 ms."
*/
usleep(50*1000);
nxsig_usleep(50*1000);
regval = lpc31_getreg(regaddr);
regval &= ~EHCI_PORTSC_RESET;
@@ -3693,7 +3694,7 @@ static int lpc31_rh_enumerate(FAR struct usbhost_connection_s *conn,
*/
while ((lpc31_getreg(regaddr) & EHCI_PORTSC_RESET) != 0);
usleep(200*1000);
nxsig_usleep(200*1000);
/* EHCI Paragraph 4.2.2:
*
+4 -3
View File
@@ -51,6 +51,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -3406,7 +3407,7 @@ static int lpc43_rh_enumerate(FAR struct usbhost_connection_s *conn,
* reset for 50Msec, not wait 50Msec before resetting.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Paragraph 2.3.9:
*
@@ -3509,7 +3510,7 @@ static int lpc43_rh_enumerate(FAR struct usbhost_connection_s *conn,
* 50 ms."
*/
usleep(50*1000);
nxsig_usleep(50*1000);
regval = lpc43_getreg(regaddr);
regval &= ~EHCI_PORTSC_RESET;
@@ -3530,7 +3531,7 @@ static int lpc43_rh_enumerate(FAR struct usbhost_connection_s *conn,
*/
while ((lpc43_getreg(regaddr) & EHCI_PORTSC_RESET) != 0);
usleep(200*1000);
nxsig_usleep(200*1000);
/* EHCI Paragraph 4.2.2:
*
+2 -1
View File
@@ -61,6 +61,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbdev_trace.h>
@@ -3523,7 +3524,7 @@ static int sam_wakeup(struct usbdev_s *dev)
/* Wait 5msec in case we just entered the resume state */
usleep(5*1000);
nxsig_usleep(5*1000);
/* Set the ESR bit to send the remote resume */
+4 -3
View File
@@ -51,6 +51,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -3406,7 +3407,7 @@ static int sam_rh_enumerate(FAR struct usbhost_connection_s *conn,
* reset for 50Msec, not wait 50Msec before resetting.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Paragraph 2.3.9:
*
@@ -3512,7 +3513,7 @@ static int sam_rh_enumerate(FAR struct usbhost_connection_s *conn,
* 50 ms."
*/
usleep(50*1000);
nxsig_usleep(50*1000);
regval = sam_getreg(regaddr);
regval &= ~EHCI_PORTSC_RESET;
@@ -3533,7 +3534,7 @@ static int sam_rh_enumerate(FAR struct usbhost_connection_s *conn,
*/
while ((sam_getreg(regaddr) & EHCI_PORTSC_RESET) != 0);
usleep(200*1000);
nxsig_usleep(200*1000);
/* Paragraph 4.2.2:
*
+8 -5
View File
@@ -52,6 +52,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -1964,7 +1965,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
*
* Small delays could require more resolution than is provided
* by the system timer. For example, if the system timer
* resolution is 10MS, then usleep(1000) will actually request
* resolution is 10MS, then nxsig_usleep(1000) will actually request
* a delay 20MS (due to both quantization and rounding).
*
* REVISIT: So which is better? To ignore tiny delays and
@@ -1974,7 +1975,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
if (delay > CONFIG_USEC_PER_TICK)
{
usleep(delay - CONFIG_USEC_PER_TICK);
nxsig_usleep(delay - CONFIG_USEC_PER_TICK);
}
}
}
@@ -2276,7 +2277,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* using the same buffer pointer and length.
*/
usleep(20*1000);
nxsig_usleep(20*1000);
}
else
{
@@ -3942,9 +3943,11 @@ static int stm32_rh_enumerate(FAR struct stm32_usbhost_s *priv,
DEBUGASSERT(priv->smstate == SMSTATE_ATTACHED);
/* USB 2.0 spec says at least 50ms delay before port reset. We wait 100ms. */
/* USB 2.0 spec says at least 50ms delay before port reset. We wait
* 100ms.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Reset the host port */
+8 -5
View File
@@ -52,6 +52,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -1969,7 +1970,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
*
* Small delays could require more resolution than is provided
* by the system timer. For example, if the system timer
* resolution is 10MS, then usleep(1000) will actually request
* resolution is 10MS, then nxsig_usleep(1000) will actually request
* a delay 20MS (due to both quantization and rounding).
*
* REVISIT: So which is better? To ignore tiny delays and
@@ -1979,7 +1980,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
if (delay > CONFIG_USEC_PER_TICK)
{
usleep(delay - CONFIG_USEC_PER_TICK);
nxsig_usleep(delay - CONFIG_USEC_PER_TICK);
}
}
}
@@ -2281,7 +2282,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* using the same buffer pointer and length.
*/
usleep(20*1000);
nxsig_usleep(20*1000);
}
else
{
@@ -3947,9 +3948,11 @@ static int stm32_rh_enumerate(FAR struct stm32_usbhost_s *priv,
DEBUGASSERT(priv->smstate == SMSTATE_ATTACHED);
/* USB 2.0 spec says at least 50ms delay before port reset. We wait 100ms. */
/* USB 2.0 spec says at least 50ms delay before port reset. We wait
* 100ms.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Reset the host port */
+8 -5
View File
@@ -53,6 +53,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -1964,7 +1965,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
*
* Small delays could require more resolution than is provided
* by the system timer. For example, if the system timer
* resolution is 10MS, then usleep(1000) will actually request
* resolution is 10MS, then nxsig_usleep(1000) will actually request
* a delay 20MS (due to both quantization and rounding).
*
* REVISIT: So which is better? To ignore tiny delays and
@@ -1974,7 +1975,7 @@ static ssize_t stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
if (delay > CONFIG_USEC_PER_TICK)
{
usleep(delay - CONFIG_USEC_PER_TICK);
nxsig_usleep(delay - CONFIG_USEC_PER_TICK);
}
}
}
@@ -2276,7 +2277,7 @@ static ssize_t stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
* using the same buffer pointer and length.
*/
usleep(20*1000);
nxsig_usleep(20*1000);
}
else
{
@@ -3941,9 +3942,11 @@ static int stm32_rh_enumerate(FAR struct stm32_usbhost_s *priv,
DEBUGASSERT(priv->smstate == SMSTATE_ATTACHED);
/* USB 2.0 spec says at least 50ms delay before port reset. We wait 100ms. */
/* USB 2.0 spec says at least 50ms delay before port reset. We wait
* 100ms.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Reset the host port */
+8 -5
View File
@@ -53,6 +53,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -1968,7 +1969,7 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
*
* Small delays could require more resolution than is provided
* by the system timer. For example, if the system timer
* resolution is 10MS, then usleep(1000) will actually request
* resolution is 10MS, then nxsig_usleep(1000) will actually request
* a delay 20MS (due to both quantization and rounding).
*
* REVISIT: So which is better? To ignore tiny delays and
@@ -1978,7 +1979,7 @@ static ssize_t stm32l4_in_transfer(FAR struct stm32l4_usbhost_s *priv,
if (delay > CONFIG_USEC_PER_TICK)
{
usleep(delay - CONFIG_USEC_PER_TICK);
nxsig_usleep(delay - CONFIG_USEC_PER_TICK);
}
}
}
@@ -2281,7 +2282,7 @@ static ssize_t stm32l4_out_transfer(FAR struct stm32l4_usbhost_s *priv,
* using the same buffer pointer and length.
*/
usleep(20*1000);
nxsig_usleep(20*1000);
}
else
{
@@ -3947,9 +3948,11 @@ static int stm32l4_rh_enumerate(FAR struct stm32l4_usbhost_s *priv,
DEBUGASSERT(priv->smstate == SMSTATE_ATTACHED);
/* USB 2.0 spec says at least 50ms delay before port reset. We wait 100ms. */
/* USB 2.0 spec says at least 50ms delay before port reset. We wait
* 100ms.
*/
usleep(100*1000);
nxsig_usleep(100*1000);
/* Reset the host port */
+2 -1
View File
@@ -71,6 +71,7 @@
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/analog/adc.h>
#include <nuttx/analog/ioctl.h>
@@ -577,7 +578,7 @@ static int tiva_adc_ioctl(struct adc_dev_s *dev, int cmd, unsigned long arg)
tiva_adc_proc_trig(priv->devno, (uint8_t)SSE_PROC_TRIG(sse));
while (!tiva_adc_sse_int_status(priv->devno, sse))
{
usleep(100);
nxsig_usleep(100);
}
tiva_adc_sse_clear_int(priv->devno, sse);
+2 -1
View File
@@ -47,6 +47,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#include <nuttx/wireless/spirit.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
@@ -147,7 +148,7 @@ static int stm32l4_reset(FAR const struct spirit_lower_s *lower)
/* Wait minimum 1.5 ms to allow Spirit a proper boot-up sequence */
usleep(1500);
nxsig_usleep(1500);
return OK;
}
+4 -3
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* configs/cloudctrl/src/stm32_relays.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Darcy Gong <darcy.gong@gmail.com>
*
@@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <arch/board/board.h>
#include "cloudctrl.h"
@@ -244,11 +245,11 @@ void relays_onoff(int relays, uint32_t mdelay)
if (relays_getstat(relays))
{
relays_setstat(relays, false);
usleep(RELAYS_MIN_RESET_TIME*1000*1000);
nxsig_usleep(RELAYS_MIN_RESET_TIME*1000*1000);
}
relays_setstat(relays,true);
usleep(mdelay*100*1000);
nxsig_usleep(mdelay*100*1000);
relays_setstat(relays, false);
}
}
+2 -1
View File
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <nuttx/signal.h>
#include <nuttx/timers/watchdog.h>
#include <arch/board/board.h>
@@ -88,7 +89,7 @@ static int wdog_daemon(int argc, char *argv[])
while(1)
{
usleep((CONFIG_PHOTON_WDG_THREAD_INTERVAL)*1000);
nxsig_usleep((CONFIG_PHOTON_WDG_THREAD_INTERVAL)*1000);
/* Send keep alive ioctl */
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************
* configs/sam4s-xplained-pro/src/up_wdt.c
*
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2016-2017 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Bob Doiron
*
@@ -48,6 +48,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <nuttx/signal.h>
#include <nuttx/timers/watchdog.h>
#include <arch/board/board.h>
@@ -114,10 +115,10 @@ static int wdog_daemon(int argc, char *argv[])
goto errout_with_dev;
}
usleep(200);
nxsig_usleep(200);
while(1)
{
usleep((CONFIG_WDT_THREAD_INTERVAL)*1000);
nxsig_usleep((CONFIG_WDT_THREAD_INTERVAL)*1000);
wdinfo("ping\n");
ret = ioctl(fd, WDIOC_KEEPALIVE, 0);
+2 -1
View File
@@ -46,6 +46,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
#include <nuttx/wireless/ieee802154/xbee.h>
@@ -154,7 +155,7 @@ static int sam_reset(FAR const struct xbee_lower_s *lower)
/* Wait minimum 1.5 ms to allow Xbee a proper boot-up sequence */
/* TODO: Update time according to datasheet */
usleep(1500);
nxsig_usleep(1500);
return OK;
}
+4 -3
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* configs/shenzhou/src/stm32_relays.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Darcy Gong
*
@@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <arch/board/board.h>
#include "shenzhou.h"
@@ -244,11 +245,11 @@ void relays_onoff(int relays, uint32_t mdelay)
if (relays_getstat(relays))
{
relays_setstat(relays, false);
usleep(RELAYS_MIN_RESET_TIME*1000*1000);
nxsig_usleep(RELAYS_MIN_RESET_TIME*1000*1000);
}
relays_setstat(relays,true);
usleep(mdelay*100*1000);
nxsig_usleep(mdelay*100*1000);
relays_setstat(relays, false);
}
}
+7 -4
View File
@@ -36,15 +36,18 @@
* Included Files
****************************************************************************/
#include <debug.h>
#include <nuttx/config.h>
#include <nuttx/mmcsd.h>
#include <nuttx/spi/spi.h>
#include <pthread.h>
#include <sched.h>
#include <semaphore.h>
#include <time.h>
#include <unistd.h>
#include <debug.h>
#include <nuttx/mmcsd.h>
#include <nuttx/signal.h>
#include <nuttx/spi/spi.h>
#include "stm32.h"
#include "stm32_butterfly2.h"
@@ -109,7 +112,7 @@ static void *stm32_cd_thread(void *arg)
* rest for a millsecond or so.
*/
usleep(1 * 1000);
nxsig_usleep(1 * 1000);
g_chmediaclbk(g_chmediaarg);
}
}
+5 -4
View File
@@ -46,9 +46,10 @@
#include <errno.h>
#include <unistd.h>
#include <nuttx/fs/fs.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#include <nuttx/modem/u-blox.h>
#include <arch/board/board.h>
@@ -182,7 +183,7 @@ static int lpc17_poweron(FAR struct ubxmdm_lower* lower)
lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ONE); /* Modem not in reset */
lpc17_configgpio(priv->pins->power_on_n | GPIO_VALUE_ZERO); /* Switch closed to GND */
usleep(10 * 1000); /* Min. time for power_on_n being low is 5 ms */
nxsig_usleep(10 * 1000); /* Min. time for power_on_n being low is 5 ms */
if (priv->usb_used)
{
@@ -196,7 +197,7 @@ static int lpc17_poweron(FAR struct ubxmdm_lower* lower)
lpc17_configgpio(priv->pins->usb_detect | usb_detect_val);
lpc17_configgpio(priv->pins->ldo_enable | GPIO_VALUE_ONE); /* LDO enabled */
usleep(1 * 1000); /* Delay to obtain correct voltage on shifters */
nxsig_usleep(1 * 1000); /* Delay to obtain correct voltage on shifters */
lpc17_configgpio(priv->pins->shifter_en_n | GPIO_VALUE_ZERO); /* UART shifter enabled */
/* lpc17_configgpio(priv->pins->power_on_n | GPIO_VALUE_ONE); * Stop current through switch */
@@ -224,7 +225,7 @@ static int lpc17_reset(FAR struct ubxmdm_lower* lower)
(FAR struct lpc17_ubxmdm_lower*) lower;
lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ZERO); /* Modem in reset */
usleep(75 * 1000); /* The minimum reset_n low time is 50 ms */
nxsig_usleep(75 * 1000); /* The minimum reset_n low time is 50 ms */
lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ONE); /* Modem not in reset */
return OK;
@@ -1,7 +1,7 @@
/****************************************************************************
* configs/viewtool-stm32f107/src/stm32_highpri.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include <unistd.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <arch/irq.h>
#include <arch/chip/chip.h>
@@ -226,7 +227,7 @@ int highpri_main(int argc, char *argv[])
/* Flush stdout and wait a bit */
fflush(stdout);
sleep(1);
nxsig_sleep(1);
seconds++;
/* Sample counts so that they are not volatile. Missing a count now
+3 -2
View File
@@ -56,6 +56,7 @@
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/spi/spi.h>
#include <nuttx/analog/adc.h>
@@ -281,7 +282,7 @@ static void adc_reset(FAR struct adc_dev_s *dev)
spi = priv->spi;
adc_lock(spi);
usleep(1000);
nxsig_usleep(1000);
SPI_SELECT(spi, priv->devno, true);
SPI_SEND(spi, ADS125X_WREG + 0x03); /* WRITE SPS REG */
@@ -332,7 +333,7 @@ static int adc_setup(FAR struct adc_dev_s *dev)
SPI_SEND(spi, priv->mux[0]);
SPI_SEND(spi, priv->pga); /* REG2 ADCON PGA=2 */
SPI_SEND(spi, getspsreg(priv->sps));
usleep(1000);
nxsig_usleep(1000);
SPI_SEND(spi, ADS125X_SELFCAL);
SPI_SELECT(spi, priv->devno, false);
+2 -1
View File
@@ -56,6 +56,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/fs/fs.h>
#include <nuttx/analog/dac.h>
@@ -204,7 +205,7 @@ static int dac_close(FAR struct file *filep)
while (dev->ad_xmit.af_head != dev->ad_xmit.af_tail)
{
#ifndef CONFIG_DISABLE_SIGNALS
usleep(HALF_SECOND_USEC);
nxsig_usleep(HALF_SECOND_USEC);
#else
up_mdelay(HALF_SECOND_MSEC);
#endif
+8 -7
View File
@@ -54,6 +54,7 @@
#include <queue.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/audio/audio.h>
@@ -342,7 +343,7 @@ static void vs1053_writereg(FAR struct vs1053_struct_s *dev, uint8_t reg, uint16
/* Short delay after a write for VS1053 processing time */
usleep(10);
nxsig_usleep(10);
}
/****************************************************************************
@@ -417,7 +418,7 @@ static int vs1053_setfrequency(FAR struct vs1053_struct_s *dev, uint32_t freq)
timeout = 200;
while (!dev->hw_lower->read_dreq(dev->hw_lower) && timeout)
{
usleep(1000);
nxsig_usleep(1000);
timeout--;
}
@@ -896,9 +897,9 @@ static int vs1053_hardreset(FAR struct vs1053_struct_s *dev)
{
dev->hw_lower->disable(dev->hw_lower); /* Disable the DREQ interrupt */
dev->hw_lower->reset(dev->hw_lower, false);
usleep(10);
nxsig_usleep(10);
dev->hw_lower->reset(dev->hw_lower, true);
usleep(VS1053_RST_USECS);
nxsig_usleep(VS1053_RST_USECS);
vs1053_setfrequency(dev, CONFIG_VS1053_XTALI); /* Slow speed at first */
return OK;
@@ -1269,7 +1270,7 @@ static void *vs1053_workerthread(pthread_addr_t pvarg)
timeout = 200;
while (!dev->hw_lower->read_dreq(dev->hw_lower) && timeout)
{
usleep(100);
nxsig_usleep(100);
timeout--;
}
@@ -1305,7 +1306,7 @@ static void *vs1053_workerthread(pthread_addr_t pvarg)
/* The ISR has requested more data */
case AUDIO_MSG_DATA_REQUEST:
usleep(500);
nxsig_usleep(500);
vs1053_feeddata(dev); /* Feed more data to the VS1053 FIFO */
break;
@@ -1315,7 +1316,7 @@ static void *vs1053_workerthread(pthread_addr_t pvarg)
case AUDIO_MSG_STOP:
if (!dev->hw_lower->read_dreq(dev->hw_lower))
{
usleep(300);
nxsig_usleep(300);
}
/* Send CANCEL message to VS1053 */
+3 -2
View File
@@ -63,6 +63,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/clock.h>
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
@@ -923,7 +924,7 @@ static void wm8904_setbitrate(FAR struct wm8904_dev_s *priv)
retries = 5;
do
{
usleep(5*5000);
nxsig_usleep(5*5000);
}
while (priv->locked == false && --retries > 0);
@@ -946,7 +947,7 @@ static void wm8904_setbitrate(FAR struct wm8904_dev_s *priv)
retries = 5;
do
{
usleep(5*5000);
nxsig_usleep(5*5000);
}
while ((wm8904_readreg(priv, WM8904_INT_STATUS) & WM8904_FLL_LOCK_INT) != 0 ||
--retries > 0);
+3 -2
View File
@@ -56,6 +56,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/fs/fs.h>
#include <nuttx/can/can.h>
@@ -520,7 +521,7 @@ static int can_close(FAR struct file *filep)
while (dev->cd_xmit.tx_head != dev->cd_xmit.tx_tail)
{
#ifndef CONFIG_DISABLE_SIGNALS
usleep(HALF_SECOND_USEC);
nxsig_usleep(HALF_SECOND_USEC);
#else
up_mdelay(HALF_SECOND_MSEC);
#endif
@@ -531,7 +532,7 @@ static int can_close(FAR struct file *filep)
while (!dev_txempty(dev))
{
#ifndef CONFIG_DISABLE_SIGNALS
usleep(HALF_SECOND_USEC);
nxsig_usleep(HALF_SECOND_USEC);
#else
up_mdelay(HALF_SECOND_MSEC);
#endif
+3 -2
View File
@@ -51,6 +51,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/kmalloc.h>
#include <nuttx/spi/spi.h>
@@ -1135,7 +1136,7 @@ static void mcp2515_reset_lowlevel(FAR struct mcp2515_can_s *priv)
/* Wait 1ms to let MCP2515 restart */
usleep(1000);
nxsig_usleep(1000);
/* Make sure that all buffers are released.
*
@@ -2434,7 +2435,7 @@ static int mcp2515_hw_initialize(struct mcp2515_can_s *priv)
regval = (regval & ~CANCTRL_REQOP_MASK) | (CANCTRL_REQOP_NORMAL);
mcp2515_writeregs(priv, MCP2515_CANCTRL, &regval, 1);
usleep(100);
nxsig_usleep(100);
/* Read the CANINTF */
+3 -2
View File
@@ -50,6 +50,7 @@
#include <unistd.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/contactless/mfrc522.h>
#include "mfrc522.h"
@@ -1107,7 +1108,7 @@ void mfrc522_softreset(FAR struct mfrc522_dev_s *dev)
/* Wait the internal state machine to initialize */
usleep(50000);
nxsig_usleep(50000);
/* Wait for the PowerDown bit in COMMAND_REG to be cleared */
@@ -1381,7 +1382,7 @@ static int mfrc522_open(FAR struct file *filep)
mfrc522_configspi(dev->spi);
usleep(10000);
nxsig_usleep(10000);
mfrc522_getfwversion(dev);
+5 -4
View File
@@ -48,6 +48,7 @@
#include <unistd.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include "pn532.h"
@@ -340,7 +341,7 @@ static int pn532_wait_rx_ready(struct pn532_dev_s *dev, int timeout)
return -ETIMEDOUT;
}
usleep(1000);
nxsig_usleep(1000);
}
dev->state = PN532_STATE_DATA_READY;
@@ -370,7 +371,7 @@ static void pn532_writecommand(struct pn532_dev_s *dev, uint8_t cmd)
pn532_lock(dev->spi);
pn532_select(dev);
usleep(10000);
nxsig_usleep(10000);
SPI_SEND(dev->spi, PN532_SPI_DATAWRITE);
SPI_SNDBLOCK(dev->spi, f, FRAME_SIZE(f));
@@ -478,7 +479,7 @@ int pn532_write_frame(struct pn532_dev_s *dev, struct pn532_frame *f)
pn532_lock(dev->spi);
pn532_select(dev);
usleep(2000);
nxsig_usleep(2000);
SPI_SEND(dev->spi, PN532_SPI_DATAWRITE);
SPI_SNDBLOCK(dev->spi, f, FRAME_SIZE(f));
@@ -879,7 +880,7 @@ static int _open(FAR struct file *filep)
pn532_configspi(dev->spi);
dev->config->reset(1);
usleep(10000);
nxsig_usleep(10000);
pn532_sam_config(dev, NULL);
pn532_get_fw_version(dev, NULL);
+2 -1
View File
@@ -122,6 +122,7 @@
#include <nuttx/fs/fs.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/spi/spi.h>
/****************************************************************************
@@ -382,7 +383,7 @@ static void ee25xx_waitwritecomplete(struct ee25xx_dev_s *priv)
if ((status & EE25XX_SR_WIP) != 0)
{
ee25xx_unlock(priv->spi);
usleep(1000);
nxsig_usleep(1000);
ee25xx_lock(priv->spi);
}
}
+6 -5
View File
@@ -47,8 +47,9 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/input/cypress_mbr3108.h>
@@ -424,7 +425,7 @@ static int mbr3108_save_check_crc(FAR struct mbr3108_dev_s *dev)
return ret;
}
usleep(MBR3108_CMD_MSECS_CHECK_CONFIG_CRC * 1000);
nxsig_usleep(MBR3108_CMD_MSECS_CHECK_CONFIG_CRC * 1000);
ret = mbr3108_check_cmd_status(dev);
if (ret != 0)
@@ -448,7 +449,7 @@ static int mbr3108_software_reset(FAR struct mbr3108_dev_s *dev)
return ret;
}
usleep(MBR3108_CMD_MSECS_SOFTWARE_RESET * 1000);
nxsig_usleep(MBR3108_CMD_MSECS_SOFTWARE_RESET * 1000);
ret = mbr3108_check_cmd_status(dev);
if (ret != 0)
@@ -492,7 +493,7 @@ static int mbr3108_clear_latched(FAR struct mbr3108_dev_s *dev)
return ret;
}
usleep(MBR3108_CMD_MSECS_CLEAR_LATCHED * 1000);
nxsig_usleep(MBR3108_CMD_MSECS_CLEAR_LATCHED * 1000);
ret = mbr3108_check_cmd_status(dev);
if (ret != 0)
@@ -906,7 +907,7 @@ static int mbr3108_open(FAR struct file *filep)
/* Let chip to power up before probing */
usleep(100 * 1000);
nxsig_usleep(100 * 1000);
/* Check that device exists on I2C. */
+2 -1
View File
@@ -66,6 +66,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/random.h>
#include <nuttx/signal.h>
#include <nuttx/semaphore.h>
#include <nuttx/input/touchscreen.h>
#include <nuttx/input/mxt.h>
@@ -1794,7 +1795,7 @@ static int mxt_hwinitialize(FAR struct mxt_dev_s *priv)
goto errout_with_objtab;
}
usleep(MXT_RESET_TIME);
nxsig_usleep(MXT_RESET_TIME);
/* Update matrix size in the info structure */
+5 -4
View File
@@ -49,6 +49,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/signal.h>
#include <nuttx/input/stmpe811.h>
#include "stmpe811.h"
@@ -236,12 +237,12 @@ uint16_t stmpe811_adcread(STMPE811_HANDLE handle, int pin)
for (i = 0; i < 3; i++)
{
/* The worst case ADC conversion time is (nominally) 56.4 uS. The
* following usleep() looks nice but in reality, the usleep()
* does not have that kind of precision (it will probably end up
* waiting 10 MS).
* following nxsig_usleep() looks nice but in reality, nxsig_usleep()
* normal does not have that kind of precision (it will probably end
* up waiting 10 MS).
*/
usleep(57);
nxsig_usleep(57);
/* Check if the conversion is complete */
+2 -1
View File
@@ -48,6 +48,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/input/stmpe811.h>
#include "stmpe811.h"
@@ -234,7 +235,7 @@ static void stmpe811_reset(FAR struct stmpe811_dev_s *priv)
/* Wait a bit */
usleep(20*1000);
nxsig_usleep(20*1000);
/* Then power on again. All registers will be in their reset state. */
+2 -1
View File
@@ -70,6 +70,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/random.h>
#include <nuttx/signal.h>
#include <nuttx/input/touchscreen.h>
#include <nuttx/input/tsc2007.h>
@@ -515,7 +516,7 @@ static int tsc2007_transfer(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
* least 10ms before attempting to read data from the TSC2007...
*/
usleep(10*1000);
nxsig_usleep(10*1000);
/* "Data access begins with the master issuing a START condition followed
* by the address byte ... with R/W = 1.
+6 -5
View File
@@ -45,6 +45,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/ascii.h>
#include <nuttx/fs/fs.h>
#include <nuttx/lcd/slcd_codec.h>
@@ -551,7 +552,7 @@ static void lcd_init(FAR struct pcf8574_lcd_dev_s *priv)
{
/* Wait for more than 15 ms after Vcc for the LCD to stabilize */
usleep(50000);
nxsig_usleep(50000);
/* Perform the init sequence. This sequence of commands is constructed so
* that it will get the device into nybble mode irrespective of what state
@@ -564,22 +565,22 @@ static void lcd_init(FAR struct pcf8574_lcd_dev_s *priv)
/* Send Command 0x30, set 8-bit mode, and wait > 4.1 ms */
latch_nybble(priv, 0x30>>4, false);
usleep(5000);
nxsig_usleep(5000);
/* Send Command 0x30, set 8-bit mode, and wait > 100 us */
latch_nybble(priv, 0x30>>4, false);
usleep(5000);
nxsig_usleep(5000);
/* Send Command 0x30, set 8-bit mode */
latch_nybble(priv, 0x30>>4, false);
usleep(200);
nxsig_usleep(200);
/* now Function set: Set interface to be 4 bits long (only 1 cycle write for the first time). */
latch_nybble(priv, 0x20>>4, false);
usleep(5000);
nxsig_usleep(5000);
/* Function set: DL=0;Interface is 4 bits, N=1 (2 Lines), F=0 (5x8 dots font) */
+3 -2
View File
@@ -42,8 +42,9 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/leds/ncp5623c.h>
#if defined(CONFIG_I2C) && defined(CONFIG_NCP5623C)
@@ -170,7 +171,7 @@ static int ncp5623c_open(FAR struct file *filep)
/* Let the chip settle a bit */
usleep(1);
nxsig_usleep(1);
return OK;
}
+3 -2
View File
@@ -42,8 +42,9 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/leds/pca9635pw.h>
#if defined(CONFIG_I2C) && defined(CONFIG_PCA9635PW)
@@ -212,7 +213,7 @@ static int pca9635pw_open(FAR struct file *filep)
* left.
*/
usleep(500);
nxsig_usleep(500);
/* Turn all led drivers to mode 2 in which the led brightness is controlled
* by the indiviual pwm registers.
+4 -3
View File
@@ -58,6 +58,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/mtd/mtd.h>
@@ -283,7 +284,7 @@ static int at24c_eraseall(FAR struct at24c_dev_s *priv)
return -ETIMEDOUT;
}
usleep(1000);
nxsig_usleep(1000);
}
at24c_i2c_write(priv, at24addr, buf, AT24XX_PAGESIZE + AT24XX_ADDRSIZE);
@@ -349,7 +350,7 @@ static ssize_t at24c_read_internal(FAR struct at24c_dev_s *priv, off_t offset,
return -ETIMEDOUT;
}
usleep(1000);
nxsig_usleep(1000);
}
/* Then transfer the following bytes */
@@ -472,7 +473,7 @@ static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t
return -ETIMEDOUT;
}
usleep(1000);
nxsig_usleep(1000);
}
memcpy(&buf[AT24XX_ADDRSIZE], buffer, priv->pagesize);
+2 -1
View File
@@ -50,6 +50,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mtd/mtd.h>
@@ -284,7 +285,7 @@ static void at25_waitwritecomplete(struct at25_dev_s *priv)
if ((status & AT25_SR_BUSY) != 0)
{
at25_unlock(priv->dev);
usleep(10000);
nxsig_usleep(10000);
at25_lock(priv->dev);
}
}
+2 -1
View File
@@ -54,6 +54,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mtd/mtd.h>
@@ -374,7 +375,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
if ((status & IS25_SR_WIP) != 0)
{
is25xp_unlock(priv->dev);
usleep(1000);
nxsig_usleep(1000);
is25xp_lock(priv->dev);
}
}
+2 -1
View File
@@ -50,6 +50,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mtd/mtd.h>
@@ -492,7 +493,7 @@ static void m25p_waitwritecomplete(struct m25p_dev_s *priv)
if ((status & M25P_SR_WIP) != 0)
{
m25p_unlock(priv->dev);
usleep(1000);
nxsig_usleep(1000);
m25p_lock(priv->dev);
}
}
+2 -1
View File
@@ -54,6 +54,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mtd/mtd.h>
@@ -396,7 +397,7 @@ static void mx25l_waitwritecomplete(FAR struct mx25l_dev_s *priv)
if ((status & MX25L_SR_WIP) != 0)
{
mx25l_unlock(priv->dev);
usleep(1000);
nxsig_usleep(1000);
mx25l_lock(priv->dev);
}
}
+5 -3
View File
@@ -47,6 +47,8 @@
#include <stdint.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/qspi.h>
#include <nuttx/mtd/mtd.h>
@@ -397,7 +399,7 @@ int mx25rxx_erase_sector(struct mx25rxx_dev_s *priv, off_t sector)
do
{
usleep(50*1000);
nxsig_usleep(50*1000);
mx25rxx_read_status(priv);
status = priv->cmdbuf[0];
}
@@ -421,7 +423,7 @@ int mx25rxx_erase_block(struct mx25rxx_dev_s *priv, off_t block)
do
{
usleep(300*1000);
nxsig_usleep(300*1000);
mx25rxx_read_status(priv);
status = priv->cmdbuf[0];
}
@@ -446,7 +448,7 @@ int mx25rxx_erase_chip(struct mx25rxx_dev_s *priv)
while ((status & MX25R_SR_WIP) != 0)
{
sleep(2);
nxsig_sleep(2);
mx25rxx_read_status(priv);
status = priv->cmdbuf[0];
}
+2 -1
View File
@@ -52,6 +52,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/qspi.h>
#include <nuttx/mtd/mtd.h>
@@ -855,7 +856,7 @@ static int n25qxxx_erase_chip(struct n25qxxx_dev_s *priv)
status = n25qxxx_read_status(priv);
while ((status & STATUS_BUSY_MASK) != 0)
{
usleep(200*1000);
nxsig_usleep(200*1000);
status = n25qxxx_read_status(priv);
}
+3 -2
View File
@@ -52,6 +52,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/qspi.h>
#include <nuttx/mtd/mtd.h>
@@ -890,7 +891,7 @@ static int s25fl1_erase_chip(struct s25fl1_dev_s *priv)
status = sf25fl1_read_status1(priv);
while ((status & STATUS1_BUSY_MASK) != 0)
{
usleep(200*1000);
nxsig_usleep(200*1000);
status = sf25fl1_read_status1(priv);
}
@@ -1511,7 +1512,7 @@ FAR struct mtd_dev_s *s25fl1_initialize(FAR struct qspi_dev_s *qspi, bool unprot
priv->cmdbuf[1] |= STATUS2_QUAD_ENABLE;
s25fl1_write_status(priv);
priv->cmdbuf[1] = sf25fl1_read_status2(priv);
usleep(50*1000);
nxsig_usleep(50*1000);
}
/* Unprotect FLASH sectors if so requested. */
+2 -1
View File
@@ -57,6 +57,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mtd/mtd.h>
@@ -425,7 +426,7 @@ static uint8_t sst25_waitwritecomplete(struct sst25_dev_s *priv)
if ((status & SST25_SR_BUSY) != 0)
{
sst25_unlock(priv->dev);
usleep(1000);
nxsig_usleep(1000);
sst25_lock(priv->dev);
}
#endif

Some files were not shown because too many files have changed in this diff Show More