Unit tests for RSTC 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 <gpbr.h>
#include <rstc.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>
#include <conf_board.h>
Macros | |
#define | BACKUP_RESET (0x01 << RSTC_SR_RSTTYP_Pos) |
#define | GENERAL_RESET (0x00 << RSTC_SR_RSTTYP_Pos) |
Reset type of chip. More... | |
#define | RSTC_GPBR_FLAG GPBR0 |
GPBR registers used for saving test state. More... | |
#define | RSTC_GPBR_RES1 GPBR2 |
#define | RSTC_GPBR_RES2 GPBR3 |
#define | RSTC_GPBR_STEP GPBR1 |
#define | RSTC_UT_START_FLAG 0x1337BEEF |
RSTC start flag value. More... | |
#define | RSTC_UT_STEP1 1 |
Test step of chip reset. More... | |
#define | RSTC_UT_STEP2 2 |
#define | RSTC_UT_STEP3 3 |
#define | SOFTWARE_RESET (0x03 << RSTC_SR_RSTTYP_Pos) |
#define | USER_RESET (0x04 << RSTC_SR_RSTTYP_Pos) |
#define | WDT_RESET (0x02 << RSTC_SR_RSTTYP_Pos) |
Functions | |
int | main (void) |
Run RSTC driver unit tests. More... | |
static void | run_rstc_test (const struct test_case *test) |
Test Reset Controller. More... | |
#define BACKUP_RESET (0x01 << RSTC_SR_RSTTYP_Pos) |
#define GENERAL_RESET (0x00 << RSTC_SR_RSTTYP_Pos) |
Reset type of chip.
#define RSTC_GPBR_FLAG GPBR0 |
GPBR registers used for saving test state.
Referenced by main(), and run_rstc_test().
#define RSTC_GPBR_RES1 GPBR2 |
Referenced by run_rstc_test().
#define RSTC_GPBR_RES2 GPBR3 |
Referenced by run_rstc_test().
#define RSTC_GPBR_STEP GPBR1 |
Referenced by run_rstc_test().
#define RSTC_UT_START_FLAG 0x1337BEEF |
RSTC start flag value.
Referenced by run_rstc_test().
#define RSTC_UT_STEP1 1 |
Test step of chip reset.
Referenced by run_rstc_test().
#define RSTC_UT_STEP2 2 |
Referenced by run_rstc_test().
#define RSTC_UT_STEP3 3 |
Referenced by run_rstc_test().
#define SOFTWARE_RESET (0x03 << RSTC_SR_RSTTYP_Pos) |
Referenced by run_rstc_test().
#define USER_RESET (0x04 << RSTC_SR_RSTTYP_Pos) |
#define WDT_RESET (0x02 << RSTC_SR_RSTTYP_Pos) |
Referenced by run_rstc_test().
int main | ( | void | ) |
Run RSTC driver unit tests.
References uart_rs232_options::baudrate, board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, gpbr_write(), NULL, RSTC_GPBR_FLAG, run_rstc_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), test_suite_run(), usart_serial_options, and wdt_disable().
|
static |
Test Reset Controller.
This test check the reset type of RSTC when the chip resets for different reasons.
References gpbr_read(), gpbr_write(), rstc_get_reset_cause(), RSTC_GPBR_FLAG, RSTC_GPBR_RES1, RSTC_GPBR_RES2, RSTC_GPBR_STEP, rstc_start_software_reset(), RSTC_UT_START_FLAG, RSTC_UT_STEP1, RSTC_UT_STEP2, RSTC_UT_STEP3, SOFTWARE_RESET, test_assert_true, wdt_disable(), wdt_init(), and WDT_RESET.
Referenced by main().