![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
#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 <mmu.h>#include <cache.h>#include <sys-clk.h>#include <sys-gpio.h>#include <mmc/sys-mmc.h>#include <mmc/sys-sdhci.h>
Functions | |
| static void | sunxi_sdhci_sync_all_cache (void) |
| static int | sunxi_sdhci_clk_enable (sunxi_sdhci_t *sdhci) |
| Enable clock for the SDHC controller. | |
| static int | sunxi_sdhci_update_clk (sunxi_sdhci_t *sdhci) |
| Update clock for the SDHC controller. | |
| static int | sunxi_sdhci_get_timing_config_timing_4 (sunxi_sdhci_t *sdhci, const uint32_t spd_md_id, const uint32_t freq_id) |
| Calculate the timing configuration for Sunxi SD Host Controller using timing mode 4. | |
| static int | sunxi_sdhci_get_timing_config (sunxi_sdhci_t *sdhci, uint32_t spd_md_id, uint32_t freq_id) |
| Get the timing configuration for the Sunxi SD Host Controller. | |
| static int | sunxi_sdhci_config_delay (sunxi_sdhci_t *sdhci, uint32_t spd_md_id, uint32_t freq_id) |
| Configure delay for the Sunxi SD Host Controller. | |
| int | sunxi_sdhci_clock_mode (sunxi_sdhci_t *sdhci, uint32_t clk) |
| Set the clock mode for the SDHC controller based on timing mode and other parameters. | |
| static int | sunxi_sdhci_config_clock (sunxi_sdhci_t *sdhci, uint32_t clk) |
| Configure the clock for the SDHC controller. | |
| static void | sunxi_sdhci_ddr_mode_set (sunxi_sdhci_t *sdhci, bool status) |
| Set DDR mode for the SDHC controller. | |
| static void | sunxi_sdhci_hs400_mode_set (sunxi_sdhci_t *sdhci, bool status) |
| Set HS400 mode for the SDHC controller. | |
| static void | sunxi_sdhci_pin_config (sunxi_sdhci_t *sdhci) |
| Configure GPIO pins for the SDHC controller. | |
| static int | sunxi_sunxi_sdhci_trans_data_cpu (sunxi_sdhci_t *sdhci, mmc_data_t *data) |
| Transfer data between SDHC controller and host CPU. | |
| static int | sunxi_sunxi_sdhci_trans_data_dma (sunxi_sdhci_t *sdhci, mmc_data_t *data) |
| Transfer data between SDHC controller and host CPU using DMA. | |
| void | sunxi_sdhci_set_ios (sunxi_sdhci_t *sdhci) |
| Set the I/O settings for the SDHC controller. | |
| int | sunxi_sdhci_core_init (sunxi_sdhci_t *sdhci) |
| Initialize the core functionality of the SDHC controller. | |
| int | sunxi_sdhci_xfer (sunxi_sdhci_t *sdhci, mmc_cmd_t *cmd, mmc_data_t *data) |
| Perform a data transfer operation on the SDHC controller. | |
| int | sunxi_sdhci_update_phase (sunxi_sdhci_t *sdhci) |
| Update phase for the SDHC controller. | |
| int | sunxi_sdhci_init (sunxi_sdhci_t *sdhci) |
| Initialize the SDHC controller. | |
| void | sunxi_sdhci_dump_reg (sunxi_sdhci_t *sdhci) |
| Dump the contents of the SDHCI registers. | |
Variables | |
| sunxi_sdhci_host_t | g_mmc_host |
| sunxi_sdhci_timing_t | g_mmc_timing |
| mmc_t | g_mmc |
|
static |
Enable clock for the SDHC controller.
This function enables clock for the specified SDHC controller.
| sdhci | Pointer to the SDHC controller structure. |
| int sunxi_sdhci_clock_mode | ( | sunxi_sdhci_t * | sdhci, |
| uint32_t | clk | ||
| ) |
Set the clock mode for the SDHC controller based on timing mode and other parameters.
This function sets the clock mode for the SDHC controller based on the timing mode and other parameters.
| sdhci | Pointer to the SDHC controller structure. |
| clk | Clock frequency. |
|
static |
Configure the clock for the SDHC controller.
This function configures the clock for the SDHC controller based on the specified clock frequency and other parameters.
| sdhci | Pointer to the SDHC controller structure. |
| clk | Clock frequency. |
|
static |
Configure delay for the Sunxi SD Host Controller.
This function configures the delay settings for the Sunxi SD Host Controller based on the provided parameters.
| sdhci | Pointer to the Sunxi SD Host Controller instance |
| spd_md_id | Speed mode ID |
| freq_id | Frequency ID |
| int sunxi_sdhci_core_init | ( | sunxi_sdhci_t * | sdhci | ) |
Initialize the core functionality of the SDHC controller.
This function initializes the core functionality of the SDHC controller, including resetting the controller, setting timeout values, configuring thresholds and debug parameters, and releasing the eMMC reset signal.
| sdhci | Pointer to the SDHC controller structure. |
|
static |
Set DDR mode for the SDHC controller.
This function sets the DDR mode for the SDHC controller based on the specified status.
| sdhci | Pointer to the SDHC controller structure. |
| status | Boolean indicating whether to enable (true) or disable (false) DDR mode. |
| void sunxi_sdhci_dump_reg | ( | sunxi_sdhci_t * | sdhci | ) |
Dump the contents of the SDHCI registers.
This function dumps the contents of the SDHCI registers for a given SD card host controller.
| sdhci | A pointer to the structure representing the SD card host controller. |
|
static |
Get the timing configuration for the Sunxi SD Host Controller.
This function retrieves the timing configuration for the Sunxi SD Host Controller based on the provided parameters.
| sdhci | Pointer to the Sunxi SD Host Controller instance |
| spd_md_id | Speed mode ID |
| freq_id | Frequency ID |
|
static |
Calculate the timing configuration for Sunxi SD Host Controller using timing mode 4.
This function calculates the timing configuration for the Sunxi SD Host Controller when operating in timing mode 4 based on the speed mode and frequency. It updates the timing data with the calculated delay.
| sdhci | A pointer to the Sunxi SD Host Controller structure. |
| spd_md_id | The speed mode ID. |
| freq_id | The frequency ID. |
|
static |
Set HS400 mode for the SDHC controller.
This function sets the HS400 mode for the SDHC controller based on the specified status.
| sdhci | Pointer to the SDHC controller structure. |
| status | Boolean indicating whether to enable (true) or disable (false) HS400 mode. |
| int sunxi_sdhci_init | ( | sunxi_sdhci_t * | sdhci | ) |
Initialize the SDHC controller.
This function initializes the SDHC controller by configuring its parameters, capabilities, and features based on the provided SDHC structure. It sets up the controller's timing mode, supported voltages, host capabilities, clock frequency limits, and register addresses. Additionally, it configures pin settings and enables clocks for the SDHC controller.
| sdhci | Pointer to the SDHC structure. |
|
static |
Configure GPIO pins for the SDHC controller.
This function initializes and configures the GPIO pins used by the SDHC controller based on the provided configuration.
| sdhci | Pointer to the SDHC controller structure. |
| void sunxi_sdhci_set_ios | ( | sunxi_sdhci_t * | sdhci | ) |
Set the I/O settings for the SDHC controller.
This function configures the I/O settings for the SDHC controller based on the provided MMC clock, bus width, and speed mode.
| sdhci | Pointer to the SDHC controller structure. |
|
static |
|
static |
Update clock for the SDHC controller.
This function updates the clock for the specified SDHC controller.
| sdhci | Pointer to the SDHC controller structure. |
| int sunxi_sdhci_update_phase | ( | sunxi_sdhci_t * | sdhci | ) |
Update phase for the SDHC controller.
This function updates the phase for the specified SDHC controller.
| sdhci | Pointer to the SDHC controller structure. |
| int sunxi_sdhci_xfer | ( | sunxi_sdhci_t * | sdhci, |
| mmc_cmd_t * | cmd, | ||
| mmc_data_t * | data | ||
| ) |
Perform a data transfer operation on the SDHC controller.
This function performs a data transfer operation on the SDHC controller, including sending a command and managing data transfer if present. It also handles error conditions such as fatal errors and card busy status.
| sdhci | Pointer to the SDHC controller structure. |
| cmd | Pointer to the MMC command structure. |
| data | Pointer to the MMC data structure. |
|
static |
Transfer data between SDHC controller and host CPU.
This function handles the data transfer between the SDHC controller and the host CPU.
| sdhci | Pointer to the SDHC controller structure. |
| data | Pointer to the MMC data structure containing transfer information. |
|
static |
Transfer data between SDHC controller and host CPU using DMA.
This function handles the data transfer between the SDHC controller and the host CPU using Direct Memory Access (DMA).
| sdhci | Pointer to the SDHC controller structure. |
| data | Pointer to the MMC data structure containing transfer information. |
| mmc_t g_mmc |
| sunxi_sdhci_host_t g_mmc_host |
| sunxi_sdhci_timing_t g_mmc_timing |