FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_watchdog.h File Reference

This file contains all the WatchDog HAL API definitions. More...

Go to the source code of this file.

Macros

#define IOT_WATCHDOG_SUCCESS   ( 0 )
 Return values used by WatchDog driver. More...
 
#define IOT_WATCHDOG_INVALID_VALUE   ( 1 )
 
#define IOT_WATCHDOG_TIME_NOT_SET   ( 2 )
 
#define IOT_WATCHDOG_FUNCTION_NOT_SUPPORTED   ( 3 )
 

Typedefs

typedef struct IotWatchdogDescriptor * IotWatchdogHandle_t
 IotWatchdogHandle_t type is the WatchDog handle returned by calling iot_watchdog_open() this is initialized in open and returned to caller. Caller must pass this pointer to the rest of the APIs.
 
typedef void(* IotWatchdogCallback_t) (void *pvUserContext)
 WatchDog notification callback type. This callback is passed to the driver by using iot_watchdog_set_callback API. This callback is used for warning notification when the bark timer or bite timer expires based on the configuration. Caller can check the status of the WatchDog timer by using eGetStatus IOCTL. More...
 

Enumerations

enum  IotWatchdogStatus_t { eWatchdogTimerStopped, eWatchdogTimerRunning, eWatchdogTimerBarkExpired, eWatchdogTimerBiteExpired }
 WatchDog timer status values. More...
 
enum  IotWatchdogBiteConfig_t { eWatchdogBiteTimerReset, eWatchdogBiteTimerInterrupt }
 WatchDog timer bite behavior setting. More...
 
enum  IotWatchdogIoctlRequest_t {
  eSetWatchdogBarkTime, eGetWatchdogBarkTime, eSetWatchdogBiteTime, eGetWatchdogBiteTime,
  eGetWatchdogStatus, eSetWatchdogBiteBehaviour
}
 Ioctl request types. More...
 

Functions

IotWatchdogHandle_t iot_watchdog_open (int32_t lWatchdogInstance)
 iot_watchdog_open is used to initialize the WatchDog, This function will stop the timer if it was started and resets the timer if any was configured earlier. More...
 
int32_t iot_watchdog_start (IotWatchdogHandle_t const pxWatchdogHandle)
 iot_watchdog_start is used to start the WatchDog timer counter. WatchDog expiry (bite) time must be set before starting the WatchDog counter. Set the bite time using eSetBiteTime IOCTL. More...
 
int32_t iot_watchdog_stop (IotWatchdogHandle_t const pxWatchdogHandle)
 iot_watchdog_stop is used to stop and resets the WatchDog timer counter. After stopping the timer and before starting the timer again, expireTime must be set. More...
 
int32_t iot_watchdog_restart (IotWatchdogHandle_t const pxWatchdogHandle)
 iot_watchdog_restart is used to restart the WatchDog timer to the originally programmed values. This function is usually used once the WatchDog timer (either bark or bite) expired and generated a callback, so caller can restart the timer to original values to restart the WatchDog timer. The main difference b/w iot_watchdog_start and iot_watchdog_restart APIs are, the former requires the time values are set using the IOCTLs and the latter re-uses the already programmed values and re-programs them. If restart_timer is used without first setting the timers, it will return an error. More...
 
void iot_watchdog_set_callback (IotWatchdogHandle_t const pxWatchdogHandle, IotWatchdogCallback_t xCallback, void *pvUserContext)
 iot_wathcdog_set_callback is used to set the callback to be called when bark time reaches the WatchDog counter or if the bite time is configured to generate interrupt (if supported by HW). The caller must set the timers using IOCTL and start the timer for the callback to be called back. Caller must restart the timer when bark timer expires and bite time is configured to reset the device to avoid the target reset. More...
 
int32_t iot_watchdog_ioctl (IotWatchdogHandle_t const pxWatchdogHandle, IotWatchdogIoctlRequest_t xRequest, void *const pvBuffer)
 iot_watchdog_ioctl is used to configure the WatchDog timer properties like the WatchDog timeout value, WatchDog clock, handler for WatchDog interrupt etc. More...
 
int32_t iot_watchdog_close (IotWatchdogHandle_t const pxWatchdogHandle)
 iot_watchdog_close is used to de-initializes the WatchDog, stops the timer if it was started and resets the timer value. More...
 

Detailed Description

This file contains all the WatchDog HAL API definitions.