FreeRTOS console and io devices support for compile
git-svn-id: svn://db.shs.com.ru/pip@688 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -120,10 +120,8 @@ endif()
|
||||
# Main lib
|
||||
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt")
|
||||
if(PIP_FREERTOS)
|
||||
list(REMOVE_ITEM PIP_FOLDERS "io_devices")
|
||||
include_directories("${PIP_SRC_MAIN}/io_devices")
|
||||
list(REMOVE_ITEM PIP_FOLDERS "console")
|
||||
include_directories("${PIP_SRC_MAIN}/console")
|
||||
#list(REMOVE_ITEM PIP_FOLDERS "console")
|
||||
#include_directories("${PIP_SRC_MAIN}/console")
|
||||
endif()
|
||||
include_directories("${PIP_SRC_MAIN}")
|
||||
set(PIP_MAIN_FOLDERS)
|
||||
@@ -132,7 +130,6 @@ foreach(F ${PIP_FOLDERS})
|
||||
include_directories("${PIP_SRC_MAIN}/${F}")
|
||||
gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS)
|
||||
endforeach(F)
|
||||
|
||||
# Crypt lib
|
||||
gather_src("${PIP_SRC_CRYPT}" CPP_LIB_CRYPT HDRS PHDRS)
|
||||
|
||||
@@ -234,7 +231,7 @@ if(ICU)
|
||||
add_definitions(-DPIP_ICU)
|
||||
list(APPEND LIBS_MAIN icuuc)
|
||||
else()
|
||||
message(STATUS "Building PIP without ICU, attention!")
|
||||
message(STATUS "Building PIP without ICU")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -465,9 +462,19 @@ else(NOT PIP_FREERTOS)
|
||||
message(STATUS "Building PIP with crypt support")
|
||||
add_definitions(-DPIP_CRYPT)
|
||||
add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT})
|
||||
target_link_libraries(pip_crypt pip ${sodium_FOUND})
|
||||
list(APPEND LIBS_STATUS sodium)
|
||||
target_link_libraries(pip_crypt pip)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_crypt)
|
||||
set(IO_UTILS_LIBS pip)
|
||||
add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS})
|
||||
message(STATUS "Building PIP IO Utils library with crypt support")
|
||||
list(APPEND IO_UTILS_LIBS pip_crypt)
|
||||
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
|
||||
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
||||
message(STATUS "Building PIP with zlib compress support")
|
||||
add_definitions(-DPIP_COMPRESS)
|
||||
add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS})
|
||||
target_link_libraries(pip_compress pip)
|
||||
list(APPEND PIP_LIBS_TARGETS pip_compress)
|
||||
endif(NOT PIP_FREERTOS)
|
||||
|
||||
# Install
|
||||
|
||||
@@ -1,24 +1,41 @@
|
||||
set(COMPONENT_SRCS "main.cpp" "pip/src_main/io_devices/piiodevice.cpp")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS pip/src_main)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/auxiliary)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/code)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/console)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/containers)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/core)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/crypt)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/geo)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/io_devices)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/io_utils)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/math)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/opencl)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/resources)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/system)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS pip/src_main/thread)
|
||||
set(COMPONENT_PRIV_REQUIRES pthread)
|
||||
set(COMPONENT_SRCS "main.cpp")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "pip/src_main")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/auxiliary")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/code")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/console")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/containers")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/core")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/crypt")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/geo")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/io_devices")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/io_utils")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/math")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/opencl")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/resources")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/system")
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS "pip/src_main/thread")
|
||||
set(COMPONENT_PRIV_REQUIRES pthread lwip freertos vfs spiffs)
|
||||
set(COMPONENT_ADD_LDFRAGMENTS linker.lf)
|
||||
register_component()
|
||||
set(PIP_FREERTOS ON)
|
||||
set(LIB OFF)
|
||||
include_directories(${IDF_INCLUDE_DIRECTORIES} ../newlib/platform_include ../libsodium/libsodium/src/libsodium/include ../libsodium/port_include ../heap/include ../esp32/include ../spi_flash/include ../driver/include ../soc/include ../soc/esp32/include ../freertos/include)
|
||||
set(INCLUDE_DIRS ${IDF_INCLUDE_DIRECTORIES})
|
||||
list(APPEND INCLUDE_DIRS "../newlib/platform_include")
|
||||
list(APPEND INCLUDE_DIRS "../newlib/include")
|
||||
list(APPEND INCLUDE_DIRS "../libsodium/libsodium/src/libsodium/include")
|
||||
list(APPEND INCLUDE_DIRS "../libsodium/port_include")
|
||||
list(APPEND INCLUDE_DIRS "../heap/include")
|
||||
list(APPEND INCLUDE_DIRS "../esp32/include")
|
||||
list(APPEND INCLUDE_DIRS "../driver/include")
|
||||
list(APPEND INCLUDE_DIRS "../spi_flash/include")
|
||||
list(APPEND INCLUDE_DIRS "../spiffs/include")
|
||||
list(APPEND INCLUDE_DIRS "../soc/include")
|
||||
list(APPEND INCLUDE_DIRS "../soc/esp32/include")
|
||||
list(APPEND INCLUDE_DIRS "../freertos/include")
|
||||
list(APPEND INCLUDE_DIRS "../lwip/lwip/src/include")
|
||||
list(APPEND INCLUDE_DIRS "../lwip/port/esp32/include")
|
||||
list(APPEND INCLUDE_DIRS "../vfs/include")
|
||||
include_directories(${INCLUDE_DIRS})
|
||||
#message("IDF_COMPILE_DEFINITIONS = ${IDF_COMPILE_DEFINITIONS}")
|
||||
#message("IDF_INCLUDE_DIRECTORIES = ${IDF_INCLUDE_DIRECTORIES}")
|
||||
add_compile_options(${IDF_COMPILE_OPTIONS})
|
||||
@@ -28,4 +45,4 @@ add_definitions(-DGCC_NOT_5_2_0=0)
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
add_subdirectory(pip)
|
||||
|
||||
target_link_libraries(${COMPONENT_TARGET} pip)
|
||||
target_link_libraries(${COMPONENT_TARGET} pip pip_crypt pip_io_utils pip_compress)
|
||||
|
||||
@@ -19,7 +19,14 @@
|
||||
|
||||
#include "picompress.h"
|
||||
#ifdef PIP_COMPRESS
|
||||
# include <zlib.h>
|
||||
# ifdef FREERTOS
|
||||
# include "rom/miniz.h"
|
||||
# define compress2 mz_compress2
|
||||
# define Z_OK MZ_OK
|
||||
# define uncompress mz_uncompress
|
||||
# else
|
||||
# include <zlib.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -91,12 +91,16 @@ PIConsole::PIConsole(bool startNow, PIKbdListener::KBFunc slot): PIThread() {
|
||||
GetConsoleMode(PRIVATE->hOut, &PRIVATE->smode);
|
||||
GetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo);
|
||||
#else
|
||||
# ifdef FREERTOS
|
||||
width = 80;
|
||||
height = 24;
|
||||
# else
|
||||
winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
width = ws.ws_col;
|
||||
height = ws.ws_row;
|
||||
# endif
|
||||
#endif
|
||||
tabs.reserve(16);
|
||||
addTab("main");
|
||||
listener = new PIKbdListener(key_event, this);
|
||||
peer_timer = new PITimer();
|
||||
@@ -544,10 +548,15 @@ void PIConsole::run() {
|
||||
width = PRIVATE->sbi.srWindow.Right - PRIVATE->sbi.srWindow.Left;
|
||||
height = PRIVATE->sbi.srWindow.Bottom - PRIVATE->sbi.srWindow.Top;
|
||||
#else
|
||||
# ifdef FREERTOS
|
||||
width = 80;
|
||||
height = 24;
|
||||
# else
|
||||
winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
width = ws.ws_col;
|
||||
height = ws.ws_row;
|
||||
# endif
|
||||
#endif
|
||||
//fflush(0); return;
|
||||
PICout::__mutex__().lock();
|
||||
@@ -634,10 +643,15 @@ void PIConsole::fillLabels() {
|
||||
width = PRIVATE->sbi.srWindow.Right - PRIVATE->sbi.srWindow.Left;
|
||||
height = PRIVATE->sbi.srWindow.Bottom - PRIVATE->sbi.srWindow.Top;
|
||||
#else
|
||||
# ifdef FREERTOS
|
||||
width = 80;
|
||||
height = 24;
|
||||
# else
|
||||
winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
width = ws.ws_col;
|
||||
height = ws.ws_row;
|
||||
# endif
|
||||
#endif
|
||||
max_y = 0;
|
||||
col_cnt = columns().size();
|
||||
|
||||
@@ -62,10 +62,15 @@ PIScreen::SystemConsole::SystemConsole() {
|
||||
GetConsoleMode(PRIVATE->hOut, &PRIVATE->smode);
|
||||
GetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo);
|
||||
#else
|
||||
# ifdef FREERTOS
|
||||
w = 80;
|
||||
h = 24;
|
||||
# else
|
||||
winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
w = ws.ws_col;
|
||||
h = ws.ws_row;
|
||||
# endif
|
||||
#endif
|
||||
resize(w, h);
|
||||
}
|
||||
@@ -109,10 +114,15 @@ void PIScreen::SystemConsole::prepare() {
|
||||
w = PRIVATE->csbi.srWindow.Right - PRIVATE->csbi.srWindow.Left + 1;
|
||||
h = PRIVATE->csbi.srWindow.Bottom - PRIVATE->csbi.srWindow.Top + 1;
|
||||
#else
|
||||
# ifdef FREERTOS
|
||||
w = 80;
|
||||
h = 24;
|
||||
# else
|
||||
winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
w = ws.ws_col;
|
||||
h = ws.ws_row;
|
||||
# endif
|
||||
#endif
|
||||
resize(w, h);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void PIScreenTile::layout() {
|
||||
}
|
||||
if (as <= ts) {
|
||||
int acnt(0);
|
||||
SizePolicy pol;
|
||||
SizePolicy pol = Fixed;
|
||||
if (ecnt > 0) {
|
||||
acnt = ecnt;
|
||||
pol = Expanding;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "piincludes_p.h"
|
||||
#include "piterminal.h"
|
||||
#include "pisharedmemory.h"
|
||||
#ifndef FREERTOS
|
||||
#ifdef WINDOWS
|
||||
# include <windows.h>
|
||||
# include <wincon.h>
|
||||
@@ -911,3 +912,5 @@ bool PITerminal::resize(int cols, int rows) {
|
||||
cells[i].resize(size_x);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // FREERTOS
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "piobject.h"
|
||||
#include "pisysteminfo.h"
|
||||
#include "piresourcesstorage.h"
|
||||
#include "pidir.h"
|
||||
#ifndef FREERTOS
|
||||
# include "pidir.h"
|
||||
# include "piprocess.h"
|
||||
#endif
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
@@ -19,7 +19,12 @@
|
||||
#include "piincludes_p.h"
|
||||
#include "pidir.h"
|
||||
|
||||
//#if !defined(ANDROID)
|
||||
#ifdef ESP_PLATFORM
|
||||
extern "C" {
|
||||
# include "esp_spiffs.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
const PIChar PIDir::separator = '/';
|
||||
#ifdef QNX
|
||||
# define _stat_struct_ struct stat
|
||||
@@ -34,14 +39,18 @@ const PIChar PIDir::separator = '/';
|
||||
# ifdef ANDROID
|
||||
# include <dirent.h>
|
||||
# else
|
||||
# include <sys/dir.h>
|
||||
# ifdef FREERTOS
|
||||
# include <sys/dirent.h>
|
||||
# else
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# endif
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
/*! \class PIDir
|
||||
* \brief Local directory
|
||||
*
|
||||
*
|
||||
* \section PIDir_sec0 Synopsis
|
||||
* This class provide access to local file. You can manipulate
|
||||
* binary content or use this class as text stream. To binary
|
||||
@@ -284,7 +293,7 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
|
||||
}
|
||||
|
||||
#else
|
||||
# ifdef QNX
|
||||
# if defined(QNX) || defined(FREERTOS)
|
||||
struct dirent * de = 0;
|
||||
DIR * dir = 0;
|
||||
dir = opendir(p.data());
|
||||
@@ -299,7 +308,7 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
|
||||
# else
|
||||
dirent ** list;
|
||||
int cnt = scandir(p.data(), &list, 0,
|
||||
# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY) || defined(QNX)
|
||||
# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY)
|
||||
alphasort);
|
||||
# else
|
||||
versionsort);
|
||||
@@ -349,9 +358,11 @@ bool PIDir::isExists(const PIString & path) {
|
||||
DWORD ret = GetFileAttributes((LPCTSTR)(path.data()));
|
||||
return (ret != 0xFFFFFFFF) && (ret & FILE_ATTRIBUTE_DIRECTORY);
|
||||
#else
|
||||
#ifndef ESP_PLATFORM
|
||||
DIR * dir_ = opendir(path.data());
|
||||
if (dir_ == 0) return false;
|
||||
closedir(dir_);
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@@ -367,7 +378,9 @@ PIDir PIDir::current() {
|
||||
ret.prepend(separator);
|
||||
return PIDir(ret);
|
||||
#else
|
||||
#ifndef ESP_PLATFORM
|
||||
if (getcwd(rc, 1024) == 0) return PIString();
|
||||
#endif
|
||||
#endif
|
||||
return PIDir(rc);
|
||||
}
|
||||
@@ -471,4 +484,3 @@ bool PIDir::renameDir(const PIString & path, const PIString & new_name) {
|
||||
}
|
||||
|
||||
|
||||
//#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#define PIDIR_H
|
||||
|
||||
#include "pifile.h"
|
||||
//#if !defined(ANDROID)
|
||||
|
||||
|
||||
class PIP_EXPORT PIDir
|
||||
{
|
||||
|
||||
@@ -56,11 +56,14 @@
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <sys/socket.h>
|
||||
# include <net/if.h>
|
||||
# include <netdb.h>
|
||||
# ifndef ANDROID
|
||||
# include <net/if.h>
|
||||
# if !defined(ANDROID) && !defined(FREERTOS)
|
||||
# include <ifaddrs.h>
|
||||
# endif
|
||||
# ifdef FREERTOS
|
||||
# include <lwip/sockets.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#include <errno.h>
|
||||
@@ -478,7 +481,11 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
||||
//if (!params[Broadcast])
|
||||
//;piCoutObj << "Warning: \"Broadcast\" parameter not set, \"joinMulticastGroup(\"" << group << "\")\" may be useless!";
|
||||
addr_r.set(path());
|
||||
#ifndef FREERTOS
|
||||
struct ip_mreqn mreq;
|
||||
#else
|
||||
struct ip_mreq mreq;
|
||||
#endif
|
||||
memset(&mreq, 0, sizeof(mreq));
|
||||
#ifdef LINUX
|
||||
//mreq.imr_address.s_addr = INADDR_ANY;
|
||||
@@ -486,8 +493,19 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
||||
const PIEthernet::Interface * ci = il.getByAddress(addr_r.ipString());
|
||||
if (ci != 0) mreq.imr_ifindex = ci->index;*/
|
||||
#endif
|
||||
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
|
||||
else mreq.imr_address.s_addr = addr_r.ip();
|
||||
if (params[PIEthernet::Broadcast])
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = INADDR_ANY;
|
||||
#else
|
||||
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||
#endif
|
||||
else
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = addr_r.ip();
|
||||
#else
|
||||
mreq.imr_interface.s_addr = addr_r.ip();
|
||||
#endif
|
||||
|
||||
/*#ifndef WINDOWS
|
||||
PIEthernet::InterfaceList il = interfaces();
|
||||
const PIEthernet::Interface * ci = il.getByAddress(ip_);
|
||||
@@ -529,10 +547,24 @@ bool PIEthernet::leaveMulticastGroup(const PIString & group) {
|
||||
}
|
||||
PIFlags<Parameters> params = parameters();
|
||||
addr_r.set(path());
|
||||
#ifndef FREERTOS
|
||||
struct ip_mreqn mreq;
|
||||
#else
|
||||
struct ip_mreq mreq;
|
||||
#endif
|
||||
memset(&mreq, 0, sizeof(mreq));
|
||||
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
|
||||
else mreq.imr_address.s_addr = addr_r.ip();
|
||||
if (params[PIEthernet::Broadcast])
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = INADDR_ANY;
|
||||
#else
|
||||
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||
#endif
|
||||
else
|
||||
#ifndef FREERTOS
|
||||
mreq.imr_address.s_addr = addr_r.ip();
|
||||
#else
|
||||
mreq.imr_interface.s_addr = addr_r.ip();
|
||||
#endif
|
||||
mreq.imr_multiaddr.s_addr = inet_addr(group.dataAscii());
|
||||
if (ethSetsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) == -1) {
|
||||
piCoutObj << "Can`t leave multicast group" << group << "," << ethErrorString();
|
||||
@@ -1023,6 +1055,8 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
|
||||
if (pAdapterInfo)
|
||||
HeapFree(GetProcessHeap(), 0, (pAdapterInfo));
|
||||
#else
|
||||
#ifdef FREERTOS
|
||||
#else
|
||||
/*# ifdef QNX
|
||||
PIStringList il, sl;
|
||||
PIProcess proc;
|
||||
@@ -1157,14 +1191,15 @@ PIEthernet::InterfaceList PIEthernet::interfaces() {
|
||||
piCout << "[PIEthernet] Can`t get interfaces:" << errorString();
|
||||
if (s != -1) ::close(s);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
return il;
|
||||
}
|
||||
|
||||
|
||||
PIEthernet::Address PIEthernet::interfaceAddress(const PIString & interface_) {
|
||||
#ifdef WINDOWS
|
||||
piCout << "[PIEthernet] Not implemented on Windows, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
|
||||
#if defined(WINDOWS) || defined(FREERTOS)
|
||||
piCout << "[PIEthernet] Not implemented, use \"PIEthernet::allAddresses\" or \"PIEthernet::interfaces\" instead";
|
||||
return Address();
|
||||
#else
|
||||
struct ifreq ifr;
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
#include "pifile.h"
|
||||
#include "pidir.h"
|
||||
#include "pitime_win.h"
|
||||
#ifdef ESP_PLATFORM
|
||||
extern "C" {
|
||||
# include "esp_spiffs.h"
|
||||
}
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
# undef S_IFDIR
|
||||
# undef S_IFREG
|
||||
@@ -40,7 +45,7 @@
|
||||
# include <utime.h>
|
||||
#endif
|
||||
#define S_IFHDN 0x40
|
||||
#if defined(QNX) || defined(ANDROID)
|
||||
#if defined(QNX) || defined(ANDROID) || defined(FREERTOS)
|
||||
# define _fopen_call_ fopen
|
||||
# define _fseek_call_ fseek
|
||||
# define _ftell_call_ ftell
|
||||
@@ -68,7 +73,6 @@
|
||||
# define _stat_link_ lstat64
|
||||
#endif
|
||||
|
||||
|
||||
/*! \class PIFile
|
||||
* \brief Local file
|
||||
*
|
||||
@@ -661,7 +665,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
|
||||
ret.time_access = PIDateTime::fromSystemTime(PISystemTime(fs.st_atime, fs.st_atime_nsec));
|
||||
ret.time_modification = PIDateTime::fromSystemTime(PISystemTime(fs.st_mtime, fs.st_mtime_nsec));
|
||||
#else
|
||||
# ifdef QNX
|
||||
# if defined(QNX) || defined(FREERTOS)
|
||||
ret.time_access = PIDateTime::fromSecondSinceEpoch(fs.st_atime);
|
||||
ret.time_modification = PIDateTime::fromSecondSinceEpoch(fs.st_mtime);
|
||||
# else
|
||||
@@ -676,6 +680,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
|
||||
ret.time_modification = PIDateTime::fromSystemTime(PISystemTime(fs.MTIME.tv_sec, fs.MTIME.tv_nsec));
|
||||
# endif
|
||||
#endif
|
||||
#ifndef FREERTOS
|
||||
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_other = FileInfo::Permissions((mode & S_IROTH) == S_IROTH, (mode & S_IWOTH) == S_IWOTH, (mode & S_IXOTH) == S_IXOTH);
|
||||
@@ -688,6 +693,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
|
||||
if ((mode & S_IFREG) == S_IFREG) ret.flags |= FileInfo::File;
|
||||
if ((mode & S_IFLNK) == S_IFLNK) ret.flags |= FileInfo::SymbolicLink;
|
||||
if ((mode & S_IFHDN) == S_IFHDN) ret.flags |= FileInfo::Hidden;
|
||||
#endif
|
||||
#endif
|
||||
if (n == ".") ret.flags = FileInfo::Dir | FileInfo::Dot;
|
||||
if (n == "..") ret.flags = FileInfo::Dir | FileInfo::DotDot;
|
||||
@@ -723,6 +729,7 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
#else
|
||||
#ifndef ESP_PLATFORM
|
||||
int mode(0);
|
||||
if (info.perm_user.read) mode |= S_IRUSR;
|
||||
if (info.perm_user.write) mode |= S_IWUSR;
|
||||
@@ -752,6 +759,7 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
|
||||
piCout << "[PIFile] applyFileInfo: \"utimes\" error:" << errorString();
|
||||
//return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,11 @@
|
||||
#include "pidir.h"
|
||||
#include "pipropertystorage.h"
|
||||
#include <errno.h>
|
||||
#ifdef WINDOWS
|
||||
# include <winreg.h>
|
||||
|
||||
#if defined(WINDOWS) || defined(FREERTOS)
|
||||
# define PISERIAL_NO_PINS
|
||||
#endif
|
||||
#ifdef PISERIAL_NO_PINS
|
||||
# define TIOCM_LE 1
|
||||
# define TIOCM_DTR 4
|
||||
# define TIOCM_RTS 7
|
||||
@@ -33,6 +36,9 @@
|
||||
# define TIOCM_CAR 1
|
||||
# define TIOCM_RNG 9
|
||||
# define TIOCM_DSR 6
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
# include <winreg.h>
|
||||
# define B50 50
|
||||
# define B75 75
|
||||
# define B110 110
|
||||
@@ -113,7 +119,7 @@
|
||||
#ifndef CRTSCTS
|
||||
# define CRTSCTS 020000000000
|
||||
#endif
|
||||
#if defined(LINUX)
|
||||
#ifdef LINUX
|
||||
# include <linux/serial.h>
|
||||
#endif
|
||||
|
||||
@@ -251,7 +257,7 @@ bool PISerial::isDSR() const {return isBit(TIOCM_DSR, "DSR");}
|
||||
|
||||
|
||||
bool PISerial::setBit(int bit, bool on, const PIString & bname) {
|
||||
#ifndef WINDOWS
|
||||
#ifndef PISERIAL_NO_PINS
|
||||
if (fd < 0) {
|
||||
piCoutObj << "setBit" << bname << " error: \"" << path() << "\" is not opened!";
|
||||
return false;
|
||||
@@ -262,14 +268,14 @@ bool PISerial::setBit(int bit, bool on, const PIString & bname) {
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
piCoutObj << "setBit" << bname << " doesn`t implemented on Windows, sorry :-(";
|
||||
piCoutObj << "setBit" << bname << " doesn`t implemented, sorry :-(";
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool PISerial::isBit(int bit, const PIString & bname) const {
|
||||
#ifndef WINDOWS
|
||||
#ifndef PISERIAL_NO_PINS
|
||||
if (fd < 0) {
|
||||
piCoutObj << "isBit" << bname << " error: \"" << path() << "\" is not opened!";
|
||||
return false;
|
||||
@@ -279,7 +285,7 @@ bool PISerial::isBit(int bit, const PIString & bname) const {
|
||||
piCoutObj << "isBit" << bname << " error: " << errorString();
|
||||
return ret & bit;
|
||||
#else
|
||||
piCoutObj << "isBit" << bname << " doesn`t implemented on Windows, sorry :-(";
|
||||
piCoutObj << "isBit" << bname << " doesn`t implemented, sorry :-(";
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "pispi.h"
|
||||
#include "pipropertystorage.h"
|
||||
#include "piincludes_p.h"
|
||||
#if !defined(WINDOWS) && !defined(MAC_OS)
|
||||
#ifdef LINUX
|
||||
# define PIP_SPI
|
||||
#endif
|
||||
#ifdef PIP_SPI
|
||||
|
||||
@@ -40,11 +40,6 @@ __THREAD_FUNC_RET__ thread_function_once(void * t) {PIThread::__thread_func_once
|
||||
#define REGISTER_THREAD(t) __PIThreadCollection::instance()->registerThread(t)
|
||||
#define UNREGISTER_THREAD(t) __PIThreadCollection::instance()->unregisterThread(t)
|
||||
|
||||
#ifdef FREERTOS
|
||||
# define PTHREAD_MIN_MSLEEP 10.
|
||||
#else
|
||||
# define PTHREAD_MIN_MSLEEP 1.
|
||||
#endif
|
||||
|
||||
/*! \class PIThread
|
||||
* \brief Thread class
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
#include "pimutex.h"
|
||||
#include "piobject.h"
|
||||
|
||||
#ifdef FREERTOS
|
||||
# define PTHREAD_MIN_MSLEEP 10.
|
||||
#else
|
||||
# define PTHREAD_MIN_MSLEEP 1.
|
||||
#endif
|
||||
|
||||
class PIThread;
|
||||
|
||||
class PIP_EXPORT __PIThreadCollection {
|
||||
|
||||
@@ -368,8 +368,10 @@ _PITimerImp_Pool::_PITimerImp_Pool(): _PITimerImp_Thread() {
|
||||
_PITimerImp_Pool::Pool::Pool(): PIThread() {
|
||||
setName("__S__PITimerImp_Pool::Pool");
|
||||
needLockRun(true);
|
||||
#ifndef FREERTOS
|
||||
timers.reserve(64);
|
||||
start(2);
|
||||
#endif
|
||||
start(PTHREAD_MIN_MSLEEP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user