platformio_pre.py
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
Import("env")
|
|
||||||
|
|
||||||
env.Append(CCFLAGS=["-Ilib/pip/libs/main/core", "-Ilib/pip/libs/main/containers", "-Ilib/pip/libs/main/introspection"])
|
|
||||||
10
library.json
10
library.json
@@ -13,17 +13,13 @@
|
|||||||
"dependencies": {"mike-matera/ArduinoSTL": "^1.3.2"},
|
"dependencies": {"mike-matera/ArduinoSTL": "^1.3.2"},
|
||||||
"build":
|
"build":
|
||||||
{
|
{
|
||||||
"srcDir": "libs/main",
|
|
||||||
"srcFilter": [
|
"srcFilter": [
|
||||||
"+<core/*.cpp>",
|
"+<libs/main/core/*.cpp>",
|
||||||
"+<core/*.h>",
|
"+<libs/main/containers/*.cpp>"
|
||||||
"+<containers/*.cpp>",
|
|
||||||
"+<containers/*.h>"
|
|
||||||
],
|
],
|
||||||
"flags": [
|
"flags": [
|
||||||
"-std=c++11",
|
|
||||||
"-DPIP_MICRO"
|
"-DPIP_MICRO"
|
||||||
],
|
],
|
||||||
"extraScript": "include_pip.py"
|
"extraScript": "platformio_pre.py"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "picompress.h"
|
#include "picompress.h"
|
||||||
#ifdef PIP_COMPRESS
|
#ifdef PIP_COMPRESS
|
||||||
# ifdef FREERTOS
|
# ifdef ESP_PLATFORM
|
||||||
# include "esp32/rom/miniz.h"
|
# include "esp32/rom/miniz.h"
|
||||||
# define compress2 mz_compress2
|
# define compress2 mz_compress2
|
||||||
# define Z_OK MZ_OK
|
# define Z_OK MZ_OK
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ PIScreen::SystemConsole::SystemConsole() {
|
|||||||
GetConsoleMode(PRIVATE->hOut, &PRIVATE->smode);
|
GetConsoleMode(PRIVATE->hOut, &PRIVATE->smode);
|
||||||
GetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo);
|
GetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo);
|
||||||
#else
|
#else
|
||||||
# ifdef FREERTOS
|
# ifdef MICRO_PIP
|
||||||
w = 80;
|
w = 80;
|
||||||
h = 24;
|
h = 24;
|
||||||
# else
|
# else
|
||||||
@@ -115,7 +115,7 @@ void PIScreen::SystemConsole::prepare() {
|
|||||||
w = PRIVATE->csbi.srWindow.Right - PRIVATE->csbi.srWindow.Left + 1;
|
w = PRIVATE->csbi.srWindow.Right - PRIVATE->csbi.srWindow.Left + 1;
|
||||||
h = PRIVATE->csbi.srWindow.Bottom - PRIVATE->csbi.srWindow.Top + 1;
|
h = PRIVATE->csbi.srWindow.Bottom - PRIVATE->csbi.srWindow.Top + 1;
|
||||||
#else
|
#else
|
||||||
# ifndef FREERTOS
|
# ifndef MICRO_PIP
|
||||||
winsize ws;
|
winsize ws;
|
||||||
ioctl(0, TIOCGWINSZ, &ws);
|
ioctl(0, TIOCGWINSZ, &ws);
|
||||||
w = ws.ws_col;
|
w = ws.ws_col;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
#include "piterminal.h"
|
#include "piterminal.h"
|
||||||
#include "pisharedmemory.h"
|
#include "pisharedmemory.h"
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <wingdi.h>
|
# include <wingdi.h>
|
||||||
@@ -918,4 +918,4 @@ bool PITerminal::resize(int cols, int rows) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FREERTOS
|
#endif // MICRO_PIP
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
|
|
||||||
#include "picout.h"
|
#include "picout.h"
|
||||||
#include "piintrospection_containers.h"
|
#include "piintrospection_containers.h"
|
||||||
#ifndef PIP_MICRO
|
//#ifndef PIP_MICRO
|
||||||
# ifdef MAC_OS
|
# ifdef MAC_OS
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# else
|
# else
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
# endif
|
# endif
|
||||||
#endif
|
//#endif
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -124,6 +124,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# ifdef CC_VC
|
# ifdef CC_VC
|
||||||
@@ -277,7 +278,7 @@
|
|||||||
} _PIP_ADD_COUNTER(_pip_initializer_);
|
} _PIP_ADD_COUNTER(_pip_initializer_);
|
||||||
|
|
||||||
|
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
# define PIP_MIN_MSLEEP 10.
|
# define PIP_MIN_MSLEEP 10.
|
||||||
#else
|
#else
|
||||||
# define PIP_MIN_MSLEEP 1.
|
# define PIP_MIN_MSLEEP 1.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include "pivector2d.h"
|
#include "pivector2d.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
# define _TYPENAME_(T) "?"
|
# define _TYPENAME_(T) "?"
|
||||||
#else
|
#else
|
||||||
# define _TYPENAME_(T) typeid(T).name()
|
# define _TYPENAME_(T) typeid(T).name()
|
||||||
|
|||||||
@@ -26,9 +26,6 @@
|
|||||||
#ifdef PIP_STD_IOSTREAM
|
#ifdef PIP_STD_IOSTREAM
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
#endif
|
#endif
|
||||||
#ifndef PIP_MICRO
|
|
||||||
# include <atomic>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class PIMutex;
|
class PIMutex;
|
||||||
class PIMutexLocker;
|
class PIMutexLocker;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
#include "piresourcesstorage.h"
|
#include "piresourcesstorage.h"
|
||||||
#include "pidir.h"
|
#include "pidir.h"
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
# include "piprocess.h"
|
# include "piprocess.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
@@ -49,7 +49,7 @@ void __PISetTimerResolution() {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
# ifndef FREERTOS
|
# ifndef MICRO_PIP
|
||||||
# include <sys/utsname.h>
|
# include <sys/utsname.h>
|
||||||
# endif
|
# endif
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
@@ -84,7 +84,7 @@ ULONG prev_res;
|
|||||||
bool delete_locs;
|
bool delete_locs;
|
||||||
PRIVATE_DEFINITION_END(PIInit)
|
PRIVATE_DEFINITION_END(PIInit)
|
||||||
|
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
void __sighandler__(PISignals::Signal s) {
|
void __sighandler__(PISignals::Signal s) {
|
||||||
//piCout << Hex << int(s);
|
//piCout << Hex << int(s);
|
||||||
if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput)
|
if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput)
|
||||||
@@ -106,12 +106,12 @@ PIInit::PIInit() {
|
|||||||
file_charset = 0;
|
file_charset = 0;
|
||||||
PISystemInfo * sinfo = PISystemInfo::instance();
|
PISystemInfo * sinfo = PISystemInfo::instance();
|
||||||
sinfo->execDateTime = PIDateTime::current();
|
sinfo->execDateTime = PIDateTime::current();
|
||||||
|
#ifndef MICRO_PIP
|
||||||
setFileCharset("UTF-8");
|
setFileCharset("UTF-8");
|
||||||
#ifndef FREERTOS
|
# ifndef ANDROID
|
||||||
#ifndef ANDROID
|
|
||||||
PISignals::setSlot(__sighandler__);
|
PISignals::setSlot(__sighandler__);
|
||||||
PISignals::grabSignals(PISignals::UserDefined1);
|
PISignals::grabSignals(PISignals::UserDefined1);
|
||||||
# ifndef WINDOWS
|
# ifndef WINDOWS
|
||||||
PISignals::grabSignals(PISignals::StopTTYInput | PISignals::StopTTYOutput);
|
PISignals::grabSignals(PISignals::StopTTYInput | PISignals::StopTTYOutput);
|
||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
sigemptyset(&ss);
|
sigemptyset(&ss);
|
||||||
@@ -128,7 +128,7 @@ PIInit::PIInit() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# else
|
# else //WINDOWS
|
||||||
// OS version
|
// OS version
|
||||||
DWORD dwVersion = GetVersion();
|
DWORD dwVersion = GetVersion();
|
||||||
DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||||
@@ -154,33 +154,33 @@ PIInit::PIInit() {
|
|||||||
setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution");
|
setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution");
|
||||||
__PISetTimerResolution();
|
__PISetTimerResolution();
|
||||||
}
|
}
|
||||||
# endif
|
# endif //WINDOWS
|
||||||
# ifdef HAS_LOCALE
|
# ifdef HAS_LOCALE
|
||||||
//cout << "has locale" << endl;
|
//cout << "has locale" << endl;
|
||||||
if (currentLocale_t != 0) {
|
if (currentLocale_t != 0) {
|
||||||
freelocale(currentLocale_t);
|
freelocale(currentLocale_t);
|
||||||
currentLocale_t = 0;
|
currentLocale_t = 0;
|
||||||
}
|
}
|
||||||
currentLocale_t = newlocale(LC_ALL, setlocale(LC_ALL, ""), 0);
|
currentLocale_t = newlocale(LC_ALL, setlocale(LC_ALL, ""), 0);
|
||||||
# else
|
# else //HAS_LOCALE
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
# endif
|
# endif //HAS_LOCALE
|
||||||
#else
|
# else //ANDROID
|
||||||
struct sigaction actions;
|
struct sigaction actions;
|
||||||
memset(&actions, 0, sizeof(actions));
|
memset(&actions, 0, sizeof(actions));
|
||||||
sigemptyset(&actions.sa_mask);
|
sigemptyset(&actions.sa_mask);
|
||||||
actions.sa_flags = 0;
|
actions.sa_flags = 0;
|
||||||
actions.sa_handler = android_thread_exit_handler;
|
actions.sa_handler = android_thread_exit_handler;
|
||||||
sigaction(SIGTERM, &actions, 0);
|
sigaction(SIGTERM, &actions, 0);
|
||||||
#endif
|
# endif //ANDROID
|
||||||
PRIVATE->delete_locs = false;
|
PRIVATE->delete_locs = false;
|
||||||
__syslocname__ = __sysoemname__ = 0;
|
__syslocname__ = __sysoemname__ = 0;
|
||||||
__utf8name__ = const_cast<char*>("UTF-8");
|
__utf8name__ = const_cast<char*>("UTF-8");
|
||||||
#ifdef PIP_ICU
|
# ifdef PIP_ICU
|
||||||
UErrorCode e((UErrorCode)0);
|
UErrorCode e((UErrorCode)0);
|
||||||
u_init(&e);
|
u_init(&e);
|
||||||
# ifdef WINDOWS
|
# ifdef WINDOWS
|
||||||
PRIVATE->delete_locs = true;
|
PRIVATE->delete_locs = true;
|
||||||
CPINFOEX cpinfo;
|
CPINFOEX cpinfo;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
@@ -192,30 +192,30 @@ PIInit::PIInit() {
|
|||||||
memset(__sysoemname__, 0, 256);
|
memset(__sysoemname__, 0, 256);
|
||||||
memcpy(__sysoemname__, "ibm-", 4);
|
memcpy(__sysoemname__, "ibm-", 4);
|
||||||
memcpy(&(__sysoemname__[4]), cpinfo.CodePageName, l);
|
memcpy(&(__sysoemname__[4]), cpinfo.CodePageName, l);
|
||||||
# else
|
# else
|
||||||
/*PIString en(getenv("LANG"));
|
/*PIString en(getenv("LANG"));
|
||||||
if (!en.isEmpty())
|
if (!en.isEmpty())
|
||||||
en = en.mid(en.find(".") + 1);
|
en = en.mid(en.find(".") + 1);
|
||||||
PIByteArray enba = en.toByteArray();
|
PIByteArray enba = en.toByteArray();
|
||||||
memcpy(__syslocname__, enba.data(), enba.size_s());*/
|
memcpy(__syslocname__, enba.data(), enba.size_s());*/
|
||||||
# endif
|
# endif
|
||||||
//piCout << __syslocname__;
|
//piCout << __syslocname__;
|
||||||
//piCout << __sysoemname__;
|
//piCout << __sysoemname__;
|
||||||
#else
|
# else //PIP_ICU
|
||||||
# ifdef WINDOWS
|
# ifdef WINDOWS
|
||||||
__syslocname__ = (char *)CP_ACP;
|
__syslocname__ = (char *)CP_ACP;
|
||||||
__sysoemname__ = (char *)CP_OEMCP;
|
__sysoemname__ = (char *)CP_OEMCP;
|
||||||
__utf8name__ = (char *)CP_UTF8;
|
__utf8name__ = (char *)CP_UTF8;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# endif //PIP_ICU
|
||||||
#ifdef MAC_OS
|
# ifdef MAC_OS
|
||||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
|
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
|
||||||
#endif
|
# endif
|
||||||
char cbuff[1024];
|
char cbuff[1024];
|
||||||
memset(cbuff, 0, 1024);
|
memset(cbuff, 0, 1024);
|
||||||
if (gethostname(cbuff, 1023) == 0)
|
if (gethostname(cbuff, 1023) == 0)
|
||||||
sinfo->hostname = cbuff;
|
sinfo->hostname = cbuff;
|
||||||
#ifdef WINDOWS
|
# ifdef WINDOWS
|
||||||
SYSTEM_INFO sysinfo;
|
SYSTEM_INFO sysinfo;
|
||||||
GetSystemInfo(&sysinfo);
|
GetSystemInfo(&sysinfo);
|
||||||
sinfo->processorsCount = sysinfo.dwNumberOfProcessors;
|
sinfo->processorsCount = sysinfo.dwNumberOfProcessors;
|
||||||
@@ -236,7 +236,7 @@ PIInit::PIInit() {
|
|||||||
ulong unlen = 1023;
|
ulong unlen = 1023;
|
||||||
if (GetUserName(cbuff, &unlen) != 0)
|
if (GetUserName(cbuff, &unlen) != 0)
|
||||||
sinfo->user = cbuff;
|
sinfo->user = cbuff;
|
||||||
#else
|
# else //WINDOWS
|
||||||
sinfo->processorsCount = piMaxi(1, int(sysconf(_SC_NPROCESSORS_ONLN)));
|
sinfo->processorsCount = piMaxi(1, int(sysconf(_SC_NPROCESSORS_ONLN)));
|
||||||
passwd * ps = getpwuid(getuid());
|
passwd * ps = getpwuid(getuid());
|
||||||
if (ps)
|
if (ps)
|
||||||
@@ -252,8 +252,9 @@ PIInit::PIInit() {
|
|||||||
sinfo->OS_version = uns.release;
|
sinfo->OS_version = uns.release;
|
||||||
sinfo->architecture = uns.machine;
|
sinfo->architecture = uns.machine;
|
||||||
}
|
}
|
||||||
# endif
|
# endif //WINDOWS
|
||||||
#endif
|
#endif // MICRO_PIP
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
esp_chip_info_t chip_info;
|
esp_chip_info_t chip_info;
|
||||||
esp_chip_info(&chip_info);
|
esp_chip_info(&chip_info);
|
||||||
@@ -265,19 +266,21 @@ PIInit::PIInit() {
|
|||||||
sinfo->OS_name =
|
sinfo->OS_name =
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
PIStringAscii("Windows");
|
PIStringAscii("Windows");
|
||||||
#elif defined(QNX)
|
# elif defined(QNX)
|
||||||
PIStringAscii("QNX");
|
PIStringAscii("QNX");
|
||||||
#elif defined(MAC_OS)
|
# elif defined(MAC_OS)
|
||||||
PIStringAscii("MacOS");
|
PIStringAscii("MacOS");
|
||||||
#elif defined(ANDROID)
|
# elif defined(ANDROID)
|
||||||
PIStringAscii("Android");
|
PIStringAscii("Android");
|
||||||
#elif defined(FREE_BSD)
|
# elif defined(FREE_BSD)
|
||||||
PIStringAscii("FreeBSD");
|
PIStringAscii("FreeBSD");
|
||||||
#elif defined(FREERTOS)
|
# elif defined(FREERTOS)
|
||||||
PIStringAscii("FreeRTOS");
|
PIStringAscii("FreeRTOS");
|
||||||
#else
|
# elif defined(MICRO_PIP)
|
||||||
|
PIStringAscii("MicroPIP");
|
||||||
|
# else
|
||||||
uns.sysname;
|
uns.sysname;
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
#include "pithread.h"
|
#include "pithread.h"
|
||||||
#include "piconditionvar.h"
|
#include "piconditionvar.h"
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
# include "pifile.h"
|
# include "pifile.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ void PIObject::piDisconnect(PIObject * src, const PIString & sig) {
|
|||||||
src->connections.remove(i);
|
src->connections.remove(i);
|
||||||
i--;
|
i--;
|
||||||
if (dest) {
|
if (dest) {
|
||||||
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(FREERTOS)
|
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(MICRO_PIP)
|
||||||
PIMutexLocker _mld(dest->mutex_connect, src != dest);
|
PIMutexLocker _mld(dest->mutex_connect, src != dest);
|
||||||
#endif
|
#endif
|
||||||
dest->updateConnectors();
|
dest->updateConnectors();
|
||||||
@@ -373,7 +373,7 @@ void PIObject::piDisconnectAll() {
|
|||||||
// piCout << "disconnect"<< src << o;
|
// piCout << "disconnect"<< src << o;
|
||||||
if (!o || (o == this)) continue;
|
if (!o || (o == this)) continue;
|
||||||
if (!o->isPIObject()) continue;
|
if (!o->isPIObject()) continue;
|
||||||
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(FREERTOS)
|
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(MICRO_PIP)
|
||||||
PIMutexLocker _mld(o->mutex_connect, this != o);
|
PIMutexLocker _mld(o->mutex_connect, this != o);
|
||||||
#endif
|
#endif
|
||||||
PIVector<Connection> & oc(o->connections);
|
PIVector<Connection> & oc(o->connections);
|
||||||
@@ -615,7 +615,7 @@ void dumpApplication() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
bool dumpApplicationToFile(const PIString & path) {
|
bool dumpApplicationToFile(const PIString & path) {
|
||||||
PIFile f(path + "_tmp");
|
PIFile f(path + "_tmp");
|
||||||
f.setName("__S__DumpFile");
|
f.setName("__S__DumpFile");
|
||||||
|
|||||||
@@ -192,9 +192,9 @@ public:
|
|||||||
static PIObject::Connection piConnect(PIObject * src, const PIString & sig, PIObject * dest_o, void * dest, void * ev_h, void * e_h, int args, const char * loc);
|
static PIObject::Connection piConnect(PIObject * src, const PIString & sig, PIObject * dest_o, void * dest, void * ev_h, void * e_h, int args, const char * loc);
|
||||||
static PIObject::Connection piConnectU(PIObject * src, const PIString & sig, PIObject * dest_o, void * dest, const PIString & hname, const char * loc, PIObject * performer = 0);
|
static PIObject::Connection piConnectU(PIObject * src, const PIString & sig, PIObject * dest_o, void * dest, const PIString & hname, const char * loc, PIObject * performer = 0);
|
||||||
static PIObject::Connection piConnectLS(PIObject * src, const PIString & sig, std::function<void()> * f, const char * loc);
|
static PIObject::Connection piConnectLS(PIObject * src, const PIString & sig, std::function<void()> * f, const char * loc);
|
||||||
template <typename INPUT, typename... TYPES>
|
template <typename PIINPUT, typename... PITYPES>
|
||||||
static std::function<void()> * __newFunctor(void(*stat_handler)(void*,TYPES...), INPUT functor) {
|
static std::function<void()> * __newFunctor(void(*stat_handler)(void*,PITYPES...), PIINPUT functor) {
|
||||||
return (std::function<void()>*)(new std::function<void(TYPES...)>(functor));
|
return (std::function<void()>*)(new std::function<void(PITYPES...)>(functor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,9 @@
|
|||||||
# include "freertos/FreeRTOS.h"
|
# include "freertos/FreeRTOS.h"
|
||||||
# include "freertos/task.h"
|
# include "freertos/task.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MICRO_PIP
|
||||||
|
# include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! \class PISystemTime
|
/*! \class PISystemTime
|
||||||
* @brief System time
|
* @brief System time
|
||||||
@@ -252,12 +255,10 @@ PISystemTime PISystemTime::current(bool precise_but_not_system) {
|
|||||||
ullong lt = ullong(sft.dwHighDateTime) * 0x100000000U + ullong(sft.dwLowDateTime);
|
ullong lt = ullong(sft.dwHighDateTime) * 0x100000000U + ullong(sft.dwLowDateTime);
|
||||||
return PISystemTime(lt / 10000000U, (lt % 10000000U) * 100U);
|
return PISystemTime(lt / 10000000U, (lt % 10000000U) * 100U);
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(MAC_OS)
|
||||||
# ifdef MAC_OS
|
|
||||||
mach_timespec_t t_cur;
|
mach_timespec_t t_cur;
|
||||||
clock_get_time(__pi_mac_clock, &t_cur);
|
clock_get_time(__pi_mac_clock, &t_cur);
|
||||||
# else
|
#elif defined(MICRO_PIP)
|
||||||
# ifdef FREERTOS
|
|
||||||
timespec t_cur;
|
timespec t_cur;
|
||||||
timeval tv;
|
timeval tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
@@ -265,11 +266,11 @@ PISystemTime PISystemTime::current(bool precise_but_not_system) {
|
|||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
t_cur.tv_sec = tv.tv_sec;
|
t_cur.tv_sec = tv.tv_sec;
|
||||||
t_cur.tv_nsec = tv.tv_usec * 1000;
|
t_cur.tv_nsec = tv.tv_usec * 1000;
|
||||||
# else
|
#else
|
||||||
timespec t_cur;
|
timespec t_cur;
|
||||||
clock_gettime(precise_but_not_system ? CLOCK_MONOTONIC : 0, &t_cur);
|
clock_gettime(precise_but_not_system ? CLOCK_MONOTONIC : 0, &t_cur);
|
||||||
# endif
|
#endif
|
||||||
# endif
|
#ifndef WINDOWS
|
||||||
return PISystemTime(t_cur.tv_sec, t_cur.tv_nsec);
|
return PISystemTime(t_cur.tv_sec, t_cur.tv_nsec);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "pistring.h"
|
#include "pistring.h"
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#ifdef PIP_FREERTOS
|
#ifdef MICRO_PIP
|
||||||
#include "pivariant.h"
|
#include "pivariant.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -48,10 +48,10 @@ template<typename T>
|
|||||||
class __VariantFunctions__: public __VariantFunctionsBase__ {
|
class __VariantFunctions__: public __VariantFunctionsBase__ {
|
||||||
public:
|
public:
|
||||||
__VariantFunctionsBase__ * instance() final {static __VariantFunctions__<T> ret; return &ret;}
|
__VariantFunctionsBase__ * instance() final {static __VariantFunctions__<T> ret; return &ret;}
|
||||||
#ifdef PIP_FREERTOS
|
#ifdef MICRO_PIP
|
||||||
PIString typeName() const final {static PIString ret(PIVariant(T()).typeName()); return ret;}
|
PIString typeName() const final {static PIString ret(PIVariant(T()).typeName()); return ret;}
|
||||||
#else
|
#else
|
||||||
PIString typeName() const final {static PIString ret(typeid(T).name()); return ret;}
|
PIString typeName() const final {static PIString ret(_TYPENAME_(T)); return ret;}
|
||||||
#endif
|
#endif
|
||||||
uint hash() const final {static uint ret = typeName().hash(); return ret;}
|
uint hash() const final {static uint ret = typeName().hash(); return ret;}
|
||||||
void newT(void *& ptr, const void * value) final {ptr = (void*)(new T(*(const T*)value));}
|
void newT(void *& ptr, const void * value) final {ptr = (void*)(new T(*(const T*)value));}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static const uchar binlog_sig[] = {'B','I','N','L','O','G'};
|
|||||||
REGISTER_DEVICE(PIBinaryLog)
|
REGISTER_DEVICE(PIBinaryLog)
|
||||||
|
|
||||||
PIBinaryLog::PIBinaryLog() {
|
PIBinaryLog::PIBinaryLog() {
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
setThreadedReadBufferSize(512);
|
setThreadedReadBufferSize(512);
|
||||||
#else
|
#else
|
||||||
setThreadedReadBufferSize(65536);
|
setThreadedReadBufferSize(65536);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "pican.h"
|
#include "pican.h"
|
||||||
#include "pipropertystorage.h"
|
#include "pipropertystorage.h"
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(FREERTOS)
|
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(MICRO_PIP)
|
||||||
# define PIP_CAN
|
# define PIP_CAN
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIP_CAN
|
#ifdef PIP_CAN
|
||||||
|
|||||||
@@ -58,10 +58,10 @@
|
|||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
# include <netdb.h>
|
# include <netdb.h>
|
||||||
# include <net/if.h>
|
# include <net/if.h>
|
||||||
# if !defined(ANDROID) && !defined(FREERTOS)
|
# if !defined(ANDROID) && !defined(LWIP)
|
||||||
# include <ifaddrs.h>
|
# include <ifaddrs.h>
|
||||||
# endif
|
# endif
|
||||||
# ifdef FREERTOS
|
# ifdef LWIP
|
||||||
# include <lwip/sockets.h>
|
# include <lwip/sockets.h>
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@@ -260,7 +260,7 @@ void PIEthernet::construct() {
|
|||||||
setMulticastTTL(1);
|
setMulticastTTL(1);
|
||||||
server_thread_.setData(this);
|
server_thread_.setData(this);
|
||||||
server_thread_.setName("__S__server_thread");
|
server_thread_.setName("__S__server_thread");
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
setThreadedReadBufferSize(512);
|
setThreadedReadBufferSize(512);
|
||||||
#else
|
#else
|
||||||
setThreadedReadBufferSize(65536);
|
setThreadedReadBufferSize(65536);
|
||||||
@@ -473,7 +473,7 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
|||||||
}
|
}
|
||||||
PIFlags<Parameters> params = parameters();
|
PIFlags<Parameters> params = parameters();
|
||||||
addr_r.set(path());
|
addr_r.set(path());
|
||||||
#ifndef FREERTOS
|
#ifndef LWIP
|
||||||
struct ip_mreqn mreq;
|
struct ip_mreqn mreq;
|
||||||
#else
|
#else
|
||||||
struct ip_mreq mreq;
|
struct ip_mreq mreq;
|
||||||
@@ -486,13 +486,13 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
|||||||
if (ci != 0) mreq.imr_ifindex = ci->index;*/
|
if (ci != 0) mreq.imr_ifindex = ci->index;*/
|
||||||
#endif
|
#endif
|
||||||
if (params[PIEthernet::Broadcast])
|
if (params[PIEthernet::Broadcast])
|
||||||
#ifndef FREERTOS
|
#ifndef LWIP
|
||||||
mreq.imr_address.s_addr = INADDR_ANY;
|
mreq.imr_address.s_addr = INADDR_ANY;
|
||||||
#else
|
#else
|
||||||
mreq.imr_interface.s_addr = INADDR_ANY;
|
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
#ifndef FREERTOS
|
#ifndef LWIP
|
||||||
mreq.imr_address.s_addr = addr_r.ip();
|
mreq.imr_address.s_addr = addr_r.ip();
|
||||||
#else
|
#else
|
||||||
mreq.imr_interface.s_addr = addr_r.ip();
|
mreq.imr_interface.s_addr = addr_r.ip();
|
||||||
@@ -520,20 +520,20 @@ bool PIEthernet::leaveMulticastGroup(const PIString & group) {
|
|||||||
}
|
}
|
||||||
PIFlags<Parameters> params = parameters();
|
PIFlags<Parameters> params = parameters();
|
||||||
addr_r.set(path());
|
addr_r.set(path());
|
||||||
#ifndef FREERTOS
|
#ifndef LWIP
|
||||||
struct ip_mreqn mreq;
|
struct ip_mreqn mreq;
|
||||||
#else
|
#else
|
||||||
struct ip_mreq mreq;
|
struct ip_mreq mreq;
|
||||||
#endif
|
#endif
|
||||||
memset(&mreq, 0, sizeof(mreq));
|
memset(&mreq, 0, sizeof(mreq));
|
||||||
if (params[PIEthernet::Broadcast])
|
if (params[PIEthernet::Broadcast])
|
||||||
#ifndef FREERTOS
|
#ifndef LWIP
|
||||||
mreq.imr_address.s_addr = INADDR_ANY;
|
mreq.imr_address.s_addr = INADDR_ANY;
|
||||||
#else
|
#else
|
||||||
mreq.imr_interface.s_addr = INADDR_ANY;
|
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
#ifndef FREERTOS
|
#ifndef LWIP
|
||||||
mreq.imr_address.s_addr = addr_r.ip();
|
mreq.imr_address.s_addr = addr_r.ip();
|
||||||
#else
|
#else
|
||||||
mreq.imr_interface.s_addr = addr_r.ip();
|
mreq.imr_interface.s_addr = addr_r.ip();
|
||||||
@@ -1053,7 +1053,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
|
|||||||
if (pAdapterInfo)
|
if (pAdapterInfo)
|
||||||
HeapFree(GetProcessHeap(), 0, (pAdapterInfo));
|
HeapFree(GetProcessHeap(), 0, (pAdapterInfo));
|
||||||
#else
|
#else
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
#else
|
#else
|
||||||
# ifdef ANDROID
|
# ifdef ANDROID
|
||||||
struct ifconf ifc;
|
struct ifconf ifc;
|
||||||
@@ -1165,7 +1165,7 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
|
|||||||
|
|
||||||
|
|
||||||
PIEthernet::Address PIEthernet::interfaceAddress(const PIString & interface_) {
|
PIEthernet::Address PIEthernet::interfaceAddress(const PIString & interface_) {
|
||||||
#if defined(WINDOWS) || defined(FREERTOS)
|
#if defined(WINDOWS) || defined(MICRO_PIP)
|
||||||
piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
|
piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
|
||||||
return Address();
|
return Address();
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
|
|||||||
ret.time_modification = PIDateTime::fromSystemTime(PISystemTime(fs.MTIME.tv_sec, fs.MTIME.tv_nsec));
|
ret.time_modification = PIDateTime::fromSystemTime(PISystemTime(fs.MTIME.tv_sec, fs.MTIME.tv_nsec));
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
ret.perm_user = FileInfo::Permissions((mode & S_IRUSR) == S_IRUSR, (mode & S_IWUSR) == S_IWUSR, (mode & S_IXUSR) == S_IXUSR);
|
ret.perm_user = FileInfo::Permissions((mode & S_IRUSR) == S_IRUSR, (mode & S_IWUSR) == S_IWUSR, (mode & S_IXUSR) == S_IXUSR);
|
||||||
ret.perm_group = FileInfo::Permissions((mode & S_IRGRP) == S_IRGRP, (mode & S_IWGRP) == S_IWGRP, (mode & S_IXGRP) == S_IXGRP);
|
ret.perm_group = FileInfo::Permissions((mode & S_IRGRP) == S_IRGRP, (mode & S_IWGRP) == S_IWGRP, (mode & S_IXGRP) == S_IXGRP);
|
||||||
ret.perm_other = FileInfo::Permissions((mode & S_IROTH) == S_IROTH, (mode & S_IWOTH) == S_IWOTH, (mode & S_IXOTH) == S_IXOTH);
|
ret.perm_other = FileInfo::Permissions((mode & S_IROTH) == S_IROTH, (mode & S_IWOTH) == S_IWOTH, (mode & S_IXOTH) == S_IXOTH);
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ bool PIIODevice::setOption(PIIODevice::DeviceOption o, bool yes) {
|
|||||||
|
|
||||||
|
|
||||||
bool stopThread(PIThread * t, bool hard) {
|
bool stopThread(PIThread * t, bool hard) {
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
t->stop(true);
|
t->stop(true);
|
||||||
#else
|
#else
|
||||||
if (hard) {
|
if (hard) {
|
||||||
@@ -222,7 +222,7 @@ void PIIODevice::_init() {
|
|||||||
setOptions(0);
|
setOptions(0);
|
||||||
setReopenEnabled(true);
|
setReopenEnabled(true);
|
||||||
setReopenTimeout(1000);
|
setReopenTimeout(1000);
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
threaded_read_buffer_size = 512;
|
threaded_read_buffer_size = 512;
|
||||||
//setThreadedReadBufferSize(512);
|
//setThreadedReadBufferSize(512);
|
||||||
#else
|
#else
|
||||||
@@ -276,7 +276,7 @@ void PIIODevice::terminate() {
|
|||||||
thread_started_ = false;
|
thread_started_ = false;
|
||||||
if (!init_) return;
|
if (!init_) return;
|
||||||
if (isRunning()) {
|
if (isRunning()) {
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
stop(true);
|
stop(true);
|
||||||
#else
|
#else
|
||||||
stop();
|
stop();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "pipropertystorage.h"
|
#include "pipropertystorage.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(FREERTOS)
|
#if defined(MICRO_PIP)
|
||||||
# define PISERIAL_NO_PINS
|
# define PISERIAL_NO_PINS
|
||||||
#endif
|
#endif
|
||||||
#if defined(PISERIAL_NO_PINS) || defined(WINDOWS)
|
#if defined(PISERIAL_NO_PINS) || defined(WINDOWS)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ REGISTER_DEVICE(PISPI)
|
|||||||
|
|
||||||
|
|
||||||
PISPI::PISPI(const PIString & path, uint speed, PIIODevice::DeviceMode mode) : PIIODevice(path, mode) {
|
PISPI::PISPI(const PIString & path, uint speed, PIIODevice::DeviceMode mode) : PIIODevice(path, mode) {
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
setThreadedReadBufferSize(512);
|
setThreadedReadBufferSize(512);
|
||||||
#else
|
#else
|
||||||
setThreadedReadBufferSize(1024);
|
setThreadedReadBufferSize(1024);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ PIBaseTransfer::PIBaseTransfer(): crc(standardCRC_16()), diag(false) {
|
|||||||
diag.setName("PIBaseTransfer");
|
diag.setName("PIBaseTransfer");
|
||||||
diag.start(50);
|
diag.start(50);
|
||||||
packets_count = 10;
|
packets_count = 10;
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
setPacketSize(512);
|
setPacketSize(512);
|
||||||
#else
|
#else
|
||||||
setPacketSize(4096);
|
setPacketSize(4096);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void PIPacketExtractor::construct() {
|
|||||||
ret_func_header = ret_func_footer = 0;
|
ret_func_header = ret_func_footer = 0;
|
||||||
setPayloadSize(0);
|
setPayloadSize(0);
|
||||||
setTimeout(100);
|
setTimeout(100);
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
setBufferSize(512);
|
setBufferSize(512);
|
||||||
#else
|
#else
|
||||||
setBufferSize(65536);
|
setBufferSize(65536);
|
||||||
|
|||||||
@@ -51,13 +51,16 @@
|
|||||||
#ifdef PIP_FREERTOS
|
#ifdef PIP_FREERTOS
|
||||||
# define FREERTOS
|
# define FREERTOS
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FREERTOS) || defined(PLATFORMIO)
|
||||||
|
# define MICRO_PIP
|
||||||
|
#endif
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# ifndef QNX
|
# ifndef QNX
|
||||||
# ifndef FREE_BSD
|
# ifndef FREE_BSD
|
||||||
# ifndef MAC_OS
|
# ifndef MAC_OS
|
||||||
# ifndef ANDROID
|
# ifndef ANDROID
|
||||||
# ifndef BLACKBERRY
|
# ifndef BLACKBERRY
|
||||||
# ifndef FREERTOS
|
# ifndef MICRO_PIP
|
||||||
# define LINUX
|
# define LINUX
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
|
|
||||||
#include "pilibrary.h"
|
#include "pilibrary.h"
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
@@ -110,4 +110,4 @@ void PILibrary::getLastError() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PIP_FREERTOS
|
#endif // MICRO_PIP
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#ifndef PILIBRARY_H
|
#ifndef PILIBRARY_H
|
||||||
#define PILIBRARY_H
|
#define PILIBRARY_H
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
|
|
||||||
#include "pistring.h"
|
#include "pistring.h"
|
||||||
|
|
||||||
@@ -50,5 +50,5 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PIP_FREERTOS
|
#endif // MICRO_PIP
|
||||||
#endif // PILIBRARY_H
|
#endif // PILIBRARY_H
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
|
|
||||||
#include "piplugin.h"
|
#include "piplugin.h"
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
@@ -408,4 +408,4 @@ PIString PIPluginLoader::libExtension() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // PIP_FREERTOS
|
#endif // MICRO_PIP
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#ifndef PIPLUGIN_H
|
#ifndef PIPLUGIN_H
|
||||||
#define PIPLUGIN_H
|
#define PIPLUGIN_H
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
|
|
||||||
#include "pilibrary.h"
|
#include "pilibrary.h"
|
||||||
#include "pistringlist.h"
|
#include "pistringlist.h"
|
||||||
@@ -212,5 +212,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // PIP_FREERTOS
|
#endif // MICRO_PIP
|
||||||
#endif // PIPLUGIN_H
|
#endif // PIPLUGIN_H
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
|
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
#include "piprocess.h"
|
#include "piprocess.h"
|
||||||
@@ -290,5 +290,5 @@ PIString PIProcess::getEnvironmentVariable(const PIString & variable) {
|
|||||||
return PIString();
|
return PIString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PIP_FREERTOS
|
#endif // MICRO_PIP
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#ifndef PIPROCESS_H
|
#ifndef PIPROCESS_H
|
||||||
#define PIPROCESS_H
|
#define PIPROCESS_H
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
|
|
||||||
#include "pithread.h"
|
#include "pithread.h"
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
@@ -104,5 +104,5 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PIP_FREERTOS
|
#endif // MICRO_PIP
|
||||||
#endif // PIPROCESS_H
|
#endif // PIPROCESS_H
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ PISystemMonitor::ThreadStatsFixed::ThreadStatsFixed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
PRIVATE_DEFINITION_START(PISystemMonitor)
|
PRIVATE_DEFINITION_START(PISystemMonitor)
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# ifdef MAC_OS
|
# ifdef MAC_OS
|
||||||
@@ -83,7 +83,7 @@ PRIVATE_DEFINITION_END(PISystemMonitor)
|
|||||||
PISystemMonitor::PISystemMonitor(): PIThread() {
|
PISystemMonitor::PISystemMonitor(): PIThread() {
|
||||||
pID_ = cycle = 0;
|
pID_ = cycle = 0;
|
||||||
cpu_count = PISystemInfo::instance()->processorsCount;
|
cpu_count = PISystemInfo::instance()->processorsCount;
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# ifdef QNX
|
# ifdef QNX
|
||||||
page_size = 4096;
|
page_size = 4096;
|
||||||
@@ -104,7 +104,7 @@ PISystemMonitor::~PISystemMonitor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
|
bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
|
||||||
stop();
|
stop();
|
||||||
pID_ = pID;
|
pID_ = pID;
|
||||||
@@ -134,7 +134,7 @@ bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
|
|||||||
|
|
||||||
|
|
||||||
bool PISystemMonitor::startOnSelf(int interval_ms) {
|
bool PISystemMonitor::startOnSelf(int interval_ms) {
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
bool ret = startOnProcess(PIProcess::currentPID(), interval_ms);
|
bool ret = startOnProcess(PIProcess::currentPID(), interval_ms);
|
||||||
cycle = -1;
|
cycle = -1;
|
||||||
#else
|
#else
|
||||||
@@ -196,7 +196,7 @@ void PISystemMonitor::run() {
|
|||||||
//piCout << tbid.keys().toType<uint>();
|
//piCout << tbid.keys().toType<uint>();
|
||||||
ProcessStats tstat;
|
ProcessStats tstat;
|
||||||
tstat.ID = pID_;
|
tstat.ID = pID_;
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
piForeach (PIThread * t, tv)
|
piForeach (PIThread * t, tv)
|
||||||
if (t->isPIObject())
|
if (t->isPIObject())
|
||||||
gatherThread(t->tid());
|
gatherThread(t->tid());
|
||||||
@@ -357,7 +357,7 @@ void PISystemMonitor::run() {
|
|||||||
void PISystemMonitor::gatherThread(llong id) {
|
void PISystemMonitor::gatherThread(llong id) {
|
||||||
PISystemMonitor::ThreadStats ts;
|
PISystemMonitor::ThreadStats ts;
|
||||||
ts.id = id;
|
ts.id = id;
|
||||||
#ifdef FREERTOS
|
#ifdef MICRO_PIP
|
||||||
ts.name = tbid.value(id, "<PIThread>");
|
ts.name = tbid.value(id, "<PIThread>");
|
||||||
#else
|
#else
|
||||||
ts.name = tbid.value(id, "<non-PIThread>");
|
ts.name = tbid.value(id, "<non-PIThread>");
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
PIString name;
|
PIString name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
bool startOnProcess(int pID, int interval_ms = 1000);
|
bool startOnProcess(int pID, int interval_ms = 1000);
|
||||||
#endif
|
#endif
|
||||||
bool startOnSelf(int interval_ms = 1000);
|
bool startOnSelf(int interval_ms = 1000);
|
||||||
@@ -106,7 +106,7 @@ private:
|
|||||||
PIMap<llong, PIString> tbid;
|
PIMap<llong, PIString> tbid;
|
||||||
mutable PIMutex stat_mutex;
|
mutable PIMutex stat_mutex;
|
||||||
int pID_, page_size, cpu_count, cycle;
|
int pID_, page_size, cpu_count, cycle;
|
||||||
#ifndef FREERTOS
|
#ifndef MICRO_PIP
|
||||||
PRIVATE_DECLARATION(PIP_EXPORT)
|
PRIVATE_DECLARATION(PIP_EXPORT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "pisystemtests.h"
|
#include "pisystemtests.h"
|
||||||
|
|
||||||
#ifndef PIP_FREERTOS
|
#ifndef MICRO_PIP
|
||||||
# include "piconfig.h"
|
# include "piconfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace PISystemTests {
|
|||||||
|
|
||||||
|
|
||||||
PISystemTests::PISystemTestReader::PISystemTestReader() {
|
PISystemTests::PISystemTestReader::PISystemTestReader() {
|
||||||
#if !defined(WINDOWS) && !defined(FREERTOS)
|
#if !defined(WINDOWS) && !defined(MICRO_PIP)
|
||||||
PIConfig conf(PIStringAscii("/etc/pip.conf"), PIIODevice::ReadOnly);
|
PIConfig conf(PIStringAscii("/etc/pip.conf"), PIIODevice::ReadOnly);
|
||||||
time_resolution_ns = conf.getValue(PIStringAscii("time_resolution_ns"), 1).toLong();
|
time_resolution_ns = conf.getValue(PIStringAscii("time_resolution_ns"), 1).toLong();
|
||||||
time_elapsed_ns = conf.getValue(PIStringAscii("time_elapsed_ns"), 0).toLong();
|
time_elapsed_ns = conf.getValue(PIStringAscii("time_elapsed_ns"), 0).toLong();
|
||||||
|
|||||||
85
platformio_pre.py
Normal file
85
platformio_pre.py
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import os
|
||||||
|
import glob
|
||||||
|
import shutil
|
||||||
|
import re
|
||||||
|
|
||||||
|
# The list of items
|
||||||
|
files = glob.glob('libs/main/*/*.h', recursive=True)
|
||||||
|
files += glob.glob('libs/main/*.h', recursive=True)
|
||||||
|
|
||||||
|
tdir = './include/'
|
||||||
|
|
||||||
|
if os.path.exists(tdir):
|
||||||
|
shutil.rmtree(tdir)
|
||||||
|
|
||||||
|
os.mkdir(tdir)
|
||||||
|
|
||||||
|
for filename in files:
|
||||||
|
shutil.copy(filename, tdir)
|
||||||
|
|
||||||
|
with open(tdir+'pip_defs.h', 'w') as f:
|
||||||
|
f.write('// This file was generated by PlatformIO, don`t edit it!')
|
||||||
|
|
||||||
|
with open(tdir+'pip_export.h', 'w') as f:
|
||||||
|
f.write('''
|
||||||
|
#ifndef PIP_EXPORT_H
|
||||||
|
#define PIP_EXPORT_H
|
||||||
|
|
||||||
|
# define PIP_EXPORT
|
||||||
|
# define PIP_NO_EXPORT
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PIP_DEPRECATED
|
||||||
|
# define PIP_DEPRECATED __attribute__ ((__deprecated__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PIP_DEPRECATED_EXPORT
|
||||||
|
# define PIP_DEPRECATED_EXPORT PIP_EXPORT PIP_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PIP_DEPRECATED_NO_EXPORT
|
||||||
|
# define PIP_DEPRECATED_NO_EXPORT PIP_NO_EXPORT PIP_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PIP_EXPORT_H */
|
||||||
|
''')
|
||||||
|
|
||||||
|
version_h = '''
|
||||||
|
#ifndef PIP_VERSION_H
|
||||||
|
#define PIP_VERSION_H
|
||||||
|
|
||||||
|
|
||||||
|
// Project
|
||||||
|
|
||||||
|
#define PIP_VERSION_MAJOR ${VERSION_MAJOR}
|
||||||
|
#define PIP_VERSION_MINOR ${VERSION_MINOR}
|
||||||
|
#define PIP_VERSION_REVISION ${VERSION_REVISION}
|
||||||
|
#define PIP_VERSION_BUILD 0
|
||||||
|
#define PIP_VERSION_SUFFIX \"${VERSION_SUFFIX}\"
|
||||||
|
#define PIP_VERSION_NAME \"${VERSION}\"
|
||||||
|
#define PIP_MAKE_VERSION(major, minor, revision) ((major << 16) | (minor << 8) | revision)
|
||||||
|
#define PIP_VERSION PIP_MAKE_VERSION(PIP_VERSION_MAJOR, PIP_VERSION_MINOR, PIP_VERSION_REVISION)
|
||||||
|
|
||||||
|
#endif // PIP_VERSION_H
|
||||||
|
'''
|
||||||
|
|
||||||
|
with open('CMakeLists.txt') as cm:
|
||||||
|
str = cm.read()
|
||||||
|
v_major = re.findall(r'pip_MAJOR\s+(\d+)\)', str)
|
||||||
|
v_minor = re.findall(r'pip_MINOR\s+(\d+)\)', str)
|
||||||
|
v_rev = re.findall(r'pip_REVISION\s+(\d+)\)', str)
|
||||||
|
v_suffix = re.findall(r'pip_SUFFIX\s+(\w+)\)', str)
|
||||||
|
ver = ''
|
||||||
|
ver = v_major[0]+'.'+v_minor[0]+'.'+v_rev[0]
|
||||||
|
version_h.replace('${VERSION_MAJOR}', v_major[0])
|
||||||
|
version_h.replace('${VERSION_MINOR}', v_minor[0])
|
||||||
|
version_h.replace('${VERSION_REVISION}', v_rev[0])
|
||||||
|
if len(v_suffix):
|
||||||
|
ver += v_suffix[0]
|
||||||
|
version_h.replace('${VERSION_SUFFIX}', v_suffix[0])
|
||||||
|
else:
|
||||||
|
version_h.replace('${VERSION_SUFFIX}', '')
|
||||||
|
print('PIP version = '+ver)
|
||||||
|
with open(tdir+'pip_version.h', 'w') as f:
|
||||||
|
f.write(version_h)
|
||||||
|
|
||||||
Reference in New Issue
Block a user