Unit tests for NAND Flash component.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include <asf.h>
#include <board.h>
#include <sysclk.h>
#include "nand_flash_raw.h"
#include "nand_flash_ecc.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 NAND Flash component unit tests. More... | |
static void | run_test_initialization (const struct test_case *test) |
Test NAND Flash initialization. More... | |
static void | run_test_raw_read_write (const struct test_case *test) |
Test raw read/write functions. More... | |
static void | run_test_software_ecc (const struct test_case *test) |
Test software ECC read/write functions. More... | |
Variables | |
static uint32_t | addr_address = BOARD_NF_ADDRESS_ADDR |
volatile uint32_t | block |
static uint32_t | cmd_address = BOARD_NF_COMMAND_ADDR |
static uint32_t | data_address = BOARD_NF_DATA_ADDR |
volatile uint32_t | error_code |
volatile uint32_t | flash_id |
static struct nand_flash_ecc | nf_ecc |
static struct nand_flash_raw | nf_raw |
static uint32_t | num_block |
static uint32_t | page_size |
static uint8_t | read_buffer [2048] |
static uint8_t | spare_buffer [NAND_COMMON_MAX_PAGE_SPARE_SIZE] |
static uint8_t | write_buffer [2048] |
int main | ( | void | ) |
Run NAND Flash component unit tests.
References usart_options_t::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_initialization(), run_test_raw_read_write(), run_test_software_ecc(), stdio_serial_init(), SYSCLK_EBI, sysclk_enable_hsb_module(), sysclk_enable_pbb_module(), sysclk_enable_peripheral_clock(), SYSCLK_HMATRIX, sysclk_init(), SYSCLK_SMC_REGS, and test_suite_run().
|
static |
Test NAND Flash initialization.
This test call the initialization function and check the flash id.
test | Current test case. |
References addr_address, cmd_address, data_address, error_code, flash_id, nand_flash_raw::model, nand_flash_model_get_device_size_in_blocks(), nand_flash_model_get_page_data_size(), nand_flash_raw_initialize(), nand_flash_raw_read_id(), nf_ecc, nf_raw, num_block, page_size, nand_flash_ecc::raw, and test_assert_true.
Referenced by main().
|
static |
Test raw read/write functions.
This test call the raw read/write functions and check the data value.
test | Current test case. |
References block, error_code, nand_flash_raw_erase_block(), nand_flash_raw_read_page(), nand_flash_raw_write_page(), nf_raw, num_block, page_size, read_buffer, test_assert_true, and write_buffer.
Referenced by main().
|
static |
Test software ECC read/write functions.
This test call the software ECC read/write functions and check the data value.
test | Current test case. |
References block, error_code, nand_flash_ecc_read_page(), nand_flash_ecc_write_page(), nand_flash_raw_erase_block(), nand_flash_raw_read_page(), nf_ecc, nf_raw, num_block, page_size, read_buffer, spare_buffer, test_assert_true, and write_buffer.
Referenced by main().
|
static |
Referenced by run_test_initialization().
volatile uint32_t block |
Referenced by run_test_raw_read_write(), and run_test_software_ecc().
|
static |
Referenced by run_test_initialization().
|
static |
Referenced by nand_flash_raw_initialize(), and run_test_initialization().
volatile uint32_t error_code |
Referenced by run_test_initialization(), run_test_raw_read_write(), and run_test_software_ecc().
volatile uint32_t flash_id |
Referenced by run_test_initialization().
|
static |
Referenced by run_test_initialization(), and run_test_software_ecc().
|
static |
Referenced by run_test_initialization(), run_test_raw_read_write(), and run_test_software_ecc().
|
static |
Referenced by run_test_initialization(), run_test_raw_read_write(), and run_test_software_ecc().
|
static |
|
static |
Referenced by run_test_raw_read_write(), and run_test_software_ecc().
|
static |
Referenced by nand_flash_ecc_read_page(), nand_flash_ecc_write_page(), and run_test_software_ecc().
|
static |
Referenced by run_test_raw_read_write(), and run_test_software_ecc().