SAM Watchdog Unit test.
Copyright (c) 2013-2020 Microchip Technology Inc. and its subsidiaries.
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
int | main (void) |
Run WDT unit tests. More... | |
static void | run_reset_cause_test (const struct test_case *test) |
Test whether last reset was by Watchdog module. More... | |
static void | run_wdt_early_warning_test (const struct test_case *test) |
Test Early Warning of Watchdog module. More... | |
static void | wait_for_wdt_reset (const struct test_case *test) |
Wait for Watchdog module to reset. More... | |
Variables | |
struct usart_module | cdc_uart_module |
static volatile bool | wdr_flag = false |
|
static |
Initialize the USART for unit test.
Initializes the SERCOM USART used for sending the unit test status to the computer via the EDBG CDC gateway.
References usart_config::baudrate, cdc_uart_module, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, CONF_STDIO_USART, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
Referenced by main().
int main | ( | void | ) |
Run WDT unit tests.
Initializes the system and serial output, then sets up the WDT unit test suite and runs it.
References cdc_uart_init(), CONF_WDT_EARLY_WARNING_PERIOD, CONF_WDT_TIMEOUT_PERIOD, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, wdt_conf::early_warning_period, wdt_conf::enable, run_reset_cause_test(), run_wdt_early_warning_test(), system_get_reset_cause(), system_init(), test_suite_run(), wdt_conf::timeout_period, wait_for_wdt_reset(), wdr_flag, wdt_get_config_defaults(), wdt_reset_count(), and wdt_set_config().
|
static |
Test whether last reset was by Watchdog module.
This function tests whether the last reset was caused by timeout of Watchdog module
test | Current test case. |
References test_assert_true, and wdr_flag.
Referenced by main().
|
static |
Test Early Warning of Watchdog module.
If last reset cause was not Watchdog, following the Watchdog initialization and enabling in the previous test, this function will wait for CONF_WDT_EARLY_WARNING_WAIT_MS and will check if early warning flag is set. Consequently, clear the early warning flag.
test | Current test case. |
References CONF_WDT_EARLY_WARNING_WAIT_MS, delay_ms, test_assert_true, wdr_flag, wdt_clear_early_warning(), and wdt_is_early_warning().
Referenced by main().
|
static |
Wait for Watchdog module to reset.
Wait for CONF_WDT_RESET_WAIT_MS for Watchdog to reset the device
test | Current test case. |
References CONF_WDT_RESET_WAIT_MS, delay_ms, and wdr_flag.
Referenced by main().
struct usart_module cdc_uart_module |
Referenced by cdc_uart_init().
Referenced by main(), run_reset_cause_test(), run_wdt_early_warning_test(), and wait_for_wdt_reset().