TCC89X 调试(三)双SD卡盘符固定

    技术2022-05-19  26

    原创:macrozhang

    在WINCE 中如果你的系统有两个SD卡存在的话,正常情况下系统会根据你插入的顺序而定义盘符,比如:第一个插入的为SDMEMORY

    那么第二个插入的则为SDMEMORY2.反过来也是一样,这就说明了SD卡的盘符没有固定。

    这样为带来什么坏处呢?

    打个比方,如果你做的是一个导航系统,你的GPS地图是拷在SD卡的。那么会因为你系统的两张卡插入的顺序不一样,而使导航的地图路径变了。从而使GPS又要重新设计地图的路径。

     

    下面介始一下如何将SD卡的盘符固定。以下的例子是TCC89X上面的。

    在SDBU/sddevuce.cpp

    sdloaddevice()

    {

    ....

    if(m_sdSlot.GetSlotIndex()==0)

    {

    // set the default load path for SD Memory Devices

    hr = StringCchCopy(loadPath, _countof(loadPath),SDCARD_SDMEMORY_CLASS_REG_PATH);

     

    } else

    {

    hr = StringCchCopy(loadPath, _countof(loadPath),SDCARD_SDMEMORY_CLASS_REG_PATH2);

    }

     ....

    }

     

    在SDBUS/SDDEVICE.HPP里面有如下定义:

     #define SDCARD_SDMEMORY_CLASS_REG_PATH TEXT(//Drivers//SDCARD//ClientDrivers//Class//SDMemory_Class)

     

    #define SDCARD_SDMEMORY_CLASS_REG_PATH2 TEXT(//Drivers//SDCARD//ClientDrivers//Class//SDMemory2_Class)

     

    在注册表做如下修改:

     

    //之前本来就有的

     [HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/SDMemory]

    "Name"="SD Memory Card"

     "Folder"="SDMEM" 盘符1。

    ;"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:80 ; send no more than 64 blocks of data per bustransfer ;

    "Profile"="SDMemory"

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

                                    "{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"

     

    ;;added 新增的

    [HKEY_LOCAL_MACHINE/System/StorageManager/Profiles/SDMemory2]

    "Name"="SD Memory Card"

    "Folder"="SDCARD";盘符2。

    ;"PartitionDriver"="" ; removable storage cannot have partitions

     

    ; SD Memory Storage class driver

     [HKEY_LOCAL_MACHINE/Drivers/SDCARD/ClientDrivers/Class/SDMemory2_Class]

     "Dll"="SDMemory.dll"

     "Prefix"="DSK"

    "BlockTransferSize"=dword:80 ; send no more than 64 blocks of data per bus transfer 

     "Profile"="SDMemory2"

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

                                      "{8DD679CE-8AB4-43c8-A14A-EA4963FAA715}"

     

    ;;-------------end-------------

     

    谢谢!

    欢迎加入:149818111


    最新回复(0)