【WinCE】SD card技术了解并WINCE下SDHC驱动开发(updated)
?
SD Card Driver on ADS Summary
了解SD card. 1
WinCE 5.0下SD Stack. 6
Bus Driver 7
Host Controller Driver 8
Client Driver 10
SD on MX31 ADS. 14
Secure Digital Host Controller 14
LP1070 Secure Digital I/O Wi-Fi Driver 17
SD on EVT. 19
附錄... 19
?
?
?
?
Author:Titan.Song
??????
Suumary:
?????? 簡(jiǎn)單介紹了一下SD卡的歷史和發(fā)展,同時(shí)結(jié)合MX31 ADS上的WINCE 下SDHC驅(qū)動(dòng)更深入的了解該硬件的一些行為特點(diǎn)。
?
了解SD card
SD是Secure Digital Card卡的簡(jiǎn)稱(chēng),直譯成漢語(yǔ)就是“安全數(shù)字卡”,是由日本松下公司、東芝公司和美國(guó)SANDISK公司共同開(kāi)發(fā)研制的全新的存儲(chǔ)卡產(chǎn)品。SD存儲(chǔ)卡是一個(gè)完全開(kāi)放的標(biāo)準(zhǔn)(系統(tǒng)),多用于MP3、數(shù)碼攝像機(jī)、數(shù)碼相機(jī)、電子圖書(shū)、AV器材等等,尤其是被廣泛應(yīng)用在超薄數(shù)碼相機(jī)上。SD卡在外形上同Multimedia Card卡保持一致,大小尺寸比MMC卡略厚,容量也大很多。并且兼容MMC卡接口規(guī)范。不由讓人們懷疑SD卡是MMC升級(jí)版。另外,SD卡為9引腳,目的是通過(guò)把傳輸方式由串行變成并行,以提高傳輸速度。它的讀寫(xiě)速度比MMC卡要快一些,同時(shí),安全性也更高。SD卡最大的特點(diǎn)就是通過(guò)加密功能,可以保證數(shù)據(jù)資料的安全保密。它還具備版權(quán)保護(hù)技術(shù),所采用的版權(quán)保護(hù)技術(shù)是DVD中使用的CPRM技術(shù)(可刻錄介質(zhì)內(nèi)容保護(hù))。
?
規(guī)格
主要特點(diǎn):
1.精巧而且超薄
SD記憶卡的尺寸只有24毫米x 32毫米 x 2.1毫米。作為“橋梁媒體”的重要特征,它精致小巧,方便您在不同設(shè)備上使用。兼容SD記憶卡的設(shè)備可以采用解碼器軟件來(lái)播放音樂(lè)、影像短片以及更多其他類(lèi)型的內(nèi)容,無(wú)需像CD播放機(jī)或DVD播放機(jī)那樣采用驅(qū)動(dòng)裝置。從而使設(shè)備的外形更加精巧,同時(shí)也賦予了產(chǎn)品設(shè)計(jì)者發(fā)揮自由創(chuàng)意的全新空間。由于消除了播放音樂(lè)時(shí)的跳音現(xiàn)象,提高了播放的穩(wěn)定性。
2.大容量栽體
目前,SD記憶卡已經(jīng)具備各種容量可供選擇,同時(shí),2GB、4GB和8GB的SDHC也出現(xiàn)了。
3.高速數(shù)據(jù)傳輸
為了提供快速響應(yīng)和容易處理數(shù)字內(nèi)容,SD記憶卡可以用每秒10MB的速率寫(xiě)入和讀取數(shù)據(jù)。當(dāng)其能夠用于遠(yuǎn)程通信終端,直接下載內(nèi)容時(shí),記憶卡的高速傳送能力將可使存取時(shí)間和通信成本降至最低,同時(shí)可減輕網(wǎng)絡(luò)壓力。
4.擁有版權(quán)保護(hù)功能
先進(jìn)的數(shù)碼技術(shù)使高保真音樂(lè)和其他高質(zhì)量?jī)?nèi)容的錄制成為現(xiàn)實(shí)。日新月異的數(shù)碼技術(shù),借助因特網(wǎng),實(shí)現(xiàn)了全球范圍的信息快速共享。這一進(jìn)步也帶來(lái)了對(duì)原版內(nèi)容的大量復(fù)制,因此,作為21世紀(jì)的一種切實(shí)可行的記憶載體就必須具備高水平的版權(quán)保護(hù)技術(shù),這樣才能保護(hù)大量高質(zhì)的數(shù)碼數(shù)據(jù)。SD記憶卡可以自由復(fù)制各種數(shù)碼數(shù)據(jù),并采用獨(dú)特的內(nèi)置CPRM技術(shù)保存和轉(zhuǎn)移版權(quán)所有的內(nèi)容,這也是建立一個(gè)全新的音樂(lè)及其他商業(yè)媒體的發(fā)布體系的關(guān)鍵所在。
?
硬件結(jié)構(gòu)
?
(參看附錄中SD卡和其他卡的一個(gè)對(duì)比表)
?
SDIO卡
SDIO(輸入/輸出)卡是一種擴(kuò)展帶SD卡插孔設(shè)備之功能的接口。正在開(kāi)發(fā)各種SDIO卡,如相機(jī)、Bluetooth 、GPS和802.11b等。
如果編寫(xiě)以上設(shè)備的驅(qū)動(dòng),當(dāng)然前提是有一個(gè)合格的SD Host Controller。如同編寫(xiě)USB STORAGE/HID設(shè)備的驅(qū)動(dòng)一樣,需要USB HCD支持。MX31的ADS支持基于SDIO的LP1070 SDIO WLAN Card(在Wince 5.0的SD卡驅(qū)動(dòng)模型里,這種驅(qū)動(dòng)稱(chēng)為client driver)。
?
SD_SDIO_SPEC.PDF
SDIO features
l???????? Targeted for portable and stationary applications
l???????? Minimal or no modification to SD Physical bus is required
l???????? Minimal change to memory driver software
l???????? Extended physical form factor available for specialized applications
l???????? Plug and play (PnP) support
l???????? Multi-function support including multiple I/O and combined I/O and memory
l???????? Up to 7 I/O functions plus one memory supported on one card.
l???????? Allows card to interrupt host
l???????? Initialization Voltage: 2.0 to 3.6V
l???????? Operational Voltage range: 3.1 to 3.5V
?
?
?
?
??
?
WinCE 5.0下SD Stack
?????? 一共可以分為3個(gè)部分:a bus driver, host controller driver 和 client drivers,現(xiàn)分別介紹:
1 Bus Driver
?????? 顧名思義,總線,連接client driver和host controller driver之間的一個(gè)管理層。這部分代碼微軟已經(jīng)寫(xiě)好了,也就是說(shuō)定義好了client和host之間的通訊接口。(是不是可以這么說(shuō):編寫(xiě)SD WIFI的程序員可以不用知道是什么SDHC,從而達(dá)到驅(qū)動(dòng)的跨硬件性)
參考代碼:
D:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDBUSDRIVER\
?
2 Host Controller
?????? 控制硬件并且通過(guò)上述的BUS driver來(lái)和client進(jìn)行通訊。
參考代碼:
D:\WINCE500\PLATFORM\Mx31\Src\Drivers\Sdhc
D:\WINCE500\PUBLIC\COMMON\OAK\CSP\ARM\FREESCALE\Mxarm11\Drivers\Sdhc
?
3 Client Driver
?????? 通過(guò)BUS driver和SD設(shè)備進(jìn)行通訊。
?
Windows CE 5.0中的SDIO支持如下:
l???????? 動(dòng)態(tài)插入和拔出
l???????? DMA方式 (平臺(tái)相關(guān))
l???????? SDIO 中斷
l???????? 動(dòng)態(tài)的時(shí)鐘控制
l???????? 錯(cuò)誤恢復(fù)
l???????? 喚醒
l???????? v1.0 多功能和組合設(shè)備
l???????? CE Power Manager來(lái)處理電源管理
l???????? MMC
?
下圖可以清晰的表達(dá)基于WINCE5.0的一個(gè)SD STACK模型:
?
?
| 安全性 SDA 中的SD Memory specification 有種機(jī)制可以在特定機(jī)器上鎖定卡里面的內(nèi)容。WINCE 5里并沒(méi)有顯示的支持該機(jī)制。但是可以自己來(lái)做,比如一個(gè)文件系統(tǒng)的FILTER等。 |
?
Bus Driver
主要功能如下:
l???????? 枚舉板上的卡,并決定他們的類(lèi)型(MMC, SD Memory or SDIO)
l???????? 配置合適的電流給卡。
l???????? 根據(jù)注冊(cè)表的值加載clients
l???????? 把總線要求入隊(duì)列
l???????? 把來(lái)自host controller的異步通知入隊(duì)列
l???????? 總線要求完成,SDIO 中斷,設(shè)備插入\拔出
l???????? 出錯(cuò)時(shí)重試
?
參考代碼:
D:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDBUSDRIVER
| 貌似此部分代碼非微軟原創(chuàng): // Copyright (c) 2002 BSQUARE Corporation.? All rights reserved. // DO NOT REMOVE --- BEGIN EXTERNALLY DEVELOPED SOURCE CODE ID 40973--- DO NOT REMOVE |
?
Host Controller Driver
主要功能:
l???????? HCD通知總線驅(qū)動(dòng)卡的插入和拔出
l???????? 給卡上電,SD定義了可接受的初時(shí)電壓范圍。
l???????? 在總線驅(qū)動(dòng)何客戶(hù)端設(shè)置完時(shí)鐘速度后,打開(kāi)客戶(hù)端卡的時(shí)鐘(80個(gè)周期)
l???????? 初始,把總線寬度設(shè)置成1。如果有需要的話(huà)(4-bit mode),把總線寬度設(shè)成4bit
l???????? 傳輸SD 命令和數(shù)據(jù)到/來(lái)自卡上。
l???????? 負(fù)責(zé)給槽上電,關(guān)電。
l???????? IST 在這里存在
l???????? (可選的)喚醒支持(插入,拔出,SDIO中斷)
?
初始化
1.???????? 調(diào)用HCD’s XXX_Init
2.???????? 調(diào)用 SDHCDAllocateContext() 來(lái)分配一段HC的上下文
a)???????? Context 是總線驅(qū)動(dòng)和HCD共享的
3.???????? HCD 使用SDHCDSetXxx宏來(lái)填充這個(gè)上下文結(jié)構(gòu)
a)???????? 這個(gè)步驟是把HC向總線驅(qū)動(dòng)描述一下
b)??????? 包括函數(shù)指針,支持的電流,最大時(shí)鐘,槽數(shù)目,SDIO的支持等等。
4.???????? 調(diào)用 SDHCDRegisterHostController() 來(lái)把自己向總線驅(qū)動(dòng)注冊(cè)一下
5.???????? 當(dāng)總線驅(qū)動(dòng)準(zhǔn)備處理SD事件時(shí),它會(huì)調(diào)用 HCD的init 函數(shù)(pContext->pInitHandler) (見(jiàn)SDHCDRegisterHostController__X函數(shù))
6.???????? 在初始化里,HCD還應(yīng)該完成硬件和資源的初始化(IST等)
?
下面代碼抄自MX31 BSP中SDHC驅(qū)動(dòng)的SDH_Init函數(shù)中:
| DWORD SDH_Init(DWORD dwContext) { // allocate the context ?status = SDHCDAllocateContext(SDH_SLOTS,? &pHostContext); 。。。。。。 ??? //Set a unique name for each host controller ??? if (pController->ControllerIndex == 1) ??? { ??????? SDHCDSetHCName(pHostContext, TEXT("MXARM11_1")); ??? } ??? else ??? { ??????? SDHCDSetHCName(pHostContext, TEXT("MXARM11_2")); ??? } // set init handler ??? SDHCDSetControllerInitHandler(pHostContext,SDInitialize);? ??? // set deinit handler??? ??? SDHCDSetControllerDeinitHandler(pHostContext, SDDeinitialize); ??? // set the bus request handler ??? SDHCDSetBusRequestHandler(pHostContext,SDHBusRequestHandler);?? ??? // set the cancel I/O handler ??? SDHCDSetCancelIOHandler(pHostContext, SDHCancelIoHandler);?? ??? // set the slot option handler ??? SDHCDSetSlotOptionHandler(pHostContext, SDHSlotOptionHandler); ??? // now register the host controller ??? status = SDHCDRegisterHostController(pHostContext); |
?
Slot Option Handler
l???????? 總線驅(qū)動(dòng)調(diào)用HCD的 SlotOptionHandler :
n???????? SDHCDSetSlotPower –設(shè)置電壓
n???????? SDHCDSetSlotInterface – 設(shè)置時(shí)鐘和總線寬度
n???????? SDHCDEnableSDIOInterrupts
n???????? SDHCDAckSDIOInterrupt
n???????? SDHCDDisableSDIOInterrupts
l???????? SDHCDGetWriteProtectStatus – HCD 必須查看SD存儲(chǔ)卡是否開(kāi)啟寫(xiě)保護(hù)
l???????? SDHCDQueryBlockCapability – 返回HCD的最大和最小塊長(zhǎng)度
?
總線要求
l???????? 總線驅(qū)動(dòng)把總線要求放入隊(duì)列然后把它們傳入HCD的 BusRequestHandler 函數(shù)
l???????? HCD根據(jù)要求來(lái)做相應(yīng)的動(dòng)作—command/read/write, multi-block, 等.
l???????? HCD 使用某種方式(DMA, PIO, busy-waiting等)來(lái)發(fā)送命令和數(shù)據(jù)
l???????? HCD 調(diào)用SDHCDIndicateBusRequestComplete() 來(lái)通知總線驅(qū)動(dòng)完成
l???????? 總線驅(qū)動(dòng)把完成事件入隊(duì)列并提交下一個(gè)要求給HCD
l???????? 總線驅(qū)動(dòng)的調(diào)度線程將會(huì)通知產(chǎn)生要求的起始源事件完成了。
?
標(biāo)準(zhǔn)的WINCE SDHC驅(qū)動(dòng)支持
l???????? Standard Host Controller v1.0
n???????? Tokyo Electron Devices – Ellen
n???????? Toshiba - Pegasus
n???????? TI PCI 7x21
n???????? Ricoh R5C811 and R5C841
l???????? Non-standard hosts
n???????? Intel PXA-27x SOC (Mainstone II)
n???????? Samsung SMDK-2410
n???????? Freescale MX series
| 關(guān)于Standard Host Controller SDA Host Working Group (MSFT executive member) Defined Standard Host Register Specification to standardize the hardware interface from bus to controller Currently ratified to v1.0 by SDA executive committee MSFT strongly advocating this standard to all IHVs, ODMs, OEMs and Silicons |
?
中斷
l???????? HCD包括IST
l???????? IST 決定哪個(gè)槽中斷
l???????? IST evaluates interrupt
比如現(xiàn)在拔出SD卡
IST 會(huì)調(diào)用Bus Driver’s SDHCIndicateSlotStateChange() with DeviceEjected parameter
l???????? Bus Driver calls client’s SlotEventCallBack routine with SDCardEjected.? (Provides async notification about changes in the slot state.)
l???????? Client performs its deinitialization
?
| 如何讓鏡像支持SD STACK SYSGEN_SDBUS – SD bus driver (sdbus.dll) SYSGEN_SDHC_STANDARD – Standard host controller (sdhc.dll) SYSGEN_SD_MEMORY – SD Memory client (sdmemory.dll) SYSGEN_BTH or SYSGEN_BTH_SDIO_ONLY – SDIO Bluetooth client (bthsdio.dll) BSP variables will be added for CSP-specific host controllers |
?
Client Driver
目前,WINCE5.0所支持的client driver如下:
l???????? SD Memory Class
l???????? SDIO Bluetooth Class - Type A
l???????? SDIO WiFi (vendor specific)
如果需要自己寫(xiě)client驅(qū)動(dòng)的話(huà)可以參考D:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDCLIENTDRIVERS目錄下的微軟自帶的SD client驅(qū)動(dòng)來(lái)寫(xiě)。
?
【example1: SD MEMORY DRIVER UNDER WINCE 5.0】
Wince自帶的SD存儲(chǔ)卡client驅(qū)動(dòng),代碼路徑為:
D:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDCLIENTDRIVERS\SDMEMORY
?
一個(gè)SD存儲(chǔ)卡在WINCE里的驅(qū)動(dòng)架構(gòu)如下圖所示:
[圖無(wú)法插入]
?
?
1注冊(cè)表和啟動(dòng)
在注冊(cè)表里告訴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命令和總線要求
將所有磁盤(pán)的操作轉(zhuǎn)換成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 |
下面為具體的DISK I/O操作函數(shù)和CARD I/O操作函數(shù),詳細(xì)實(shí)現(xiàn)見(jiàn)sdmemdiskio.cpp和sdmemcardio.cpp:
| // // SDDiskIO // //? SDMemCardConfig??? - Initialise the memcard structure and card itself DWORD SDMemCardConfig( PSD_MEMCARD_INFO pMemCard ); ? ??? //? SDMemRead??????? ??- Read data from card into pSG scatter gather buffers DWORD SDMemRead( PSD_MEMCARD_INFO pMemCard, PSG_REQ pSG ); ? ??? //? SDMemWrite???????? - Write data to card from pSG scatter gather buffers DWORD SDMemWrite( PSD_MEMCARD_INFO pMemCard, PSG_REQ pSG ); ? ??? //? SDMemErase???????? - Erase a contiguous set of blocks DWORD SDMemErase( PSD_MEMCARD_INFO pMemCard, PDELETE_SECTOR_INFO pDSI ); ? ??? //? SDMemEraseAll????? - Erase all blocks DWORD SDMemEraseAll( PSD_MEMCARD_INFO pMemCard ); ? // // SDCardIO // ? ?? ?//? SDMemDoBusRequest? - Perform a bus request, returns Windows Status DWORD SDMemDoBusRequest( PSD_MEMCARD_INFO? pMemcard, ???????????????????????? UCHAR???????????? Command, ???????????????????????? DWORD???????????? Argument, ???????????????????????? SD_TRANSFER_CLASS TransferClass, ???????????????????????? SD_RESPONSE_TYPE? ResponseType, ???????????????????????? ULONG???????????? NumBlocks, ???????????????????????? ULONG???????????? BlockSize, ???????????????????????? PUCHAR??????????? pBuffer, ?????? ??????????????????DWORD???????????? Flags); ? ??? //? SDMemSetBlockLen?? - Sets read/write block length for SD memory card DWORD SDMemSetBlockLen( PSD_MEMCARD_INFO pMemcard, ??????????????????????? DWORD??????????? BlockLen ); ? ??? //? SDMemReadMultiple? - Read multiple 512 byte blocks of data from card DWORD SDMemReadMultiple( PSD_MEMCARD_INFO pHandle, ???????????????????????? ULONG??????????? StartBlock, ???????????????????????? ULONG??????????? NumBlocks, ???????????????????????? PUCHAR?????????? pBuffer ); ? ??? //? SDMemWriteMultiple - Write multiple 512 byte blocks of data to card DWORD SDMemWriteMultiple( PSD_MEMCARD_INFO pHandle, ????????????????????????? LONG???????????? StartBlock, ????????????????????????? LONG???????????? NumBlocks, ????????????? ????????????PUCHAR?????????? pBuffer ); ? ??? //? SDMemWriteUsingSingleBlocks - Write using single block writes DWORD SDMemWriteUsingSingleBlocks( PSD_MEMCARD_INFO pHandle, ?????????????????????????????????? LONG???????????? StartBlock, ??????????????????? ???????????????LONG???????????? NumBlocks, ?????????????????????????????????? PUCHAR?????????? pBuffer ); ? ??? //? SDMemDoErase - Erase a contiguous set of blocks DWORD SDMemDoErase( PSD_MEMCARD_INFO pHandle, ??????????????????? LONG???????????? StartBlock, ??????????????????? LONG???????????? NumBlocks ); ? DWORD SDAPIStatusToErrorCode( SD_API_STATUS Status ); ? DWORD SDGetCardStatus(PSD_MEMCARD_INFO pMemCard , SD_CARD_STATUS *pCardStatus); ? VOID HandleIoctlPowerSet(PSD_MEMCARD_INFO?????? pMemCard, ??????? ?????????????????PCEDEVICE_POWER_STATE? pDevicePowerState); VOID InitializePowerManagement(PSD_MEMCARD_INFO pMemCard); VOID DeinitializePowerManagement(PSD_MEMCARD_INFO pMemCard); SD_API_STATUS IssueCardSelectDeSelect(PSD_MEMCARD_INFO pMemCard, BOOL Select); VOID RequestEnd(PSD_MEMCARD_INFO pMemCard); ? SD_API_STATUS RequestPrologue(PSD_MEMCARD_INFO pMemCard, DWORD DeviceIoControl); |
?
?
?
SD on MX31 ADS
Secure Digital Host Controller
The Secure Digital Host Controller (SDHC) 模塊支持MMC,SD和Secure Digital I/O and Combo Cards (SDIO)三種。MX31一共有2個(gè)SDHC硬件模塊。一個(gè)host controller 只支持連接上的一個(gè)卡。
| SDHC.DLL由以下源代碼組成 『―――― 微軟代碼 ? ??c:\macallan\private\winceos\coreos\ceosutil\utiltree.cxx ??? c:\macallan\public\common\sdk\inc\svsutil.hxx ??? c:\macallan\private\winceos\coreos\ceosutil\utilmemf.cxx ??? c:\macallan\public\common\sdk\inc\svsutil.hxx ??? c:\macallan\private\winceos\coreos\ceosutil\utilmem.cxx ??? c:\macallan\private\winceos\coreos\ceosutil\svsutil.cxx ??? c:\macallan\public\common\oak\drivers\sdcard\sdcardlib\sdcardapistubs.cpp ??? c:\macallan\public\common\oak\drivers\sdcard\sdcardlib\sddebug.cpp ??? c:\macallan\public\common\oak\drivers\sdcard\sdcardlib\sdmemapi.cpp ??? c:\macallan\public\common\oak\inc\block_allocator.hxx c:\macallan\public\common\oak\drivers\sdcard\sdhclib\sdhclib.cpp ―――――』 d:\wince500\platform\mx31\src\drivers\sdhc\bspsdhc.c ??? d:\wince500\public\common\oak\csp\arm\freescale\mxarm11\drivers\sdhc\main.cpp ??? d:\wince500\public\common\oak\csp\arm\freescale\mxarm11\drivers\sdhc\sdcontrol.cpp d:\wince500\public\common\sdk\inc\kfuncs.h
|
?
?
SDHC的注冊(cè)表設(shè)置
| #if (defined BSP_SDHC1 || defined BSP_SDHC2) [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\SDMemory_Class] "BlockTransferSize"=dword:100 ; Overwrite from default 64 blocks. ; "SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\MMC_Class] "BlockTransferSize"=dword:100 ; Overwrite from default 64 blocks. ; "SingleBlockWrites"=dword:1 ; alternatively force the driver to use single block access [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MMC] "Name"="MMC Card" "Folder"="MMC" [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory] "Name"="SD Memory Card" "Folder"="SD Memory" #endif IF BSP_SDHC1 [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SDHC_ARM11_1] "Order"=dword:21 "Dll"="sdhc.dll" "Prefix"="SDH" "ControllerISTPriority"=dword:64 "Index"=dword:1 ENDIF ;BSP_SDHC1 IF BSP_SDHC2 [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SDHC_ARM11_2] "Order"=dword:21 "Dll"="sdhc.dll" "Prefix"="SDH" "ControllerISTPriority"=dword:64 "Index"=dword:2 ENDIF ;BSP_SDHC |
?
SDHC和DMA
| SDHC驅(qū)動(dòng)支持DMA 和非DMA 2種數(shù)據(jù)傳輸模式,默認(rèn)是DMA。For every request submitted to it, the driver attempts to build a DMA Scatter Gather Buffer Descriptor list for the buffer passed to it by the upper layer. For cases where this list cannot be built, the driver falls back to the non-DMA mode of transfer. The default configuration is maintained in the file bsp_cfg.h using the parameters BSP_SDMA_SUPPORT_SDHC1 and BSP_SDMA_SUPPORT_SDHC2. A value of TRUE means DMA is the default mode, and for cases where DMA cannot be used, the driver falls back to a non-DMA mode. A value of FALSE means non-DMA mode is the default and DMA mode will not be attempted. For the driver to attempt to build the Scatter Gather DMA Buffer Descriptors, the upper layer should ensure that the buffer meets the following criteria. ? Start of the buffer should be a word aligned address. ? Number of bytes to transfer should be word aligned. Due to cache coherency issues arising due to processor and SDMA access of the memory, the above criteria is further stringent for the read or receive operation (it is not applicable for write or transmit): ? Start of the buffer should be a cache line size (32 bytes) aligned address. ? Number of bytes to transfer should be cache line size (32 bytes) aligned. |
?
電源管理
| The primary methods for limiting power in SDHC module is to gate off all clocks to the controllers and to cut off power to the card slot when no cards are inserted. When a card is inserted to any of the slots, that slot alone is powered and the clocks to that controller alone are gated on. While using memory cards, the clock to the host controller and the clock to memory cards are gated off when ever the controller is idle. For SDIO cards, both the clocks stay on all the time. SDHC driver supports the full power on and full power off states. In full power off state, the clocks to the controllers and the power to the inserted cards are turned off. When powered on, all cards inserted before and after the power down will be detected and mounted. PowerUp This function is implemented to support resuming a memory card operation that was previously terminated by calling PowerDown() API. Power to the card is restored, clocks to the pertaining controller is restarted. SDHC driver is notified of a device status change. This results in signaling the SD bus driver of a card removal followed by a card insertion. The card is re-initialized and is mounted so that the all operations scheduled during a power down resumes. SDIO cards will be initialized on resume. The details of this architecture and its operation can be found in the Platform Builder Help under the heading “Power On and Off Notifications for Secure Digital Card Drivers”, or in the online Microsoft documentation at the following URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceddk5/html/wce50conpoweronoffnot ificationsforsecuredigitalcarddrivers.asp Note that this function is intended to be called only by the Power Manager. PowerDown This function has been implemented to support suspending all currently active SD operations just before the entire system enters the low power state. Note that this function is intended to be called only by the Power Manager. This function gates off all clocks to the controllers and powers down all the card slots. |
?
LP1070 Secure Digital I/O Wi-Fi Driver
SDIO Wi-Fi 驅(qū)動(dòng)是通過(guò)Freescale LP1070 SDIO Wi-Fi 卡來(lái)連接到一個(gè)IEEE 802.11b/g 無(wú)限局域網(wǎng)(WLAN) 。驅(qū)動(dòng)支持以54 Mbps的速率和WLAN通訊。
| 注意: The LP1070 SDIO Wi-Fi driver is an NDIS 5.0 compliant miniport driver. LP1070 SDIO Wi-Fi card needs a 3.1~3.3V power supply from on-board Secure Digital Slot. |
?
| [HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Custom\MANF-0325-CARDID-0217-FUNC-1] "Instance0"="FSL1070NdisSD:FSL1070NdisSD1" "Prefix"="NDL" "Dll"="FSL1070NdisSD.dll" [HKEY_LOCAL_MACHINE\Comm\FSL1070NdisSD] "ImagePath"="FSL1070NdisSD.dll" "Group"="NDIS" "DisplayName"="WaveBlaster 802.11 SDIO Adapter" [HKEY_LOCAL_MACHINE\Comm\FSL1070NdisSD\Linkage] "Route"=hex(7):\ 46,53,4c,31,30,37,30,4e,64,69,73,53,44,31,00,00,00,00 [HKEY_LOCAL_MACHINE\Comm\FSL1070NdisSD1] "ImagePath"="FSL1070NdisSD.dll" "Group"="NDIS" "DisplayName"="WaveBlaster 802.11 SDIO Adapter" [HKEY_LOCAL_MACHINE\Comm\FSL1070NdisSD1\Parms] "SDIOMaxClockFreq"=dword:017d7840 "SDIOMaxByteNumber"=dword:000003e8 "SDIOMaxBlockNumber"=dword:000003e8 "SDIOBlockSize"=dword:00000040 "SDIOSupportBlockMode"=dword:00000001 "SDIOSupport4BitMode"=dword:00000001 "BluetoothCoexCapability"=dword:00000000 "CcxCapability"=dword:00000000 "RadioMeasurementCapability"=dword:00000000 "MultiDomainCapability"=dword:00000000 "RoamRssiHysteresis80211bg"=dword:0000000a "RoamRssiThreshold80211bg"=dword:ffffff9d "ListenInterval"=dword:00000000 "BufferConfig"=dword:00000000 "DbgMaxFileSize"=dword:00019000 "WMMEnabled"=dword:00000000 "ResetEnable"=dword:00000001 "UWASensitivityLockout"=dword:00000000 "ShortPreamble"=dword:00000001 "RTSCTSThreshold"=dword:0000092b\ "FragmentThreshold"=dword:0000092a "DefaultKey3"="0x0000000000" "DefaultKey2"="0x0000000000" "DefaultKey1"="0x0000000000" "DefaultKey0"="0x0000000000" "LongKeys"=dword:00000000 "Auth"=dword:00000000 "WEP"=dword:00000000 "PowerSaving"=dword:00000000 "RateSelect"=dword:00000000 "MACID"="0x000000000000" "IbssChannel"=dword:00000000 "Ibss54g"=dword:00000000 "RestrictedChannel"=dword:00000000 "BSSID"="0x000000000000" "Manual"=dword:00000000 "ESSID"="" "Domain"=dword:00000010 "ProtocolType"=dword:00000003 "NetworkType"=dword:00000000 "STAuwa"="uwa_airoha.bin" "STAupper"="mac_airoha_STA.bin" "NetworkAddress"="" "BusType"=dword:00000000 "BusNumber"=dword:00000000 [HKEY_LOCAL_MACHINE\Comm\FSL1070NdisSD1\Parms\Tcpip] "Subnetmask"=hex(7):\ 32,35,35,2e,32,35,35,2e,32,35,35,2e,30,00,00,00,00 "IpAddress"=hex(7):\ 30,2e,30,2e,30,2e,30,00,00,00,00 "UseZeroBroadcast"=dword:00000000 "EnableDHCP"=dword:00000001 |
?
SD on EVT
目前在EVT板上,對(duì)于SD的代碼更改如下:
| 1???????? ***************************************** 2???????? *********************************************** |
?
附錄
SD卡與其他卡的對(duì)比
?
?
?
SDHC
?
| Compatibility |
| ?
* SDHC Host Products can use both SD and SDHC Memory Cards. |
| Capacity (4GB SDHC Memory Card)
|
?
常用網(wǎng)站:
http://www.sdcard.com/
http://www.sdcard.org/
?
posted on 2007-02-11 10:09 Titan 閱讀(17472) 評(píng)論(29) ?編輯 收藏 網(wǎng)摘 所屬分類(lèi): Windows CE
評(píng)論
I think high Capacilty SD is not supported in MS code library....You need to modify code. 2007-03-29 15:03 |? ????????
哥們兒太專(zhuān)業(yè)了!我想問(wèn)一下那里有SD WiFi 在Windows XP下的驅(qū)動(dòng)。請(qǐng)賜教!多謝!急!!! 2007-04-17 00:09 |
? ????????
太牛比了,我要常來(lái) 2007-05-04 19:26 |? ????????
非常感謝你的發(fā)表!我正好發(fā)愁要怎樣寫(xiě)一個(gè)CLIENT DRIVER用在mx31上, 你的發(fā)表讓我了解許多。 2007-08-01 14:34 |? ????????
有一個(gè)請(qǐng)求。我的imx31ADS bsp 里沒(méi)有LP1070 Secure Digital I/O Wi-Fi Driver, 可不可以發(fā)給我呢?2007-08-01 18:35 |
? ????????
WinCE5下SDIO接口的性能比較差,WinCE6(Mobile5)里對(duì)bus層和SDHC作了些改進(jìn),增加了fast-path機(jī)制,性能有所改進(jìn)。不過(guò)像WLAN設(shè)備最好還是用monolithic的SDIO driver,優(yōu)點(diǎn)是吞吐率有很大提高,缺點(diǎn)是移植起來(lái)比較麻煩。博主是做memory卡的還是做WiFi設(shè)備的,以后多交流啊 2007-08-02 16:33 |
? ????????
你有msn嗎,可否一起探討一下sd card drvier 2007-08-14 22:41 |? ????????
謝謝您。您的文章讓我受益匪淺,我前些天買(mǎi)了一個(gè)4G的SDHC卡,結(jié)果不能和我的機(jī)器兼容(Acer N300 BW,WM5.0系統(tǒng),S3C2410的CPU),想看看能不能自己驅(qū)動(dòng)。 2007-08-22 00:37 |? ????????
謝謝 2007-10-22 21:30 |? ????????
I am going to develop a product based on SDHC card(both hardware and software,embeded). Will you please e-mail a copy of SDHC specification to raysys@126.com? Thanks a lot. 2007-10-23 22:23 |? ????????
我現(xiàn)在的系統(tǒng)為ARM9+CE50,支持SD接口,以支持SD卡的讀寫(xiě)。我希望能找到提供CE driver的SD WLAN卡,若有相關(guān)信息,請(qǐng)通知我x10@emtronix.com.cn。謝謝! 2007-12-05 18:12 |? ????????
我有問(wèn)題請(qǐng)教,我現(xiàn)在使用的S3C3445單片機(jī),想使用wince自帶的SD卡驅(qū)動(dòng),修改后使用。我的硬件接口和寄存器配置應(yīng)該在哪里添加上去,我沒(méi)有找到相應(yīng)的文件,麻煩您能給我一些幫助 2007-12-17 14:26 |? ????????
我有問(wèn)題要請(qǐng)教 請(qǐng)問(wèn)買(mǎi)數(shù)碼相機(jī)帶內(nèi)存卡嗎? 2008-01-18 12:15 |? ????????
不錯(cuò) 2008-01-23 16:45 |? ????????
有個(gè)問(wèn)題想問(wèn):我目前使用的是PXA270的板子
之前我在改注冊(cè)表中關(guān)于SD的ORDER的數(shù)值時(shí)候發(fā)現(xiàn)
當(dāng)ORDER的數(shù)值改為小于15的時(shí)候,系統(tǒng)啟動(dòng)后找不到SD的圖標(biāo)(感覺(jué)像是沒(méi)有被加載)但是當(dāng)將ORDER的數(shù)值改為大于15時(shí)候就ok。(DMA的ORDER的數(shù)值是為5)
希望樓主不惜賜教
謝謝 2008-01-23 16:50 |
? ????????
今天又來(lái)看,收獲不小,謝謝樓主 2008-02-04 14:21 |? ????????
continuous up! 2008-03-01 21:56 |? ????????
博主,你還真專(zhuān)業(yè),頂你,網(wǎng)絡(luò)上多幾個(gè)想你這樣的人,我們就方便多了 2008-04-03 22:38 |? ????????
本人新買(mǎi)的東芝SDHC Memory Card 4GB,在電腦WIN XP未能顯示,是否要裝驅(qū)動(dòng)程式,請(qǐng)指教,多謝. 2008-04-14 00:45 |? ????????
我想知道怎么才能讀到SD HC的卡,因?yàn)槲椰F(xiàn)在的讀卡器沒(méi)有讀到呢 2008-05-12 13:27 |?[樓主] ??????????
@ALEX80SD 2.0的協(xié)議里通過(guò)CMD8這個(gè)命令是否有返回來(lái)決定當(dāng)前的SD設(shè)備是V2.0,即SDHC. 2008-05-12 14:16 | ?
? ??????????
很全面的介紹,不錯(cuò)~ 2008-05-16 12:35 | ?? ????????
我在作linux sdio, 你的wince 參考代碼發(fā)給我一份好嗎?謝謝!
sun.xueqin75@gmail.com
2008-08-18 21:35 |
? ????????
請(qǐng)求:各位DX能否提供一個(gè)裝在SD卡上,插入設(shè)備直接運(yùn)行即可實(shí)現(xiàn)支持大容量SD卡的程序嗎?原因:本人購(gòu)買(mǎi)的一個(gè)導(dǎo)航盒現(xiàn)在只能支持2G以下的SD卡,遠(yuǎn)遠(yuǎn)不能滿(mǎn)足我安裝多個(gè)導(dǎo)航軟件的需求,我希望能它能支持4G、8G的卡。
設(shè)備的參數(shù)是:主頻400MHZ,主芯片型號(hào)SANSUNG S3C2440A-40,操作系統(tǒng)WINCE5.0,軟件編譯類(lèi)型ARMV4I,內(nèi)存64MB,存儲(chǔ)卡SD卡。
聯(lián)系方式:antee@163.com
不勝感激!!!! 2008-11-02 12:37 |
? ????????
請(qǐng)問(wèn)在WM系統(tǒng)上的 設(shè)置-》系統(tǒng)-》關(guān)于 中 擴(kuò)展槽 的使用情況接口是在哪設(shè)置啊? 比如插入T卡就顯示,擴(kuò)展槽已使用,沒(méi)插入T卡就顯示擴(kuò)展槽未使用。謝謝! 2008-12-24 16:34 |?[樓主] ??????????
這個(gè)信息是通過(guò)一個(gè)注冊(cè)表值來(lái)設(shè)定的。你在文檔里搜SCKT.
Mobile的問(wèn)題不好公開(kāi)討論,如果有不理解請(qǐng)發(fā)到我郵箱:songtitan@msn.com 2008-12-24 16:39 | ?
? ????????
我現(xiàn)在也在開(kāi)發(fā)SDIO Client驅(qū)動(dòng),碰到了很多問(wèn)題,能否向各位請(qǐng)教一下,謝謝了。我在開(kāi)發(fā)時(shí),使用SDRegisterClient函數(shù)時(shí),總是返回錯(cuò)誤,各位碰到過(guò)這樣的問(wèn)題嗎?
還有能否在pocket pc 2003下開(kāi)發(fā)SDIO的Client驅(qū)動(dòng),看了很多的函數(shù)都說(shuō)是WINCE 5.0以后
才支持的,那么在2003下具有SD接口的POCKET PC如何開(kāi)發(fā)SD驅(qū)動(dòng)。
在這上面隔了很久了,那位能指點(diǎn)一下啊,謝謝了。
我的郵箱:siguoc@yahoo.com.cn qq:46236863 msn:siguoc@hotmail.com 希望能夠收到各位的回信,非常謝謝。 2009-01-09 01:09 |
? ????????
請(qǐng)求:各位DX能否提供一個(gè)裝在SD卡上,插入設(shè)備直接運(yùn)行即可實(shí)現(xiàn)支持大容量SD卡的程序嗎?原因:本人購(gòu)買(mǎi)的一個(gè)導(dǎo)航盒現(xiàn)在只能支持2G以下的SD卡,遠(yuǎn)遠(yuǎn)不能滿(mǎn)足我安裝多個(gè)導(dǎo)航軟件的需求,我希望能它能支持4G、8G的卡。
設(shè)備的參數(shù)是:主頻400MHZ,主芯片型號(hào)SANSUNG S3C2440A-40,操作系統(tǒng)WINCE5.0,軟件編譯類(lèi)型ARMV4I,內(nèi)存64MB,存儲(chǔ)卡SD卡。
聯(lián)系方式:nxycfb@126.com
不勝感激!!!! 2009-04-21 09:04 |
? ????????
求:各位DX能否提供一個(gè)裝在SD卡上,插入設(shè)備直接運(yùn)行即可實(shí)現(xiàn)支持大容量SD卡的程序嗎?原因:本人購(gòu)買(mǎi)的一個(gè)導(dǎo)航盒現(xiàn)在只能支持2G以下的SD卡,遠(yuǎn)遠(yuǎn)不能滿(mǎn)足我安裝多個(gè)導(dǎo)航軟件的需求,我希望能它能支持4G、8G的卡。
設(shè)備的參數(shù)是:主頻400MHZ,主芯片型號(hào)SANSUNG S3C2440A-40,操作系統(tǒng)WINCE5.0,軟件編譯類(lèi)型ARMV4I,內(nèi)存64MB,存儲(chǔ)卡SD卡。
聯(lián)系方式:nut3721@163.com
不勝感激!!!! 2009-05-05 00:44 | #1樓? ??回復(fù)??引用????
轉(zhuǎn)載于:https://www.cnblogs.com/gmh915/archive/2009/06/16/1945433.html
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專(zhuān)家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的【WinCE】SD card技术了解并WINCE下SDHC驱动开发(updated)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 早上起床很疲惫,没有精神,可能湿气已经找
- 下一篇: 为什么定投不怕买在高位 后期可以摊薄成