mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-06 09:37:34 +00:00
refactor: moved startup from rtos2-utils to TACOS
This commit is contained in:
@@ -21,11 +21,18 @@
|
||||
|
||||
// sta-core-specific imports.
|
||||
#include <sta/devices/stm32/bus/uart.hpp>
|
||||
#include <sta/devices/stm32/init.hpp>
|
||||
#include <sta/debug/printing/printable_uart.hpp>
|
||||
#include <sta/debug/debug.hpp>
|
||||
#include <sta/debug/assert.hpp>
|
||||
#include <sta/lang.hpp>
|
||||
|
||||
// rtos2-utils-specific includes.
|
||||
#include <sta/rtos/system/startup.hpp>
|
||||
#include <sta/rtos/system/events.hpp>
|
||||
|
||||
// Tacos-specific includes.
|
||||
#include <sta/tacos/c_api/startup.h>
|
||||
#include <sta/tacos/manager.hpp>
|
||||
#include <sta/tacos/statemachine.hpp>
|
||||
#include <sta/tacos/watchdog.hpp>
|
||||
@@ -72,7 +79,7 @@ namespace sta
|
||||
STM32UART * intf_ptr = new STM32UART(getUARThandle(), settings, mutex);
|
||||
Debug = new PrintableUART(intf_ptr);
|
||||
}
|
||||
}
|
||||
} // namespace tacos
|
||||
#endif // STA_DEBUGGING_ENABLED
|
||||
|
||||
namespace tacos
|
||||
@@ -142,12 +149,7 @@ namespace sta
|
||||
CanBus::instance()->start();
|
||||
}
|
||||
#endif //STA_TACOS_CAN_BUS_ENABLED
|
||||
} // namespace tacos
|
||||
|
||||
|
||||
namespace rtos
|
||||
{
|
||||
// Override the weak implementation of startupExtras provided in rtos2-utils.
|
||||
void startupExtras(void * argument)
|
||||
{
|
||||
#ifdef STA_DEBUGGING_ENABLED
|
||||
@@ -166,7 +168,31 @@ namespace sta
|
||||
tacos::initCanBus();
|
||||
#endif // STA_TACOS_CAN_BUS_ENABLED
|
||||
}
|
||||
} // namespace rtos
|
||||
} // namespace tacos
|
||||
} // namespace sta
|
||||
|
||||
void startTACOS(void * arg)
|
||||
{
|
||||
STA_ASSERT_MSG(osKernelGetState() != osKernelInactive, "Cannot call startTACOS() before osKernelInitialize()");
|
||||
|
||||
// Initialize HAL
|
||||
sta::initHAL();
|
||||
|
||||
// Initialize RTOS system resources
|
||||
sta::rtos::initSystem();
|
||||
|
||||
// Call further initialization code
|
||||
sta::tacos::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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user