1
0
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:
Martine Lenders 2020-11-05 16:36:25 +01:00 committed by GitHub
commit cc10d31391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 31 additions and 18 deletions

View File

@ -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

View File

@ -1 +1 @@
USEMODULE += posix_time
USEMODULE += posix_sleep

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,3 @@
MODULE = posix_time
MODULE = posix_sleep
include $(RIOTBASE)/Makefile.base

View File

@ -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;
}

View 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

View File

@ -0,0 +1,3 @@
BOARD_INSUFFICIENT_MEMORY := \
nucleo-l011k4 \
#

View File

@ -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

View File

@ -1,5 +0,0 @@
include ../Makefile.tests_common
USEMODULE += posix_time
include $(RIOTBASE)/Makefile.include