Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sd.h File Reference

Public API for SD subsystem. More...

#include <zephyr/device.h>
#include <zephyr/drivers/sdhc.h>
#include <zephyr/kernel.h>

Go to the source code of this file.

Data Structures

struct  sdio_func
 SDIO function definition. More...
 
struct  sd_card
 SD card structure. More...
 

Enumerations

enum  card_status { CARD_UNINITIALIZED = 0 , CARD_ERROR = 1 , CARD_INITIALIZED = 2 }
 card status. More...
 
enum  card_type { CARD_SDMMC = 0 , CARD_SDIO = 1 , CARD_COMBO = 2 , CARD_MMC = 3 }
 card type. More...
 

Functions

int sd_init (const struct device *sdhc_dev, struct sd_card *card)
 Initialize an SD device.
 
bool sd_is_card_present (const struct device *sdhc_dev)
 checks to see if card is present in the SD slot
 

Detailed Description

Public API for SD subsystem.

Enumeration Type Documentation

◆ card_status

card status.

Used internally by subsystem.

Enumerator
CARD_UNINITIALIZED 

card has not been initialized

CARD_ERROR 

card state is error

CARD_INITIALIZED 

card is in valid state

◆ card_type

enum card_type

card type.

Used internally by subsystem.

Enumerator
CARD_SDMMC 

SD memory card.

CARD_SDIO 

SD I/O card.

CARD_COMBO 

SD memory and I/O card.

CARD_MMC 

MMC memory card.

Function Documentation

◆ sd_init()

int sd_init ( const struct device * sdhc_dev,
struct sd_card * card )

Initialize an SD device.

Initializes an SD device to use with the subsystem. After this call, only the SD card structure is required to access the card.

Parameters
sdhc_devSD host controller device for this card
cardSD card structure for this card
Return values
0card was initialized
-ETIMEDOUTcard initialization timed out
-EBUSYcard is busy
-EIOIO error while starting card

◆ sd_is_card_present()

bool sd_is_card_present ( const struct device * sdhc_dev)

checks to see if card is present in the SD slot

Parameters
sdhc_devSD host controller to check for card presence on
Return values
truecard is present
falsecard is not present