SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions | Variables
sys-sdhci.h File Reference
#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <reg/reg-smhc.h>
#include <sys-gpio.h>
#include <log.h>
Include dependency graph for sys-sdhci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sdhci_cmd_t
 
struct  sdhci_data_t
 
struct  sdhci_idma_desc_t
 
struct  sdhci_t
 

Macros

#define SMHC_DES_NUM_SHIFT   12 /* smhc2!! */
 
#define SMHC_DES_BUFFER_MAX_LEN   (1 << SMHC_DES_NUM_SHIFT)
 

Enumerations

enum  smhc_clk_t {
  MMC_CLK_400K = 0 , MMC_CLK_25M , MMC_CLK_50M , MMC_CLK_50M_DDR ,
  MMC_CLK_100M , MMC_CLK_150M , MMC_CLK_200M
}
 
enum  sdhci_type_t { SDHCI_TYPE_SD = 1 , SDHCI_TYPE_MMC }
 

Functions

bool sdhci_reset (sdhci_t *hci)
 Reset the SD card controller.
 
bool sdhci_set_voltage (sdhci_t *hci, uint32_t voltage)
 Set the voltage for the SD card controller.
 
bool sdhci_set_width (sdhci_t *hci, uint32_t width)
 Set the data bus width for the SD card controller.
 
bool sdhci_set_clock (sdhci_t *hci, smhc_clk_t hz)
 Set the clock frequency for the SD card controller.
 
bool sdhci_transfer (sdhci_t *hci, sdhci_cmd_t *cmd, sdhci_data_t *dat)
 Perform a data transfer operation with the SD card controller.
 
int sunxi_sdhci_init (sdhci_t *sdhci)
 Initialize the SD card controller for Sunxi platform.
 

Variables

sdhci_t sdhci0
 

Macro Definition Documentation

◆ SMHC_DES_BUFFER_MAX_LEN

#define SMHC_DES_BUFFER_MAX_LEN   (1 << SMHC_DES_NUM_SHIFT)

◆ SMHC_DES_NUM_SHIFT

#define SMHC_DES_NUM_SHIFT   12 /* smhc2!! */

Enumeration Type Documentation

◆ sdhci_type_t

Enumerator
SDHCI_TYPE_SD 
SDHCI_TYPE_MMC 

◆ smhc_clk_t

enum smhc_clk_t
Enumerator
MMC_CLK_400K 
MMC_CLK_25M 
MMC_CLK_50M 
MMC_CLK_50M_DDR 
MMC_CLK_100M 
MMC_CLK_150M 
MMC_CLK_200M 

Function Documentation

◆ sdhci_reset()

bool sdhci_reset ( sdhci_t hci)

Reset the SD card controller.

Parameters
hciA pointer to the SD card controller structure.
Returns
True if the reset is successful, false otherwise.

◆ sdhci_set_clock()

bool sdhci_set_clock ( sdhci_t hci,
smhc_clk_t  hz 
)

Set the clock frequency for the SD card controller.

Parameters
hciA pointer to the SD card controller structure.
hzThe clock frequency value to be set.
Returns
True if the clock frequency setting is successful, false otherwise.

◆ sdhci_set_voltage()

bool sdhci_set_voltage ( sdhci_t hci,
uint32_t  voltage 
)

Set the voltage for the SD card controller.

Parameters
hciA pointer to the SD card controller structure.
voltageThe voltage value to be set.
Returns
True if the voltage setting is successful, false otherwise.

◆ sdhci_set_width()

bool sdhci_set_width ( sdhci_t hci,
uint32_t  width 
)

Set the data bus width for the SD card controller.

Parameters
hciA pointer to the SD card controller structure.
widthThe data bus width value to be set.
Returns
True if the data bus width setting is successful, false otherwise.

◆ sdhci_transfer()

bool sdhci_transfer ( sdhci_t hci,
sdhci_cmd_t cmd,
sdhci_data_t dat 
)

Perform a data transfer operation with the SD card controller.

Parameters
hciA pointer to the SD card controller structure.
cmdPointer to the SD command structure.
datPointer to the SD data structure.
Returns
True if the transfer is successful, false otherwise.

◆ sunxi_sdhci_init()

int sunxi_sdhci_init ( sdhci_t sdhci)

Initialize the SD card controller for Sunxi platform.

Parameters
sdhciA pointer to the SD card controller structure.
Returns
0 if initialization is successful, an error code otherwise.

Variable Documentation

◆ sdhci0

sdhci_t sdhci0
extern