Use wince6.0 nandflash as mass storage (USB flash disk)
Platform: wince6 + cloud6410
BSP: youjian bsp2.1
Some customers demanded that nandflash be used as the mass storage and did not want to use the synchronization tool to transmit data. The procedure is as follows:
1. Select device drivers> USB function clients> mass storage.
2. In smdk6410.bat
Set bsp_usbfnclass = serial
@ REM set bsp_usbfnclass = mass_storage
Change
@ REM set bsp_usbfnclass = serial
Set bsp_usbfnclass = mass_storage
3. Modify the USB function registry in platform. Reg.
# If 0; add Mao for USB mass_storage
; ------------ USB function driver -------------------------------------------
; @ Cesysgen if ce_modules_usbfn
If bsp_nousbfn!
If bsp_kitl! = Usbserial
[HKEY_LOCAL_MACHINE \ drivers \ builtin \ sc6410usbfn]
"DLL" = "maid"
"Prefix" = "ufn"
"Order" = DWORD: 20
"Priority256" = DWORD: 64
"IRQ" = DWORD: 60; usb otg virtual IRQ = 96 (0x60), physical IRQ = 58
"Busioctl" = DWORD: 2a0048
"Iclass" = multi_sz: "{E2BDC372-598F-4619-BC50-54B3F7848D35} = % B", "{6f40791d-300e-44e4-bc38-e0e63ca8375c} = % B"
[HKEY_LOCAL_MACHINE \ drivers \ USB \ functiondrivers]
"Defaultclientdriver" =-; erase previous default
; ------------ USB function serial driver --------------------------------------
If bsp_usbfnclass = serial
[HKEY_LOCAL_MACHINE \ drivers \ USB \ functiondrivers]
"Defaultclientdriver" = "serial_class"
[HKEY_LOCAL_MACHINE \ drivers \ USB \ functiondrivers \ serial_class]
"Friendlyname" = loc_usbfn_serial_name
"Idvendor" = DWORD: 045e
; "Idvendor" = DWORD: 0547; add Mao
"Manufacturer" = loc_usbfn_serial_manufacturer
"Idproduct" = DWORD: 00ce
; "Idproduct" = DWORD: 2720; add Mao
"Product" = loc_usbfn_serial_product
"Index" = DWORD: 5
Endif bsp_usbfnclass
;-------------------------------------------------------------------------
; ------------ USB function mass stroge driver ---------------------------------
If bsp_usbfnclass = mass_storage
[HKEY_LOCAL_MACHINE \ drivers \ USB \ functiondrivers]
; "Defaultclientdriver" =-; erase previous default
"Defaultclientdriver" = "mass_storage_class"
[HKEY_LOCAL_MACHINE \ drivers \ USB \ functiondrivers \ mass_storage_class]
"DLL" = "usbmsfn. dll"
"Interfacesubclass" = DWORD: 06
"Interfaceprotocol" = DWORD: 50
"Devicename" = "dsk1:" // The suffix of the DSK must be consistent with the index in nandflash.
"Friendlyname" = "Mass Storage"
"Idvendor" = DWORD: 045e
"Manufacturer" = "generic manufacturer (prototype -- remember to change idvendor )"
"Idproduct" = DWORD: FFFF
"Product" = "generic mass storage (prototype -- remember to change idvendor )"
"Bcddevice" = DWORD: 0
"Removable" = DWORD: 0
; --------------- Add Mao 1217 ------------
[HKEY_LOCAL_MACHINE \ drivers \ USB \ functiondrivers \ rndis]
"Idvendor" = DWORD: 0547
"Manufacturer" = loc_usbfn_rndis_manufacturer
"Idproduct" = DWORD: 2c2d
"Product" = loc_usbfn_rndis_product
; --------------- Add Mao 1217 ------------
Endif bsp_usbfnclass
[HKEY_LOCAL_MACHINE \ drivers \ sdcard \ clientdrivers \ class \ sdmemory_class]
"Index" = DWORD: 3
[HKEY_LOCAL_MACHINE \ drivers \ sdcard \ clientdrivers \ class \ sdmemory_class \ high_capacity]
"Index" = DWORD: 3
[HKEY_LOCAL_MACHINE \ drivers \ sdcard \ clientdrivers \ class \ mmc_class]
"Index" = DWORD: 3
;-------------------------------------------------------------------------
[HKEY_CURRENT_USER \ controlpanel \ comm]
"Cnct" = "'usb"
[HKEY_LOCAL_MACHINE \ debugzones]
"Usbfn" = DWORD: FFFF
"Serial" = DWORD: FFFF
"PM" = DWORD: FFFF
Endif
Endif bsp_nousbfn!
; @ Cesysgen endif ce_modules_usbfn
;-------------------------------------------------------------------------
4. The nandflash registry is as follows:
[HKEY_LOCAL_MACHINE \ drivers \ builtin \ nandflash]
"DLL" = "nandflash. dll"
"Prefix" = "DSK"
"Order" = DWORD: 4
; "IOCTL" = DWORD: 4
"Profile" = "nsflash"
"Iclass" = "{A4E7EDDA-E575-4252-9D6B-4195D48BB865 }"
& Quot; index & quot; = DWORD: 1; add Mao 1217
; Override names in default profile
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ nsflash]
"Defaultfilesystem" = "fatfs"
"Name" = "Microsoft flash disk"
"Folder" = "nandflash"
"Partitiondriver" = "mspart. dll"
"Automount" = DWORD: 1
"Autopart" = DWORD: 1
"AutoFormat" = DWORD: 1
[HKEY_LOCAL_MACHINE \ SYSTEM \ storagemanager \ profiles \ nsflash \ fatfs]
"Enablecache" = DWORD: 1
"Cachesize" = DWORD: 1000
"Mountbootable" = DWORD: 1
; "Flags" = DWORD: 00000024
"Checkforformat" = DWORD: 1
; Add Mao
; "Formatexfat" = DWORD: 1
"Formatfat" = DWORD: 1
"Flags" = DWORD: 14
"Enablewriteback" = DWORD: 1
"Mountasroot" = DWORD: 1
"Mountasbootable" = DWORD: 1
After you re-download the sysgen, you will find a removable disk on the PC,
Problems:
When you click "open", the system prompts that the disk is not formatted and needs to be formatted, but an error occurs during formatting, or the system cannot start after the system is restarted,
The reason is: My nandflash is divided into binfs and FAT32 partitions. PC recognizes binfs partitions. Now we need to map FAT32 partitions to PC, modify g_hstore = openstore (g_szdevicename) in usbfn-class-storage-block.cpp under public;
G_hstore = openpartition (g_hstore, _ T ("part01"); // Add Mao for Mass Storage
After re-compilation, I found that I still prompted to format the disk when I opened it for the first time. After formatting, I can use it. Why do I need to format it online:
If the ce6 device uses the exfat file system and connects to the Windows XP system PC as the mass storage drive letter, XP will prompt that the drive letter is not formatted and needs to be formatted, this is because the Windows desktop system is from Vista SP1 to support exfat, followed by win7 and so on are no problem, and Win XP to identify exfat needs to install patch 955704, file name: WindowsXP-KB955704-x86-CHS.exe
:
Http://www.microsoft.com/downloads/zh-cn/details.aspx? Familyid = 1cbe3906-ddd1-4ca2-b727-c2dff5e30f61
Of course, if you do not select the exfat file system component, I guess this problem is not final. After installing the patch, it will be OK.