Re: Reading and Writing to the NandFlash from WinCE OS
- From: "Hector Bujanda" <hector_bujanda@xxxxxxxx>
- Date: Wed, 2 Jul 2008 18:00:18 +0200
I use it at the same time as the storage manager uses standard IOCTL to
handle the filesystem (we have some mutex to protect accesses in the FMD
driver).
As I showed in a previous mail, from the application:
hFlash =
CreateFile(_T("DSK1:"),GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
This way of working is something I've seen it's possible in my BSP (and we
have implemented in some other)... but doesn't mean is the proper way of
working.
Bye.
"Ng Wee Hong" <weehong@xxxxxxxxx> wrote in message
news:OPcT6Pp2IHA.1772@xxxxxxxxxxxxxxxxxxxxxxx
Thank you Valter and Hector for your help.
As both of you suggested, I think i need to implement access the Flash
throught the FMD using IOCTL.
Should I implement it in the FMD_OEMIoControl (through IOCTL_DISK_USER) or
OEMIoControl?
Hector,
I can't find IOCTL_FMD_WRITE_RESERVED or IOCTL_FMD_READ_RESERVED, so I
guess it not implemented in my BSP and I need to implement similar feature
myself?
Another thing I need to clarify is
I have tried to open "DSK1:" using CreateFile but also always failed. Is
it because as I mentioned earlier, is the port/file "DSK1:" being used by
the Store Manager for the file system? Do I need to "umount" it? If yes,
how should I do it?
Thanks again.
Regards,
Wee Hong
"Hector Bujanda" <hector_bujanda@xxxxxxxx> wrote in message
news:uzefmTE2IHA.4552@xxxxxxxxxxxxxxxxxxxxxxx
The FMD driver is normally done to access Filesystem Areas of NAND.
You have to extend a little bit the FMD driver to get access to other
areas.
I have used sometimes available (and normally not used/implemented)
IOCTL_FMD_WRITE_RESERVED, IOCTL_FMD_READ_RESERVED to use the existing
FMD_ReadSector, FMD_WriteSector functions (with some address to Sector
translation).
Then your app can do something like this:
HANDLE hFlash;
ReservedReq MyReservedReq;
hFlash = CreateFile
(_T("DSK1:"),GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
MyReservedReq.dwStart= dwValueStart;
MyReservedReq.pBuffer= pucBuffer;
MyReservedReq.dwLen = dwValueLen;
if (DeviceIoControl( hFlash, IOCTL_FMD_READ_RESERVED, &MyReservedReq,
sizeof(MyReservedReq), 0, 0,NULL,NULL) == FALSE)
{
return -1;
}
return dwValueLen;
Bye,
"Ng Wee Hong" <weehong@xxxxxxxxx> wrote in message
news:%23RP1S4D2IHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
Hi All,
I am a newbie.
My development board is SMDK 2410.
I need to access the Flash which mean be able to read and write.
I know that Flash will contain the bootloader, the WinCE image and the
rest of the free space will be use by the Microsoft Storage Manager to
create a file system using the FlashDrv.dll.
There is a little free space that I would like to use it for storing
information which can be use between the Bootloader and the WinCE OS. I
have no problem reading and write to the flash in the bootloader but I
do not know how to do it in the WinCE OS.
I have do a lot of search and experiment but still can't do it.
There is a driver found in \smdk2410\drivers\NandFlsh\FMD
I found 2 relevant file, FMD.lib and FlashDrv.dll.
I think the functions
FMD_ReadSector and FMD_WriteSector should be able to do what I wanted
but I just don't know how to use them correctly.
The FlashDrv.dll contain these 2 functions but are does not export them.
They only have
DSK_Init
DSK_Deinit
...
DSK_IOControl
Have tried to open them using CreateFile(TEXT("DSK0:"), ... and
CreateFile(TEXT("DSK1:") ... but without success. Is it because it
use/opened by the file system?
I tried to use make use of the FMD.lib and create an application to use
them but it seems the value return is not what is being stored. I think
I shouldn't have uses FMD_ReadSector and FMD_WriteSector in user mode
right?
I have tried to use them in IOCTL in OEMIoControl but I have problem
linking it. The Platform Builder complaint linking error
g:\wince420\platform\smdk2410\kernel\buildexe\kern\hal.lib(oemioctl.obj)
: error LNK2019: unresolved external symbol FMD_ReadSector referenced in
function OEMIoControl
Can someone please guide me what should I do to be able to access the
flash from WinCE?
Actually I would like to explore upgrading the WinCE image using this
method. Maybe read the image from thumb drive and write it to the flash
from the WinCE.
Thanks in advance.
Regards,
Wee Hong
.
- Follow-Ups:
- Re: Reading and Writing to the NandFlash from WinCE OS
- From: Ng Wee Hong
- Re: Reading and Writing to the NandFlash from WinCE OS
- Prev by Date: Re: about cirrus maverickcrunch coprocessor
- Next by Date: Re: about cirrus maverickcrunch coprocessor
- Previous by thread: WNetEnumResource API failed with error of 6118
- Next by thread: Re: Reading and Writing to the NandFlash from WinCE OS
- Index(es):
Relevant Pages
|