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

SD Host Controller public API header file. More...

#include <errno.h>
#include <zephyr/device.h>
#include <zephyr/sd/sd_spec.h>
#include <zephyr/syscalls/sdhc.h>

Go to the source code of this file.

Data Structures

struct  sdhc_command
 SD host controller command structure. More...
 
struct  sdhc_data
 SD host controller data structure. More...
 
struct  sdhc_host_caps
 SD host controller capabilities. More...
 
struct  sdhc_io
 SD host controller I/O control structure. More...
 
struct  sdhc_host_props
 SD host controller properties. More...
 
struct  sdhc_driver_api
 

Macros

#define SDHC_NATIVE_RESPONSE_MASK   0xF
 
#define SDHC_SPI_RESPONSE_TYPE_MASK   0xF0
 
SD command timeouts
#define SDHC_TIMEOUT_FOREVER   (-1)
 

Typedefs

typedef void(* sdhc_interrupt_cb_t) (const struct device *dev, int reason, const void *user_data)
 SDHC card interrupt callback prototype.
 

Enumerations

enum  sdhc_bus_mode { SDHC_BUSMODE_OPENDRAIN = 1 , SDHC_BUSMODE_PUSHPULL = 2 }
 SD bus mode. More...
 
enum  sdhc_power { SDHC_POWER_OFF = 1 , SDHC_POWER_ON = 2 }
 SD host controller power. More...
 
enum  sdhc_bus_width { SDHC_BUS_WIDTH1BIT = 1U , SDHC_BUS_WIDTH4BIT = 4U , SDHC_BUS_WIDTH8BIT = 8U }
 SD host controller bus width. More...
 
enum  sdhc_timing_mode {
  SDHC_TIMING_LEGACY = 1U , SDHC_TIMING_HS = 2U , SDHC_TIMING_SDR12 = 3U , SDHC_TIMING_SDR25 = 4U ,
  SDHC_TIMING_SDR50 = 5U , SDHC_TIMING_SDR104 = 6U , SDHC_TIMING_DDR50 = 7U , SDHC_TIMING_DDR52 = 8U ,
  SDHC_TIMING_HS200 = 9U , SDHC_TIMING_HS400 = 10U
}
 SD host controller timing mode. More...
 
enum  sd_voltage { SD_VOL_3_3_V = 1U , SD_VOL_3_0_V = 2U , SD_VOL_1_8_V = 3U , SD_VOL_1_2_V = 4U }
 SD voltage. More...
 
enum  sdhc_interrupt_source { SDHC_INT_SDIO = BIT(0) , SDHC_INT_INSERTED = BIT(1) , SDHC_INT_REMOVED = BIT(2) }
 SD host controller interrupt sources. More...
 

Functions

int sdhc_hw_reset (const struct device *dev)
 reset SDHC controller state
 
int sdhc_request (const struct device *dev, struct sdhc_command *cmd, struct sdhc_data *data)
 Send command to SDHC.
 
int sdhc_set_io (const struct device *dev, struct sdhc_io *io)
 set I/O properties of SDHC
 
int sdhc_card_present (const struct device *dev)
 check for SDHC card presence
 
int sdhc_execute_tuning (const struct device *dev)
 run SDHC tuning
 
int sdhc_card_busy (const struct device *dev)
 check if SD card is busy
 
int sdhc_get_host_props (const struct device *dev, struct sdhc_host_props *props)
 Get SD host controller properties.
 
int sdhc_enable_interrupt (const struct device *dev, sdhc_interrupt_cb_t callback, int sources, void *user_data)
 Enable SDHC interrupt sources.
 
int sdhc_disable_interrupt (const struct device *dev, int sources)
 Disable SDHC interrupt sources.
 

Detailed Description

SD Host Controller public API header file.