Mistake on this page?
Report an issue in GitHub or email us
Functions
Watchdog HAL tests

Greentea tests for the Watchdog HAL. More...

Functions

void test_max_timeout_is_valid ()
 Test max_timeout validity. More...
 
void test_restart_is_possible ()
 Test Watchdog features if a stopped Watchdog can be started again. More...
 
void test_stop ()
 Test Watchdog stop. More...
 
void test_update_config ()
 Test Watchdog init multiple times. More...
 
template<uint32_t timeout_ms>
void test_init ()
 Test Watchdog init with a valid config. More...
 
void test_init_max_timeout ()
 Test Watchdog init with a max_timeout. More...
 
void test_simple_reset ()
 Test watchdog reset. More...
 
void test_sleep_reset ()
 Test watchdog reset in sleep mode. More...
 
void test_deepsleep_reset ()
 Test watchdog reset in deepsleep mode. More...
 
void test_restart_reset ()
 Test watchdog reset after watchdog restart. More...
 
void test_kick_reset ()
 Test watchdog kick. More...
 
template<uint32_t timeout_ms, uint32_t delta_ms>
void test_timing ()
 Test watchdog timing accuracy. More...
 

Detailed Description

Greentea tests for the Watchdog HAL.

To run the Watchdog HAL tests use the command:

mbed test -t <toolchain> -m <target> -n tests-mbed_hal-watchdog*

Function Documentation

void test_deepsleep_reset ( )

Test watchdog reset in deepsleep mode.

Given a device with a watchdog started, when the watchdog timeout expires while the device is in deepsleep mode, then the device is restarted.

void test_init ( )

Test Watchdog init with a valid config.

Given config.timeout_ms is set to T ms, which is within supported Watchdog timeout range, when hal_watchdog_init() is called, then WATCHDOG_STATUS_OK is returned and hal_watchdog_get_reload_value() returns a reload value R and T <= R < 2 * T.

void test_init_max_timeout ( )

Test Watchdog init with a max_timeout.

Given config.timeout_ms is set to max_timeout, which is a value returned by hal_watchdog_get_platform_features(), when hal_watchdog_init() is called, then WATCHDOG_STATUS_OK is returned and hal_watchdog_get_reload_value() returns max_timeout.

void test_kick_reset ( )

Test watchdog kick.

Given a device with a watchdog started, when the watchdog is kicked before its timeout expires, then the device restart is prevented. When the watchdog is NOT kicked again before next timeout expires, then the device is restarted.

void test_max_timeout_is_valid ( )

Test max_timeout validity.

Given a device supporting Watchdog HAL API, when hal_watchdog_get_platform_features() is called, then max_timeout member of returned watchdog_features_t struct is greater than 1.

void test_restart_is_possible ( )

Test Watchdog features if a stopped Watchdog can be started again.

Given a device supporting Watchdog HAL API, when the device supports the disable_watchdog feature, then the device also supports update_config feature.

void test_restart_reset ( )

Test watchdog reset after watchdog restart.

Given a device with a watchdog started, when the watchdog is stopped before its timeout expires, then the device is not restarted. When the watchdog is started again and its timeout expires, then the device is restarted.

void test_simple_reset ( )

Test watchdog reset.

Given a device with a watchdog started, when a watchdog timeout expires, then the device is restarted.

void test_sleep_reset ( )

Test watchdog reset in sleep mode.

Given a device with a watchdog started, when the watchdog timeout expires while the device is in sleep mode, then the device is restarted.

void test_stop ( )

Test Watchdog stop.

Given a device without a support for the disable_watchdog feature, when hal_watchdog_stop() is called, then WATCHDOG_STATUS_NOT_SUPPORTED is returned.

Otherwise, given the device with disable_watchdog feature support:

Given the Watchdog is NOT running, when hal_watchdog_stop() is called, then WATCHDOG_STATUS_OK is returned.

Given the Watchdog is running, when hal_watchdog_stop() is called before the timeout expires, then WATCHDOG_STATUS_OK is returned and the device is not restarted.

Given the Watchdog is NOT running (it has already been stopped), when hal_watchdog_stop() is called, then WATCHDOG_STATUS_OK is returned.

void test_timing ( )

Test watchdog timing accuracy.

Phase 1. Given a watchdog timer started with a timeout value of X ms, when the time of X ms elapses, then the device is restarted by the watchdog.

Phase 2. Given a device restarted by the watchdog timer, when the device receives time measurement T from the host, then X <= T < 2 * X.

void test_update_config ( )

Test Watchdog init multiple times.

Given a set of unique timeout values, when config.timeout_ms is set to each of these values (T), then, for every value T, hal_watchdog_init() returns WATCHDOG_STATUS_OK and hal_watchdog_get_reload_value() returns a reload value R and T <= R < 2 * T.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.