Unit tests for GPBR driver.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <board.h>
#include <sysclk.h>
#include "gpbr.h"
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>
#include <conf_board.h>
#include "rtt.h"
#include "supc.h"
#include "flash_efc.h"
Macros | |
#define | BACKUP_MODE_FLAG 0xAA55AA55 |
Backup mode flag. More... | |
#define | FLASH_WAIT_STATE_NBR 6 |
Flash wait state number. More... | |
#define | GPBR_UNIT_TEST_CONST_DATA (0xdeadbeef) |
GPBR unit test const written data. More... | |
#define | NORMAL_MODE_FLAG 0xffffffff |
Normal mode flag. More... | |
#define | RTT_WAIT_TIME 2 |
RTT wait time. More... | |
Functions | |
static void | gpbr_test_configure_rtt (void) |
RTT configuration function. More... | |
int | main (void) |
Run GPBR driver unit tests. More... | |
void | RTT_Handler (void) |
Interrupt handler for the RTT. More... | |
static void | run_gpbr_test (const struct test_case *test) |
Test GPBR read/write interfaces. More... | |
#define BACKUP_MODE_FLAG 0xAA55AA55 |
Backup mode flag.
Referenced by run_gpbr_test().
#define FLASH_WAIT_STATE_NBR 6 |
Flash wait state number.
Referenced by run_gpbr_test().
#define GPBR_UNIT_TEST_CONST_DATA (0xdeadbeef) |
GPBR unit test const written data.
Referenced by run_gpbr_test().
#define NORMAL_MODE_FLAG 0xffffffff |
Normal mode flag.
Referenced by run_gpbr_test().
#define RTT_WAIT_TIME 2 |
RTT wait time.
Referenced by run_gpbr_test().
|
static |
RTT configuration function.
Configures the RTT to generate a one second tick, which triggers the RTT alarms interrupt.
References rtt_enable_interrupt(), rtt_init(), and rtt_read_timer_value().
Referenced by run_gpbr_test().
int main | ( | void | ) |
Run GPBR driver unit tests.
References uart_rs232_options::baudrate, board_init(), CONF_TEST_BAUDRATE, CONF_TEST_CHAR_LENGTH, CONF_TEST_PARITY, CONF_TEST_STOP_BITS, CONF_TEST_USART, CONSOLE_UART_ID, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_gpbr_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and test_suite_run().
void RTT_Handler | ( | void | ) |
|
static |
Test GPBR read/write interfaces.
test | Current test case. |
References BACKUP_MODE_FLAG, FLASH_ACCESS_MODE_128, flash_erase_page(), flash_init(), FLASH_RC_OK, flash_unlock(), FLASH_WAIT_STATE_NBR, flash_write(), GPBR0, gpbr_read(), gpbr_test_configure_rtt(), GPBR_UNIT_TEST_CONST_DATA, gpbr_write(), IFLASH_ERASE_PAGES_8, NORMAL_MODE_FLAG, pmc_enable_backupmode(), RTT_WAIT_TIME, rtt_write_alarm_time(), supc_enable_backup_mode(), supc_set_wakeup_mode(), test_assert_true, and TEST_PAGE_ADDRESS.
Referenced by main().