RTOS work threads

git-svn-id: svn://db.shs.com.ru/pip@687 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2019-02-05 15:40:22 +00:00
parent b7ef5bfdcb
commit 30973842d1
10 changed files with 128 additions and 20 deletions

View File

@@ -28,6 +28,9 @@
# include "pidir.h"
# include "piprocess.h"
#endif
#ifdef ESP_PLATFORM
# include "esp_system.h"
#endif
#ifdef WINDOWS
# include <winsock2.h>
extern FILETIME __pi_ftjan1970;
@@ -261,6 +264,14 @@ PIInit::PIInit() {
sinfo->architecture = uns.machine;
}
# endif
#endif
#ifdef ESP_PLATFORM
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
sinfo->processorsCount = chip_info.cores;
sinfo->architecture = "Xtensa LX6";
//printf("silicon revision %d, ", chip_info.revision);
sinfo->OS_version = esp_get_idf_version();
#endif
sinfo->OS_name =
#ifdef WINDOWS

View File

@@ -30,7 +30,10 @@
//# include <crt_externs.h>
extern clock_serv_t __pi_mac_clock;
#endif
#ifdef FREERTOS
# include "freertos/FreeRTOS.h"
# include "freertos/task.h"
#endif
/*! \class PISystemTime
* \brief System time
@@ -63,8 +66,12 @@ void piUSleep(int usecs) {
//printf("Sleep %d\n", usecs / 1000);
if (usecs > 0) Sleep(usecs / 1000);
#else
# ifdef FREERTOS
vTaskDelay(usecs / 1000 / portTICK_PERIOD_MS);
# else
usecs -= PISystemTests::usleep_offset_us;
if (usecs > 0) usleep(usecs);
# endif
#endif
}
@@ -243,8 +250,18 @@ PISystemTime PISystemTime::current(bool precise_but_not_system) {
mach_timespec_t t_cur;
clock_get_time(__pi_mac_clock, &t_cur);
# else
# ifdef FREERTOS
timespec t_cur;
timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
gettimeofday(&tv, NULL);
t_cur.tv_sec = tv.tv_sec;
t_cur.tv_nsec = tv.tv_usec * 1000;
# else
timespec t_cur;
clock_gettime(0, &t_cur);
# endif
# endif
return PISystemTime(t_cur.tv_sec, t_cur.tv_nsec);
#endif

View File

@@ -25,13 +25,9 @@
#include "pistring.h"
#ifdef FREERTOS
# include "time.h"
#else
# include <ctime>
# ifdef QNX
# include <time.h>
# endif
#include <ctime>
#ifdef QNX
# include <time.h>
#endif
//! \brief Sleep for "msecs" milliseconds
PIP_EXPORT void msleep(int msecs);