SD card interface functions for sam0 class devices.
More...
SD card interface functions for sam0 class devices.
- Warning
- This driver is deprecated. Use the
sdmmc
driver module instead. You can refer to the `same54-xpro´ board as an example on how to use it.
|
file | sdhc.h |
| SD card interface functions for sam0 class devices.
|
|
|
int | sdhc_init (sdhc_state_t *state) |
| Initialize the SD host controller.
|
|
bool | sdhc_send_cmd (sdhc_state_t *state, uint32_t cmd, uint32_t arg) |
| Send a command to the SD card.
|
|
int | sdhc_read_blocks (sdhc_state_t *state, uint32_t block, void *dst, uint16_t num) |
| Read blocks from the SD card into memory.
|
|
int | sdhc_write_blocks (sdhc_state_t *state, uint32_t block, const void *src, uint16_t num) |
| Write memory to SD card blocks.
|
|
int | sdhc_erase_blocks (sdhc_state_t *state, uint32_t block, uint16_t num) |
| Erase memory from SD card blocks.
|
|
◆ CARD_TYPE_HC
#define CARD_TYPE_HC (1 << 3) |
High capacity card.
Definition at line 64 of file sdhc.h.
◆ CARD_TYPE_MMC
#define CARD_TYPE_MMC (1 << 1) |
MMC card.
Definition at line 62 of file sdhc.h.
◆ CARD_TYPE_SD
#define CARD_TYPE_SD (1 << 0) |
SD card.
Definition at line 61 of file sdhc.h.
◆ CARD_TYPE_SD_COMBO
SD combo card (io + memory)
Definition at line 66 of file sdhc.h.
◆ CARD_TYPE_SDIO
#define CARD_TYPE_SDIO (1 << 2) |
SDIO card.
Definition at line 63 of file sdhc.h.
◆ CARD_TYPE_UNKNOWN
#define CARD_TYPE_UNKNOWN (0) |
Unknown type card.
Definition at line 60 of file sdhc.h.
◆ CARD_VER_MMC_1_2
#define CARD_VER_MMC_1_2 (0x12) |
MMC version 1.2.
Definition at line 76 of file sdhc.h.
◆ CARD_VER_MMC_1_4
#define CARD_VER_MMC_1_4 (0x14) |
MMC version 1.4.
Definition at line 77 of file sdhc.h.
◆ CARD_VER_MMC_2_2
#define CARD_VER_MMC_2_2 (0x22) |
MMC version 2.2.
Definition at line 78 of file sdhc.h.
◆ CARD_VER_MMC_3
#define CARD_VER_MMC_3 (0x30) |
MMC version 3.
Definition at line 79 of file sdhc.h.
◆ CARD_VER_MMC_4
#define CARD_VER_MMC_4 (0x40) |
MMC version 4.
Definition at line 80 of file sdhc.h.
◆ CARD_VER_SD_1_0
#define CARD_VER_SD_1_0 (0x10) |
SD version 1.0 and 1.01.
Definition at line 72 of file sdhc.h.
◆ CARD_VER_SD_1_10
#define CARD_VER_SD_1_10 (0x1A) |
SD version 1.10.
Definition at line 73 of file sdhc.h.
◆ CARD_VER_SD_2_0
#define CARD_VER_SD_2_0 (0X20) |
SD version 2.00.
Definition at line 74 of file sdhc.h.
◆ CARD_VER_SD_3_0
#define CARD_VER_SD_3_0 (0X30) |
SD version 3.0X.
Definition at line 75 of file sdhc.h.
◆ CARD_VER_UNKNOWN
#define CARD_VER_UNKNOWN (0) |
Unknown card version.
Definition at line 71 of file sdhc.h.
◆ MCI_CMD_MULTI_BLOCK
#define MCI_CMD_MULTI_BLOCK (1ul << 20) |
To signal a data transfer in multi block mode.
Definition at line 95 of file sdhc.h.
◆ MCI_CMD_OPENDRAIN
#define MCI_CMD_OPENDRAIN (1ul << 14) |
Open drain for a broadcast command.
Definition at line 89 of file sdhc.h.
◆ MCI_CMD_SDIO_BLOCK
#define MCI_CMD_SDIO_BLOCK (1ul << 17) |
To signal a SDIO transfer in block mode.
Definition at line 92 of file sdhc.h.
◆ MCI_CMD_SDIO_BYTE
#define MCI_CMD_SDIO_BYTE (1ul << 16) |
To signal a SDIO transfer in multi byte mode.
Definition at line 91 of file sdhc.h.
◆ MCI_CMD_SINGLE_BLOCK
#define MCI_CMD_SINGLE_BLOCK (1ul << 19) |
To signal a data transfer in single block mode.
Definition at line 94 of file sdhc.h.
◆ MCI_CMD_STREAM
#define MCI_CMD_STREAM (1ul << 18) |
To signal a data transfer in stream mode.
Definition at line 93 of file sdhc.h.
◆ MCI_CMD_WRITE
#define MCI_CMD_WRITE (1ul << 15) |
To signal a data write operation.
Definition at line 90 of file sdhc.h.
◆ MCI_RESP_136
#define MCI_RESP_136 (1ul << 11) |
136 bit response
Definition at line 86 of file sdhc.h.
◆ MCI_RESP_BUSY
#define MCI_RESP_BUSY (1ul << 13) |
Card may send busy.
Definition at line 88 of file sdhc.h.
◆ MCI_RESP_CRC
#define MCI_RESP_CRC (1ul << 12) |
Expect valid crc.
Definition at line 87 of file sdhc.h.
◆ MCI_RESP_PRESENT
#define MCI_RESP_PRESENT (1ul << 8) |
Have response.
Definition at line 85 of file sdhc.h.
◆ SD_MMC_BLOCK_SIZE
#define SD_MMC_BLOCK_SIZE 512 |
This SD stack uses the maximum block size authorized (512 bytes)
SD card block size
Definition at line 99 of file sdhc.h.
◆ SDHC_FAST_CLOCK_HZ
#define SDHC_FAST_CLOCK_HZ 25000000 |
Clock frequency after init.
Definition at line 101 of file sdhc.h.
◆ SDHC_SLOW_CLOCK_HZ
#define SDHC_SLOW_CLOCK_HZ 400000 |
Clock frequency on init.
Definition at line 100 of file sdhc.h.
◆ sdhc_erase_blocks()
int sdhc_erase_blocks |
( |
sdhc_state_t * |
state, |
|
|
uint32_t |
block, |
|
|
uint16_t |
num |
|
) |
| |
Erase memory from SD card blocks.
Erases n 512 byte blocks on the SD card
- Parameters
-
[in] | state | driver context |
[in] | block | first block number to erase |
[in] | num | number of blocks to erase |
- Returns
- 0 if success, negative error if failed
◆ sdhc_init()
Initialize the SD host controller.
- Parameters
-
- Returns
- int 0 on success, error otherwise
◆ sdhc_read_blocks()
int sdhc_read_blocks |
( |
sdhc_state_t * |
state, |
|
|
uint32_t |
block, |
|
|
void * |
dst, |
|
|
uint16_t |
num |
|
) |
| |
Read blocks from the SD card into memory.
Reads n 512 byte blocks from the SD card
- Parameters
-
[in] | state | driver context |
[in] | block | block number to read from |
[out] | dst | destination address |
[in] | num | number of blocks to read |
- Returns
- 0 if success, negative error if failed
◆ sdhc_send_cmd()
bool sdhc_send_cmd |
( |
sdhc_state_t * |
state, |
|
|
uint32_t |
cmd, |
|
|
uint32_t |
arg |
|
) |
| |
Send a command to the SD card.
- Parameters
-
[in] | state | driver context |
[in] | cmd | the command code |
[in] | arg | command argument |
- Returns
- true command was successful
-
false command returned error
◆ sdhc_write_blocks()
int sdhc_write_blocks |
( |
sdhc_state_t * |
state, |
|
|
uint32_t |
block, |
|
|
const void * |
src, |
|
|
uint16_t |
num |
|
) |
| |
Write memory to SD card blocks.
Writes n 512 bytes blocks on the SD card
- Parameters
-
[in] | state | driver context |
[in] | block | block number to write to |
[in] | src | pointer to memory to write |
[in] | num | number of blocks to write |
- Returns
- 0 if success, negative error if failed