Unit tests for flash efc driver.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <board.h>
#include <sysclk.h>
#include <flash_efc.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_test.h>
#include <conf_board.h>
Functions | |
int | main (void) |
Run flash efc driver unit tests. More... | |
static void | run_flash_configure_test (const struct test_case *test) |
Test flash configure functions. More... | |
static void | run_flash_device_id_test (const struct test_case *test) |
Test flash device id interface. More... | |
static void | run_flash_erase_test (const struct test_case *test) |
Test flash erasing. More... | |
static void | run_flash_gpnvm_test (const struct test_case *test) |
Test flash GPNVM setting. More... | |
static void | run_flash_information_test (const struct test_case *test) |
Test get flash information interfaces. More... | |
static void | run_flash_lock_test (const struct test_case *test) |
Test flash lock setting. More... | |
static void | run_flash_write_test (const struct test_case *test) |
Test flash writing. More... | |
int main | ( | void | ) |
Run flash efc 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_flash_configure_test(), run_flash_device_id_test(), run_flash_erase_test(), run_flash_gpnvm_test(), run_flash_information_test(), run_flash_lock_test(), run_flash_write_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and test_suite_run().
|
static |
Test flash configure functions.
test | Current test case. |
References FLASH_ACCESS_MODE_128, flash_get_wait_state(), flash_init(), flash_set_wait_state(), flash_set_wait_state_adaptively(), IFLASH_ADDR, sysclk_get_cpu_hz(), and test_assert_true.
Referenced by main().
|
static |
Test flash device id interface.
This test gets the device id of the flash.
test | Current test case. |
References FLASH_RC_OK, flash_read_unique_id(), and test_assert_true.
Referenced by main().
|
static |
Test flash erasing.
test | Current test case. |
References flash_erase_plane(), flash_unlock(), IFLASH1_ADDR, IFLASH_PAGE_SIZE, test_assert_true, and TEST_PAGE_ADDRESS.
Referenced by main().
|
static |
Test flash GPNVM setting.
This test gets the gpnvm 1 status and then sets and clears the status.
test | Current test case. |
References flash_clear_gpnvm(), flash_is_gpnvm_set(), FLASH_RC_NO, FLASH_RC_YES, flash_set_gpnvm(), and test_assert_true.
Referenced by main().
|
static |
Test get flash information interfaces.
test | Current test case. |
References DEFAULT_PAGE_COUNT, DEFAULT_REGION_COUNT, flash_get_descriptor(), flash_get_page_count(), flash_get_page_count_per_region(), flash_get_region_count(), IFLASH_ADDR, and test_assert_true.
Referenced by main().
|
static |
Test flash lock setting.
test | Current test case. |
References flash_erase_sector(), flash_is_locked(), flash_lock(), flash_unlock(), flash_write(), IFLASH_ADDR, IFLASH_PAGE_SIZE, test_assert_true, and TEST_PAGE_ADDRESS.
Referenced by main().
|
static |
Test flash writing.
This test tests the flash writing function in the test page of the flash.
test | Current test case. |
References flash_erase_sector(), flash_unlock(), flash_write(), IFLASH_ADDR, IFLASH_PAGE_SIZE, test_assert_true, and TEST_PAGE_ADDRESS.
Referenced by main().