SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros | Functions
sys-sdhci.c File Reference
#include <barrier.h>
#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <log.h>
#include <timer.h>
#include <sys-clk.h>
#include <sys-gpio.h>
#include "sys-sdcard.h"
#include "sys-sdhci.h"
Include dependency graph for sys-sdhci.c:

Macros

#define FALSE   0
 
#define TRUE   1
 

Functions

static void set_read_timeout (sdhci_t *sdhci, uint32_t timeout)
 
static int prepare_dma (sdhci_t *sdhci, sdhci_data_t *data)
 
static int wait_done (sdhci_t *sdhci, sdhci_data_t *dat, uint32_t timeout_msecs, uint32_t flag, bool dma)
 
static bool read_bytes (sdhci_t *sdhci, sdhci_data_t *dat)
 
static bool write_bytes (sdhci_t *sdhci, sdhci_data_t *dat)
 
bool sdhci_transfer (sdhci_t *sdhci, sdhci_cmd_t *cmd, sdhci_data_t *dat)
 Perform a data transfer operation with the SD card controller.
 
bool sdhci_reset (sdhci_t *sdhci)
 Reset the SD card controller.
 
bool sdhci_set_width (sdhci_t *sdhci, uint32_t width)
 Set the data bus width for the SD card controller.
 
static int init_default_timing (sdhci_t *sdhci)
 
static int config_delay (sdhci_t *sdhci)
 
static bool update_card_clock (sdhci_t *sdhci)
 
bool sdhci_set_clock (sdhci_t *sdhci, smhc_clk_t clock)
 Set the clock frequency for the SD card controller.
 
int sunxi_sdhci_init (sdhci_t *sdhci)
 Initialize the SD card controller for Sunxi platform.
 

Macro Definition Documentation

◆ FALSE

#define FALSE   0

◆ TRUE

#define TRUE   1

Function Documentation

◆ config_delay()

static int config_delay ( sdhci_t sdhci)
static

◆ init_default_timing()

static int init_default_timing ( sdhci_t sdhci)
static

◆ prepare_dma()

static int prepare_dma ( sdhci_t sdhci,
sdhci_data_t data 
)
static

◆ read_bytes()

static bool read_bytes ( sdhci_t sdhci,
sdhci_data_t dat 
)
static

◆ 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_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.

◆ set_read_timeout()

static void set_read_timeout ( sdhci_t sdhci,
uint32_t  timeout 
)
static

◆ 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.

◆ update_card_clock()

static bool update_card_clock ( sdhci_t sdhci)
static

◆ wait_done()

static int wait_done ( sdhci_t sdhci,
sdhci_data_t dat,
uint32_t  timeout_msecs,
uint32_t  flag,
bool  dma 
)
static

◆ write_bytes()

static bool write_bytes ( sdhci_t sdhci,
sdhci_data_t dat 
)
static