mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
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:
parent
fdd0dcc0b6
commit
936df1bcb5
85 changed files with 569 additions and 189 deletions
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, ®val, 1);
|
||||
|
||||
usleep(100);
|
||||
nxsig_usleep(100);
|
||||
|
||||
/* Read the CANINTF */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -56,6 +56,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>
|
||||
|
@ -348,7 +349,7 @@ static void sst25xx_waitwritecomplete(struct sst25xx_dev_s *priv)
|
|||
if ((status & SST25_SR_WIP) != 0)
|
||||
{
|
||||
sst25xx_unlock(priv->dev);
|
||||
usleep(1000);
|
||||
nxsig_usleep(1000);
|
||||
sst25xx_lock(priv->dev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,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>
|
||||
|
@ -407,7 +408,7 @@ static void sst26_waitwritecomplete(struct sst26_dev_s *priv)
|
|||
if ((status & SST26_SR_WIP) != 0)
|
||||
{
|
||||
sst26_unlock(priv->dev);
|
||||
usleep(1000);
|
||||
nxsig_usleep(1000);
|
||||
sst26_lock(priv->dev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/mtd/mtd.h>
|
||||
|
||||
|
@ -454,12 +455,12 @@ static int sst39vf_chiperase(FAR struct sst39vf_dev_s *priv)
|
|||
|
||||
/* No, wait one system clock tick */
|
||||
|
||||
usleep(USEC_PER_TICK);
|
||||
nxsig_usleep(USEC_PER_TICK);
|
||||
}
|
||||
#else
|
||||
/* Delay the maximum amount of time for the chip erase to complete. */
|
||||
|
||||
usleep(SST39VF_TSCE_MSEC * USEC_PER_MSEC);
|
||||
nxsig_usleep(SST39VF_TSCE_MSEC * USEC_PER_MSEC);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
|
@ -530,12 +531,12 @@ static int sst39vf_sectorerase(FAR struct sst39vf_dev_s *priv,
|
|||
|
||||
/* No, wait one system clock tick */
|
||||
|
||||
usleep(USEC_PER_TICK);
|
||||
nxsig_usleep(USEC_PER_TICK);
|
||||
}
|
||||
#else
|
||||
/* Delay the maximum amount of time for the sector erase to complete. */
|
||||
|
||||
usleep(SST39VF_TSE_MSEC * USEC_PER_MSEC);
|
||||
nxsig_usleep(SST39VF_TSE_MSEC * USEC_PER_MSEC);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -52,6 +52,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>
|
||||
|
@ -521,7 +522,7 @@ static uint8_t w25_waitwritecomplete(struct w25_dev_s *priv)
|
|||
if (priv->prev_instr != W25_PP && (status & W25_SR_BUSY) != 0)
|
||||
{
|
||||
w25_unlock(priv->spi);
|
||||
usleep(1000);
|
||||
nxsig_usleep(1000);
|
||||
w25_lock(priv->spi);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
@ -134,7 +135,7 @@
|
|||
struct slip_driver_s
|
||||
{
|
||||
volatile bool bifup; /* true:ifup false:ifdown */
|
||||
bool txnodelay; /* True: usleep() not needed */
|
||||
bool txnodelay; /* True: nxsig_usleep() not needed */
|
||||
int16_t fd; /* TTY file descriptor */
|
||||
uint16_t rxlen; /* The number of bytes in rxbuf */
|
||||
pid_t rxpid; /* Receiver thread ID */
|
||||
|
@ -456,7 +457,7 @@ static void slip_txtask(int argc, FAR char *argv[])
|
|||
if (!priv->txnodelay)
|
||||
{
|
||||
slip_semgive(priv);
|
||||
usleep(SLIP_WDDELAY);
|
||||
nxsig_usleep(SLIP_WDDELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/power/battery_charger.h>
|
||||
#include <nuttx/power/battery_ioctl.h>
|
||||
|
@ -294,7 +295,7 @@ static inline int bq2425x_reset(FAR struct bq2425x_dev_s *priv)
|
|||
|
||||
/* Wait a little bit to clear registers */
|
||||
|
||||
usleep(500);
|
||||
nxsig_usleep(500);
|
||||
|
||||
/* There is a BUG in BQ2425X the RESET bit is always read as 1 */
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/power/battery_charger.h>
|
||||
#include <nuttx/power/battery_ioctl.h>
|
||||
|
@ -344,7 +345,7 @@ static int bq2429x_reset(FAR struct bq2429x_dev_s *priv)
|
|||
|
||||
/* Wait a little bit to clear registers */
|
||||
|
||||
usleep(500);
|
||||
nxsig_usleep(500);
|
||||
|
||||
#if 0
|
||||
/* There is a BUG in BQ2429X the RESET bit is always read as 1 */
|
||||
|
|
|
@ -47,8 +47,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/sensors/adxl345.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/random.h>
|
||||
#include <nuttx/sensors/adxl345.h>
|
||||
|
||||
#include "adxl345.h"
|
||||
|
||||
|
@ -359,7 +360,7 @@ static void adxl345_reset(FAR struct adxl345_dev_s *priv)
|
|||
|
||||
/* Wait a bit to make the GOD of TIME happy */
|
||||
|
||||
usleep(20*1000);
|
||||
nxsig_usleep(20*1000);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/bmp180.h>
|
||||
|
@ -402,7 +403,7 @@ static void bmp180_read_press_temp(FAR struct bmp180_dev_s *priv)
|
|||
|
||||
/* Wait 5ms */
|
||||
|
||||
usleep(5000);
|
||||
nxsig_usleep(5000);
|
||||
|
||||
/* Read temperature */
|
||||
|
||||
|
@ -414,7 +415,7 @@ static void bmp180_read_press_temp(FAR struct bmp180_dev_s *priv)
|
|||
|
||||
/* Delay 25.5ms (to OverSampling 8X) */
|
||||
|
||||
usleep(25500);
|
||||
nxsig_usleep(25500);
|
||||
|
||||
/* Read pressure */
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@
|
|||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/sensors/hc_sr04.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -144,7 +145,7 @@ static int hcsr04_start_measuring(FAR struct hcsr04_dev_s *priv)
|
|||
/* Send to 10uS trigger pulse */
|
||||
|
||||
priv->config->set_trigger(priv->config, true);
|
||||
usleep(10);
|
||||
nxsig_usleep(10);
|
||||
priv->config->set_trigger(priv->config, false);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/kxtj9.h>
|
||||
|
@ -303,7 +304,7 @@ static void kxtj9_soft_reset(FAR struct kxtj9_dev_s *priv)
|
|||
|
||||
/* Delay 10ms for the accel parts to re-initialize */
|
||||
|
||||
usleep(10000);
|
||||
nxsig_usleep(10000);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -49,9 +49,10 @@
|
|||
#include <poll.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/random.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
#include <nuttx/sensors/lis2dh.h>
|
||||
|
||||
|
@ -1121,7 +1122,7 @@ static int lis2dh_handle_selftest(FAR struct lis2dh_dev_s *priv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
usleep(20000);
|
||||
nxsig_usleep(20000);
|
||||
|
||||
/* Now INT1 should have been latched high and INT2 should be still low */
|
||||
|
||||
|
@ -1150,7 +1151,7 @@ static int lis2dh_handle_selftest(FAR struct lis2dh_dev_s *priv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
usleep(20000);
|
||||
nxsig_usleep(20000);
|
||||
|
||||
if (priv->config->read_int2_pin() != 1)
|
||||
{
|
||||
|
@ -1256,7 +1257,7 @@ static FAR const struct lis2dh_vector_s *
|
|||
|
||||
while (--retries_left > 0)
|
||||
{
|
||||
usleep(20000);
|
||||
nxsig_usleep(20000);
|
||||
if (lis2dh_data_available(dev))
|
||||
{
|
||||
if (lis2dh_access(dev, ST_LIS2DH_OUT_X_L_REG, retval,
|
||||
|
@ -1692,7 +1693,7 @@ static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev)
|
|||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
usleep(1);
|
||||
nxsig_usleep(1);
|
||||
}
|
||||
while (true);
|
||||
|
||||
|
|
|
@ -47,10 +47,11 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/random.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/sensors/mpl115a.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_MPL115A)
|
||||
|
||||
|
@ -215,7 +216,7 @@ static void mpl115a_read_press_temp(FAR struct mpl115a_dev_s *priv)
|
|||
|
||||
/* Delay 5ms */
|
||||
|
||||
usleep(5000);
|
||||
nxsig_usleep(5000);
|
||||
|
||||
priv->mpl115a_pressure = mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_PADC_MSB << 1)) << 8;
|
||||
priv->mpl115a_pressure |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_PADC_LSB << 1));
|
||||
|
|
|
@ -45,10 +45,11 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/random.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/sensors/veml6070.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_VEML6070)
|
||||
|
||||
|
@ -248,7 +249,7 @@ static ssize_t veml6070_read(FAR struct file *filep, FAR char *buffer,
|
|||
|
||||
/* 1T for Rset 270Kohms is 125ms */
|
||||
|
||||
usleep(125000);
|
||||
nxsig_usleep(125000);
|
||||
|
||||
/* Read the MSB first */
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/serial/serial.h>
|
||||
|
@ -452,7 +453,7 @@ static int uart_tcdrain(FAR uart_dev_t *dev)
|
|||
while (!uart_txempty(dev))
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
usleep(HALF_SECOND_USEC);
|
||||
nxsig_usleep(HALF_SECOND_USEC);
|
||||
#else
|
||||
up_mdelay(HALF_SECOND_MSEC);
|
||||
#endif
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/spi/spi_transfer.h>
|
||||
|
||||
|
@ -148,7 +149,7 @@ int spi_transfer(FAR struct spi_dev_s *spi, FAR struct spi_sequence_s *seq)
|
|||
|
||||
if (trans->delay > 0)
|
||||
{
|
||||
usleep(trans->delay);
|
||||
nxsig_usleep(trans->delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/usbhost/usbhost_enumerate.c
|
||||
*
|
||||
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
#include <nuttx/usb/hub.h>
|
||||
|
@ -433,7 +434,7 @@ int usbhost_enumerate(FAR struct usbhost_hubport_s *hport,
|
|||
goto errout;
|
||||
}
|
||||
|
||||
usleep(2*1000);
|
||||
nxsig_usleep(2*1000);
|
||||
|
||||
/* Assign the function address to the port */
|
||||
|
||||
|
@ -531,7 +532,7 @@ int usbhost_enumerate(FAR struct usbhost_hubport_s *hport,
|
|||
|
||||
/* Some devices may require some delay before initialization */
|
||||
|
||||
usleep(100*1000);
|
||||
nxsig_usleep(100*1000);
|
||||
|
||||
#ifdef CONFIG_USBHOST_COMPOSITE
|
||||
/* Check if the device attached to the downstream port if a USB composite
|
||||
|
|
|
@ -57,10 +57,11 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
@ -96,7 +97,7 @@
|
|||
# warning "Worker thread support is required (CONFIG_SCHED_WORKQUEUE)"
|
||||
#endif
|
||||
|
||||
/* Signals must not be disabled as they are needed by usleep. Need to have
|
||||
/* Signals must not be disabled as they are needed by nxsig_usleep. Need to have
|
||||
* CONFIG_DISABLE_SIGNALS=n
|
||||
*/
|
||||
|
||||
|
@ -1039,7 +1040,7 @@ static int usbhost_kbdpoll(int argc, char *argv[])
|
|||
|
||||
priv->polling = true;
|
||||
usbhost_givesem(&g_syncsem);
|
||||
sleep(1);
|
||||
nxsig_sleep(1);
|
||||
|
||||
/* Loop here until the device is disconnected */
|
||||
|
||||
|
@ -1250,7 +1251,7 @@ static int usbhost_kbdpoll(int argc, char *argv[])
|
|||
delay = CONFIG_HIDKBD_POLLUSEC;
|
||||
}
|
||||
|
||||
usleep(delay);
|
||||
nxsig_usleep(delay);
|
||||
}
|
||||
|
||||
/* We get here when the driver is removed.. or when too many errors have
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
#include <nuttx/usb/usb.h>
|
||||
|
@ -1076,7 +1077,7 @@ static int usbhost_mouse_poll(int argc, char *argv[])
|
|||
|
||||
priv->polling = true;
|
||||
usbhost_givesem(&g_syncsem);
|
||||
sleep(1);
|
||||
nxsig_sleep(1);
|
||||
|
||||
/* Loop here until the device is disconnected */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/usbhost/usbhost_hub.c
|
||||
*
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Kaushal Parikh <kaushal@dspworks.in>
|
||||
* Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
|
@ -834,7 +835,7 @@ static void usbhost_hub_event(FAR void *arg)
|
|||
}
|
||||
|
||||
debouncetime += 25;
|
||||
usleep(25*1000);
|
||||
nxsig_usleep(25*1000);
|
||||
}
|
||||
|
||||
if (ret < 0 || debouncetime >= 1500)
|
||||
|
@ -862,7 +863,7 @@ static void usbhost_hub_event(FAR void *arg)
|
|||
continue;
|
||||
}
|
||||
|
||||
usleep(100*1000);
|
||||
nxsig_usleep(100*1000);
|
||||
|
||||
ctrlreq->type = USB_REQ_DIR_IN | USBHUB_REQ_TYPE_PORT;
|
||||
ctrlreq->req = USBHUB_REQ_GETSTATUS;
|
||||
|
|
|
@ -50,10 +50,11 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/scsi.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
@ -1248,7 +1249,7 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
|
|||
|
||||
/* Wait just a bit */
|
||||
|
||||
usleep(USBHOST_RETRY_USEC);
|
||||
nxsig_usleep(USBHOST_RETRY_USEC);
|
||||
|
||||
/* Send TESTUNITREADY to see if the unit is ready. The most likely error
|
||||
* error that can occur here is a a stall which simply means that the
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
@ -618,7 +619,7 @@ static int usbhost_xboxcontroller_poll(int argc, char *argv[])
|
|||
|
||||
priv->polling = true;
|
||||
usbhost_givesem(&g_syncsem);
|
||||
sleep(1);
|
||||
nxsig_sleep(1);
|
||||
|
||||
/* Loop here until the device is disconnected */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* drivers/usbmonitor/usbmonitor.c
|
||||
*
|
||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
#include <nuttx/usb/usbhost_trace.h>
|
||||
|
@ -166,7 +167,7 @@ static int usbmonitor_daemon(int argc, char **argv)
|
|||
|
||||
while (!g_usbmonitor.stop)
|
||||
{
|
||||
sleep(CONFIG_USBMONITOR_INTERVAL);
|
||||
nxsig_sleep(CONFIG_USBMONITOR_INTERVAL);
|
||||
#ifdef CONFIG_USBDEV_TRACE
|
||||
(void)usbtrace_enumerate(usbmonitor_tracecallback, NULL);
|
||||
#endif
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
@ -1264,9 +1265,9 @@ static ssize_t cc3000_write(FAR struct file *filep, FAR const char *usrbuffer, s
|
|||
if (priv->state == eSPI_STATE_INITIALIZED)
|
||||
{
|
||||
cc3000_lock_and_select(priv->spi); /* Assert CS */
|
||||
usleep(55);
|
||||
nxsig_usleep(55);
|
||||
SPI_SNDBLOCK(priv->spi, buffer, 4);
|
||||
usleep(55);
|
||||
nxsig_usleep(55);
|
||||
SPI_SNDBLOCK(priv->spi, buffer+4, tx_len-4);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -47,11 +47,13 @@
|
|||
#include <debug.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/wireless/cc3000/hci.h>
|
||||
#include "cc3000_socket.h"
|
||||
#include <nuttx/wireless/cc3000/evnt_handler.h>
|
||||
#include <nuttx/wireless/cc3000/netapp.h>
|
||||
|
||||
#include "cc3000_socket.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -154,7 +156,7 @@ int HostFlowControlConsumeBuff(int sd)
|
|||
|
||||
if (0 == tSLInformation.usNumberOfFreeBuffers)
|
||||
{
|
||||
usleep(100000);
|
||||
nxsig_usleep(100000);
|
||||
}
|
||||
}
|
||||
while (0 == tSLInformation.usNumberOfFreeBuffers);
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
|
||||
# include <nuttx/wqueue.h>
|
||||
|
@ -792,7 +793,7 @@ static void nrf24l01_tostate(struct nrf24l01_dev_s *dev,
|
|||
/* Leaving power down (note: new state cannot be power down here) */
|
||||
|
||||
nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PWR_UP, true);
|
||||
usleep(NRF24L01_TPD2STBY_DELAY);
|
||||
nxsig_usleep(NRF24L01_TPD2STBY_DELAY);
|
||||
}
|
||||
|
||||
/* Entering new state */
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
#include "spirit_config.h"
|
||||
#include "spirit_types.h"
|
||||
#include "spirit_management.h"
|
||||
|
@ -225,7 +227,7 @@ int spirit_radio_initialize(FAR struct spirit_library_s *spirit,
|
|||
|
||||
/* Delay for state transition */
|
||||
|
||||
usleep(100);
|
||||
nxsig_usleep(100);
|
||||
|
||||
/* Wait for the device to enter STANDBY */
|
||||
|
||||
|
@ -262,7 +264,7 @@ int spirit_radio_initialize(FAR struct spirit_library_s *spirit,
|
|||
|
||||
/* Delay for state transition */
|
||||
|
||||
usleep(100);
|
||||
nxsig_usleep(100);
|
||||
|
||||
/* Make sure that the device becomes READY */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxmu/nx_start.c
|
||||
*
|
||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,6 +47,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
|
@ -204,7 +205,7 @@ int nx_start(void)
|
|||
* this operation cannot be done from the IDLE thread!
|
||||
*/
|
||||
|
||||
usleep(50*1000);
|
||||
nxsig_usleep(50*1000);
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -171,6 +171,70 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
|||
int nxsig_nanosleep(FAR const struct timespec *rqtp,
|
||||
FAR struct timespec *rmtp);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_sleep
|
||||
*
|
||||
* Description:
|
||||
* The nxsig_sleep() function will cause the calling thread to be
|
||||
* suspended from execution until either the number of real-time seconds
|
||||
* specified by the argument 'seconds' has elapsed or a signal is
|
||||
* delivered to the calling thread.
|
||||
*
|
||||
* This is an internal OS interface. It is functionally equivalent to
|
||||
* the standard sleep() application interface except that:
|
||||
*
|
||||
* - It is not a cancellaction point, and
|
||||
* - There is no check that the action of the signal is to invoke a
|
||||
* signal-catching function or to terminate the process.
|
||||
*
|
||||
* See the description of sleep() for additional information that is not
|
||||
* duplicated here.
|
||||
*
|
||||
* Parameters:
|
||||
* seconds - The number of seconds to sleep
|
||||
*
|
||||
* Returned Value:
|
||||
* If nxsig_sleep() returns because the requested time has elapsed, the
|
||||
* value returned will be zero (OK). If nxsig_sleep() returns because of
|
||||
* premature arousal due to delivery of a signal, the return value will
|
||||
* be the "unslept" amount (the requested time minus the time actually
|
||||
* slept) in seconds.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
unsigned int nxsig_sleep(unsigned int seconds);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_usleep
|
||||
*
|
||||
* Description:
|
||||
* The nxsig_usleep() function will cause the calling thread to be
|
||||
* suspended from execution until either the number of real-time
|
||||
* microseconds specified by the argument 'usec' has elapsed or a signal
|
||||
* is delivered to the calling thread. The suspension time may be longer
|
||||
* than requested due to the scheduling of other activity by the system.
|
||||
*
|
||||
* This is an internal OS interface. It is functionally equivalent to
|
||||
* the standard nxsig_usleep() application interface except that:
|
||||
*
|
||||
* - It is not a cancellaction point, and
|
||||
* - It does not modify the errno value.
|
||||
*
|
||||
* See the description of usleep() for additional information that is not
|
||||
* duplicated here.
|
||||
*
|
||||
* Parameters:
|
||||
* usec - the number of microseconds to wait.
|
||||
*
|
||||
* Returned 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 nxsig_usleep(useconds_t usec);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_notification
|
||||
*
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
* are unspecified.
|
||||
*
|
||||
* Parameters:
|
||||
* seconds
|
||||
* seconds - The number of seconds to sleep
|
||||
*
|
||||
* Returned Value:
|
||||
* If sleep() returns because the requested time has elapsed, the value
|
||||
|
@ -115,7 +115,7 @@ unsigned int sleep(unsigned int seconds)
|
|||
|
||||
/* Don't sleep if seconds == 0 */
|
||||
|
||||
if (seconds)
|
||||
if (seconds > 0)
|
||||
{
|
||||
/* Let nanosleep() do all of the work. */
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/page.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
|
@ -538,15 +539,14 @@ int pg_worker(int argc, char *argv[])
|
|||
{
|
||||
/* Wait awhile. We will wait here until either the configurable timeout
|
||||
* elapses or until we are awakened by a signal (which terminates the
|
||||
* usleep with an EINTR error). Note that interrupts will be re-enabled
|
||||
* while this task sleeps.
|
||||
* nxsig_usleep with an EINTR error). Note that interrupts will be re- * enabled while this task sleeps.
|
||||
*
|
||||
* The timeout is a failsafe that will handle any cases where a single
|
||||
* is lost (that would really be a bug and shouldn't happen!) and also
|
||||
* supports timeouts for case of non-blocking, asynchronous fills.
|
||||
*/
|
||||
|
||||
usleep(CONFIG_PAGING_WORKPERIOD);
|
||||
nxsig_usleep(CONFIG_PAGING_WORKPERIOD);
|
||||
|
||||
/* The page fill worker thread will be awakened on one of three conditions:
|
||||
*
|
||||
|
|
|
@ -42,7 +42,7 @@ CSRCS += sig_findaction.c sig_allocpendingsigaction.c
|
|||
CSRCS += sig_releasependingsigaction.c sig_unmaskpendingsignal.c
|
||||
CSRCS += sig_removependingsignal.c sig_releasependingsignal.c sig_lowest.c
|
||||
CSRCS += sig_mqnotempty.c sig_cleanup.c sig_dispatch.c sig_deliver.c
|
||||
CSRCS += sig_pause.c sig_nanosleep.c
|
||||
CSRCS += sig_pause.c sig_nanosleep.c sig_usleep.c sig_sleep.c
|
||||
|
||||
ifeq ($(CONFIG_SIG_EVTHREAD),y)
|
||||
CSRCS += sig_notification.c
|
||||
|
|
121
sched/signal/sig_sleep.c
Normal file
121
sched/signal/sig_sleep.c
Normal file
|
@ -0,0 +1,121 @@
|
|||
/****************************************************************************
|
||||
* sched/signal/sig_sleep.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_sleep
|
||||
*
|
||||
* Description:
|
||||
* The nxsig_sleep() function will cause the calling thread to be
|
||||
* suspended from execution until either the number of real-time seconds
|
||||
* specified by the argument 'seconds' has elapsed or a signal is
|
||||
* delivered to the calling thread.
|
||||
*
|
||||
* This is an internal OS interface. It is functionally equivalent to
|
||||
* the standard sleep() application interface except that:
|
||||
*
|
||||
* - It is not a cancellaction point, and
|
||||
* - There is no check that the action of the signal is to invoke a
|
||||
* signal-catching function or to terminate the process.
|
||||
*
|
||||
* See the description of sleep() for additional information that is not
|
||||
* duplicated here.
|
||||
*
|
||||
* Parameters:
|
||||
* seconds - The number of seconds to sleep
|
||||
*
|
||||
* Returned Value:
|
||||
* If nxsig_sleep() returns because the requested time has elapsed, the
|
||||
* value returned will be zero (OK). If nxsig_sleep() returns because of
|
||||
* premature arousal due to delivery of a signal, the return value will
|
||||
* be the "unslept" amount (the requested time minus the time actually
|
||||
* slept) in seconds.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
unsigned int nxsig_sleep(unsigned int seconds)
|
||||
{
|
||||
struct timespec rqtp;
|
||||
struct timespec rmtp;
|
||||
unsigned int remaining = 0;
|
||||
int ret;
|
||||
|
||||
/* Don't sleep if seconds == 0 */
|
||||
|
||||
if (seconds > 0)
|
||||
{
|
||||
/* Let nxsig_nanosleep() do all of the work. */
|
||||
|
||||
rqtp.tv_sec = seconds;
|
||||
rqtp.tv_nsec = 0;
|
||||
|
||||
ret = nxsig_nanosleep(&rqtp, &rmtp);
|
||||
|
||||
/* nanosleep() should only fail if it was interrupted by a signal,
|
||||
* but we treat all errors the same,
|
||||
*/
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
remaining = rmtp.tv_sec;
|
||||
if (remaining < seconds && rmtp.tv_nsec >= 500000000)
|
||||
{
|
||||
/* Round up */
|
||||
|
||||
remaining++;
|
||||
}
|
||||
}
|
||||
|
||||
return remaining;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
101
sched/signal/sig_usleep.c
Normal file
101
sched/signal/sig_usleep.c
Normal file
|
@ -0,0 +1,101 @@
|
|||
/****************************************************************************
|
||||
* sched/sig_usleep.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/signal.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsig_usleep
|
||||
*
|
||||
* Description:
|
||||
* The nxsig_usleep() function will cause the calling thread to be
|
||||
* suspended from execution until either the number of real-time
|
||||
* microseconds specified by the argument 'usec' has elapsed or a signal
|
||||
* is delivered to the calling thread. The suspension time may be longer
|
||||
* than requested due to the scheduling of other activity by the system.
|
||||
*
|
||||
* This is an internal OS interface. It is functionally equivalent to
|
||||
* the standard nxsig_usleep() application interface except that:
|
||||
*
|
||||
* - It is not a cancellaction point, and
|
||||
* - It does not modify the errno value.
|
||||
*
|
||||
* See the description of usleep() for additional information that is not
|
||||
* duplicated here.
|
||||
*
|
||||
* Parameters:
|
||||
* usec - the number of microseconds to wait.
|
||||
*
|
||||
* Returned 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 nxsig_usleep(useconds_t usec)
|
||||
{
|
||||
struct timespec rqtp;
|
||||
time_t sec;
|
||||
int ret = 0;
|
||||
|
||||
if (usec)
|
||||
{
|
||||
/* Let nxsig_nanosleep() do all of the work. */
|
||||
|
||||
sec = usec / 1000000;
|
||||
rqtp.tv_sec = sec;
|
||||
rqtp.tv_nsec = (usec - (sec * 1000000)) * 1000;
|
||||
|
||||
ret = nxsig_nanosleep(&rqtp, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* sched/wqueue/work_process.c
|
||||
*
|
||||
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009-2014, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
#include "wqueue/wqueue.h"
|
||||
|
@ -258,7 +259,7 @@ void work_process(FAR struct kwork_wqueue_s *wqueue, systime_t period, int wndx)
|
|||
*/
|
||||
|
||||
wqueue->worker[wndx].busy = false;
|
||||
usleep(next * USEC_PER_TICK);
|
||||
nxsig_usleep(next * USEC_PER_TICK);
|
||||
wqueue->worker[wndx].busy = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue