Unit tests for WDT-SAM4L driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | WDT_UT_TAG_ADDR (FLASH_USER_PAGE_ADDR + 128) |
Address to store unit test stage. More... | |
WDT unit test stage | |
#define | WDT_UT_STAGE_START 0x10 |
Start stage. More... | |
#define | WDT_UT_STAGE_RST_MCU 0x21 |
Reset MCU by the WDT. More... | |
#define | WDT_UT_STAGE_BM_NORMAL 0x32 |
Normal usage in basic mode. More... | |
#define | WDT_UT_STAGE_BM_TIMEOUT_RST 0x33 |
Timeout reset in basic mode. More... | |
#define | WDT_UT_STAGE_WM_NORMAL 0x44 |
Normal usage in window mode. More... | |
#define | WDT_UT_STAGE_WM_TIMEBAN_RST 0x45 |
Timeban reset in window mode. More... | |
#define | WDT_UT_STAGE_WM_TIMEOUT_RST 0x46 |
Timeout reset in window mode. More... | |
#define | WDT_UT_STAGE_END 0x57 |
End stage. More... | |
#define | WDT_UT_STAGE_MASK 0xF0 |
#define | WDT_UT_STAGE_BM 0x30 |
#define | WDT_UT_STAGE_WM 0x40 |
Functions | |
static bool | is_wdt_reset (void) |
Check if the WDT reset happened. More... | |
int | main (void) |
Run WDT driver unit tests. More... | |
static void | mdelay (uint32_t ul_dly_ticks) |
Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick). More... | |
static void | run_wdt_test_all (const struct test_case *test) |
Test watchdog for all cases. More... | |
void | SysTick_Handler (void) |
Handler for System Tick interrupt. More... | |
Variables | |
volatile uint32_t | g_ul_ms_ticks = 0 |
Global g_ul_ms_ticks in milliseconds since start of application. More... | |
#define WDT_UT_STAGE_BM 0x30 |
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_BM_NORMAL 0x32 |
Normal usage in basic mode.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_BM_TIMEOUT_RST 0x33 |
Timeout reset in basic mode.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_END 0x57 |
End stage.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_MASK 0xF0 |
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_RST_MCU 0x21 |
Reset MCU by the WDT.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_START 0x10 |
Start stage.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_WM 0x40 |
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_WM_NORMAL 0x44 |
Normal usage in window mode.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_WM_TIMEBAN_RST 0x45 |
Timeban reset in window mode.
Referenced by run_wdt_test_all().
#define WDT_UT_STAGE_WM_TIMEOUT_RST 0x46 |
Timeout reset in window mode.
Referenced by run_wdt_test_all().
#define WDT_UT_TAG_ADDR (FLASH_USER_PAGE_ADDR + 128) |
Address to store unit test stage.
Referenced by run_wdt_test_all().
|
static |
Check if the WDT reset happened.
Referenced by run_wdt_test_all().
int main | ( | void | ) |
Run WDT driver unit tests.
References uart_rs232_options::baudrate, board_init(), CONF_TEST_BAUDRATE, CONF_TEST_CHARLENGTH, CONF_TEST_PARITY, CONF_TEST_STOPBITS, CONF_TEST_USART, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_wdt_test_all(), stdio_serial_init(), sysclk_get_cpu_hz(), sysclk_init(), and test_suite_run().
|
static |
Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick).
ul_dly_ticks | Delay to wait for, in milliseconds. |
References g_ul_ms_ticks.
Referenced by run_wdt_test_all().
|
static |
Test watchdog for all cases.
test | Current test case. |
References wdt_config::clk_src, flashcalw_memcpy(), is_wdt_reset(), mdelay(), osc_enable(), OSC_ID_OSC32, OSC_ID_RC32K, osc_is_ready(), osc_wait_ready(), test_assert_false, test_assert_true, wdt_config::timeout_period, wdt_clear(), WDT_CLK_SRC_32K, wdt_disable(), wdt_enable(), wdt_get_config_defaults(), wdt_init(), wdt_config::wdt_mode, WDT_MODE_WINDOW, WDT_PERIOD_16384_CLK, WDT_PERIOD_65536_CLK, wdt_reset_mcu(), WDT_UT_STAGE_BM, WDT_UT_STAGE_BM_NORMAL, WDT_UT_STAGE_BM_TIMEOUT_RST, WDT_UT_STAGE_END, WDT_UT_STAGE_MASK, WDT_UT_STAGE_RST_MCU, WDT_UT_STAGE_START, WDT_UT_STAGE_WM, WDT_UT_STAGE_WM_NORMAL, WDT_UT_STAGE_WM_TIMEBAN_RST, WDT_UT_STAGE_WM_TIMEOUT_RST, WDT_UT_TAG_ADDR, and wdt_config::window_period.
Referenced by main().
void SysTick_Handler | ( | void | ) |
Handler for System Tick interrupt.
Process System Tick Event Increments the g_ul_ms_ticks counter.
References g_ul_ms_ticks.
volatile uint32_t g_ul_ms_ticks = 0 |
Global g_ul_ms_ticks in milliseconds since start of application.
Referenced by mdelay(), and SysTick_Handler().