ITPub博客

首页 > Linux操作系统 > Linux操作系统 > WinCE 下的SD 卡结构(转)

WinCE 下的SD 卡结构(转)

原创 Linux操作系统 作者:cifra_guokun 时间:2009-05-21 21:27:30 0 删除 编辑

今天在网上看了看SD 卡方面的 资料,结合自己的理解  整理如下.

有时间我去做个实验验证一下.

0.SD驱动有两种架构,一为INTEL的,一为MS的,你如果用的MS的Public自带的代码,那就看注册表中HKEY_LOCAL_MACHINE\Drivers\BuiltIn项下的host,bus项设置好了没有,如果OK,那就检查HKEY_LOCAL_MACHINE\Drivers\Active下host,bus两层驱动跑起来没有.

逻辑上主要是:

SDHC_SC2410.dll是最底层,负责具体的发命令什么的,SDBus.dll是中间层,负责整合命令和管理,这两个在HKEY_LOCAL_MACHINE\Drivers\BuiltIn下,系统启动时就加载,SDMemory.dll是最高层.正常工作时,一旦卡插入,SDHC_SC2410.dll的IST检测到中断,通知SDBus.dll做初始化工作,OK后SDBus.dll加载SDMemory.dll,系统才能识别卡.

1.WINCE 下 SD驱动程序包括 三部分   

HOST  硬件地层部分  对应文件一般是SDHC_SC2410.dll

BUS  中间逻辑命令层                            SDBUS.DLL

CLIENT 上层                                           SDMEMORY.DLL

SD 卡驱动是表准驱动,一般不需要独立去写.

2.在WINCE 项目中添加SD 卡的相关的组建,例如:

 CATALOG->device drivers->SDIO->SDMemory
CATALOG->device drivers->SDIO->SDIO Host->Samsung 2410 SDIO Host

CATALOG->device drivers-> Storage Devices ->Storage Devices ->Secure Digital/Multimedia Card (SD/MMC)等

3.添加文件到 PLATFORM.BIB 中.


; SD BUS driver
 SDBusDriver.dll  $(_FLATRELEASEDIR)\SDBusDriver.dll  NK SH
; SD host
 SDCSDCard.DLL  $(_FLATRELEASEDIR)\SDCSDCard.DLL  NK SH 
 SDMemory.dll  $(_FLATRELEASEDIR)\SDMemory.dll   NK SH
4添加注册表项目:


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; charlie, SDIO
    ; two step load process, the bus driver will perform. it''s
    ; own ActivateDevice call in the Entry point provided
    ; this way the driver even though it is a Builtin device, it can be unloaded
[HKEY_LOCAL_MACHINE\Drivers\Builtin\SDBusDriver]
   "Order"=dword:20
   "Dll"="SDBusDriver.dll"
   "Entry"="SDBusDriverStartUp"

[HKEY_LOCAL_MACHINE\Drivers\SDCARD\SDBusDriver]
   "Order"=dword:20
   "Dll"="SDBusDriver.dll"
   "Prefix"="SDC"
   "ThreadPriority"=dword:64     ; default thread priority for dispatch thread
   "RequestListDepth"=dword:30   ; pre-allocated requests
   ;"ZoneMask"=dword:e01d        ; example zone mask

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]
    "Name"="SD Memory Card"
    "Folder"="Storage Card"
;    "PartitionDriver"=""          ; removable storage cannot have partitions

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MMC]
    "Name"="MMC Card"
    "Folder"="Storage Card"
;    "PartitionDriver"=""          ; removable storage cannot have partitions

    ; SD Memory Storage class driver
[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\SDMemory_Class]
   "Dll"="SDMemory.dll"
   "Prefix"="DSK"
   "FSD"="FATFS.DLL"
   "IOCTL"=dword:4             ; DISK_IOCTL_INITIALIZE, sent to driver by DeviceManager
   "BlockTransferSize"=dword:40 ; Send no more than 64 blocks of data per bus transfer
   ;"SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access

   "Profile"="SDMemory"
   "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",  
                     "{A32942B7-920C-486b-B0E6-92A702A99B35}" 
  
    ; MMC Storage Class Driver
[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\MMC_Class]
   "Dll"="SDMemory.dll"
   "Prefix"="DSK" 
   "FSD"="FATFS.DLL"
   "IOCTL"=dword:4             ; DISK_IOCTL_INITIALIZE, sent to driver by DeviceManager
   "BlockTransferSize"=dword:40 ; Send no more than 64 blocks of data per bus transfer
   ;"SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access

   "Profile"="MMC"
  "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",
                    "{A32942B7-920C-486b-B0E6-92A702A99B35}"


   ; setting for SD bus driver to load driver
[HKEY_LOCAL_MACHINE\Drivers\SDCARD\HostControllers\SDSC]
   "Dll"="SDCSDCard.dll"
   "Prefix"="SDC"

5.系统启动后,SDBus.dll和SDHC_SC2410.dll能在注册表HKEY_LOCAL_MACHINE\Drivers\Active 看到.

6.调试.

一般先从底层开始,是否发生系统硬件中断,打印中断信息.

返回系统中断信息 :SYS_SDXXX

说明系统硬件是正常的 ,再开始调试其他部分.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13771794/viewspace-600752/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 初识javascript
请登录后发表评论 登录
全部评论

注册时间:2008-04-07

  • 博文量
    92
  • 访问量
    305863