Microchip® Advanced Software Framework

sd_mmc.h File Reference

Common SD/MMC stack header file.

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

#include "compiler.h"
#include "conf_sd_mmc.h"

Macros

#define SD_MMC_BLOCK_SIZE   512
 This SD MMC stack uses the maximum block size autorized (512 bytes) More...
 
Return error codes
#define SD_MMC_OK   0
 
#define SD_MMC_INIT_ONGOING   1
 
#define SD_MMC_ERR_NO_CARD   2
 
#define SD_MMC_ERR_UNUSABLE   3
 
#define SD_MMC_ERR_SLOT   4
 
#define SD_MMC_ERR_COMM   5
 
#define SD_MMC_ERR_PARAM   6
 
#define SD_MMC_ERR_WP   7
 
Card Types
#define CARD_TYPE_UNKNOWN   (0)
 Unknown type card. More...
 
#define CARD_TYPE_SD   (1 << 0)
 SD card. More...
 
#define CARD_TYPE_MMC   (1 << 1)
 MMC card. More...
 
#define CARD_TYPE_SDIO   (1 << 2)
 SDIO card. More...
 
#define CARD_TYPE_HC   (1 << 3)
 High capacity card. More...
 
#define CARD_TYPE_SD_COMBO   (CARD_TYPE_SD | CARD_TYPE_SDIO)
 SD combo card (io + memory) More...
 
Card Versions
#define CARD_VER_UNKNOWN   (0)
 
#define CARD_VER_SD_1_0   (0x10)
 
#define CARD_VER_SD_1_10   (0x1A)
 
#define CARD_VER_SD_2_0   (0X20)
 
#define CARD_VER_SD_3_0   (0X30)
 
#define CARD_VER_MMC_1_2   (0x12)
 
#define CARD_VER_MMC_1_4   (0x14)
 
#define CARD_VER_MMC_2_2   (0x22)
 
#define CARD_VER_MMC_3   (0x30)
 
#define CARD_VER_MMC_4   (0x40)
 

Typedefs

typedef uint8_t card_type_t
 Type of card type. More...
 
typedef uint8_t card_version_t
 Type of card version. More...
 
typedef uint8_t sd_mmc_err_t
 Type of return error code. More...
 

Functions

sd_mmc_err_t sd_mmc_check (uint8_t slot)
 Performs a card checks. More...
 
uint32_t sd_mmc_get_capacity (uint8_t slot)
 Get the memory capacity. More...
 
card_type_t sd_mmc_get_type (uint8_t slot)
 Get the card type. More...
 
card_version_t sd_mmc_get_version (uint8_t slot)
 Get the card version. More...
 
void sd_mmc_init (void)
 Initialize the SD/MMC stack and low level driver required. More...
 
sd_mmc_err_t sd_mmc_init_read_blocks (uint8_t slot, uint32_t start, uint16_t nb_block)
 Initialize the read blocks of data from the card. More...
 
sd_mmc_err_t sd_mmc_init_write_blocks (uint8_t slot, uint32_t start, uint16_t nb_block)
 Initialize the write blocks of data. More...
 
bool sd_mmc_is_write_protected (uint8_t slot)
 Get the card write protection status. More...
 
uint8_t sd_mmc_nb_slot (void)
 Return the number of slot available. More...
 
sd_mmc_err_t sd_mmc_start_read_blocks (void *dest, uint16_t nb_block)
 Start the read blocks of data from the card. More...
 
sd_mmc_err_t sd_mmc_start_write_blocks (const void *src, uint16_t nb_block)
 Start the write blocks of data. More...
 
sd_mmc_err_t sd_mmc_wait_end_of_read_blocks (bool abort)
 Wait the end of read blocks of data from the card. More...
 
sd_mmc_err_t sd_mmc_wait_end_of_write_blocks (bool abort)
 Wait the end of write blocks of data. More...