HPM SDK
HPMicro Software Development Kit
hpm_sdmmc_host.h File Reference
#include "hpm_common.h"
#include "hpm_sdmmc_osal.h"
#include "hpm_sdxc_drv.h"

Go to the source code of this file.

Data Structures

struct  hpm_sdmmc_pin_info_t
 SDMMC Pin info structure. More...
 
struct  hpm_sdmmc_extra_io_data_t
 SDMMC extra Pin info. More...
 
struct  sdmmc_io_init_apis_t
 
struct  sdmmc_host_param_t
 
struct  sdmmc_host_t
 

Macros

#define HPM_SDMMC_HOST_SUPPORT_4BIT   (1UL << 0)
 
#define HPM_SDMMC_HOST_SUPPORT_8BIT   (1UL << 1)
 
#define HPM_SDMMC_HOST_SUPPORT_3V3   (1UL << 2)
 
#define HPM_SDMMC_HOST_SUPPORT_1V8   (1UL << 3)
 
#define HPM_SDMMC_HOST_SUPPORT_DDR   (1UL << 4)
 
#define HPM_SDMMC_HOST_SUPPORT_SDR50   (1UL << 5)
 
#define HPM_SDMMC_HOST_SUPPORT_SDR104   (1UL << 6)
 
#define HPM_SDMMC_HOST_SUPPORT_HS200   (1UL << 7)
 
#define HPM_SDMMC_HOST_SUPPORT_HS400   (1Ul << 8)
 
#define HPM_SDMMC_HOST_SUPPORT_CARD_DETECTION   (1UL << 16)
 
#define HPM_SDMMC_HOST_SUPPORT_VOLTAGE_SWITCH   (1UL << 17)
 
#define HPM_SDMMC_HOST_SUPPORT_POWER_SWITCH   (1UL << 18)
 
#define HPM_SDMMC_HOST_SUPPORT_WRITE_PROTECTION   (1UL << 19)
 
#define HPM_SDMMC_HOST_SUPPORT_RESET_PIN   (1UL << 20)
 
#define HPM_SDMMC_HOST_SUPPORT_DATA_STROBE   (1UL << 21)
 
#define HPM_SDMMC_HOST_CD_IN_IP   (HPM_SDMMC_HOST_SUPPORT_CARD_DETECTION << 8)
 
#define HPM_SDMMC_HOST_VSEL_IN_IP   (HPM_SDMMC_HOST_SUPPORT_VOLTAGE_SWITCH << 8)
 
#define HPM_SDMMC_HOST_PWR_IN_IP   (HPM_SDMMC_HOST_SUPPORT_POWER_SWITCH << 8)
 
#define HPM_SDMMC_HOST_WP_IN_IP   (HPM_SDMMC_HOST_SUPPORT_WRITE_PROTECTION << 8)
 
#define HPM_SDMMC_HOST_RST_IN_IP   (HPM_SDMMC_HOST_SUPPORT_RESET_PIN << 8)
 
#define HPM_SDMMC_HOST_ADMA3_ALIGN_SIZE   (8U)
 
#define HPM_SDMMC_HOST_ADMA_TBL_SIZE   (SDXC_AMDA3_DESC_MIN_WORDS * 2UL)
 

Typedefs

typedef sdxc_xfer_t sdmmchost_xfer_t
 
typedef sdxc_command_t sdmmchost_cmd_t
 
typedef sdxc_data_t sdmmchost_data_t
 
typedef sdxc_adma2_descriptor_t sdmmc_adma2_desc_t
 
typedef SDXC_Type SDMMCHOST_Type
 
typedef sdxc_capabilities_t sdmmchost_capabilities_t
 
typedef uint32_t(* sdmmchost_clock_init_func_t) (SDMMCHOST_Type *base, uint32_t clk_freq, bool need_reverse)
 
typedef void(* sdmmchost_power_switch_func_t) (SDMMCHOST_Type *base, bool on_off)
 
typedef void(* sdmmchost_io_init_func_t) (SDMMCHOST_Type *base)
 
typedef void(* sdmmchost_switch_1v8_io_func_t) (SDMMCHOST_Type *base)
 
typedef void(* sdmmchost_cmd_line_init_func_t) (SDMMCHOST_Type *base, bool push_pull)
 
typedef bool(* sdmmchost_card_detect_func_t) (SDMMCHOST_Type *base)
 

Enumerations

enum  sdmmc_buswidth_t { sdmmc_bus_width_1bit = 0 , sdmmc_bus_width_4bit = 1 , sdmmc_bus_width_8bit = 2 }
 SD/MMC Bus Width definitions. More...
 
enum  sdmmc_dev_type_t { sdmmc_dev_type_emmc = 0 , sdmmc_dev_type_sd = 1 , sdmmc_dev_type_sdio = 2 }
 SD/MMC Device Type definitions. More...
 
enum  sdmmc_card_detection_mode_t { sdmmc_host_card_detection_none = 0 , sdmmc_host_card_detection_via_gpio = 1 , sdmmc_host_card_detection_via_sdxc = 2 }
 SD/MMC Host Card Detection Modes. More...
 
enum  hpm_sdmmc_io_volt_t { hpm_sdmmc_io_voltage_3v3 = 0 , hpm_sdmmc_io_voltage_1v8 = 1 }
 SDMMC IO Voltage. More...
 
enum  hpm_sdmmc_operation_mode_t { hpm_sdmmc_operation_mode_inactive = 0 , hpm_sdmmc_operation_mode_identification = 1 , hpm_sdmmc_operation_mode_transfer = 2 , hpm_sdmmc_operation_mode_interrupt = 3 }
 SDMMC Operation mode. More...
 
enum  sdmmc_speed_mode_t {
  sdmmc_sd_speed_normal = 0 , sdmmc_sd_speed_high = 1 , sdmmc_sd_speed_sdr12 = sdmmc_sd_speed_normal , sdmmc_sd_speed_sdr25 = sdmmc_sd_speed_high ,
  sdmmc_sd_speed_sdr50 = 2 , sdmmc_sd_speed_sdr104 = 3 , sdmmc_sd_speed_ddr50 = 4 , sdmmc_emmc_speed_legacy = 0 ,
  sdmmc_emmc_speed_high_speed_sdr = 1 , sdmmc_emmc_speed_hs200 = 3 , sdmmc_emmc_speed_high_speed_ddr = 4 , sdmmc_emmc_speed_hs400 = 7
}
 SD/MMC Speed definitions. More...
 
enum  hpm_sdmmc_power_option_t { hpm_sdmmc_power_off = 0 , hpm_sdmmc_power_up = 1 , hpm_sdmmc_power_on = 2 }
 

Functions

hpm_stat_t sdmmchost_init (sdmmc_host_t *host)
 SDMMC Host Initialization. More...
 
void sdmmchost_set_card_bus_width (sdmmc_host_t *host, sdmmc_buswidth_t bus_width)
 Set the card bus width. More...
 
uint32_t sdmmchost_set_card_clock (sdmmc_host_t *host, uint32_t freq, bool clock_inverse)
 Set the Card clock. More...
 
void sdmmchost_deinit (sdmmc_host_t *host)
 Deinitialize the host. More...
 
void sdmmchost_reset (const sdmmc_host_t *host)
 Reset the host. More...
 
void sdmmchost_wait_card_active (const sdmmc_host_t *host)
 Wait until the card is active. More...
 
hpm_stat_t sdmmchost_send_command (sdmmc_host_t *host, const sdmmchost_cmd_t *cmd)
 Send command via the host. More...
 
hpm_stat_t sdmmchost_transfer (sdmmc_host_t *host, const sdmmchost_xfer_t *content)
 Transfer data via the host. More...
 
bool sdmmchost_is_card_detected (const sdmmc_host_t *host)
 Check whether the card is detected or not. More...
 
void sdmmchost_init_io (sdmmc_host_t *host, hpm_sdmmc_operation_mode_t operation_mode)
 Initialize the Host IO according to the operation mode. More...
 
void sdmmchost_delay_ms (const sdmmc_host_t *host, uint32_t ms)
 Host delay. More...
 
hpm_stat_t sdmmchost_switch_to_1v8 (sdmmc_host_t *host)
 Switch the Host to 1.8V IO voltage. More...
 
void sdmmchost_vsel_pin_control (const sdmmc_host_t *host, hpm_sdmmc_io_volt_t io_volt)
 Control the Voltage selection pin. More...
 
void sdmmchost_enable_emmc_support (const sdmmc_host_t *host, bool enable)
 Enable the eMMC support on the host. More...
 
hpm_stat_t sdmmchost_set_speed_mode (const sdmmc_host_t *host, sdmmc_speed_mode_t speed_mode)
 Set the speed mode via the Host. More...
 
hpm_stat_t sdmmchost_error_recovery (sdmmc_host_t *host, sdmmchost_cmd_t *cmd)
 Trigger the Error recovery via the Host. More...
 
bool sdmmchost_is_voltage_switch_supported (const sdmmc_host_t *host)
 Check whether the host support voltage switch. More...
 
void sdmmchost_enable_enhanced_data_strobe (const sdmmc_host_t *host, bool enable)
 Enable the enhanced data strboe. More...
 
void sdmmchost_set_data_strobe_delay (const sdmmc_host_t *host)
 Set the Data strobe delay for Host. More...
 
void sdmmchost_select_voltage (sdmmc_host_t *host, hpm_sdmmc_io_volt_t io_volt)
 Select the IO voltage. More...
 
void sdmmchost_set_cardclk_delay_chain (const sdmmc_host_t *host)
 Set the Card clock delay chain for the host. More...
 
void sdmmchost_set_rxclk_delay_chain (sdmmc_host_t *host)
 Set the Card Rx Clock delay chain for the host. More...
 
void sdmmchost_irq_handler (sdmmc_host_t *host)
 THe Host IRQ Handler. More...
 
void sdmmchost_register_sdio_callback (sdmmc_host_t *host, void(*sdio_irq_callback)(void *param), void *param)
 Registers an SDIO interrupt callback function for the SDMMC host controller. More...
 
void sdmmchost_enable_sdio_interrupt (sdmmc_host_t *host, bool enable)
 Enable or disable SDIO interrupt on the SDMMC host controller. More...
 
uint32_t sdmmchost_get_data_pin_level (sdmmc_host_t *host)
 Return the data pin level. More...