SAM 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 EEPROM emulator unit tests. More... | |
static void | run_eeprom_buffer_read_write_test (const struct test_case *test) |
Test for EEPROM emulator buffer read/write function. More... | |
static void | run_eeprom_init_test (const struct test_case *test) |
Test for EEPROM emulator initialization. More... | |
static void | run_eeprom_page_read_write_test (const struct test_case *test) |
Test for EEPROM emulator page read/write function. More... | |
static void | setup_eeprom_buffer_read_write_test (const struct test_case *test) |
Setup function for EEPROM emulator buffer read/write test. More... | |
static void | setup_eeprom_page_read_write_test (const struct test_case *test) |
Setup function for EEPROM emulator page read/write test. More... | |
Variables | |
struct usart_module | cdc_uart_module |
struct eeprom_emulator_parameters | ee_params |
uint16_t | i |
volatile bool | init_success |
uint8_t | test_buffer [TEST_BUFFER_SIZE] |
uint8_t | test_page [EEPROM_PAGE_SIZE] |
uint8_t | verify_buffer [TEST_BUFFER_SIZE] |
uint8_t | verify_page [EEPROM_PAGE_SIZE] |
#define TEST_BUFFER_OFFSET 123 |
Referenced by run_eeprom_buffer_read_write_test().
#define TEST_BUFFER_SIZE 19 |
Referenced by run_eeprom_buffer_read_write_test(), and setup_eeprom_buffer_read_write_test().
#define TEST_EEPROM_PAGE 1 |
Referenced by run_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 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_eeprom_buffer_read_write_test(), run_eeprom_init_test(), run_eeprom_page_read_write_test(), setup_eeprom_buffer_read_write_test(), setup_eeprom_page_read_write_test(), system_init(), and test_suite_run().
|
static |
Test for 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 eeprom_emulator_commit_page_buffer(), eeprom_emulator_read_buffer(), eeprom_emulator_write_buffer(), i, init_success, STATUS_OK, test_assert_true, test_buffer, TEST_BUFFER_OFFSET, TEST_BUFFER_SIZE, and verify_buffer.
Referenced by main().
|
static |
Test for EEPROM emulator initialization.
This test initializes the EEPROM emulator. If no memory was set for EEPROM in the fuses then all test will be skipped. During initialization it will format the EEPROM memory if it was not done previously.
It also checks the get parameter functionality.
test | Current test case. |
References ee_params, eeprom_emulator_erase_memory(), eeprom_emulator_get_parameters(), eeprom_emulator_init(), EEPROM_PAGE_SIZE, init_success, eeprom_emulator_parameters::page_size, STATUS_ERR_NO_MEMORY, STATUS_OK, and test_assert_true.
Referenced by main().
|
static |
Test for 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 eeprom_emulator_commit_page_buffer(), eeprom_emulator_read_page(), eeprom_emulator_write_page(), EEPROM_PAGE_SIZE, i, init_success, STATUS_OK, test_assert_true, TEST_EEPROM_PAGE, test_page, and verify_page.
Referenced by main().
|
static |
Setup function for 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 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 EEPROM_PAGE_SIZE, i, test_page, and verify_page.
Referenced by main().
struct usart_module cdc_uart_module |
Referenced by cdc_uart_init().
struct eeprom_emulator_parameters ee_params |
Referenced by run_eeprom_init_test().
uint16_t i |
Referenced by _eeprom_emulator_check_logical_page(), _sercom_get_sercom_inst_index(), _sercom_set_handler(), nvm_read_buffer(), nvm_update_buffer(), nvm_write_buffer(), run_eeprom_buffer_read_write_test(), run_eeprom_page_read_write_test(), setup_eeprom_buffer_read_write_test(), setup_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 |
Referenced by run_eeprom_buffer_read_write_test(), run_eeprom_init_test(), and run_eeprom_page_read_write_test().
uint8_t test_buffer[TEST_BUFFER_SIZE] |
Referenced by run_eeprom_buffer_read_write_test(), and setup_eeprom_buffer_read_write_test().
uint8_t test_page[EEPROM_PAGE_SIZE] |
Referenced by run_eeprom_page_read_write_test(), and setup_eeprom_page_read_write_test().
uint8_t verify_buffer[TEST_BUFFER_SIZE] |
Referenced by run_eeprom_buffer_read_write_test(), and setup_eeprom_buffer_read_write_test().
uint8_t verify_page[EEPROM_PAGE_SIZE] |
Referenced by run_eeprom_page_read_write_test(), and setup_eeprom_page_read_write_test().