refactor: migrate MICRO_PIP to fine-grained feature flags
Replace monolithic MICRO_PIP/PIP_MICRO with granular flags: Feature flags (CMake options + platform auto-detection): - PIP_NO_FILESYSTEM, PIP_NO_THREADS, PIP_NO_SOCKET - PIP_NO_PROCESS, PIP_NO_DYNLIB, PIP_NO_FFT, PIP_NO_SERIAL Embedded optimization flag: - PIP_EMBEDDED (auto-set for Pico SDK and FreeRTOS) Controls buffer sizes, time stubs, terminal fallback, init stubs Platform blocks in CMakeLists.txt: - Pico SDK: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL; conditionally disables THREADS (no FreeRTOS) and SOCKET (no LWIP) - FreeRTOS: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL; conditionally disables SOCKET (no LWIP) - Android: auto-disables PROCESS, DYNLIB, FFT Updated 96 files across libs/, utils/, tests/, and CMakeLists.txt. Builds verified for Linux (547 tests pass) and Pico SDK (100%). Removed all MICRO_PIP and PIP_MICRO references (0 remaining).
This commit is contained in:
@@ -59,26 +59,20 @@ typedef std::function<bool(const uchar *, int, void *)> ReadRetFunc;
|
||||
|
||||
#else
|
||||
|
||||
# define REGISTER_DEVICE(name) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIIODevice::registerDevice(name::fullPathPrefixS(), #name, []() -> PIIODevice * { return new name(); }); \
|
||||
STATIC_INITIALIZER_END
|
||||
# define REGISTER_DEVICE(name) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIIODevice::registerDevice(name::fullPathPrefixS(), #name, []() -> PIIODevice * { return new name(); }); \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
# define PIIODEVICE(name, prefix) \
|
||||
PIOBJECT_SUBCLASS(name, PIIODevice) \
|
||||
PIIODevice * copy() const override { \
|
||||
return new name(); \
|
||||
} \
|
||||
\
|
||||
public: \
|
||||
PIConstChars fullPathPrefix() const override { \
|
||||
return prefix; \
|
||||
} \
|
||||
static PIConstChars fullPathPrefixS() { \
|
||||
return prefix; \
|
||||
} \
|
||||
\
|
||||
private:
|
||||
# define PIIODEVICE(name, prefix) \
|
||||
PIOBJECT_SUBCLASS(name, PIIODevice) \
|
||||
PIIODevice * copy() const override { return new name(); } \
|
||||
\
|
||||
public: \
|
||||
PIConstChars fullPathPrefix() const override { return prefix; } \
|
||||
static PIConstChars fullPathPrefixS() { return prefix; } \
|
||||
\
|
||||
private:
|
||||
|
||||
|
||||
#endif
|
||||
@@ -248,7 +242,7 @@ public:
|
||||
//! \~russian Возвращает пользовательские данные, передаваемые в callback потокового чтения.
|
||||
void * threadedReadData() const { return ret_data_; }
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
//! \~english Returns whether threaded read is running.
|
||||
//! \~russian Возвращает, запущено ли потоковое чтение.
|
||||
bool isThreadedRead() const;
|
||||
@@ -279,6 +273,7 @@ public:
|
||||
//! \~english Waits until threaded read finishes or "timeout" expires.
|
||||
//! \~russian Ожидает завершения потокового чтения, но не дольше "timeout".
|
||||
bool waitThreadedReadFinished(PISystemTime timeout = {});
|
||||
#endif // PIP_NO_THREADS
|
||||
|
||||
|
||||
//! \~english Returns delay between unsuccessful threaded read attempts in milliseconds.
|
||||
@@ -367,6 +362,7 @@ public:
|
||||
PIByteArray readForTime(PISystemTime timeout);
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
//! \~english Queues "data" for threaded write and returns task ID.
|
||||
//! \~russian Помещает "data" в очередь потоковой записи и возвращает ID задания.
|
||||
ullong writeThreaded(const void * data, ssize_t max_size) { return writeThreaded(PIByteArray(data, uint(max_size))); }
|
||||
@@ -374,6 +370,7 @@ public:
|
||||
//! \~english Queues byte array "data" for threaded write and returns task ID.
|
||||
//! \~russian Помещает массив байт "data" в очередь потоковой записи и возвращает ID задания.
|
||||
ullong writeThreaded(const PIByteArray & data);
|
||||
#endif
|
||||
|
||||
|
||||
//! \~english Configures the device from section "section" of file "config_file".
|
||||
@@ -611,16 +608,18 @@ private:
|
||||
static PIMap<PIConstChars, FabricInfo> & fabrics();
|
||||
|
||||
PITimeMeasurer tm, reopen_tm;
|
||||
PIThread read_thread, write_thread;
|
||||
PIByteArray buffer_in, buffer_tr;
|
||||
PIQueue<PIPair<PIByteArray, ullong>> write_queue;
|
||||
PISystemTime reopen_timeout;
|
||||
ullong tri = 0;
|
||||
uint threaded_read_buffer_size, threaded_read_timeout_ms = 10;
|
||||
bool reopen_enabled = true, destroying = false;
|
||||
|
||||
static PIMutex nfp_mutex;
|
||||
static PIMap<PIString, PIString> nfp_cache;
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
PIThread read_thread, write_thread;
|
||||
PIQueue<PIPair<PIByteArray, ullong>> write_queue;
|
||||
static PIMutex nfp_mutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // PIIODEVICE_H
|
||||
|
||||
Reference in New Issue
Block a user