SD/MMC Driver¶
Following API only apply to 4G modems, On 2G modems SD card is mounted automatically if detected on power-up.
Once card is mounted, it is available on VFS path “/sd”. All standard file IO operations (open, close, read, write etc.) can be performed.
Example use¶
#include <hw/sdmmc.h>
/* To Mount SD Card */
sdmmc_mount(CARD_TYPE_SD);
/* To Mount EMMC */
sdmmc_mount(CARD_TYPE_EMMC);
/* To Unmount card */
sdmmc_unmount();
Read More¶
Standard IO <syscall/stdio> Directory <syscall/dirent> Fileystem <syscall/statvfs>
API Reference¶
Header File¶
Source: include/hw/sdmmc.h
#include <hw/sdmmc.h>
Functions¶
-
int sdmmc_mount(uint8_t type)¶
Mount an SD card.
To support SD card hotplug, Use GPIO for SD card detection Unmount SD card when card is removed and mount again when card is inserted.
On success, SD card is mounted on VFS at path: “/sd”
Note
Only supported on 4G Modules
- Parameters
type – card type cardtype_e
- Returns
0 on success, negative on error
-
int sdmmc_unmount(void)¶
Unmount SD card.
Note
Only supported on 4G Modules
- Returns
0 on success, negative on error
