2023-09-07 19:30:58 +02:00

93 lines
1.6 KiB
C++

/**
* @file
* @brief Implementation of watchdog system task.
*/
#ifndef STA_RTOS_SYSTEM_WATCHDOG_HPP
#define STA_RTOS_SYSTEM_WATCHDOG_HPP
/**
* @defgroup STA_RTOS_Watchdog Watchdog task
* @ingroup STA_RTOS_API
* @brief Watchdog system task.
*
* Check @ref STA_RTOS_BuildConfig for configuration options.
*/
#ifdef DOXYGEN
/**
* @brief Enable module.
*
* @ingroup STA_RTOS_BuildConfig
*/
# define STA_RTOS_WATCHDOG_ENABLE
#endif // DOXYGEN
/**
* @def STA_RTOS_SYSTEM_WATCHDOG_TIMER_PERIOD
* @brief Set period in ticks of heartbeat timer.
*
* @ingroup STA_RTOS_BuildConfig
*/
#ifndef STA_RTOS_SYSTEM_WATCHDOG_TIMER_PERIOD
# define STA_RTOS_SYSTEM_WATCHDOG_TIMER_PERIOD 1000
#endif // !STA_RTOS_SYSTEM_WATCHDOG_TIMER_PERIOD
#include <sta/config.hpp>
#ifdef STA_RTOS_WATCHDOG_ENABLE
#include <cstdint>
// Watchdog task flags
//
/**
* @brief Watchdog heartbeat flag.
*
* @ingroup STA_RTOS_Watchdog
*/
#define STA_WATCHDOG_FLAG_HEARTBEAT 0x00001000U
namespace sta
{
namespace rtos
{
/**
* @brief Initialize system watchdog.
*
* @ingroup STA_RTOS_Watchdog
*/
void initWatchdog();
/**
* @brief Send notification to watchdog task.
*
* @ingroup STA_RTOS_Watchdog
*/
void notifyWatchdog(uint32_t flags);
/**
* @brief Handler for watchdog events.
*
* Must be implemented by application.
*
* @param arg Watchdog task argument
* @param flags Event flags
*
* @ingroup STA_RTOS_Watchdog
*/
void watchdogEventHandler(void * arg, uint32_t flags);
} // namespace rtos
} // namespace sta
#endif // STA_RTOS_WATCHDOG_ENABLE
#endif // STA_RTOS_SYSTEM_WATCHDOG_HPP