SD/MMC card example.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for output. More... | |
int | main (void) |
Application entry point. More... | |
static void | main_display_info_card (uint8_t slot) |
Display basic information of the card. More... | |
static void | main_test_memory (uint8_t slot) |
Card R/W tests. More... | |
Variables | |
struct usart_module | cdc_uart_module |
Structure for UART module connected to EDBG (used for unit test output) More... | |
Read/write access configurations | |
#define | TEST_MEM_START_OFFSET (1024lu * 1024lu * 4lu) |
Offset before the end of memory card to start the test. More... | |
#define | TEST_MEM_AREA_SIZE (1024lu * 128lu) |
Memory area size dedicated for the read/write test. More... | |
#define | TEST_MEM_ACCESS_SIZE (8lu * SD_MMC_BLOCK_SIZE) |
Size of each read or write access. More... | |
#define | TEST_FILL_VALUE_U32 (0x5500AAFFU) |
The value used to generate test data. More... | |
static COMPILER_WORD_ALIGNED uint8_t | buf_test [TEST_MEM_ACCESS_SIZE] |
Buffer used by read/write tests. More... | |
#define TEST_FILL_VALUE_U32 (0x5500AAFFU) |
The value used to generate test data.
Referenced by main_test_memory().
#define TEST_MEM_ACCESS_SIZE (8lu * SD_MMC_BLOCK_SIZE) |
Size of each read or write access.
Increasing this number can get higher R/W performance.
Referenced by main_test_memory().
#define TEST_MEM_AREA_SIZE (1024lu * 128lu) |
Memory area size dedicated for the read/write test.
Referenced by main_test_memory().
#define TEST_MEM_START_OFFSET (1024lu * 1024lu * 4lu) |
Offset before the end of memory card to start the test.
Referenced by main_test_memory().
|
static |
Initialize the USART for output.
Initializes the SERCOM USART used for sending the output 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, 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 | ) |
Application entry point.
References CARD_TYPE_MMC, CARD_TYPE_SD, cdc_uart_init(), cpu_irq_enable, delay_init(), err, irq_initialize_vectors, main_display_info_card(), main_test_memory(), printf, sd_mmc_check(), SD_MMC_ERR_NO_CARD, sd_mmc_get_type(), sd_mmc_init(), SD_MMC_INIT_ONGOING, sd_mmc_nb_slot(), SD_MMC_OK, system_init(), and time_tick_init().
|
static |
Display basic information of the card.
slot | SD/MMC slot to test |
References CARD_TYPE_HC, CARD_TYPE_MMC, CARD_TYPE_SD, CARD_TYPE_SD_COMBO, CARD_TYPE_UNKNOWN, printf, sd_mmc_get_capacity(), and sd_mmc_get_type().
Referenced by main().
|
static |
Card R/W tests.
slot | SD/MMC slot to test |
References buf_test, i, printf, SD_MMC_BLOCK_SIZE, sd_mmc_get_capacity(), sd_mmc_init_read_blocks(), sd_mmc_init_write_blocks(), sd_mmc_is_write_protected(), SD_MMC_OK, sd_mmc_start_read_blocks(), sd_mmc_start_write_blocks(), sd_mmc_wait_end_of_read_blocks(), sd_mmc_wait_end_of_write_blocks(), TEST_FILL_VALUE_U32, TEST_MEM_ACCESS_SIZE, TEST_MEM_AREA_SIZE, TEST_MEM_START_OFFSET, time_tick_calc_delay(), and time_tick_get().
Referenced by main().
|
static |
Buffer used by read/write tests.
Referenced by main_test_memory().
struct usart_module cdc_uart_module |
Structure for UART module connected to EDBG (used for unit test output)