
#pragma once

#include <stdint.h>

/**
 * @brief Initialize the system watchdog
 *
 * @return 0 on success, -errno of failure
 */
int watchdog_init(void);

/**
 * @brief Register a thread to be monitored by the watchdog
 *
 * @param[in] reload - Expiry in millisecond the task needs to feed the watchdog
 * 
 * @return Chaneel ID of the task, -errno of failure
 */
int watchdog_task_register(uint32_t reload);

/**
 * @brief Deregister a thread from being monitored by the watchdog
 *
 * @param[in] channelId - Channel ID of the task to deregister
 * 
 * @return 0 on success, -errno of failure
 */
int watchdog_task_deregister(int channelId);

/**
 * @brief Feed the watchdog
 *
 * @param[in] channelId - Channel ID of the task to feed
 * 
 * @return 0 on success, -errno of failure
 */
int watchdog_feed(int channelId);
