mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-13 02:56:00 +00:00
Move watchdog files
This commit is contained in:
parent
8e4dbe1100
commit
1cfae97cae
@ -2,8 +2,11 @@
|
|||||||
* @file
|
* @file
|
||||||
* @brief Implementation of watchdog system task.
|
* @brief Implementation of watchdog system task.
|
||||||
*/
|
*/
|
||||||
#ifndef STA_RTOS_WATCHDOG_HPP
|
#ifndef STA_RTOS_SYSTEM_WATCHDOG_HPP
|
||||||
#define STA_RTOS_WATCHDOG_HPP
|
#define STA_RTOS_SYSTEM_WATCHDOG_HPP
|
||||||
|
|
||||||
|
#include <sta/rtos/system/names.hpp>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup STA_RTOS_Watchdog Watchdog task
|
* @defgroup STA_RTOS_Watchdog Watchdog task
|
||||||
@ -33,6 +36,17 @@
|
|||||||
# define STA_RTOS_WATCHDOG_TIMER_PERIOD 1000
|
# define STA_RTOS_WATCHDOG_TIMER_PERIOD 1000
|
||||||
#endif // !STA_RTOS_WATCHDOG_TIMER_PERIOD
|
#endif // !STA_RTOS_WATCHDOG_TIMER_PERIOD
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def STA_RTOS_WATCHDOG_TIMER_NAME
|
||||||
|
* @brief Set name of watchdog timer.
|
||||||
|
*
|
||||||
|
* @ingroup STA_RTOS_BuildConfig
|
||||||
|
*/
|
||||||
|
#ifndef STA_RTOS_WATCHDOG_TIMER_NAME
|
||||||
|
# define STA_RTOS_WATCHDOG_TIMER_NAME heartbeat
|
||||||
|
#endif // !STA_RTOS_WATCHDOG_TIMER_NAME
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def STA_RTOS_WATCHDOG_TIMER_HANDLE
|
* @def STA_RTOS_WATCHDOG_TIMER_HANDLE
|
||||||
* @brief Set variable name of heartbeat timer handle.
|
* @brief Set variable name of heartbeat timer handle.
|
||||||
@ -40,7 +54,7 @@
|
|||||||
* @ingroup STA_RTOS_BuildConfig
|
* @ingroup STA_RTOS_BuildConfig
|
||||||
*/
|
*/
|
||||||
#ifndef STA_RTOS_WATCHDOG_TIMER_HANDLE
|
#ifndef STA_RTOS_WATCHDOG_TIMER_HANDLE
|
||||||
# define STA_RTOS_WATCHDOG_TIMER_HANDLE heartbeatHandle
|
# define STA_RTOS_WATCHDOG_TIMER_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_WATCHDOG_TIMER_NAME)
|
||||||
#endif // !STA_RTOS_WATCHDOG_TIMER_HANDLE
|
#endif // !STA_RTOS_WATCHDOG_TIMER_HANDLE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,18 +64,19 @@
|
|||||||
* @ingroup STA_RTOS_BuildConfig
|
* @ingroup STA_RTOS_BuildConfig
|
||||||
*/
|
*/
|
||||||
#ifndef STA_RTOS_WATCHDOG_TIMER_CALLBACK
|
#ifndef STA_RTOS_WATCHDOG_TIMER_CALLBACK
|
||||||
# define STA_RTOS_WATCHDOG_TIMER_CALLBACK heartbeatCallback
|
# define STA_RTOS_WATCHDOG_TIMER_CALLBACK STA_RTOS_MAKE_CALLBACK_NAME(STA_RTOS_WATCHDOG_TIMER_NAME)
|
||||||
#endif // !STA_RTOS_WATCHDOG_TIMER_CALLBACK
|
#endif // !STA_RTOS_WATCHDOG_TIMER_CALLBACK
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def STA_RTOS_WATCHDOG_HANDLE
|
* @def STA_RTOS_WATCHDOG_TASK_NAME
|
||||||
* @brief Set variable name of watchdog task handle.
|
* @brief Set name of watchdog task.
|
||||||
*
|
*
|
||||||
* @ingroup STA_RTOS_BuildConfig
|
* @ingroup STA_RTOS_BuildConfig
|
||||||
*/
|
*/
|
||||||
#ifndef STA_RTOS_WATCHDOG_HANDLE
|
#ifndef STA_RTOS_WATCHDOG_TASK_NAME
|
||||||
# define STA_RTOS_WATCHDOG_HANDLE watchdogHandle
|
# define STA_RTOS_WATCHDOG_TASK_NAME watchdog
|
||||||
#endif // !STA_RTOS_WATCHDOG_HANDLE
|
#endif // !STA_RTOS_WATCHDOG_TASK_NAME
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def STA_RTOS_WATCHDOG_ENTRY_FUNCTION
|
* @def STA_RTOS_WATCHDOG_ENTRY_FUNCTION
|
||||||
@ -70,7 +85,7 @@
|
|||||||
* @ingroup STA_RTOS_BuildConfig
|
* @ingroup STA_RTOS_BuildConfig
|
||||||
*/
|
*/
|
||||||
#ifndef STA_RTOS_WATCHDOG_ENTRY_FUNCTION
|
#ifndef STA_RTOS_WATCHDOG_ENTRY_FUNCTION
|
||||||
# define STA_RTOS_WATCHDOG_ENTRY_FUNCTION watchdogTask
|
# define STA_RTOS_WATCHDOG_ENTRY_FUNCTION STA_RTOS_MAKE_ENTRY_NAME(STA_RTOS_WATCHDOG_TASK_NAME)
|
||||||
#endif // !STA_RTOS_WATCHDOG_ENTRY_FUNCTION
|
#endif // !STA_RTOS_WATCHDOG_ENTRY_FUNCTION
|
||||||
|
|
||||||
|
|
||||||
@ -123,4 +138,4 @@ namespace sta
|
|||||||
|
|
||||||
#endif // STA_RTOS_WATCHDOG_ENABLE
|
#endif // STA_RTOS_WATCHDOG_ENABLE
|
||||||
|
|
||||||
#endif // STA_RTOS2_WATCHDOG_HPP
|
#endif // STA_RTOS_SYSTEM_WATCHDOG_HPP
|
18
src/rtos/system/watchdog/handles.hpp
Normal file
18
src/rtos/system/watchdog/handles.hpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef STA_RTOS_SYSTEM_WATCHDOG_HANDLES_HPP
|
||||||
|
#define STA_RTOS_SYSTEM_WATCHDOG_HANDLES_HPP
|
||||||
|
|
||||||
|
#include <sta/rtos/system/watchdog.hpp>
|
||||||
|
|
||||||
|
#include <cmsis_os2.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define WATCHDOG_TASK_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_WATCHDOG_TASK_NAME)
|
||||||
|
#define WATCHDOG_TIMER_HANDLE STA_RTOS_MAKE_HANDLE_NAME(STA_RTOS_WATCHDOG_TIMER_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
// Access handles from freertos.c
|
||||||
|
extern osThreadId_t WATCHDOG_TASK_HANDLE;
|
||||||
|
extern osTimerId_t WATCHDOG_TIMER_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // STA_RTOS_SYSTEM_WATCHDOG_HANDLES_HPP
|
@ -1,19 +1,15 @@
|
|||||||
#include <sta/rtos/watchdog.hpp>
|
#include <sta/rtos/system/watchdog.hpp>
|
||||||
|
|
||||||
#ifdef STA_RTOS_WATCHDOG_ENABLE
|
#ifdef STA_RTOS_WATCHDOG_ENABLE
|
||||||
|
|
||||||
#include <cmsis_os2.h>
|
#include "handles.hpp"
|
||||||
|
|
||||||
|
|
||||||
// Access handles from freertos.c
|
|
||||||
extern osTimerId_t STA_RTOS_WATCHDOG_TIMER_HANDLE;
|
|
||||||
|
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
void startWatchdogTimer()
|
void startWatchdogTimer()
|
||||||
{
|
{
|
||||||
osTimerStart(STA_RTOS_WATCHDOG_TIMER_HANDLE, STA_RTOS_WATCHDOG_TIMER_PERIOD);
|
osTimerStart(WATCHDOG_TIMER_HANDLE, STA_RTOS_WATCHDOG_TIMER_PERIOD);
|
||||||
}
|
}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
@ -25,7 +21,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
// Notify watchdog task to send heartbeat message
|
// Notify watchdog task to send heartbeat message
|
||||||
// Required because blocking in a timer callback is not allowed
|
// Required because blocking in a timer callback is not allowed
|
||||||
sta::notifyWatchdog(STA_WATCHDOG_FLAG_HEARTBEAT);
|
osThreadFlagsSet(WATCHDOG_TASK_HANDLE, STA_WATCHDOG_FLAG_HEARTBEAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,24 +1,19 @@
|
|||||||
#include <sta/rtos/watchdog.hpp>
|
#include <sta/rtos/system/watchdog.hpp>
|
||||||
|
|
||||||
#ifdef STA_RTOS_WATCHDOG_ENABLE
|
#ifdef STA_RTOS_WATCHDOG_ENABLE
|
||||||
|
|
||||||
#include <sta/rtos/defs.hpp>
|
#include <sta/rtos/defs.hpp>
|
||||||
#include <sta/rtos/system_event.hpp>
|
#include <sta/rtos/system/system_event.hpp>
|
||||||
|
|
||||||
#include <main.h>
|
|
||||||
|
|
||||||
#include <cmsis_os2.h>
|
|
||||||
|
|
||||||
|
|
||||||
// Access handle from freertos.c
|
#include "handles.hpp"
|
||||||
extern osThreadId_t STA_RTOS_WATCHDOG_HANDLE;
|
|
||||||
|
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
void notifyWatchdog(uint32_t flags)
|
void notifyWatchdog(uint32_t flags)
|
||||||
{
|
{
|
||||||
osThreadFlagsSet(STA_RTOS_WATCHDOG_HANDLE, flags);
|
osThreadFlagsSet(WATCHDOG_TASK_HANDLE, flags);
|
||||||
}
|
}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user