SAM Read While Write(RWW) EEPROM Emulator Service Unit test.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | TEST_BUFFER_OFFSET 123 |
#define | TEST_BUFFER_SIZE 19 |
#define | TEST_EEPROM_PAGE 1 |
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
int | main (void) |
Run RWW EEPROM emulator unit tests. More... | |
static void | run_rww_eeprom_buffer_read_write_test (const struct test_case *test) |
Test for RWW EEPROM emulator buffer read/write function. More... | |
static void | run_rww_eeprom_init_test (const struct test_case *test) |
Test for RWW EEPROM emulator initialization. More... | |
static void | run_rww_eeprom_page_read_write_test (const struct test_case *test) |
Test for RWW EEPROM emulator page read/write function. More... | |
static void | setup_rww_eeprom_buffer_read_write_test (const struct test_case *test) |
Setup function for RWW EEPROM emulator buffer read/write test. More... | |
static void | setup_rww_eeprom_page_read_write_test (const struct test_case *test) |
Setup function for RWW EEPROM emulator page read/write test. More... | |
Variables | |
struct usart_module | cdc_uart_module |
struct rww_eeprom_emulator_parameters | ee_params |
uint16_t | i |
volatile bool | init_success |
uint8_t | test_buffer [TEST_BUFFER_SIZE] |
uint8_t | test_page [RWW_EEPROM_PAGE_SIZE] |
uint8_t | verify_buffer [TEST_BUFFER_SIZE] |
uint8_t | verify_page [RWW_EEPROM_PAGE_SIZE] |
#define TEST_BUFFER_OFFSET 123 |
Referenced by run_rww_eeprom_buffer_read_write_test().
#define TEST_BUFFER_SIZE 19 |
Referenced by run_rww_eeprom_buffer_read_write_test(), and setup_rww_eeprom_buffer_read_write_test().
#define TEST_EEPROM_PAGE 1 |
Referenced by run_rww_eeprom_page_read_write_test().
|
static |
Initialize the USART for unit test.
Initializes the SERCOM USART used for sending the unit test status to the computer via the EDBG CDC gateway.
References usart_config::baudrate, cdc_uart_module, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, CONF_STDIO_USART, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
Referenced by main().
int main | ( | void | ) |
Run RWW EEPROM emulator unit tests.
Initializes the system and serial output, then sets up the EEPROM emulator unit test suite and runs it.
References cdc_uart_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_rww_eeprom_buffer_read_write_test(), run_rww_eeprom_init_test(), run_rww_eeprom_page_read_write_test(), setup_rww_eeprom_buffer_read_write_test(), setup_rww_eeprom_page_read_write_test(), system_init(), and test_suite_run().
|
static |
Test for RWW EEPROM emulator buffer read/write function.
This test writes a buffer of data of a given length to a given offset. It then reads back the data from that offset and verifies.
test | Current test case. |
References i, init_success, rww_eeprom_emulator_commit_page_buffer(), rww_eeprom_emulator_read_buffer(), rww_eeprom_emulator_write_buffer(), STATUS_OK, test_assert_true, test_buffer, TEST_BUFFER_OFFSET, TEST_BUFFER_SIZE, and verify_buffer.
Referenced by main().
|
static |
Test for RWW EEPROM emulator initialization.
This test initializes the RWW EEPROM emulator. If no memory was set for RWW EEPROM in the fuses then all test will be skipped. During initialization it will format the RWW EEPROM memory if it was not done previously.
It also checks the get parameter functionality.
test | Current test case. |
References ee_params, init_success, rww_eeprom_emulator_parameters::page_size, rww_eeprom_emulator_erase_memory(), rww_eeprom_emulator_get_parameters(), rww_eeprom_emulator_init(), RWW_EEPROM_PAGE_SIZE, STATUS_OK, and test_assert_true.
Referenced by main().
|
static |
Test for RWW EEPROM emulator page read/write function.
This test writes a page of data to a given page number. It then reads back the page and verifies.
test | Current test case. |
References i, init_success, rww_eeprom_emulator_commit_page_buffer(), rww_eeprom_emulator_read_page(), rww_eeprom_emulator_write_page(), RWW_EEPROM_PAGE_SIZE, STATUS_OK, test_assert_true, TEST_EEPROM_PAGE, test_page, and verify_page.
Referenced by main().
|
static |
Setup function for RWW EEPROM emulator buffer read/write test.
This function initializes the test buffer and verify buffer with appropriate values.
test | Current test case. |
References i, test_buffer, TEST_BUFFER_SIZE, and verify_buffer.
Referenced by main().
|
static |
Setup function for RWW EEPROM emulator page read/write test.
This function initializes the test_page and verify_page data arrays with appropriate values.
test | Current test case. |
References i, RWW_EEPROM_PAGE_SIZE, test_page, and verify_page.
Referenced by main().
struct usart_module cdc_uart_module |
Referenced by cdc_uart_init().
struct rww_eeprom_emulator_parameters ee_params |
Referenced by run_rww_eeprom_init_test().
uint16_t i |
Referenced by _rww_eeprom_emulator_check_logical_page(), _rww_eeprom_emulator_move_data_to_spare(), _rww_eeprom_emulator_page_checksum(), _sercom_get_sercom_inst_index(), _sercom_set_handler(), nvm_read_buffer(), nvm_update_buffer(), nvm_write_buffer(), run_rww_eeprom_buffer_read_write_test(), run_rww_eeprom_page_read_write_test(), setup_rww_eeprom_buffer_read_write_test(), setup_rww_eeprom_page_read_write_test(), system_pinmux_group_set_config(), test_suite_run(), usart_init(), usart_read_buffer_wait(), and usart_write_buffer_wait().
volatile bool init_success |
uint8_t test_buffer[TEST_BUFFER_SIZE] |
Referenced by run_rww_eeprom_buffer_read_write_test(), and setup_rww_eeprom_buffer_read_write_test().
uint8_t test_page[RWW_EEPROM_PAGE_SIZE] |
Referenced by run_rww_eeprom_page_read_write_test(), and setup_rww_eeprom_page_read_write_test().
uint8_t verify_buffer[TEST_BUFFER_SIZE] |
Referenced by run_rww_eeprom_buffer_read_write_test(), and setup_rww_eeprom_buffer_read_write_test().
uint8_t verify_page[RWW_EEPROM_PAGE_SIZE] |
Referenced by run_rww_eeprom_page_read_write_test(), and setup_rww_eeprom_page_read_write_test().