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. More...
|
|
bool | sdhc_send_cmd (sdhc_state_t *state, uint32_t cmd, uint32_t arg) |
| Send a command to the SD card. More...
|
|
int | sdhc_read_blocks (sdhc_state_t *state, uint32_t block, void *dst, uint16_t num) |
| Read blocks from the SD card into memory. More...
|
|
int | sdhc_write_blocks (sdhc_state_t *state, uint32_t block, const void *src, uint16_t num) |
| Write memory to SD card blocks. More...
|
|
int | sdhc_erase_blocks (sdhc_state_t *state, uint32_t block, uint16_t num) |
| Erase memory from SD card blocks. More...
|
|
◆ 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_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