mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-09-28 21:17:33 +00:00
Removed system events and startup, added peek method to RtosEvent class
This commit is contained in:
@@ -22,8 +22,13 @@ namespace sta {
|
||||
return osEventFlagsGet(event_id);
|
||||
}
|
||||
|
||||
uint32_t RtosEvent::wait(uint32_t flags, uint32_t timeout) {
|
||||
uint32_t RtosEvent::wait(uint32_t flags, uint32_t timeout /* = osWaitForever */) {
|
||||
return osEventFlagsWait(event_id, flags, osFlagsWaitAny, timeout);
|
||||
}
|
||||
|
||||
} // namespace sta
|
||||
uint32_t RtosEvent::peek(uint32_t flags, uint32_t timeout /* = osWaitForever */)
|
||||
{
|
||||
return osEventFlagsWait(event_id, flags, osFlagsWaitAny | osFlagsNoClear, timeout);
|
||||
}
|
||||
|
||||
} // namespace sta
|
||||
|
@@ -1,61 +0,0 @@
|
||||
#include <sta/rtos/system/events.hpp>
|
||||
|
||||
#include <sta/debug/assert.hpp>
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
#include <FreeRTOS.h>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// Static memory for system events
|
||||
StaticEventGroup_t systemEventControlBlock;
|
||||
// Event handle
|
||||
osEventFlagsId_t systemEventsHandle = nullptr;
|
||||
}
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace rtos
|
||||
{
|
||||
void initSystemEvents()
|
||||
{
|
||||
// Create event using static allocation
|
||||
const osEventFlagsAttr_t attributes = {
|
||||
.name = "systemEvent",
|
||||
.cb_mem = &systemEventControlBlock,
|
||||
.cb_size = sizeof(systemEventControlBlock),
|
||||
};
|
||||
|
||||
if (systemEventsHandle == nullptr)
|
||||
{
|
||||
systemEventsHandle = osEventFlagsNew(&attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void signalSystemEvents(uint32_t flags)
|
||||
{
|
||||
STA_ASSERT_MSG(systemEventsHandle != nullptr, "System events not initialized");
|
||||
osEventFlagsSet(systemEventsHandle, flags);
|
||||
}
|
||||
|
||||
void waitForSystemEvents(uint32_t flags, uint32_t options, uint32_t timeout)
|
||||
{
|
||||
STA_ASSERT_MSG(systemEventsHandle != nullptr, "System events not initialized");
|
||||
osEventFlagsWait(systemEventsHandle, flags, options | osFlagsNoClear, timeout);
|
||||
}
|
||||
|
||||
|
||||
void signalStartupEvent()
|
||||
{
|
||||
signalSystemEvents(STA_RTOS_SYSTEM_EVENTS_STARTUP);
|
||||
}
|
||||
|
||||
void waitForStartupEvent()
|
||||
{
|
||||
waitForSystemEvents(STA_RTOS_SYSTEM_EVENTS_STARTUP, osFlagsWaitAll, osWaitForever);
|
||||
}
|
||||
} // namespace rtos
|
||||
} // namespace sta
|
@@ -1,16 +0,0 @@
|
||||
#include <sta/rtos/system/events.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace rtos
|
||||
{
|
||||
void initSystem()
|
||||
{
|
||||
|
||||
#ifdef STA_RTOS_SYSTEM_EVENTS_ENABLE
|
||||
initSystemEvents();
|
||||
#endif // STA_RTOS_SYSTEM_EVENTS_ENABLE
|
||||
|
||||
}
|
||||
} // namespace rtos
|
||||
} // namespace sta
|
Reference in New Issue
Block a user