国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Linux服務器 > 正文

詳解linux 驅動編寫(sd卡驅動)

2024-09-05 23:04:42
字體:
來源:轉載
供稿:網友

隨著sd卡的流行,sd卡在嵌入式設備上使用的場景也越來越多。那下面我們可以看一下,linux/164835.html">linux驅動框架上是怎么處理sd卡驅動的?

1、代碼目錄地址

drivers/mmc 

2、基本結構

從mmc的代碼結構可以看得出,主要分為兩個部分,其中core為協議部分,host為各個soc的適配部分

host是我們需要真正關心的代碼

3、以s3c為例,觀察makefile

obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o ...... obj-$(CONFIG_MMC_S3C)    += s3cmci.o 

4、根據s3c閱讀Kconfig,確認s3c下的sd卡還依賴哪些文件

config MMC_SDHCI_S3C   tristate "SDHCI support on Samsung S3C SoC"   depends on MMC_SDHCI && PLAT_SAMSUNG   help    This selects the Secure Digital Host Controller Interface (SDHCI)    often referrered to as the HSMMC block in some of the Samsung S3C    range of SoC.     If you have a controller with this interface, say Y or M here.     If unsure, say N.  config MMC_SDHCI_S3C_DMA   bool "DMA support on S3C SDHCI"   depends on MMC_SDHCI_S3C   help    Enable DMA support on the Samsung S3C SDHCI glue. The DMA    has proved to be problematic if the controller encounters    certain errors, and thus should be treated with care.     YMMV.  config MMC_S3C   tristate "Samsung S3C SD/MMC Card Interface support"   depends on ARCH_S3C24XX   depends on S3C24XX_DMAC   help    This selects a driver for the MCI interface found in      Samsung's S3C2410, S3C2412, S3C2440, S3C2442 CPUs.    If you have a board based on one of those and a MMC/SD    slot, say Y or M here.     If unsure, say N. 

5、MMC_S3C和MMC_SDHCI_S3C是主要的macro,接著了解兩個macro對應文件的數據結構

首先看一下s3cmci.c文件,

static const struct mmc_host_ops s3cmci_ops = {   .request  = s3cmci_request,   .set_ios  = s3cmci_set_ios,   .get_ro   = mmc_gpio_get_ro,   .get_cd   = mmc_gpio_get_cd,   .enable_sdio_irq = s3cmci_enable_sdio_irq, }; 

再看一下sdhci-s3c.c文件,

static struct sdhci_ops sdhci_s3c_ops = {   .get_max_clock   = sdhci_s3c_get_max_clk,   .set_clock   = sdhci_s3c_set_clock,   .get_min_clock   = sdhci_s3c_get_min_clock,   .set_bus_width   = sdhci_set_bus_width,   .reset     = sdhci_reset,   .set_uhs_signaling = sdhci_set_uhs_signaling, }; 

6 、從host角度來說,有了platform driver和上面的host driver,驅動流程就算搞清楚了。

但是如果深入下去的話,還是需要好好讀一下sd協議,這里面花的時間最多。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到服務器教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 兴义市| 剑阁县| 西安市| 唐山市| 义乌市| 永修县| 杂多县| 临湘市| 凉城县| 阿克苏市| 安岳县| 饶平县| 梁河县| 从化市| 芜湖市| 广宗县| 诸城市| 伊宁县| 明星| 沙坪坝区| 子长县| 岫岩| 北川| 含山县| 永胜县| 新河县| 瑞丽市| 大化| 南川市| 汉阴县| 苍梧县| 通辽市| 喀喇沁旗| 焦作市| 奎屯市| 临洮县| 中宁县| 光山县| 江源县| 常山县| 金堂县|