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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

wince 快速挂载SD卡及U盘

發布時間:2024/3/24 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 wince 快速挂载SD卡及U盘 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

作者:Apollo5520

轉自:http://blog.chinaunix.net/uid-8087110-id-1989039.html


1、起初我的wince bsp 在插入8G u盤時需要等待大概40秒左右才出現盤符,這個速度簡直無法忍受。 2、經過分析,發現比較耗時的是位于文件 C:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\FSD\FATUTIL\MAIN\scandisk.cpp內的 ScanVolumeInternal 函數 ,這個函數是用來掃描文件系統的,如果能夠去掉插入sd卡或U盤時不自動掃描則可以大大縮短出現盤符的時間。 3、經過分析發現這個是有FATFS相關注冊表進行控制的

[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]

"MountFlags"=dword:0 ;

"Flags"=dword:14 ;


具體的控制是Flags項,這個分支定義的是整個FATFS的參數,如果想進行分類進行不同的定義,則需要修改相關注冊表分支,例如,想定義flash自動掃描則添加定義如下

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\FlashDrv\FATFS]

"MountFlags"=dword:2

"Flags"=dword:10

;在Profiles\FlashDrv添加FATFS分支定義falsh上FATFS文件系統的相關參數,其他的sd卡,U盤等也可分別進行定義


以上兩個分支可同時存在,進行詳細的的定義。

關于FATFS相關參賽的定義如下:(http://msdn.microsoft.com/en-us/library/ms885403.aspx)

Platform Builder for Microsoft Windows CE 5.0 FAT File System Registry Settings

The file allocation table (FAT) file system retrieves driver specific settings from the registry.

The following table shows the registry settings for the FAT file system stored inHKEY_LOCAL_MACHINE\System\StorageManager\FATFS.

Registry value: TypeDescription
BufferSize: REG_DWORDSpecifies the number of sector-sized buffers to use for streams.

The default value is 64 for TFAT and 32 for FAT.

CacheSize: REG_DWORDIndicates the size of the disk cache, in number of sectors. This value must be a power of 2 and at least 16 sectors. If set to zero, FATFS will determine the best cache size to use.

For more information, see CacheSize registry subkey.

CodePage: REG_DWORDOverrides CP_OEMCP in all character conversions.
Dll: REG_SZSpecifies the name of the file system DLL.
EnableCache: REG_DWORDControls caching.
  • 0 - Disables caching
  • 1 - Enables caching
EnableCacheWarm: REG_DWORDEnables pre-warming of the cache.
Flags: REG_DWORDIndicates FAT file system registry flags.

For more information, see Flags registry subkey.

FormatTfat: REG_DWORDFormats the volume as TFAT on auto-format or through IOCTL_DISK_FORMAT_VOLUME.
FriendlyName: REG_SZSpecifies a friendly name for the file system.
MountLabel: REG_DWORDPulls the volume label and uses it as a mount point.
Paging: REG_DWORDControls paging.
  • 0 - Disables paging
  • 1 - Enables paging
Util: REG_SZSpecifies the DLL name of utility to do format and scan.

Flags registry subkey

The following table shows the available values you can set for the Flags registry subkey; set Flags to a combination of these values.

FlagValueDescription
FATFS_UPDATE_ACCESS0x00000001Updates access times.
FATFS_DISABLE_LOG0x00000002Disables event logging.
FATFS_DISABLE_AUTOSCAN0x00000004Disables automatic calls to ScanVolume.
FATFS_VERIFY_WRITES0x00000008Verifies all writes.
FATFS_ENABLE_BACKUP_FAT0x00000010Adds a backup FAT to all formats.
FATFS_FORCE_WRITETHROUGH0x00000020Sets all files to WRITE_THROUGH, regardless of the parameters to CreateFile.
FATFS_DISABLE_AUTOFORMAT0x00000040Disables automatic formatting of unformatted volumes.
FATFS_WFWS_NOWRITETHRU0x00010000Disables write through on the WriteFileWithSeek function. Improves memory-mapped file performance.
FATFS_DISABLE_FORMAT0x00020000Disables format.
FATFS_TRANS_DATA0x00040000Transacts data on a write operation.
FATFS_TFAT_USECLUS10x00080000Uses the cluster 1 entry in the FAT table for a TFAT transaction. TFAT uses the NOF field of the boot sector by default.
FATFS_DISABLE_TFAT_REDIR0x00100000Disables the redirect of the root directory to another hidden directory for FAT12 or 16.
FATFS_TFAT_ALWAYS0x00200000Marks transaction status, even if only one sector in FAT is changed.
FATFS_FORCE_TFAT0x00400000Forces TFAT transactions even if the volume is not formatted as TFAT.

CacheSize registry subkey

The CacheSize registry subkey is a hexadecimal number of sectors to cache. This has to be a power of two. The following table shows valid numbers for theCacheSize registry subkey.

Registry entryNumber of sectorsCache in kilobytes (KB)
221
442
884
10168
201632
406432
8012864
100256128
200512256
4001024512
80020481024
10004096

2048

Example

The following registry key example shows the location of the Flags andCacheSize registry subkey values.

Copy Code [HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]"Flags": dword:00000024"CacheSize" = dword:400

If CacheSize is set to zero, the cache size will be set automatically.

?

http://www.vckbase.com/document/viewdoc/?id=1267

對”Flags”值的描述如下(C:\WINCE500\PRIVATE\WINCEOS\COREOS\FSD\FATFS\fatfs.h):
 

標志描述
FATFS_UPDATE_ACCESS0x00000001更新訪問時間
FATFS_DISABLE_AUTOSCAN0x00000004不能自動調用ScanVolume
FATFS_VERIFY_WRITES0x00000008檢驗所有寫操作
FATFS_ENABLE_BACKUP_FAT0x00000010備份FAT表
FATFS_FORCE_WRITETHROUGH0x00000020讓系統可以直接將任何緩沖區中的數據寫到磁盤上,這樣系統將加快寫數據到磁盤的速度
FATFS_DISABLE_AUTOFORMAT0x00000040禁止自動格式化未格式化的分區
FATFS_DISABLE_COMPCHECK0x00000080禁止自動檢測壓縮分區

上面把FLAGS定義為 14,也就是備份FAT表、不自動掃描卷標。這樣8G的SD卡,3秒就可以出現盤符了。

?

原創文章,轉載請注明:轉載自 風雨無阻博客(http://Apollo5520.cublog.cn)

本文鏈接地址:http://blog.chinaunix.net/u3/105764/showart_2114352.html

?


總結

以上是生活随笔為你收集整理的wince 快速挂载SD卡及U盘的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。