none
CE6下SD卡驱动的问题。 RRS feed

  • 问题

  •  SD卡问题:将CE5的SD驱动Porting到CE6以后,SD卡的访问速度只有CE5的三分之一。
    在CE5下,读大概是6MB/Sec, 写大概是4.8MB/Sec.
    在CE6下,读大概是2.4MB/Sec, 写大概是500KB/Sec.

    请问大家遇到过这种情况吗?
    有Porting到CE6的,或者是工作在CE6下的,请问大家的SD卡访问速度是多少?

    还有就是在CE6下的SD卡驱动的MDD部分,BusRequestHandler中添加了一个Physical Buffer,请问这个东东如何使用的?有用过的吗?

    经过Debug发现主要原因是CE6下的文件系统好像和CE5下的不同。
    首先说明我的测试程序是一个简单的CreateFile、WriteFile、ReadFile的程序。程序使用10M大小的文件和10M的buffer作为测试。
    在CE5下,其在SDMemRead中debug发现,每次都可以以大于64个Sector的大小读取,但是发现在CE6下,每次读取的大小都是8个Sector。
    这样同样大小的文件,CE6下就使用了接近于16倍的命令量来读取(每个Read命令后有一个Stop命令),所以速度慢了。

    不知道有没有哪位高人对WinCE的文件系统读写操作比较熟悉的,可以解释一下原因吗?
    尤其是WinCE6下的这种限制为每次读8个Sector的情况,是不是文件系统导致的?有什么方法可以设置吗?

    BlockTransferSize这个键值我已经改过了,系统默认的是64(0x40)。这个键值只能限制每次发送给SD Driver的Sector值,只能比这个值小,
    其对在系统对SDMemRead调用之前传入的Sector数量没有影响。即:这个值如果修改小于8,则会产生影响,使SD Driver的Performance更差。
    改大这个值,没有任何作用。

    从系统的现象来说我觉得是WinCE6.0下的文件系统的操作和WinCE5.0下不一样造成的。
    现在想办法能不能通过修改Platform.reg的方式改变每次读写操作的Sector的量。

    vcleaner
    2009年2月25日 13:56

全部回复

  • 我的测试程序使用的10M的buffer,但是可以debug出每次文件系统的读写都是以一个Page为操作,那么BlockTransferSize这个控制的阀值,是不是在WinCE6.0下就没有作用了?因为这个值只能在小于8的时候才能起到控制作用。Common.reg中这个值默认为0x40,那还有意义吗?
    vcleaner
    2009年3月2日 7:28
  • 下面是debug出来的调用过程: 
    0xd405de9c SDMEMORY!SMC_IOControl(unsigned long 0xd3f20f90, unsigned long 0x00075c08, unsigned char * 0xd3b78190, unsigned long 0x0000001c, unsigned char * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764) sdmemmain.cpp line 584
    0xd405e070 DEVMGR!DM_DevDeviceIoControl(fsopendev_t * 0x00000000, unsigned long 0x00000000, void * 0xd405e764, unsigned long 0x00000000, void * 0x00000000, unsigned long 0x8c079bc0, unsigned long * 0x000005c9, _OVERLAPPED * 0x8ef79e50) devfile.c line 453 + 76 bytes
    0xd405e0d8 KERNEL!MDCallKernelHAPI + 60 bytes
    0xd405e128 KERNEL!NKHandleCall(unsigned long 0xd3b79da0, _DHCALL_STRUCT * 0xd405e138) apicall.c line 1983 + 40 bytes
    0xd405e1a4 K.COREDLL!DirectHandleCall(unsigned long 0x00000007) coredll.cpp line 73 + 24 bytes
    0xd405e1cc K.COREDLL!xxx_DeviceIoControl(void * 0x05c90003, unsigned long 0x00075c08, void * 0xd3b78190, unsigned long 0x0000001c, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764, _OVERLAPPED * 0x00000000) twinbase.cpp line 32 + 84 bytes
    0xd405e22c MSPART!DoDiskIoControl(tagDriverState * 0xd3f22250, unsigned long 0x00075c08, void * 0xd3b78190, unsigned long 0x0000001c, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764, _OVERLAPPED * 0x00000000) part.h line 148 + 96 bytes
    0xd405e270 MSPART!ReadPartition(unsigned long 0xd3f224f0, unsigned char * 0xd3b78190, unsigned long 0x0000001c, unsigned char * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764) part.cpp line 619 + 64 bytes
    0xd405e2f0 MSPART!PD_DeviceIoControl(unsigned long 0xd3f224f0, unsigned long 0x00075c08, unsigned char * 0xd3b78190, unsigned long 0x0000001c, unsigned char * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764) part.cpp line 791 + 36 bytes
    0xd405e398 FSDMGR!PartitionDriver_t::DeviceIoControl(unsigned long 0x00000000, unsigned long 0xd405e764, void * 0xc0d4b070, unsigned long 0x00000001, void * 0xd405e3c0, unsigned long 0xc0d4ade4, unsigned long * 0xd3f212d0) partition.hpp line 277 + 60 bytes
    0xd405e3e8 FSDMGR!PartitionDisk_t::DiskIoControl(unsigned long 0x00075c08, void * 0xd3b78190, unsigned long 0x0000001c, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764, _OVERLAPPED * 0x00000000) partition.cpp line 216 + 68 bytes
    0xd405e43c FSDMGR!StoreDisk_t::StoreIoControl(PartitionDisk_t * 0xd3f22590, unsigned long 0x00075c08, void * 0xd3b78190, unsigned long 0x0000001c, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764) storedisk.cpp line 1242 + 72 bytes
    0xd405e498 FSDMGR!STG_DeviceIoControl(StoreHandle_t * 0x0000001c, unsigned long 0x00000000, void * 0x00000000, unsigned long 0xd405e764, void * 0xd3b78190, unsigned long 0x00000001, unsigned long * 0x00000000, _OVERLAPPED * 0x8fca08b8) stgapi.cpp line 697 + 68 bytes
    0xd405e590 KERNEL!MDCallKernelHAPI + 60 bytes
    0xd405e5e0 KERNEL!NKHandleCall(unsigned long 0x00000001, _DHCALL_STRUCT * 0x00000000) apicall.c line 1983 + 40 bytes
    0xd405e65c K.COREDLL!DirectHandleCall(unsigned long 0x00000007) coredll.cpp line 73 + 24 bytes
    0xd405e684 K.COREDLL!xxx_DeviceIoControl(void * 0x05cc0003, unsigned long 0x00075c08, void * 0xd3b78190, unsigned long 0x0000001c, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764, _OVERLAPPED * 0x00000000) twinbase.cpp line 32 + 84 bytes
    0xd405e6e4 FSDMGR!FSDMGR_DiskIoControl(LogicalDisk_t * 0xd3f22590, unsigned long 0x00075c08, void * 0xd3b78190, unsigned long 0x0000001c, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0xd405e764, _OVERLAPPED * 0x00000000) fsdmgrapi.cpp line 623 + 52 bytes
    0xd405e748 FSDMGR!ReadWriteDiskEx(_FSD_SCATTER_GATHER_INFO * 0xd405e7a0, _FSD_SCATTER_GATHER_RESULTS * 0x00000000, unsigned long 0x00075c08) fsdmgrapi.cpp line 748 + 76 bytes
    0xd405e7a0 FSDMGR!FSDMGR_ReadDisk(LogicalDisk_t * 0xd3f22590, unsigned long 0x00484dc8, unsigned long 0x00000008, unsigned char * 0xd4061000, unsigned long 0x00001000) fsdmgrapi.cpp line 788 + 16 bytes
    0xd405e7e8 EXFAT!Disk::ReadWriteDisk(unsigned long 0x00000009, unsigned long 0x00484dc8, unsigned long 0x00000008, unsigned char * 0xd4061000) disk.cpp line 179 + 48 bytes
    0xd405e83c EXFAT!Volume::ReadVolume(unsigned long 0x00484dc8, unsigned long 0x00000008, void * 0xd4061000, unsigned long 0x00000009) volume.cpp line 1370 + 36 bytes
    0xd405e864 EXFAT!Stream::ReadStreamData(unsigned __int64 0xd405e888d405e88c, void * 0x00000000, unsigned long 0x00000000, unsigned long 0x00000000, unsigned long * 0x00001000) stream.cpp line 324 + 36 bytes
    0xd405e928 EXFAT!File::ReadFileData(unsigned __int64 0x0000000000001000, void * 0xd4061000, unsigned long 0x00001000, unsigned long * 0xd405ea70) file.cpp line 896 + 52 bytes
    0xd405ea2c EXFAT!File::ReadFile(unsigned __int64 0x0000000000001000, void * 0xd4061000, unsigned long 0x00001000, unsigned long * 0xd405ea70) file.cpp line 134 + 36 bytes
    0xd405ea60 EXFAT!FAT_ReadFileWithSeek(FileHandle * 0xd0675a90, void * 0xd4061000, unsigned long 0x00001000, unsigned long * 0xd405ec08, _OVERLAPPED * 0x00000000, unsigned long 0x00001000, unsigned long 0x00000000) api.cpp line 206 + 44 bytes
    0xd405eab0 CACHEFILT!FilterHook_t::ReadFileWithSeek(unsigned long 0x00001000, void * 0x00000000, unsigned long 0x00000000, unsigned long * 0x00000040, _OVERLAPPED * 0xae1c2000, unsigned long 0x054f0006, unsigned long 0xd0ab0afc) fsdmgr.h line 515 + 60 bytes
    0xd405eafc CACHEFILT!FSSharedFileMap_t::UncachedReadWriteWithSeek(void * 0xd4061000, unsigned long 0x00001000, unsigned long * 0xd405ec08, unsigned long 0x00001000, unsigned long 0x00000000, int 0x00000000) fssharedfilemap_uncached.cpp line 114 + 68 bytes
    0xd405eba8 CACHEFILT!FCFILT_ReadWriteData(unsigned long 0xd0ab0c10, unsigned char * 0xd4061000, unsigned long 0x00001000, unsigned long * 0xd405ec08, const _ULARGE_INTEGER * 0xd405eccc, int 0x00000000) fssharedfilemap_cached.cpp line 152 + 56 bytes
    0xd405ebec KERNEL!MAPPageInPage(_FSMAP * 0x8e0023a8, _ULARGE_INTEGER * 0xd405eccc, unsigned char * 0xd4061000) mapfile.c line 1599 + 56 bytes
    0xd405ecac KERNEL!PageFromMapper(_PROCESS * 0x8c863bc0, unsigned long 0xd2a71000, int 0x00000000) mapfile.c line 1762 + 16 bytes
    0xd405ed5c KERNEL!VMProcessPageFault(_PROCESS * 0x8c863bc0, unsigned long 0xd2a71a00, int 0x00000000) vm.c line 1207 + 24 bytes
    0xd405edcc KERNEL!MDHandleHardwareException(_CALLSTACK * 0xd405f08c, _EXCEPTION_RECORD * 0xd405f03c, _CONTEXT * 0xd405ef48, unsigned long * 0xd405ee78) mdarm.c line 824 + 36 bytes
    0xd405ee5c KERNEL!ExceptionDispatch(_EXCEPTION_RECORD * 0xd405f03c, _CONTEXT * 0xd405ef48) exdsptch.c line 930 + 20 bytes
    0xd405ef48 KERNEL!CaptureContext + 44 bytes

    ======================================================================
    从上面的调用过程中可以看出在:MAPPageInPage中使用了每次读取一个Page的操作,即一次4K。
    这个操作就造成了SD卡的读取速度比较慢。


    如果这里没有熟悉的人,不知道大家是否可以提供一个和MS的开发人员沟通的方法?最好直接是MS的CE开发人员,我想和他沟通沟通。
    vcleaner
    2009年3月6日 6:31