refactor: removed starutp from rtos2-utils

This commit is contained in:
CarlWachter 2024-11-03 12:42:19 +01:00
parent cf1443891c
commit 345c74bdab
3 changed files with 11 additions and 81 deletions

View File

@ -1,22 +0,0 @@
#ifndef STA_RTOS_C_API_STARTUP_H
#define STA_RTOS_C_API_STARTUP_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief
*
* @param arg Default task argument
*/
void startALPAKA(void * arg);
#ifdef __cplusplus
}
#endif
#endif // STA_RTOS_C_API_STARTUP_H

View File

@ -5,30 +5,24 @@
#ifndef STA_RTOS_SYSTEM_STARTUP_HPP
#define STA_RTOS_SYSTEM_STARTUP_HPP
/**
* @defgroup STA_RTOS_Startup Startup task
* @defgroup STA_RTOS_Startup RTOS Startup
* @ingroup STA_RTOS_API
* @brief Startup system task.
*
* Check @ref STA_RTOS_BuildConfig for configuration options.
* @brief Initializes rtos functions.
*/
namespace sta
{
namespace rtos
{
/**
* @brief Extra initialization run at start of startup task.
*
* May be overridden by application if required.
*
* @ingroup STA_RTOS_Startup
*/
void startupExtras(void * argument);
} // namespace rtos
} // namespace sta
/**
* @brief Initializes rtos functions.
*
* @ingroup STA_RTOS_Startup
*/
void initSystem();
} // namespace rtos
} // namespace sta
#endif // STA_RTOS_SYSTEM_STARTUP_HPP

View File

@ -1,29 +1,14 @@
#include <sta/rtos/system/startup.hpp>
#include <sta/rtos/c_api/startup.h>
#include <sta/debug/assert.hpp>
#include <sta/lang.hpp>
#include <sta/rtos/system/can_bus.hpp>
#include <sta/rtos/system/events.hpp>
#include <sta/rtos/system/watchdog.hpp>
#include <sta/devices/stm32/init.hpp>
#include <cmsis_os2.h>
namespace sta
{
namespace rtos
{
// Provide weak implementation to allow overriding
STA_WEAK
void startupExtras(void *)
{}
void initSystem()
{
#ifdef STA_RTOS_SYSTEM_EVENTS_ENABLE
initSystemEvents();
#endif // STA_RTOS_SYSTEM_EVENTS_ENABLE
@ -35,30 +20,3 @@ namespace sta
}
} // namespace rtos
} // namespace sta
void startALPAKA(void * arg)
{
STA_ASSERT_MSG(osKernelGetState() != osKernelInactive, "Cannot call startALPAKA() before osKernelInitialize()");
// Initialize HAL
sta::initHAL();
// Initialize RTOS system resources
sta::rtos::initSystem();
// Call further initialization code
sta::rtos::startupExtras(arg);
// Wake threads
#ifdef STA_RTOS_SYSTEM_EVENTS_ENABLE
sta::rtos::signalStartupEvent();
#endif // STA_RTOS_SYSTEM_EVENTS_ENABLE
// Check if called from thread
if (osThreadGetId() != nullptr)
{
// Terminate current thread
osThreadExit();
}
}