Microchip® Advanced Software Framework

example1/example.c File Reference

SD/MMC card example.

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

#include <asf.h>
#include "conf_example.h"
#include <string.h>
#include "time_tick.h"

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 void cdc_uart_init ( void  )
static
static void main_display_info_card ( uint8_t  slot)
static

Display basic information of the card.

Note
This function should be called only after the card has been initialized successfully.
Parameters
slotSD/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().

COMPILER_WORD_ALIGNED uint8_t buf_test[TEST_MEM_ACCESS_SIZE]
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)