From 8668554a1982c732425031de86ea5a4782f4a871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Betto?= <niccolo.betto@skywarder.eu> Date: Wed, 20 Mar 2024 11:44:26 +0100 Subject: [PATCH] Add missing Miosix 2.7 functions --- kernel/kernel.cpp | 16 +++++++++++++++- kernel/kernel.h | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/kernel/kernel.cpp b/kernel/kernel.cpp index 2402ecc..cbfbece 100644 --- a/kernel/kernel.cpp +++ b/kernel/kernel.cpp @@ -51,7 +51,9 @@ void startKernel() {} bool isKernelRunning() { return true; } -long long getTime() { return time(NULL); } +long long getTime() { return time(NULL) * 1000; } + +long long IRQgetTime() { return time(NULL) * 1000; } Thread *Thread::create(void *(*startfunc)(void *), unsigned int stacksize, Priority priority, void *argv, unsigned short options) @@ -103,6 +105,18 @@ Priority Thread::IRQgetPriority() { return Priority{}; } void Thread::IRQwait() {} +TimedWaitResult Thread::IRQenableIrqAndTimedWait( + FastInterruptDisableLock &dLock, long long absoluteTimeNs) +{ + return TimedWaitResult::NoTimeout; +} + +TimedWaitResult Thread::IRQenableIrqAndTimedWait(InterruptDisableLock &dLock, + long long absoluteTimeNs) +{ + return TimedWaitResult::NoTimeout; +} + void Thread::IRQwakeup() {} bool Thread::IRQexists(Thread *p) { return true; } diff --git a/kernel/kernel.h b/kernel/kernel.h index 370c4c9..af4f1d3 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -89,6 +89,14 @@ bool isKernelRunning(); long long getTime(); +long long IRQgetTime(); + +enum class TimedWaitResult +{ + NoTimeout, + Timeout +}; + class Thread { public: @@ -144,6 +152,12 @@ public: static void IRQwait(); + static TimedWaitResult IRQenableIrqAndTimedWait( + FastInterruptDisableLock &dLock, long long absoluteTimeNs); + + static TimedWaitResult IRQenableIrqAndTimedWait(InterruptDisableLock &dLock, + long long absoluteTimeNs); + void IRQwakeup(); static bool IRQexists(Thread *p); -- GitLab