mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #15305 from aabadie/pr/sys/posix_sleep
sys/posix: rename posix_time to posix_sleep
This commit is contained in:
commit
cc10d31391
@ -15,7 +15,7 @@ USEMODULE += auto_init_gnrc_netif
|
||||
USEMODULE += gnrc_ipv6_default
|
||||
USEMODULE += sock_udp
|
||||
USEMODULE += posix_sockets
|
||||
USEMODULE += posix_time
|
||||
USEMODULE += posix_sleep
|
||||
USEMODULE += posix_inet
|
||||
# Add also the shell, some shell commands
|
||||
USEMODULE += shell
|
||||
|
@ -1 +1 @@
|
||||
USEMODULE += posix_time
|
||||
USEMODULE += posix_sleep
|
||||
|
@ -140,8 +140,8 @@ endif
|
||||
ifneq (,$(filter posix_sockets,$(USEMODULE)))
|
||||
DIRS += posix/sockets
|
||||
endif
|
||||
ifneq (,$(filter posix_time,$(USEMODULE)))
|
||||
DIRS += posix/time
|
||||
ifneq (,$(filter posix_sleep,$(USEMODULE)))
|
||||
DIRS += posix/sleep
|
||||
endif
|
||||
ifneq (,$(filter pthread,$(USEMODULE)))
|
||||
DIRS += posix/pthread
|
||||
|
@ -561,8 +561,12 @@ ifneq (,$(filter posix_semaphore,$(USEMODULE)))
|
||||
USEMODULE += posix_headers
|
||||
endif
|
||||
|
||||
ifneq (,$(filter posix_time,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
ifneq (,$(filter posix_sleep,$(USEMODULE)))
|
||||
USEMODULE += ztimer_msec
|
||||
ifneq (,$(filter periph_rtt,$(USEMODULE)))
|
||||
USEMODULE += ztimer_periph_rtt
|
||||
endif
|
||||
USEMODULE += ztimer_usec
|
||||
USEMODULE += posix_headers
|
||||
endif
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
MODULE = posix_time
|
||||
MODULE = posix_sleep
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
@ -7,27 +7,29 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_xtimer
|
||||
* @ingroup posix
|
||||
*
|
||||
* @{
|
||||
* @file
|
||||
* @brief xtimer posix wrapper
|
||||
* @brief posix sleep/usleep implementation wrapped around @ref ztimer
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "kernel_defines.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
unsigned int sleep(unsigned int seconds)
|
||||
{
|
||||
xtimer_usleep64(seconds * US_PER_SEC);
|
||||
ztimer_sleep(ZTIMER_MSEC, seconds * MS_PER_SEC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
xtimer_usleep64(usec);
|
||||
ztimer_sleep(ZTIMER_USEC, usec);
|
||||
return 0;
|
||||
}
|
9
tests/posix_sleep/Makefile
Normal file
9
tests/posix_sleep/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += posix_sleep
|
||||
|
||||
# Pull-in periph-rtt on board that provides this feature to switch to the RTT
|
||||
# backend of ztimer
|
||||
FEATURES_OPTIONAL += periph_rtt
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
3
tests/posix_sleep/Makefile.ci
Normal file
3
tests/posix_sleep/Makefile.ci
Normal file
@ -0,0 +1,3 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
nucleo-l011k4 \
|
||||
#
|
@ -1,4 +1,4 @@
|
||||
# posix_time test application
|
||||
# posix_sleep test application
|
||||
|
||||
This test tests POSIX' `sleep()` and `usleep()`.
|
||||
The test script also checks the sanity of the timings by comparing the overall
|
@ -1,5 +0,0 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += posix_time
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
Loading…
Reference in New Issue
Block a user