mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-12 02:36:00 +00:00
Improve doxygen comments. Add HAL init
This commit is contained in:
parent
ced5f9981f
commit
202c1f3aa6
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* @brief Constants and macros for use with CMSIS RTOS2.
|
||||||
|
*/
|
||||||
#ifndef STA_OS2_DEFS_HPP
|
#ifndef STA_OS2_DEFS_HPP
|
||||||
#define STA_OS2_DEFS_HPP
|
#define STA_OS2_DEFS_HPP
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* @brief Helper for easy system task setup in `<sta/config.hpp>`.
|
* @brief Helper for easy system task setup in `<sta/config.hpp>`.
|
||||||
*
|
*
|
||||||
* Define **STA_OS2_SYSTEM_TASKS_ENABLE** before including this header
|
* Configuration:
|
||||||
* to enable all system tasks and required features.
|
* STA_OS2_SYSTEM_TASKS_ENABLE: Enable all system tasks and required features
|
||||||
|
* STA_OS2_WATCHDOG_TIMER_NAME: Set watchdog timer handle and callback names based on this
|
||||||
|
* STA_OS2_WATCHDOG_NAME: Set watchdog task handle and entry function names based on this
|
||||||
*/
|
*/
|
||||||
#ifndef STA_OS2_EASY_CONFIG_HPP
|
#ifndef STA_OS2_EASY_CONFIG_HPP
|
||||||
#define STA_OS2_EASY_CONFIG_HPP
|
#define STA_OS2_EASY_CONFIG_HPP
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* @brief CMSIS RTOS2 mutex implementation.
|
||||||
|
*/
|
||||||
#ifndef STA_OS2_MUTEX_HPP
|
#ifndef STA_OS2_MUTEX_HPP
|
||||||
#define STA_OS2_MUTEX_HPP
|
#define STA_OS2_MUTEX_HPP
|
||||||
|
|
||||||
|
63
include/sta/os2/queue.hpp
Normal file
63
include/sta/os2/queue.hpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* @brief CMSIS RTOS2 queue implementation.
|
||||||
|
*/
|
||||||
|
#ifndef STA_OS2_QUEUE_HPP
|
||||||
|
#define STA_OS2_QUEUE_HPP
|
||||||
|
|
||||||
|
#include <sta/assert.hpp>
|
||||||
|
|
||||||
|
#include <cmsis_os2.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace sta
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
class Os2Queue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using Message = T;
|
||||||
|
public:
|
||||||
|
Os2Queue(osMessageQueueId_t * handle);
|
||||||
|
|
||||||
|
bool put(const Message & msg, uint32_t timeout = osWaitForever);
|
||||||
|
bool get(Message * outMsg, uint32_t timeout = osWaitForever);
|
||||||
|
|
||||||
|
uint32 available() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
osMessageQueueId_t * handle_;
|
||||||
|
};
|
||||||
|
} // namespace sta
|
||||||
|
|
||||||
|
|
||||||
|
namespace sta
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
Os2Queue<T>::Os2Queue(osMessageQueueId_t * handle)
|
||||||
|
: handle_{handle}
|
||||||
|
{
|
||||||
|
STA_ASSERT(handle != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool Os2Queue<T>::put(const Message & msg, uint32_t timeout /* = osWaitForever */)
|
||||||
|
{
|
||||||
|
return (osOK == osMessageQueuePut(*handle_, &msg, 0, timeout));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool Os2Queue<T>::get(Message * outMsg, uint32_t timeout /* = osWaitForever */)
|
||||||
|
{
|
||||||
|
uint8_t prio;
|
||||||
|
return (osOK == osMessageQueueGet(*handle_, outMsg, &prio, timeout));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
uint32 Os2Queue<T>::available() const
|
||||||
|
{
|
||||||
|
return osMessageQueueGetCount(*handle_);
|
||||||
|
}
|
||||||
|
} // namespace sta
|
||||||
|
|
||||||
|
|
||||||
|
#endif // STA_OS2_QUEUE_HPP
|
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* @brief CMSIS RTOS2 signal implementation.
|
||||||
|
*/
|
||||||
#ifndef STA_OS2_SIGNAL_HPP
|
#ifndef STA_OS2_SIGNAL_HPP
|
||||||
#define STA_OS2_SIGNAL_HPP
|
#define STA_OS2_SIGNAL_HPP
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* @brief System startup task.
|
||||||
|
*/
|
||||||
#include <sta/os2/startup.hpp>
|
#include <sta/os2/startup.hpp>
|
||||||
#ifdef STA_OS2_STARTUP_ENABLE
|
#ifdef STA_OS2_STARTUP_ENABLE
|
||||||
|
|
||||||
#include <sta/lang.hpp>
|
#include <sta/lang.hpp>
|
||||||
|
#include <sta/hal/init.hpp>
|
||||||
#include <sta/os2/system_event.hpp>
|
#include <sta/os2/system_event.hpp>
|
||||||
#include <sta/os2/watchdog.hpp>
|
#include <sta/os2/watchdog.hpp>
|
||||||
|
|
||||||
#include <main.h>
|
|
||||||
|
|
||||||
#include <cmsis_os2.h>
|
#include <cmsis_os2.h>
|
||||||
|
|
||||||
|
|
||||||
@ -32,16 +34,14 @@ extern "C"
|
|||||||
// Call further initialization code
|
// Call further initialization code
|
||||||
sta::startupExtras(arg);
|
sta::startupExtras(arg);
|
||||||
|
|
||||||
|
// Initialize HAL
|
||||||
|
sta::initHAL();
|
||||||
|
|
||||||
#ifdef STA_OS2_WATCHDOG_ENABLE
|
#ifdef STA_OS2_WATCHDOG_ENABLE
|
||||||
// Start timers
|
// Start timers
|
||||||
sta::startWatchdogTimer();
|
sta::startWatchdogTimer();
|
||||||
#endif // STA_OS2_WATCHDOG_ENABLE
|
#endif // STA_OS2_WATCHDOG_ENABLE
|
||||||
|
|
||||||
#ifdef STA_HAL_DELAY_US_TIM
|
|
||||||
HAL_TIM_Base_Start(&STA_HAL_DELAY_US_TIM);
|
|
||||||
#endif // STA_HAL_DELAY_US_TIM
|
|
||||||
|
|
||||||
// Wake tasks
|
// Wake tasks
|
||||||
sta::signalStartupEvent();
|
sta::signalStartupEvent();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user