日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【WinCE】SD card技术了解并WINCE下SDHC驱动开发(updated)

發(fā)布時(shí)間:2025/5/22 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【WinCE】SD card技术了解并WINCE下SDHC驱动开发(updated) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

SD Card Driver on ADS Summary

了解SD card. 1

WinCE 5.0SD 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

?

?

?

?

AuthorTitan.Song

??????

Suumary:

?????? 簡單介紹了一下SD卡的歷史和發(fā)展,同時(shí)結(jié)合MX31 ADS上的WINCE SDHC驅(qū)動更深入的了解該硬件的一些行為特點(diǎn)。

?

了解SD card

SDSecure Digital Card卡的簡稱,直譯成漢語就是安全數(shù)字卡,是由日本松下公司、東芝公司和美國SANDISK公司共同開發(fā)研制的全新的存儲卡產(chǎn)品。SD存儲卡是一個(gè)完全開放的標(biāo)準(zhǔn)(系統(tǒng)),多用于MP3、數(shù)碼攝像機(jī)、數(shù)碼相機(jī)、電子圖書、AV器材等等,尤其是被廣泛應(yīng)用在超薄數(shù)碼相機(jī)上。SD卡在外形上同Multimedia Card卡保持一致,大小尺寸比MMC卡略厚,容量也大很多。并且兼容MMC卡接口規(guī)范。不由讓人們懷疑SD卡是MMC升級版。另外,SD卡為9引腳,目的是通過把傳輸方式由串行變成并行,以提高傳輸速度。它的讀寫速度比MMC卡要快一些,同時(shí),安全性也更高。SD卡最大的特點(diǎn)就是通過加密功能,可以保證數(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è)備可以采用解碼器軟件來播放音樂、影像短片以及更多其他類型的內(nèi)容,無需像CD播放機(jī)或DVD播放機(jī)那樣采用驅(qū)動裝置。從而使設(shè)備的外形更加精巧,同時(shí)也賦予了產(chǎn)品設(shè)計(jì)者發(fā)揮自由創(chuàng)意的全新空間。由于消除了播放音樂時(shí)的跳音現(xiàn)象,提高了播放的穩(wěn)定性。

2.大容量栽體

目前,SD記憶卡已經(jīng)具備各種容量可供選擇,同時(shí),2GB4GB8GBSDHC也出現(xiàn)了。

3.高速數(shù)據(jù)傳輸

為了提供快速響應(yīng)和容易處理數(shù)字內(nèi)容,SD記憶卡可以用每秒10MB的速率寫入和讀取數(shù)據(jù)。當(dāng)其能夠用于遠(yuǎn)程通信終端,直接下載內(nèi)容時(shí),記憶卡的高速傳送能力將可使存取時(shí)間和通信成本降至最低,同時(shí)可減輕網(wǎng)絡(luò)壓力。

4.擁有版權(quán)保護(hù)功能

先進(jìn)的數(shù)碼技術(shù)使高保真音樂和其他高質(zhì)量內(nèi)容的錄制成為現(xiàn)實(shí)。日新月異的數(shù)碼技術(shù),借助因特網(wǎng),實(shí)現(xiàn)了全球范圍的信息快速共享。這一進(jìn)步也帶來了對原版內(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è)全新的音樂及其他商業(yè)媒體的發(fā)布體系的關(guān)鍵所在。

?

硬件結(jié)構(gòu)

?


(參看附錄中
SD卡和其他卡的一個(gè)對比表)

?

SDIO

SDIO(輸入/輸出)卡是一種擴(kuò)展帶SD卡插孔設(shè)備之功能的接口。正在開發(fā)各種SDIO卡,如相機(jī)、Bluetooth GPS802.11b等。




如果編寫以上設(shè)備的驅(qū)動,當(dāng)然前提是有一個(gè)合格的SD Host Controller。如同編寫USB STORAGE/HID設(shè)備的驅(qū)動一樣,需要USB HCD支持。MX31ADS支持基于SDIOLP1070 SDIO WLAN Card(在Wince 5.0SD卡驅(qū)動模型里,這種驅(qū)動稱為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.0SD Stack

?????? 一共可以分為3個(gè)部分:a bus driver, host controller driver client drivers,現(xiàn)分別介紹:

1 Bus Driver

?????? 顧名思義,總線,連接client driverhost controller driver之間的一個(gè)管理層。這部分代碼微軟已經(jīng)寫好了,也就是說定義好了clienthost之間的通訊接口。(是不是可以這么說:編寫SD WIFI的程序員可以不用知道是什么SDHC,從而達(dá)到驅(qū)動的跨硬件性)

參考代碼:

D:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDBUSDRIVER\

?

2 Host Controller

?????? 控制硬件并且通過上述的BUS driver來和client進(jìn)行通訊。

參考代碼:

D:\WINCE500\PLATFORM\Mx31\Src\Drivers\Sdhc

D:\WINCE500\PUBLIC\COMMON\OAK\CSP\ARM\FREESCALE\Mxarm11\Drivers\Sdhc

?

3 Client Driver

?????? 通過BUS driverSD設(shè)備進(jìn)行通訊。

?

Windows CE 5.0中的SDIO支持如下:

l???????? 動態(tài)插入和拔出

l???????? DMA方式 (平臺相關(guān))

l???????? SDIO 中斷

l???????? 動態(tài)的時(shí)鐘控制

l???????? 錯(cuò)誤恢復(fù)

l???????? 喚醒

l???????? v1.0 多功能和組合設(shè)備

l???????? CE Power Manager來處理電源管理

l???????? MMC

?

下圖可以清晰的表達(dá)基于WINCE5.0的一個(gè)SD STACK模型:

?

?

安全性

SDA 中的SD Memory specification 有種機(jī)制可以在特定機(jī)器上鎖定卡里面的內(nèi)容。WINCE 5里并沒有顯示的支持該機(jī)制。但是可以自己來做,比如一個(gè)文件系統(tǒng)的FILTER等。

?

Bus Driver

主要功能如下:

l???????? 枚舉板上的卡,并決定他們的類型(MMC, SD Memory or SDIO

l???????? 配置合適的電流給卡。

l???????? 根據(jù)注冊表的值加載clients

l???????? 把總線要求入隊(duì)列

l???????? 把來自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ū)動卡的插入和拔出

l???????? 給卡上電,SD定義了可接受的初時(shí)電壓范圍。

l???????? 在總線驅(qū)動何客戶端設(shè)置完時(shí)鐘速度后,打開客戶端卡的時(shí)鐘(80個(gè)周期)

l???????? 初始,把總線寬度設(shè)置成1。如果有需要的話(4-bit mode),把總線寬度設(shè)成4bit

l???????? 傳輸SD 命令和數(shù)據(jù)到/來自卡上。

l???????? 負(fù)責(zé)給槽上電,關(guān)電。

l???????? IST 在這里存在

l???????? (可選的)喚醒支持(插入,拔出,SDIO中斷)

?

初始化

1.???????? 調(diào)用HCD’s XXX_Init

2.???????? 調(diào)用 SDHCDAllocateContext() 來分配一段HC的上下文

a)???????? Context 是總線驅(qū)動和HCD共享的

3.???????? HCD 使用SDHCDSetXxx宏來填充這個(gè)上下文結(jié)構(gòu)

a)???????? 這個(gè)步驟是把HC向總線驅(qū)動描述一下

b)??????? 包括函數(shù)指針,支持的電流,最大時(shí)鐘,槽數(shù)目,SDIO的支持等等。

4.???????? 調(diào)用 SDHCDRegisterHostController() 來把自己向總線驅(qū)動注冊一下

5.???????? 當(dāng)總線驅(qū)動準(zhǔn)備處理SD事件時(shí),它會調(diào)用 HCDinit 函數(shù)(pContext->pInitHandler) (見SDHCDRegisterHostController__X函數(shù))

6.???????? 在初始化里,HCD還應(yīng)該完成硬件和資源的初始化(IST等)

?

下面代碼抄自MX31 BSPSDHC驅(qū)動的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ū)動調(diào)用HCD SlotOptionHandler

n???????? SDHCDSetSlotPower設(shè)置電壓

n???????? SDHCDSetSlotInterface設(shè)置時(shí)鐘和總線寬度

n???????? SDHCDEnableSDIOInterrupts

n???????? SDHCDAckSDIOInterrupt

n???????? SDHCDDisableSDIOInterrupts

l???????? SDHCDGetWriteProtectStatus – HCD 必須查看SD存儲卡是否開啟寫保護(hù)

l???????? SDHCDQueryBlockCapability返回HCD的最大和最小塊長度

?

總線要求

l???????? 總線驅(qū)動把總線要求放入隊(duì)列然后把它們傳入HCD BusRequestHandler 函數(shù)

l???????? HCD根據(jù)要求來做相應(yīng)的動作—command/read/write, multi-block, .

l???????? HCD 使用某種方式(DMA, PIO, busy-waiting等)來發(fā)送命令和數(shù)據(jù)

l???????? HCD 調(diào)用SDHCDIndicateBusRequestComplete() 來通知總線驅(qū)動完成

l???????? 總線驅(qū)動把完成事件入隊(duì)列并提交下一個(gè)要求給HCD

l???????? 總線驅(qū)動的調(diào)度線程將會通知產(chǎn)生要求的起始源事件完成了。

?

標(biāo)準(zhǔn)的WINCE SDHC驅(qū)動支持

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 會調(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)

如果需要自己寫client驅(qū)動的話可以參考D:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDCLIENTDRIVERS目錄下的微軟自帶的SD client驅(qū)動來寫。

?

example1: SD MEMORY DRIVER UNDER WINCE 5.0

Wince自帶的SD存儲卡client驅(qū)動,代碼路徑為:

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

?

一個(gè)SD存儲卡在WINCE里的驅(qū)動架構(gòu)如下圖所示:
[圖無法插入]

?

?

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命令和總線要求

將所有磁盤的操作轉(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)見sdmemdiskio.cppsdmemcardio.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) 模塊支持MMCSDSecure 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的注冊表設(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ū)動支持DMA 和非DMA 2種數(shù)據(jù)傳輸模式,默認(rèn)是DMAFor 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ū)動是通過Freescale LP1070 SDIO Wi-Fi 卡來連接到一個(gè)IEEE 802.11b/g 無限局域網(wǎng)(WLAN) 。驅(qū)動支持以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板上,對于SD的代碼更改如下:

1???????? *****************************************

2???????? ***********************************************

?

附錄

SD卡與其他卡的對比

?

?

?

SDHC

?


Compatibility

?

* SDHC Host Products can use both SD and SDHC Memory Cards.
* SD Host Products can use only SD Memory Card 2GB or less.

Capacity (4GB SDHC Memory Card)

Still image JPEG
1,880 x 2,160 pixels, 6 Megapixels

Approx. 1,240 images

MPEG-2 Video
704 x 480 pixels, 5 Mbps, 30 fps

Approx. 1 hr 40 min

MPEG-4 Video
QVGA (320 x 240 pixels), 384 kbps, 15 fps

Approx. 19 hrs

Music (SD-Audio/AAC)
128 kbps

Approx. 68 hrs
(About 1,000 songs)

?

常用網(wǎng)站:

http://www.sdcard.com/

http://www.sdcard.org/

?

posted on 2007-02-11 10:09 Titan 閱讀(17472) 評論(29) ?編輯 收藏 網(wǎng)摘 所屬分類: Windows CE

評論

I think high Capacilty SD is not supported in MS code library....You need to modify code. 2007-03-29 15:03 |

? ????????

哥們兒
太專業(yè)了!我想問一下那里有SD WiFi 在Windows XP下的驅(qū)動。請賜教!多謝!急!!!
2007-04-17 00:09 |

? ????????

太牛比了,我要常來 2007-05-04 19:26 |

? ????????

非常感謝你的發(fā)表!我正好發(fā)愁要怎樣寫一個(gè)CLIENT DRIVER用在mx31上, 你的發(fā)表讓我了解許多。 2007-08-01 14:34 |

? ????????

有一個(gè)請求。我的imx31ADS bsp 里沒有LP1070 Secure Digital I/O Wi-Fi Driver, 可不可以發(fā)給我呢?



2007-08-01 18:35 |

? ????????

WinCE5下SDIO接口的性能比較差,WinCE6(Mobile5)里對bus層和SDHC作了些改進(jìn),增加了fast-path機(jī)制,性能有所改進(jìn)。不過像WLAN設(shè)備最好還是用monolithic的SDIO driver,優(yōu)點(diǎn)是吞吐率有很大提高,缺點(diǎn)是移植起來比較麻煩。
博主是做memory卡的還是做WiFi設(shè)備的,以后多交流啊
2007-08-02 16:33 |

? ????????

你有msn嗎,可否一起探討一下sd card drvier 2007-08-14 22:41 |

? ????????

謝謝您。您的文章讓我受益匪淺,我前些天買了一個(gè)4G的SDHC卡,結(jié)果不能和我的機(jī)器兼容(Acer N300 BW,WM5.0系統(tǒng),S3C2410的CPU),想看看能不能自己驅(qū)動。 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卡的讀寫。我希望能找到提供CE driver的SD WLAN卡,若有相關(guān)信息,請通知我x10@emtronix.com.cn。謝謝! 2007-12-05 18:12 |

? ????????

我有問題請教,我現(xiàn)在使用的S3C3445單片機(jī),想使用wince自帶的SD卡驅(qū)動,修改后使用。我的硬件接口和寄存器配置應(yīng)該在哪里添加上去,我沒有找到相應(yīng)的文件,麻煩您能給我一些幫助 2007-12-17 14:26 |

? ????????

我有問題要請教 請問買數(shù)碼相機(jī)帶內(nèi)存卡嗎? 2008-01-18 12:15 |

? ????????

不錯(cuò) 2008-01-23 16:45 |

? ????????

有個(gè)問題想問:
我目前使用的是PXA270的板子
之前我在改注冊表中關(guān)于SD的ORDER的數(shù)值時(shí)候發(fā)現(xiàn)
當(dāng)ORDER的數(shù)值改為小于15的時(shí)候,系統(tǒng)啟動后找不到SD的圖標(biāo)(感覺像是沒有被加載)但是當(dāng)將ORDER的數(shù)值改為大于15時(shí)候就ok。(DMA的ORDER的數(shù)值是為5)
希望樓主不惜賜教
謝謝
2008-01-23 16:50 |

? ????????

今天又來看,收獲不小,謝謝樓主 2008-02-04 14:21 |

? ????????

continuous up! 2008-03-01 21:56 |

? ????????

博主,你還真專業(yè),頂你,網(wǎng)絡(luò)上多幾個(gè)想你這樣的人,我們就方便多了 2008-04-03 22:38 |

? ????????

本人新買的東芝SDHC Memory Card 4GB,在電腦WIN XP未能顯示,是否要裝驅(qū)動程式,請指教,多謝. 2008-04-14 00:45 |

? ????????

我想知道怎么才能讀到SD HC的卡,因?yàn)槲椰F(xiàn)在的讀卡器沒有讀到呢 2008-05-12 13:27 |

?[樓主] ??????????

@ALEX80
SD 2.0的協(xié)議里通過CMD8這個(gè)命令是否有返回來決定當(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 |

? ????????

請求:各位DX能否提供一個(gè)裝在SD卡上,插入設(shè)備直接運(yùn)行即可實(shí)現(xiàn)支持大容量SD卡的程序嗎?

原因:本人購買的一個(gè)導(dǎo)航盒現(xiàn)在只能支持2G以下的SD卡,遠(yuǎn)遠(yuǎn)不能滿足我安裝多個(gè)導(dǎo)航軟件的需求,我希望能它能支持4G、8G的卡。

設(shè)備的參數(shù)是:主頻400MHZ,主芯片型號SANSUNG S3C2440A-40,操作系統(tǒng)WINCE5.0,軟件編譯類型ARMV4I,內(nèi)存64MB,存儲卡SD卡。

聯(lián)系方式:antee@163.com

不勝感激!!!!
2008-11-02 12:37 |

? ????????

請問在WM系統(tǒng)上的 設(shè)置-》系統(tǒng)-》關(guān)于 中 擴(kuò)展槽 的使用情況接口是在哪設(shè)置啊? 比如插入T卡就顯示,擴(kuò)展槽已使用,沒插入T卡就顯示擴(kuò)展槽未使用。謝謝! 2008-12-24 16:34 |

?[樓主] ??????????

這個(gè)信息是通過一個(gè)注冊表值來設(shè)定的。
你在文檔里搜SCKT.
Mobile的問題不好公開討論,如果有不理解請發(fā)到我郵箱:songtitan@msn.com
2008-12-24 16:39 | ?

? ????????

我現(xiàn)在也在開發(fā)SDIO Client驅(qū)動,碰到了很多問題,能否向各位請教一下,謝謝了。
我在開發(fā)時(shí),使用SDRegisterClient函數(shù)時(shí),總是返回錯(cuò)誤,各位碰到過這樣的問題嗎?
還有能否在pocket pc 2003下開發(fā)SDIO的Client驅(qū)動,看了很多的函數(shù)都說是WINCE 5.0以后
才支持的,那么在2003下具有SD接口的POCKET PC如何開發(fā)SD驅(qū)動。
在這上面隔了很久了,那位能指點(diǎn)一下啊,謝謝了。
我的郵箱:siguoc@yahoo.com.cn qq:46236863 msn:siguoc@hotmail.com 希望能夠收到各位的回信,非常謝謝。
2009-01-09 01:09 |

? ????????

請求:各位DX能否提供一個(gè)裝在SD卡上,插入設(shè)備直接運(yùn)行即可實(shí)現(xiàn)支持大容量SD卡的程序嗎?

原因:本人購買的一個(gè)導(dǎo)航盒現(xiàn)在只能支持2G以下的SD卡,遠(yuǎn)遠(yuǎn)不能滿足我安裝多個(gè)導(dǎo)航軟件的需求,我希望能它能支持4G、8G的卡。

設(shè)備的參數(shù)是:主頻400MHZ,主芯片型號SANSUNG S3C2440A-40,操作系統(tǒng)WINCE5.0,軟件編譯類型ARMV4I,內(nèi)存64MB,存儲卡SD卡。

聯(lián)系方式:nxycfb@126.com

不勝感激!!!!
2009-04-21 09:04 |

? ????????

求:各位DX能否提供一個(gè)裝在SD卡上,插入設(shè)備直接運(yùn)行即可實(shí)現(xiàn)支持大容量SD卡的程序嗎?

原因:本人購買的一個(gè)導(dǎo)航盒現(xiàn)在只能支持2G以下的SD卡,遠(yuǎn)遠(yuǎn)不能滿足我安裝多個(gè)導(dǎo)航軟件的需求,我希望能它能支持4G、8G的卡。

設(shè)備的參數(shù)是:主頻400MHZ,主芯片型號SANSUNG S3C2440A-40,操作系統(tǒng)WINCE5.0,軟件編譯類型ARMV4I,內(nèi)存64MB,存儲卡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ù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的【WinCE】SD card技术了解并WINCE下SDHC驱动开发(updated)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。