Microchip® Advanced Software Framework

unit_tests.c File Reference

SD/MMC card unit tests.

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

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

Functions

static void cdc_uart_init (void)
 Initialize the USART for unit test. More...
 
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 rw_test (const struct test_case *test, uint16_t nb_block, bool split_tansfer)
 SD/MMC 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...
 
struct usart_module cdc_uart_module
 Structure for UART module connected to EDBG (used for unit test output) More...
 

#define NB_MULTI_BLOCKS   (2)

Referenced by run_sd_mmc_rw_test(), and rw_test().

#define TEST_CIA_SIZE   (0x16)

Read and write test length of CIA in bytes.

#define TEST_FILL_VALUE_U32   (0x5500AAFFU)

The value used to generate test data.

Referenced by rw_test().

static void cdc_uart_init ( void  )
static
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_rw_test ( const struct test_case test)
static

SD/MMC card read and write test.

Parameters
testCurrent test case.

References CARD_TYPE_MMC, CARD_TYPE_SD, NB_MULTI_BLOCKS, rw_test(), sd_mmc_check(), sd_mmc_get_type(), SD_MMC_OK, and test_assert_true.

Referenced by main().

static void rw_test ( const struct test_case test,
uint16_t  nb_block,
bool  split_tansfer 
)
static

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

Referenced by rw_test().

Buffer used by read/write tests.

Referenced by rw_test().

struct usart_module cdc_uart_module

Structure for UART module connected to EDBG (used for unit test output)

Referenced by cdc_uart_init().