Microchip® Advanced Software Framework

unit_tests_sam4l.c File Reference

Unit tests for WDT-SAM4L driver.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include <conf_test.h>

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 bool is_wdt_reset ( void  )
static

Check if the WDT reset happened.

Returns
True for WDT reset happened, false for not happened.

Referenced by run_wdt_test_all().

static void mdelay ( uint32_t  ul_dly_ticks)
static

Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick).

Parameters
ul_dly_ticksDelay to wait for, in milliseconds.

References g_ul_ms_ticks.

Referenced by run_wdt_test_all().

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.