Modules | Macros | Typedefs | Functions
SD/MMC/SDIO common stack
Collaboration diagram for SD/MMC/SDIO common stack:

Modules

 SD/MMC Memory
 
 SD/MMC Protocol Definition
 

Macros

#define SD_MMC_BLOCK_SIZE   512
 This SD MMC stack uses the maximum block size autorized (512 bytes) More...
 

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...
 

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)
 
#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)
 

Detailed Description

SD/MMC/SDIO basic APIs used by SD/MMC/SDIO memory APIs (sd_mmc_stack_mem_group). Also, it can be used by application which use the SDIO card or specific application which does not need of File System.

For usual application which use the SD/MMC card in memory mode with a file system, please refer to sd_mmc_stack_mem_group.

Macro Definition Documentation

◆ CARD_TYPE_HC

#define CARD_TYPE_HC   (1 << 3)

High capacity card

Definition at line 84 of file sd_mmc.h.

◆ CARD_TYPE_MMC

#define CARD_TYPE_MMC   (1 << 1)

MMC card.

Definition at line 82 of file sd_mmc.h.

◆ CARD_TYPE_SD

#define CARD_TYPE_SD   (1 << 0)

SD card.

Definition at line 81 of file sd_mmc.h.

◆ CARD_TYPE_SD_COMBO

#define CARD_TYPE_SD_COMBO   (CARD_TYPE_SD | CARD_TYPE_SDIO)

SD combo card (io + memory)

Definition at line 86 of file sd_mmc.h.

◆ CARD_TYPE_SDIO

#define CARD_TYPE_SDIO   (1 << 2)

SDIO card.

Definition at line 83 of file sd_mmc.h.

◆ CARD_TYPE_UNKNOWN

#define CARD_TYPE_UNKNOWN   (0)

Unknown type card.

Definition at line 80 of file sd_mmc.h.

◆ CARD_VER_MMC_1_2

#define CARD_VER_MMC_1_2   (0x12)

Definition at line 98 of file sd_mmc.h.

◆ CARD_VER_MMC_1_4

#define CARD_VER_MMC_1_4   (0x14)

Definition at line 99 of file sd_mmc.h.

◆ CARD_VER_MMC_2_2

#define CARD_VER_MMC_2_2   (0x22)

Definition at line 100 of file sd_mmc.h.

◆ CARD_VER_MMC_3

#define CARD_VER_MMC_3   (0x30)

Definition at line 101 of file sd_mmc.h.

◆ CARD_VER_MMC_4

#define CARD_VER_MMC_4   (0x40)

Definition at line 102 of file sd_mmc.h.

◆ CARD_VER_SD_1_0

#define CARD_VER_SD_1_0   (0x10)

Definition at line 94 of file sd_mmc.h.

◆ CARD_VER_SD_1_10

#define CARD_VER_SD_1_10   (0x1A)

Definition at line 95 of file sd_mmc.h.

◆ CARD_VER_SD_2_0

#define CARD_VER_SD_2_0   (0X20)

Definition at line 96 of file sd_mmc.h.

◆ CARD_VER_SD_3_0

#define CARD_VER_SD_3_0   (0X30)

Definition at line 97 of file sd_mmc.h.

◆ CARD_VER_UNKNOWN

#define CARD_VER_UNKNOWN   (0)

Definition at line 93 of file sd_mmc.h.

◆ SD_MMC_BLOCK_SIZE

#define SD_MMC_BLOCK_SIZE   512

This SD MMC stack uses the maximum block size autorized (512 bytes)

Definition at line 106 of file sd_mmc.h.

◆ SD_MMC_ERR_COMM

#define SD_MMC_ERR_COMM   5

Definition at line 71 of file sd_mmc.h.

◆ SD_MMC_ERR_NO_CARD

#define SD_MMC_ERR_NO_CARD   2

Definition at line 68 of file sd_mmc.h.

◆ SD_MMC_ERR_PARAM

#define SD_MMC_ERR_PARAM   6

Definition at line 72 of file sd_mmc.h.

◆ SD_MMC_ERR_SLOT

#define SD_MMC_ERR_SLOT   4

Definition at line 70 of file sd_mmc.h.

◆ SD_MMC_ERR_UNUSABLE

#define SD_MMC_ERR_UNUSABLE   3

Definition at line 69 of file sd_mmc.h.

◆ SD_MMC_ERR_WP

#define SD_MMC_ERR_WP   7

Definition at line 73 of file sd_mmc.h.

◆ SD_MMC_INIT_ONGOING

#define SD_MMC_INIT_ONGOING   1

Definition at line 67 of file sd_mmc.h.

◆ SD_MMC_OK

#define SD_MMC_OK   0

Definition at line 66 of file sd_mmc.h.

Typedef Documentation

◆ card_type_t

typedef uint8_t card_type_t

Type of card type.

Definition at line 76 of file sd_mmc.h.

◆ card_version_t

typedef uint8_t card_version_t

Type of card version.

Definition at line 89 of file sd_mmc.h.

◆ sd_mmc_err_t

typedef uint8_t sd_mmc_err_t

Type of return error code.

Definition at line 62 of file sd_mmc.h.

Function Documentation

◆ sd_mmc_check()

sd_mmc_err_t sd_mmc_check ( uint8_t  slot)

Performs a card checks.

Parameters
slotCard slot to use
Return values
SD_MMC_OKCard ready
SD_MMC_INIT_ONGOINGInitialization on going
SD_MMC_ERR_NO_CARDCard not present in slot
Othervalue for error cases, see sd_mmc_err_t

Definition at line 1776 of file sd_mmc.c.

◆ sd_mmc_get_capacity()

uint32_t sd_mmc_get_capacity ( uint8_t  slot)

Get the memory capacity.

Parameters
slotCard slot
Returns
Capacity (unit KB)

Definition at line 1820 of file sd_mmc.c.

◆ sd_mmc_get_type()

card_type_t sd_mmc_get_type ( uint8_t  slot)

Get the card type.

Parameters
slotCard slot
Returns
Card type (card_type_t)

Definition at line 1802 of file sd_mmc.c.

◆ sd_mmc_get_version()

card_version_t sd_mmc_get_version ( uint8_t  slot)

Get the card version.

Parameters
slotCard slot
Returns
Card version (card_version_t)

Definition at line 1811 of file sd_mmc.c.

◆ sd_mmc_init()

void sd_mmc_init ( void  )

Initialize the SD/MMC stack and low level driver required.

Enable the PMC clock for the card detect pins

Enable the PMC clock for the card write protection pins

Definition at line 1746 of file sd_mmc.c.

◆ sd_mmc_init_read_blocks()

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.

Parameters
slotCard slot to use
startStart block number to to read.
nb_blockTotal number of blocks to be read.
Returns
return SD_MMC_OK if success, otherwise return an error code (sd_mmc_err_t).

Definition at line 1842 of file sd_mmc.c.

◆ sd_mmc_init_write_blocks()

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.

Parameters
slotCard slot to use
startStart block number to be written.
nb_blockTotal number of blocks to be written.
Returns
return SD_MMC_OK if success, otherwise return an error code (sd_mmc_err_t).

Definition at line 1932 of file sd_mmc.c.

◆ sd_mmc_is_write_protected()

bool sd_mmc_is_write_protected ( uint8_t  slot)

Get the card write protection status.

Parameters
slotCard slot
Returns
true, if write portected

Definition at line 1829 of file sd_mmc.c.

◆ sd_mmc_nb_slot()

uint8_t sd_mmc_nb_slot ( void  )

Return the number of slot available.

Returns
Number of card slot available

Definition at line 1771 of file sd_mmc.c.

◆ sd_mmc_start_read_blocks()

sd_mmc_err_t sd_mmc_start_read_blocks ( void *  dest,
uint16_t  nb_block 
)

Start the read blocks of data from the card.

Parameters
destPointer to read buffer.
nb_blockNumber of blocks to be read.
Returns
return SD_MMC_OK if started, otherwise return an error code (sd_mmc_err_t).

Definition at line 1893 of file sd_mmc.c.

◆ sd_mmc_start_write_blocks()

sd_mmc_err_t sd_mmc_start_write_blocks ( const void *  src,
uint16_t  nb_block 
)

Start the write blocks of data.

Parameters
srcPointer to write buffer.
nb_blockNumber of blocks to be written.
Returns
return SD_MMC_OK if started, otherwise return an error code (sd_mmc_err_t).

Definition at line 1980 of file sd_mmc.c.

◆ sd_mmc_wait_end_of_read_blocks()

sd_mmc_err_t sd_mmc_wait_end_of_read_blocks ( bool  abort)

Wait the end of read blocks of data from the card.

Parameters
abortAbort reading process initialized by sd_mmc_init_read_blocks() after the reading issued by sd_mmc_start_read_blocks() is done
Returns
return SD_MMC_OK if success, otherwise return an error code (sd_mmc_err_t).

Definition at line 1905 of file sd_mmc.c.

◆ sd_mmc_wait_end_of_write_blocks()

sd_mmc_err_t sd_mmc_wait_end_of_write_blocks ( bool  abort)

Wait the end of write blocks of data.

Parameters
abortAbort writing process initialized by sd_mmc_init_write_blocks() after the writing issued by sd_mmc_start_write_blocks() is done
Returns
return SD_MMC_OK if success, otherwise return an error code (sd_mmc_err_t).

Definition at line 1991 of file sd_mmc.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00