Within the OS, nxisg_sleep() should be used instead of sleep(). sleep() is a cancellation point and sets the errno value. Neither of which should be done inside the OS.

This commit is contained in:
Gregory Nutt 2019-11-29 19:03:24 -06:00
parent 4f1d891067
commit 108ffe7044
9 changed files with 25 additions and 23 deletions

View file

@ -44,6 +44,8 @@
#include <unistd.h>
#include <debug.h>
#include <nuttx/signal.h>
#include "stm32_dfumode.h"
/****************************************************************************
@ -73,7 +75,7 @@ void stm32_dfumode(void)
{
#ifdef CONFIG_DEBUG_WARN
_warn("Entering DFU mode...\n");
sleep(1);
nxsig_sleep(1);
#endif
asm("ldr r0, =0x40023844\n\t" /* RCC_APB2ENR */

View file

@ -504,7 +504,7 @@ int highpri_main(int argc, char *argv[])
adc1->ad_ops->ao_ioctl(adc1, IO_TRIGGER_REG, 0);
nxsig_usleep(100);
usleep(100);
#endif
#ifdef HIGHPRI_HAVE_INJECTED
@ -512,7 +512,7 @@ int highpri_main(int argc, char *argv[])
adc1->ad_ops->ao_ioctl(adc1, IO_TRIGGER_INJ, 0);
nxsig_usleep(100);
usleep(100);
#endif
/* Lock global data */
@ -548,7 +548,7 @@ int highpri_main(int argc, char *argv[])
g_highpri.lock = false;
sleep(1);
nxsig_sleep(1);
}
errout:

View file

@ -546,7 +546,7 @@ int highpri_main(int argc, char *argv[])
adc1->ad_ops->ao_ioctl(adc1, IO_TRIGGER_REG, 0);
nxsig_usleep(100);
usleep(100);
#endif
#ifdef HIGHPRI_HAVE_INJECTED
@ -554,7 +554,7 @@ int highpri_main(int argc, char *argv[])
adc1->ad_ops->ao_ioctl(adc1, IO_TRIGGER_INJ, 0);
nxsig_usleep(100);
usleep(100);
#endif
/* Lock global data */
@ -590,7 +590,7 @@ int highpri_main(int argc, char *argv[])
g_highpri.lock = false;
sleep(1);
nxsig_sleep(1);
}
errout:

View file

@ -1,7 +1,7 @@
/****************************************************************************
* boards/arm/stm32/nucleo-f334r8/src/stm32_spwm.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2018, 2019 Gregory Nutt. All rights reserved.
* Author: Mateusz Szafoni <raiden00@railab.me>
*
* Redistribution and use in source and binary forms, with or without
@ -1047,7 +1047,7 @@ int spwm_main(int argc, char *argv[])
/* Sleep */
sleep(1);
nxsig_sleep(1);
}
errout:

View file

@ -495,7 +495,7 @@ int highpri_main(int argc, char *argv[])
adc1->ad_ops->ao_ioctl(adc1, IO_TRIGGER_REG, 0);
nxsig_usleep(100);
usleep(100);
#endif
#ifdef HIGHPRI_HAVE_INJECTED
@ -503,7 +503,7 @@ int highpri_main(int argc, char *argv[])
adc1->ad_ops->ao_ioctl(adc1, IO_TRIGGER_INJ, 0);
nxsig_usleep(100);
usleep(100);
#endif
/* Lock global data */
@ -539,7 +539,7 @@ int highpri_main(int argc, char *argv[])
g_highpri.lock = false;
sleep(1);
nxsig_sleep(1);
}
errout:

View file

@ -10,7 +10,7 @@
* Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved.
* Author: Paul Alexander Patience <paul-a.patience@polymtl.ca>
*
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2016, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -53,11 +53,11 @@
#include <stdlib.h>
#include <nuttx/kmalloc.h>
#include <nuttx/random.h>
#include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/lsm303agr.h>
#include <nuttx/random.h>
#include <nuttx/signal.h>
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_LSM303AGR)
@ -834,7 +834,7 @@ static int lsm303agr_selftest(FAR struct lsm303agr_dev_s *priv, uint32_t mode)
sninfo("\n");
}
sleep(2);
nxsig_sleep(2);
/* Disable test */

View file

@ -10,7 +10,7 @@
* Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved.
* Author: Paul Alexander Patience <paul-a.patience@polymtl.ca>
*
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2016, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -53,11 +53,11 @@
#include <stdlib.h>
#include <nuttx/kmalloc.h>
#include <nuttx/random.h>
#include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/lsm6dsl.h>
#include <nuttx/random.h>
#include <nuttx/signal.h>
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_LSM6DSL)
@ -855,7 +855,7 @@ static int lsm6dsl_selftest(FAR struct lsm6dsl_dev_s *priv, uint32_t mode)
sninfo("\n");
}
sleep(2);
nxsig_sleep(2);
/* Disable test */

View file

@ -47,10 +47,10 @@
#include <stdlib.h>
#include <nuttx/kmalloc.h>
#include <nuttx/random.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/lsm9ds1.h>
#include <nuttx/random.h>
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_LSM9DS1)

View file

@ -3001,7 +3001,7 @@ static int max3421e_connected(FAR struct max3421e_usbhost_s *priv)
/* Stop SOF generation and reset the bus */
max3421e_busreset(priv);
sleep(1);
nxsig_sleep(1);
/* Check for low- or full-speed and restart SOF generation. */
@ -3460,7 +3460,7 @@ static int max3421e_getspeed(FAR struct max3421e_usbhost_s *priv,
/* Stop SOF generation and reset the host port */
max3421e_busreset(priv);
sleep(1);
nxsig_sleep(1);
/* Get the current device speed */