mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-05 19:01:54 +00:00
Rework structure and configuration
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef STA_OS2_HPP
|
||||
#define STA_OS2_HPP
|
||||
#ifndef STA_OS2_DEFS_HPP
|
||||
#define STA_OS2_DEFS_HPP
|
||||
|
||||
|
||||
// See limits defined in cmsis_os2.c
|
||||
@@ -10,4 +10,4 @@
|
||||
#define STA_OS2_EVENT_FLAGS_VALID_BITS ((1UL << STA_OS2_MAX_BITS_EVENT_GROUPS) - 1U)
|
||||
|
||||
|
||||
#endif // STA_OS2_HPP
|
||||
#endif // STA_OS2_DEFS_HPP
|
29
include/sta/os2/startup.hpp
Normal file
29
include/sta/os2/startup.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @brief Implementation of startup system task.
|
||||
*
|
||||
* Define STA_OS2_STARTUP_ENABLE in <sta/config.hpp> to enable.
|
||||
*
|
||||
* Configuration:
|
||||
* STA_OS2_STARTUP_ENTRY_FUNCTION: Name of task entry function (default: startupTask)
|
||||
*/
|
||||
#ifndef STA_OS2_STARTUP_HPP
|
||||
#define STA_OS2_STARTUP_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_OS2_STARTUP_ENABLE
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Extra initialization run at start of startup task.
|
||||
*
|
||||
* May be overridden by application if required.
|
||||
*/
|
||||
void startupExtras(void * argument);
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_OS2_STARTUP_ENABLE
|
||||
|
||||
#endif // STA_OS2_STARTUP_HPP
|
59
include/sta/os2/system_event.hpp
Normal file
59
include/sta/os2/system_event.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @brief Implementation of system events.
|
||||
*
|
||||
* Define STA_OS2_SYSTEM_EVENT_ENABLE in <sta/config.hpp> to enable.
|
||||
*
|
||||
* Set STA_OS2_SYSTEM_EVENT_HANDLE to name of global handle variable.
|
||||
* Defaults to `systemEventHandle`.
|
||||
*/
|
||||
#ifndef STA_OS2_SYSTEM_EVENT_HPP
|
||||
#define STA_OS2_SYSTEM_EVENT_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_OS2_SYSTEM_EVENT_ENABLE
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// System event flags
|
||||
//
|
||||
|
||||
#define STA_SYSTEM_EVENT_STARTUP 0x100000U
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Signal system events.
|
||||
*
|
||||
* @param flags System event flags
|
||||
*/
|
||||
void signalSystemEvents(uint32_t flags);
|
||||
|
||||
/**
|
||||
* @brief Wait for system events.
|
||||
*
|
||||
* @param flags System event flags
|
||||
* @param options osFlagsWaitAll or osFlagsWaitAny (osFlagsNoClear always set)
|
||||
* @param timeout Wait timeout (0 = instant, osWaitForever = infinite)
|
||||
*/
|
||||
void waitForSystemEvents(uint32_t flags, uint32_t options, uint32_t timeout);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Signal startup system event.
|
||||
*/
|
||||
void signalStartupEvent();
|
||||
|
||||
/**
|
||||
* @brief Wait for startup system event.
|
||||
*
|
||||
* Blocking while waiting
|
||||
*/
|
||||
void waitForStartupEvent();
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_OS2_SYSTEM_EVENT_ENABLE
|
||||
|
||||
#endif // STA_OS2_SYSTEM_EVENT_HPP
|
44
include/sta/os2/watchdog.hpp
Normal file
44
include/sta/os2/watchdog.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @brief Implementation of watchdog system task.
|
||||
*
|
||||
* Define STA_OS2_WATCHDOG_ENABLE in <sta/config.hpp> to enable.
|
||||
*
|
||||
* Configuration:
|
||||
* STA_OS2_WATCHDOG_TIMER_PERIOD: Period of heartbeat timer (default: 1000)
|
||||
* STA_OS2_WATCHDOG_TIMER_HANDLE: Name of global timer handle variable (default: heartbeatHandle)
|
||||
* STA_OS2_WATCHDOG_TIMER_CALLBACK: Name of timer callback function (default: heartbeatCallback)
|
||||
*
|
||||
* STA_OS2_WATCHDOG_HANDLE: Name of global task handle variable (default: watchdogHandle)
|
||||
* STA_OS2_WATCHDOG_ENTRY_FUNCTION: Name of task entry function (default: watchdogTask)
|
||||
*/
|
||||
#ifndef STA_OS2_WATCHDOG_HPP
|
||||
#define STA_OS2_WATCHDOG_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_OS2_WATCHDOG_ENABLE
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// Watchdog task flags
|
||||
//
|
||||
|
||||
#define STA_WATCHDOG_FLAG_HEARTBEAT 0x00001000U
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Start heartbeat timer for watchdog.
|
||||
*/
|
||||
void startWatchdogTimer();
|
||||
/**
|
||||
* @brief Send notification to watchdog task.
|
||||
*/
|
||||
void notifyWatchdog(uint32_t flags);
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_OS2_WATCHDOG_ENABLE
|
||||
|
||||
#endif // STA_OS2_WATCHDOG_HPP
|
@@ -1,52 +0,0 @@
|
||||
#ifndef STA_SYSTEM_EVENT_HPP
|
||||
#define STA_SYSTEM_EVENT_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
|
||||
#ifdef STA_SYSTEM_EVENT_ENABLE
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// System event flags
|
||||
//
|
||||
|
||||
#define STA_SYSTEM_EVENT_STARTUP 0x100000U
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Signal system events
|
||||
*
|
||||
* @param flags System event flags
|
||||
*/
|
||||
void signalSystemEvents(uint32_t flags);
|
||||
|
||||
/**
|
||||
* @brief Wait for system event.
|
||||
*
|
||||
* @param flags System event flags
|
||||
* @param options osFlagsWaitAll or osFlagsWaitAny (osFlagsNoClear always set)
|
||||
* @param timeout Wait timeout (0 = instant, osWaitForever = infinite)
|
||||
*/
|
||||
void waitForSystemEvents(uint32_t flags, uint32_t options, uint32_t timeout);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Signal startup system event
|
||||
*/
|
||||
void signalStartupEvent();
|
||||
|
||||
/**
|
||||
* @brief Wait for startup system event.
|
||||
*
|
||||
* Blocking while waiting
|
||||
*/
|
||||
void waitForStartupEvent();
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_SYSTEM_EVENT_ENABLE
|
||||
|
||||
#endif // STA_SYSTEM_EVENT_HPP
|
@@ -1,26 +0,0 @@
|
||||
#ifndef STA_WATCHDOG_HPP
|
||||
#define STA_WATCHDOG_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
|
||||
#ifdef STA_WATCHDOG_ENABLE
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// Watchdog task flags
|
||||
//
|
||||
|
||||
#define STA_WATCHDOG_FLAG_HEARTBEAT 0x00001000U
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
void startWatchdogTimer();
|
||||
void notifyWatchdog(uint32_t flags);
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_WATCHDOG_ENABLE
|
||||
|
||||
#endif // STA_WATCHDOG_HPP
|
Reference in New Issue
Block a user