add initial RTOS support
now without io devices and console git-svn-id: svn://db.shs.com.ru/pip@683 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -45,7 +45,7 @@ typedef PIByteArray(*AccessFunction)(const void *, const char *);
|
||||
|
||||
struct PIP_EXPORT TypeInfo {
|
||||
TypeInfo(const PIString & n = PIString(), const PIString & t = PIString(), PICodeInfo::TypeFlags f = 0, int b = -1) {name = n; type = t; flags = f; bits = b;}
|
||||
const bool isBitfield() const {return bits > 0;}
|
||||
bool isBitfield() const {return bits > 0;}
|
||||
MetaMap meta;
|
||||
PIString name;
|
||||
PIString type;
|
||||
|
||||
@@ -41,4 +41,5 @@ typedef LONG(NTAPI*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
#endif // PIINCLUDES_P_H
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
#include "pisignals.h"
|
||||
#include "piobject.h"
|
||||
#include "pisysteminfo.h"
|
||||
#include "pidir.h"
|
||||
#include "piprocess.h"
|
||||
#include "piresourcesstorage.h"
|
||||
#ifndef FREERTOS
|
||||
# include "pidir.h"
|
||||
# include "piprocess.h"
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
# include <winsock2.h>
|
||||
extern FILETIME __pi_ftjan1970;
|
||||
@@ -44,7 +46,9 @@
|
||||
}
|
||||
#else
|
||||
# include <pwd.h>
|
||||
# include <sys/utsname.h>
|
||||
# ifndef FREERTOS
|
||||
# include <sys/utsname.h>
|
||||
# endif
|
||||
# include <pthread.h>
|
||||
# ifdef BLACKBERRY
|
||||
# include <signal.h>
|
||||
@@ -88,6 +92,7 @@ PRIVATE_DEFINITION_START(PIInit)
|
||||
#endif
|
||||
PRIVATE_DEFINITION_END(PIInit)
|
||||
|
||||
#ifndef FREERTOS
|
||||
void __sighandler__(PISignals::Signal s) {
|
||||
//piCout << Hex << int(s);
|
||||
if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput)
|
||||
@@ -95,6 +100,7 @@ void __sighandler__(PISignals::Signal s) {
|
||||
if (s == PISignals::UserDefined1)
|
||||
dumpApplicationToFile(PIDir::home().path() + PIDir::separator + PIStringAscii("_PIP_DUMP_") + PIString::fromNumber(PIProcess::currentPID()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
@@ -109,6 +115,7 @@ PIInit::PIInit() {
|
||||
PISystemInfo * sinfo = PISystemInfo::instance();
|
||||
sinfo->execDateTime = PIDateTime::current();
|
||||
setFileCharset("UTF-8");
|
||||
#ifndef FREERTOS
|
||||
#ifndef ANDROID
|
||||
PISignals::setSlot(__sighandler__);
|
||||
PISignals::grabSignals(PISignals::UserDefined1);
|
||||
@@ -211,11 +218,14 @@ 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);
|
||||
@@ -248,11 +258,13 @@ PIInit::PIInit() {
|
||||
if (l)
|
||||
sinfo->user = l;
|
||||
}
|
||||
# ifndef FREERTOS
|
||||
struct utsname uns;
|
||||
if (uname(&uns) == 0) {
|
||||
sinfo->OS_version = uns.release;
|
||||
sinfo->architecture = uns.machine;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
sinfo->OS_name =
|
||||
#ifdef WINDOWS
|
||||
@@ -270,7 +282,11 @@ PIInit::PIInit() {
|
||||
# ifdef FREE_BSD
|
||||
PIStringAscii("FreeBSD");
|
||||
# else
|
||||
# ifdef FREERTOS
|
||||
PIStringAscii("FreeRTOS");
|
||||
# else
|
||||
uns.sysname;
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
*/
|
||||
|
||||
#include "piobject.h"
|
||||
#include "pifile.h"
|
||||
#include "pisysteminfo.h"
|
||||
|
||||
#ifndef FREERTOS
|
||||
# include "pifile.h"
|
||||
#endif
|
||||
|
||||
/** \class PIObject
|
||||
* \brief This is base class for any classes which use events -> handlers mechanism.
|
||||
@@ -585,7 +586,7 @@ void dumpApplication() {
|
||||
//printf("dump application done\n");
|
||||
}
|
||||
|
||||
|
||||
#ifndef FREERTOS
|
||||
bool dumpApplicationToFile(const PIString & path) {
|
||||
PIFile f(path + "_tmp");
|
||||
f.setName("__S__DumpFile");
|
||||
@@ -600,3 +601,4 @@ bool dumpApplicationToFile(const PIString & path) {
|
||||
PIFile::rename(path + "_tmp", path);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,14 @@
|
||||
|
||||
|
||||
#include "pistring.h"
|
||||
#include <ctime>
|
||||
#ifdef QNX
|
||||
# include <time.h>
|
||||
#ifdef FREERTOS
|
||||
# include "time.h"
|
||||
#else
|
||||
# include <ctime>
|
||||
# ifdef QNX
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//! \brief Sleep for "msecs" milliseconds
|
||||
PIP_EXPORT void msleep(int msecs);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "pican.h"
|
||||
#include "pipropertystorage.h"
|
||||
#include "piincludes_p.h"
|
||||
#if !defined(WINDOWS) && !defined(MAC_OS)
|
||||
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(FREERTOS)
|
||||
# define PIP_CAN
|
||||
#endif
|
||||
#ifdef PIP_CAN
|
||||
|
||||
@@ -45,13 +45,18 @@
|
||||
# define ANDROID
|
||||
# endif
|
||||
#endif
|
||||
#ifdef PIP_FREERTOS
|
||||
# define FREERTOS
|
||||
#endif
|
||||
#ifndef WINDOWS
|
||||
# ifndef QNX
|
||||
# ifndef FREE_BSD
|
||||
# ifndef MAC_OS
|
||||
# ifndef ANDROID
|
||||
# ifndef BLACKBERRY
|
||||
# define LINUX
|
||||
# ifndef FREERTOS
|
||||
# define LINUX
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIP_FREERTOS
|
||||
|
||||
#include "picodec.h"
|
||||
|
||||
|
||||
@@ -39,3 +41,5 @@ PIByteArray PICodec::exec_iconv(const PIString & from, const PIString & to, cons
|
||||
waitForFinish();
|
||||
return readOutput();
|
||||
}
|
||||
|
||||
#endif // PIP_FREERTOS
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef PICODEC_H
|
||||
#define PICODEC_H
|
||||
|
||||
#ifndef PIP_FREERTOS
|
||||
|
||||
#include "piprocess.h"
|
||||
|
||||
class PIP_EXPORT PICodec: protected PIProcess
|
||||
@@ -48,4 +50,5 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // PIP_FREERTOS
|
||||
#endif // PICODEC_H
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIP_FREERTOS
|
||||
|
||||
#include "pilibrary.h"
|
||||
#include "piincludes_p.h"
|
||||
#ifndef WINDOWS
|
||||
@@ -107,3 +109,5 @@ void PILibrary::getLastError() {
|
||||
else liberror.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // PIP_FREERTOS
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#
|
||||
#ifndef PILIBRARY_H
|
||||
#define PILIBRARY_H
|
||||
|
||||
#ifndef PIP_FREERTOS
|
||||
|
||||
#include "pistring.h"
|
||||
|
||||
class PIP_EXPORT PILibrary {
|
||||
@@ -45,4 +47,5 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // PIP_FREERTOS
|
||||
#endif // PILIBRARY_H
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIP_FREERTOS
|
||||
|
||||
#include "piincludes_p.h"
|
||||
#include "piprocess.h"
|
||||
#ifndef WINDOWS
|
||||
@@ -26,7 +28,6 @@
|
||||
#ifdef MAC_OS
|
||||
# include <crt_externs.h>
|
||||
#endif
|
||||
|
||||
PRIVATE_DEFINITION_START(PIProcess)
|
||||
#ifdef WINDOWS
|
||||
STARTUPINFOA si;
|
||||
@@ -38,7 +39,6 @@ PRIVATE_DEFINITION_START(PIProcess)
|
||||
PRIVATE_DEFINITION_END(PIProcess)
|
||||
|
||||
|
||||
|
||||
PIProcess::PIProcess(): PIThread() {
|
||||
exit_code = -1;
|
||||
#ifdef WINDOWS
|
||||
@@ -307,3 +307,5 @@ PIString PIProcess::getEnvironmentVariable(const PIString & variable) {
|
||||
return PIString();
|
||||
}
|
||||
|
||||
#endif // PIP_FREERTOS
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#ifndef PIPROCESS_H
|
||||
#define PIPROCESS_H
|
||||
|
||||
#ifndef PIP_FREERTOS
|
||||
|
||||
#include "pithread.h"
|
||||
#include "pifile.h"
|
||||
|
||||
@@ -102,4 +104,5 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // PIP_FREERTOS
|
||||
#endif // PIPROCESS_H
|
||||
|
||||
@@ -83,6 +83,7 @@ PISystemMonitor::ProcessStats::ProcessStats() {
|
||||
}
|
||||
|
||||
|
||||
#ifndef FREERTOS
|
||||
bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
|
||||
stop();
|
||||
self_ = false;
|
||||
@@ -109,13 +110,12 @@ bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
|
||||
return start(interval_ms);
|
||||
}
|
||||
|
||||
|
||||
bool PISystemMonitor::startOnSelf(int interval_ms) {
|
||||
bool ret = startOnProcess(PIProcess::currentPID(), interval_ms);
|
||||
self_ = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const {
|
||||
mutex_.lock();
|
||||
|
||||
@@ -70,9 +70,10 @@ public:
|
||||
ullong space_used;
|
||||
ullong space_free;*/
|
||||
};
|
||||
|
||||
#ifndef FREERTOS
|
||||
bool startOnProcess(int pID, int interval_ms = 1000);
|
||||
bool startOnSelf(int interval_ms = 1000);
|
||||
#endif
|
||||
void stop();
|
||||
|
||||
const ProcessStats & statistic() const {return stat;}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
# include <sys/syscall.h>
|
||||
# define gettid() syscall(SYS_gettid)
|
||||
#endif
|
||||
#if defined(MAC_OS) || defined(BLACKBERRY)
|
||||
#if defined(MAC_OS) || defined(BLACKBERRY) || defined(FREERTOS)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
__THREAD_FUNC_RET__ thread_function(void * t) {PIThread::__thread_func__(t); return 0;}
|
||||
@@ -335,7 +335,8 @@ int PIThread::priority2System(PIThread::Priority p) {
|
||||
|
||||
|
||||
void PIThread::setPriority(PIThread::Priority prior) {
|
||||
priority_ = prior;
|
||||
#ifndef FREERTOS // FreeRTOS can't change priority runtime
|
||||
priority_ = prior;
|
||||
#ifndef WINDOWS
|
||||
if (!running_ || (PRIVATE->thread == 0)) return;
|
||||
//piCout << "setPriority" << PRIVATE->thread;
|
||||
@@ -354,6 +355,7 @@ void PIThread::setPriority(PIThread::Priority prior) {
|
||||
if (!running_ || (PRIVATE->thread == 0)) return;
|
||||
SetThreadPriority(PRIVATE->thread, priority2System(priority_));
|
||||
#endif
|
||||
#endif //FREERTOS
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user