Unit tests for AT25DFx driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include <board.h>
#include <sysclk.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <conf_clock.h>
#include <conf_board.h>
#include <conf_test.h>
#include <at25dfx.h>
#include <conf_at25dfx.h>
Macros | |
#define | TEST_PROTECT_ADDRESS 0x200 |
Functions | |
int | main (void) |
Run AT25DFx driver unit tests. More... | |
static void | run_test_at25dfx_data_access (const struct test_case *test) |
Test data read, write and erase API functions. More... | |
static void | run_test_at25dfx_init (const struct test_case *test) |
Test AT25DFx initialization procedure. More... | |
static void | run_test_at25dfx_protect (const struct test_case *test) |
Test AT25DFx protect functions. More... | |
Variables | |
static uint8_t | data_buff [AT25DFX_UNIT_TEST_PAGE_SIZE] |
#define TEST_PROTECT_ADDRESS 0x200 |
Referenced by run_test_at25dfx_protect().
int main | ( | void | ) |
Run AT25DFx driver unit tests.
References uart_rs232_options::baudrate, board_init(), CONF_TEST_BAUDRATE, CONF_TEST_CHARLENGTH, CONF_TEST_PARITY, CONF_TEST_STOPBITS, CONF_TEST_USART, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_test_at25dfx_data_access(), run_test_at25dfx_init(), run_test_at25dfx_protect(), stdio_serial_init(), sysclk_init(), and test_suite_run().
|
static |
Test data read, write and erase API functions.
This test calls the data chip erase, read, write and block erase API functions.
test | Current test case. |
References AT25_ERROR, AT25_SUCCESS, AT25_TYPE_UNPROTECT, at25dfx_erase_block(), at25dfx_protect_chip(), at25dfx_read(), AT25DFX_UNIT_TEST_BLOCK_ADDR, AT25DFX_UNIT_TEST_BLOCK_SIZE, AT25DFX_UNIT_TEST_PAGE_SIZE, at25dfx_write(), data_buff, and test_assert_true.
Referenced by main().
|
static |
Test AT25DFx initialization procedure.
This test calls the initialization function and checks the SerialFlash.
test | Current test case. |
References AT25_SUCCESS, at25dfx_initialize(), at25dfx_mem_check(), AT25DFX_MEM_ID, at25dfx_set_mem_active(), and test_assert_true.
Referenced by main().
|
static |
Test AT25DFx protect functions.
This test calls the SerialFlash protect functions.
test | Current test case. |
References AT25_SECTOR_PROTECTED, AT25_SECTOR_UNPROTECTED, AT25_STATUS_SWP, AT25_STATUS_SWP_PROTNONE, AT25_TYPE_PROTECT, AT25_TYPE_UNPROTECT, at25dfx_protect_chip(), at25dfx_protect_sector(), at25dfx_read_sector_protect_status(), at25dfx_read_status(), test_assert_true, and TEST_PROTECT_ADDRESS.
Referenced by main().
|
static |
Referenced by run_test_at25dfx_data_access().