Microchip® Advanced Software Framework

unit_tests.c File Reference

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 void delay_ms ( uint32_t  ul_dly_ticks)
static

Delay number of tick Systicks (happens every 1 ms).

References gs_ul_ms_ticks.

Referenced by run_wdt_test().

static void run_wdt_test ( const struct test_case test)
static

Test watchdog setting.

This test sets the watchdog to trigger an interrupt every 100ms.

Parameters
testCurrent 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.

volatile uint32_t gs_ul_ms_ticks = 0U
static

Referenced by delay_ms(), and SysTick_Handler().

volatile int gs_wdt_triggered = 0U
static

Referenced by run_wdt_test(), and WDT_Handler().