Microchip® Advanced Software Framework

common/components/memory/sd_mmc/unit_tests/unit_tests.c File Reference

SD/MMC card unit tests.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "conf_board.h"
#include "conf_clock.h"
#include "conf_test.h"
#include "sd_mmc_protocol.h"

Functions

int main (void)
 Application entry point. More...
 
static void run_sd_mmc_init_test (const struct test_case *test)
 SD/MMC stack initialization test. More...
 
static void run_sd_mmc_rw_test (const struct test_case *test)
 SD/MMC card read and write test. More...
 
static void run_sd_mmc_sdio_rw_test (const struct test_case *test)
 SD/MMC/SDIO card read and write test. More...
 
static void run_sdio_rw_test (const struct test_case *test)
 SDIO card read and write test. More...
 

Test configurations

Number of blocks for multiple read or write

#define NB_MULTI_BLOCKS   (2)
 
#define TEST_FILL_VALUE_U32   (0x5500AAFFU)
 The value used to generate test data. More...
 
#define TEST_CIA_SIZE   (0x16)
 Read and write test length of CIA in bytes. More...
 
static COMPILER_WORD_ALIGNED
uint8_t 
buf_save [SD_MMC_BLOCK_SIZE *NB_MULTI_BLOCKS]
 Buffer used to save the sector area used by read/write tests. More...
 
static COMPILER_WORD_ALIGNED
uint8_t 
buf_test [SD_MMC_BLOCK_SIZE *NB_MULTI_BLOCKS]
 Buffer used by read/write tests. More...
 
static COMPILER_WORD_ALIGNED
uint8_t 
buf_cia [TEST_CIA_SIZE]
 Buffer for test SDIO data. More...
 

#define NB_MULTI_BLOCKS   (2)

Referenced by run_sd_mmc_rw_test().

#define TEST_CIA_SIZE   (0x16)

Read and write test length of CIA in bytes.

Referenced by run_sdio_rw_test().

#define TEST_FILL_VALUE_U32   (0x5500AAFFU)

The value used to generate test data.

Referenced by run_sd_mmc_rw_test().

static void run_sd_mmc_init_test ( const struct test_case test)
static

SD/MMC stack initialization test.

Parameters
testCurrent test case.

References sd_mmc_check(), SD_MMC_ERR_NO_CARD, sd_mmc_init(), SD_MMC_INIT_ONGOING, SD_MMC_OK, and test_assert_true.

Referenced by main().

static void run_sd_mmc_sdio_rw_test ( const struct test_case test)
static

SD/MMC/SDIO card read and write test.

Parameters
testCurrent test case.

References CARD_TYPE_MMC, CARD_TYPE_SD, CARD_TYPE_SDIO, run_sd_mmc_rw_test(), run_sdio_rw_test(), sd_mmc_check(), sd_mmc_get_type(), SD_MMC_OK, and test_assert_true.

Referenced by main().

static void run_sdio_rw_test ( const struct test_case test)
static

SDIO card read and write test.

Parameters
testCurrent test case.

References buf_cia, SD_MMC_OK, SDIO_CCCR_IEN, SDIO_CIA, test_assert_true, and TEST_CIA_SIZE.

Referenced by run_sd_mmc_sdio_rw_test().

COMPILER_WORD_ALIGNED uint8_t buf_cia[TEST_CIA_SIZE]
static

Buffer for test SDIO data.

Referenced by run_sdio_rw_test().

Buffer used to save the sector area used by read/write tests.

Referenced by run_sd_mmc_rw_test().

Buffer used by read/write tests.

Referenced by run_sd_mmc_rw_test().