MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
Secure Digital High Capacity (SDHC)

Modules

 SDHC_Registers
 Registers, Bit Masks and Bit Positions for the SDHC Peripheral Module.
 
 Sdhc_async
 Callback function type used in asynchronous SDHC communications requests.
 

Data Structures

struct  sdhc_cfg_t
 
struct  sdhc_cmd_cfg_t
 

Macros

#define SDHC_Bus_Voltage_1_8   5
 
#define SDHC_Bus_Voltage_3_0   6
 
#define SDHC_Bus_Voltage_3_3   7
 
#define SDHC_DIRECTION_CFG   0
 
#define SDHC_DIRECTION_READ   1
 
#define SDHC_DIRECTION_WRITE   2
 

Typedefs

typedef void(* sdhc_callback_fn) (int error_code)
 

Functions

int SDHC_Init (const sdhc_cfg_t *cfg, const sys_cfg_sdhc_t *sys_cfg)
 Initialize and enable SDHC module. More...
 
int SDHC_Shutdown (void)
 Shutdown SDHC module. More...
 
void SDHC_PowerUp (void)
 Enable SDHC Bus Power.
 
void SDHC_PowerDown (void)
 Disable SDHC Bus Power.
 
void SDHC_Set_Clock_Config (unsigned int clk_div)
 Set clock divider. More...
 
unsigned int SDHC_Get_Clock_Config (void)
 Get clock divider. More...
 
int SDHC_SendCommand (sdhc_cmd_cfg_t *sd_cmd_cfg)
 Send Command, blocking. More...
 
int SDHC_SendCommandAsync (sdhc_cmd_cfg_t *sd_cmd_cfg)
 Send SDHC command Async. More...
 
void SDHC_Handler (void)
 
int SDHC_Card_Inserted (void)
 See if card is inserted. More...
 
void SDHC_ClearFlags (uint32_t mask)
 Clear interrupt flags. More...
 
unsigned SDHC_GetFlags (void)
 Get interrupt flags. More...
 
void SDHC_Reset (void)
 Resets SDHC back to default settings. More...
 
void SDHC_Reset_CMD_DAT (void)
 Abort any command or data transaction in progress on controller. More...
 
int SDHC_Card_Busy (void)
 Check if Card is busy. More...
 
unsigned int SDHC_Get_Host_Cn_1 (void)
 Retrieve host control 1 register. More...
 
uint32_t SDHC_Get_Response32 (void)
 Read a 32-bit command response. More...
 
uint32_t SDHC_Get_Response32_Auto (void)
 Read a 32-bit command response for Auto commands. More...
 
void SDHC_Get_Response128 (unsigned char *response)
 Read a 128-bit command response. More...
 

Detailed Description

Function Documentation

◆ SDHC_Init()

int SDHC_Init ( const sdhc_cfg_t cfg,
const sys_cfg_sdhc_t *  sys_cfg 
)
Parameters
cfgPointer to SDHC configuration.
sys_cfgPointer to system configuration object
Returns
E_NO_ERROR If everything is successful.
Error Codes If function is unsuccessful.

◆ SDHC_Shutdown()

int SDHC_Shutdown ( void  )
Returns
E_NO_ERROR If everything is successful.
Error Codes If function is unsuccessful.

◆ SDHC_Set_Clock_Config()

void SDHC_Set_Clock_Config ( unsigned int  clk_div)
Parameters
clk_divDivider setting s
Returns
E_NO_ERROR If everything is successful.
Error Codes If function is unsuccessful.

◆ SDHC_Get_Clock_Config()

unsigned int SDHC_Get_Clock_Config ( void  )
Returns
Clock divider setting s
E_NO_ERROR If everything is successful.
Error Codes If function is unsuccessful.

◆ SDHC_SendCommand()

int SDHC_SendCommand ( sdhc_cmd_cfg_t sd_cmd_cfg)
Parameters
sd_cmd_cfgThe sd command configuration
Returns
E_NO_ERROR If everything is successful.
Error Codes If function is unsuccessful.

◆ SDHC_SendCommandAsync()

int SDHC_SendCommandAsync ( sdhc_cmd_cfg_t sd_cmd_cfg)
Parameters
sd_cmd_cfgThe sd command configuration
Returns
E_NO_ERROR If everything is successful.
Error Codes If function is unsuccessful.

◆ SDHC_Card_Inserted()

int SDHC_Card_Inserted ( void  )
Returns
1 is card inserted, 0 is card not inserted

◆ SDHC_ClearFlags()

void SDHC_ClearFlags ( uint32_t  mask)
Parameters
maskMask of the SDHC interrupts to clear, see SDHC_INTFL Register.

◆ SDHC_GetFlags()

unsigned SDHC_GetFlags ( void  )
Returns
Mask of active flags.

◆ SDHC_Reset()

void SDHC_Reset ( void  )

◆ SDHC_Reset_CMD_DAT()

void SDHC_Reset_CMD_DAT ( void  )

◆ SDHC_Card_Busy()

int SDHC_Card_Busy ( void  )
Returns
1 card busy , 0 card is not busy

◆ SDHC_Get_Host_Cn_1()

unsigned int SDHC_Get_Host_Cn_1 ( void  )
Returns
host control register

◆ SDHC_Get_Response32()

uint32_t SDHC_Get_Response32 ( void  )

This function may be used to read response types R1, R1a, R3, R4, R5, R5b, and R6

Returns
Command response

◆ SDHC_Get_Response32_Auto()

uint32_t SDHC_Get_Response32_Auto ( void  )

This function may be used to read response types R1b and R1 after an Auto CMD12 or Auto CMD23

Returns
Command response

◆ SDHC_Get_Response128()

void SDHC_Get_Response128 ( unsigned char *  response)
Parameters
responsePointer to storage for response (16 bytes)

This function may be used to read response type R2 (CID or CSD)