SD Card Driver on wince4

来源:互联网 发布:反美颜软件作文 编辑:程序博客网 时间:2024/05/21 14:52
 

Client Driver

目前,WINCE5.0所支持的client driver如下:

l         SD Memory Class

l         SDIO Bluetooth Class - Type A

l         SDIO WiFi (vendor specific)

如果需要自己写client驱动的话可以参考D:/WINCE500/PUBLIC/COMMON/OAK/DRIVERS/SDCARD/SDCLIENTDRIVERS目录下的微软自带的SD client驱动来写。

example1: SD MEMORY DRIVER UNDER WINCE 5.0

Wince自带的SD存储卡client驱动,代码路径为:

D:/WINCE500/PUBLIC/COMMON/OAK/DRIVERS/SDCARD/SDCLIENTDRIVERS/SDMEMORY

一个SD存储卡在WINCE里的驱动架构如下图所示:
[图无法插入]

1注册表和启动

在注册表里告诉Storage Manager

[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"

   "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

   ;"IdleTimeout"=dword:7D0      ; 2000 milliseconds

   ;"IdlePowerState"=dword:2     ; 0 == D0, 1 == D1, etc.

   ;"DisablePowerManagement"=""  ; if value present, then disable (remove value to enable)

   "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"

   "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

   ;"IdleTimeout"=dword:7D0      ; milliseconds

   ;"IdlePowerState"=dword:2     ; 0 == D0, 1 == D1, etc.

   ;"DisablePowerManagement"=""  ; if value present, then disable (remove value to enable)

   "Profile"="MMC"

   "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}",

                     "{A32942B7-920C-486b-B0E6-92A702A99B35}"

2 SD命令和总线要求

将所有磁盘的操作转换成SD的命令和总线要求

NAME SDMEMORY.DLL

EXPORTS

DSK_Close=SMC_Close

DSK_Deinit=SMC_Deinit

DSK_Init=SMC_Init

DSK_IOControl=SMC_IOControl

DSK_Open=SMC_Open

DSK_PowerDown=SMC_PowerDown

DSK_PowerUp=SMC_PowerUp

DSK_Read=SMC_Read

DSK_Seek=SMC_Seek

DSK_Write=SMC_Write