add initial FreeRTOS support

git-svn-id: svn://db.shs.com.ru/pip@685 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2019-02-05 00:53:14 +00:00
parent 763de789b0
commit 3721ec2e3d
4 changed files with 13 additions and 9 deletions

View File

@@ -190,7 +190,7 @@ endif()
# Check if RT timers exists
set(CMAKE_REQUIRED_INCLUDES time.h)
set(CMAKE_REQUIRED_LIBRARIES )
if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT WIN32) AND (NOT DEFINED ANDROID_PLATFORM))
if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT WIN32) AND (NOT DEFINED ANDROID_PLATFORM) AND (NOT PIP_FREERTOS))
list(APPEND LIBS_MAIN rt)
set(CMAKE_REQUIRED_LIBRARIES rt)
endif()
@@ -276,6 +276,7 @@ if ((NOT DEFINED LIBPROJECT) AND (DEFINED ANDROID_PLATFORM))
#message("${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include")
#message("${ANDROID_NDK}/sysroot/usr/include")
endif()
if(NOT PIP_FREERTOS)
if(WIN32)
if(${C_COMPILER} STREQUAL "cl.exe")
else()
@@ -291,6 +292,7 @@ else()
endif()
endif()
endif()
endif()
set(PIP_LIBS)
if(PIP_FREERTOS)
set(PIP_LIBS ${LIBS_MAIN})

View File

@@ -218,14 +218,11 @@ PIInit::PIInit() {
#endif
#ifdef MAC_OS
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
#endif
#endif
char cbuff[1024];
memset(cbuff, 0, 1024);
#ifndef FREERTOS
if (gethostname(cbuff, 1023) == 0)
sinfo->hostname = cbuff;
#endif
#ifdef WINDOWS
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
@@ -258,7 +255,6 @@ PIInit::PIInit() {
if (l)
sinfo->user = l;
}
# ifndef FREERTOS
struct utsname uns;
if (uname(&uns) == 0) {
sinfo->OS_version = uns.release;

View File

@@ -17,8 +17,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pisystemtests.h"
#ifndef PIP_FREERTOS
# include "piconfig.h"
#endif
namespace PISystemTests {
@@ -32,7 +36,7 @@ namespace PISystemTests {
PISystemTests::PISystemTestReader::PISystemTestReader() {
#ifndef WINDOWS
#if !defined(WINDOWS) && !defined(FREERTOS)
PIConfig conf(PIStringAscii("/etc/pip.conf"), PIIODevice::ReadOnly);
//conf.setReopenEnabled(false);
time_resolution_ns = conf.getValue(PIStringAscii("time_resolution_ns"), 1);
@@ -40,3 +44,5 @@ PISystemTests::PISystemTestReader::PISystemTestReader() {
usleep_offset_us = conf.getValue(PIStringAscii("usleep_offset_us"), 60);
#endif
}

View File

@@ -389,7 +389,7 @@ bool PIThread::waitForStart(int timeout_msecs) {
void PIThread::__thread_func__(void * t) {
#ifndef WINDOWS
# ifndef ANDROID
# if !defined(ANDROID) && !defined(FREERTOS)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
# endif
@@ -466,7 +466,7 @@ void PIThread::__thread_func__(void * t) {
void PIThread::__thread_func_once__(void * t) {
#ifndef WINDOWS
# ifndef ANDROID
# if !defined(ANDROID) && !defined(FREERTOS)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
# endif