forked from Archive/PX4-Autopilot
platforms: use define for lockstep scheduler
Instead of using the define __PX4_POSIX_SITL it makes more sense to have a define just to determine if the lockstep scheduler should be used.
This commit is contained in:
parent
73578a593f
commit
547dd8511b
|
@ -216,6 +216,13 @@ include(${PX4_CONFIG_FILE})
|
|||
message(STATUS "PX4 config: ${PX4_CONFIG}")
|
||||
message(STATUS "PX4 platform: ${PX4_PLATFORM}")
|
||||
|
||||
if (ENABLE_LOCKSTEP_SCHEDULER)
|
||||
add_definitions(-DENABLE_LOCKSTEP_SCHEDULER)
|
||||
message(STATUS "PX4 lockstep: enabled")
|
||||
else()
|
||||
message(STATUS "PX4 lockstep: disabled")
|
||||
endif()
|
||||
|
||||
# external modules
|
||||
set(EXTERNAL_MODULES_LOCATION "" CACHE STRING "External modules source location")
|
||||
|
||||
|
|
|
@ -98,5 +98,4 @@ if(REPLAY_FILE)
|
|||
add_definitions(-DORB_USE_PUBLISHER_RULES)
|
||||
endif()
|
||||
|
||||
add_definitions(-D__PX4_POSIX_SITL)
|
||||
set(LOCKSTEP_SCHEDULER_NEEDED yes)
|
||||
set(ENABLE_LOCKSTEP_SCHEDULER yes)
|
||||
|
|
|
@ -96,3 +96,5 @@ if(REPLAY_FILE)
|
|||
message("Building with uorb publisher rules support")
|
||||
add_definitions(-DORB_USE_PUBLISHER_RULES)
|
||||
endif()
|
||||
|
||||
set(ENABLE_LOCKSTEP_SCHEDULER no)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
if (LOCKSTEP_SCHEDULER_NEEDED)
|
||||
if (ENABLE_LOCKSTEP_SCHEDULER)
|
||||
add_subdirectory(lockstep_scheduler)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4")
|
|||
target_link_libraries(px4_layer PRIVATE work_queue)
|
||||
target_link_libraries(px4_layer PRIVATE px4_daemon)
|
||||
|
||||
if(LOCKSTEP_SCHEDULER_NEEDED)
|
||||
if(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
target_link_libraries(px4_layer PRIVATE lockstep_scheduler)
|
||||
include_directories(${PX4_SOURCE_DIR}/platforms/posix/src/lockstep_scheduler/include)
|
||||
endif()
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <errno.h>
|
||||
#include "hrt_work.h"
|
||||
|
||||
#if defined(__PX4_POSIX_SITL)
|
||||
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
#include <lockstep_scheduler/lockstep_scheduler.h>
|
||||
#endif
|
||||
|
||||
|
@ -72,7 +72,7 @@ static hrt_abstime _delay_interval = 0;
|
|||
static hrt_abstime max_time = 0;
|
||||
static pthread_mutex_t _hrt_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#if defined(__PX4_POSIX_SITL)
|
||||
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
static LockstepScheduler lockstep_scheduler;
|
||||
#endif
|
||||
|
||||
|
@ -594,7 +594,7 @@ void abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
|
|||
ts->tv_nsec = abstime * 1000;
|
||||
}
|
||||
|
||||
#if defined(__PX4_POSIX_SITL)
|
||||
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
int px4_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
if (clk_id == CLOCK_MONOTONIC) {
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
#define system_exit exit
|
||||
|
||||
#if defined(__PX4_POSIX_SITL)
|
||||
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@ -99,7 +99,7 @@
|
|||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#else // defined(__PX4_POSIX_SITL)
|
||||
#else // defined(ENABLE_LOCKSTEP_SCHEDULER)
|
||||
|
||||
#define system_usleep usleep
|
||||
#define system_sleep sleep
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#define clockid_t int
|
||||
#endif
|
||||
|
||||
#if defined(__PX4_POSIX_SITL) || defined(__PX4_QURT)
|
||||
#if defined(ENABLE_LOCKSTEP_SCHEDULER) || defined(__PX4_QURT)
|
||||
|
||||
__BEGIN_DECLS
|
||||
__EXPORT int px4_clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
|
|
Loading…
Reference in New Issue