feat: add lab-rv32i-freertos-scheduler-states card

This commit is contained in:
user
2026-07-21 19:14:20 +02:00
commit 71ddd87301
66 changed files with 34187 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
#ifndef FREERTOS_CPP_TASK_REF_HPP
#define FREERTOS_CPP_TASK_REF_HPP
extern "C"
{
#include "FreeRTOS.h"
#include "task.h"
}
namespace freertos
{
/* Non-owning view: it never deletes the task and must not outlive the handle. */
class TaskRef final
{
public:
explicit constexpr TaskRef( TaskHandle_t handle ) noexcept
: handle_ { handle }
{
}
static TaskRef current() noexcept
{
return TaskRef { xTaskGetCurrentTaskHandle() };
}
eTaskState state() const noexcept
{
return eTaskGetState( handle_ );
}
UBaseType_t priority() const noexcept
{
return uxTaskPriorityGet( handle_ );
}
void set_priority( UBaseType_t priority ) const noexcept
{
vTaskPrioritySet( handle_, priority );
}
constexpr TaskHandle_t native_handle() const noexcept
{
return handle_;
}
private:
TaskHandle_t handle_;
};
} // namespace freertos
#endif
+60
View File
@@ -0,0 +1,60 @@
#ifndef FREERTOS_CPP_TICKS_HPP
#define FREERTOS_CPP_TICKS_HPP
extern "C"
{
#include "FreeRTOS.h"
#include "task.h"
}
namespace freertos
{
class Ticks final
{
public:
explicit constexpr Ticks( TickType_t value ) noexcept : value_ { value }
{
}
constexpr TickType_t count() const noexcept
{
return value_;
}
private:
TickType_t value_;
};
class TickPoint final
{
public:
explicit constexpr TickPoint( TickType_t value ) noexcept : value_ { value }
{
}
static TickPoint now() noexcept
{
return TickPoint { xTaskGetTickCount() };
}
constexpr TickType_t count() const noexcept
{
return value_;
}
friend constexpr Ticks operator-( TickPoint later,
TickPoint earlier ) noexcept
{
return Ticks { static_cast< TickType_t >( later.value_ -
earlier.value_ ) };
}
private:
TickType_t value_;
};
} // namespace freertos
#endif