Unit tests for WDT driver.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include <board.h>
#include <sysclk.h>
#include <wdt.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>
#include <conf_board.h>
Functions | |
static void | delay_ms (uint32_t ul_dly_ticks) |
Delay number of tick Systicks (happens every 1 ms). More... | |
int | main (void) |
Run WDT driver unit tests. More... | |
static void | run_wdt_test (const struct test_case *test) |
Test watchdog setting. More... | |
void | SysTick_Handler (void) |
SysTick handler. More... | |
void | WDT_Handler (void) |
WDT interrupt handler. More... | |
Variables | |
static volatile uint32_t | gs_ul_ms_ticks = 0U |
static volatile int | gs_wdt_triggered = 0U |
|
static |
Delay number of tick Systicks (happens every 1 ms).
References gs_ul_ms_ticks.
Referenced by run_wdt_test().
int main | ( | void | ) |
Run WDT driver unit tests.
References uart_rs232_options::baudrate, board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, run_wdt_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_get_cpu_hz(), sysclk_init(), test_suite_run(), usart_serial_options, and wdt_disable().
|
static |
Test watchdog setting.
This test sets the watchdog to trigger an interrupt every 100ms.
test | Current test case. |
References delay_ms(), gs_wdt_triggered, test_assert_true, wdt_init(), and wdt_restart().
Referenced by main().
void SysTick_Handler | ( | void | ) |
SysTick handler.
References gs_ul_ms_ticks.
void WDT_Handler | ( | void | ) |
WDT interrupt handler.
References gs_wdt_triggered.
|
static |
Referenced by delay_ms(), and SysTick_Handler().
|
static |
Referenced by run_wdt_test(), and WDT_Handler().