Raw Flash Access

We are using a fairly standard devf-****** driver for our flash and by
running the driver with the -s option, we give it the base address of the
flash and the size. This gives us the /dev/fs0 and /dev/fs0p0 mount points.
By opening on the /dev/fs0p0 raw mountpoint, we can read the contents of the
flash successfully. We can write values to the flash using write but only to
turn existing 1’s to 0’s (as you would expect from a non-erased flash). What
I would like to be able to do is to erase a sector of the raw flash
programatically so that I can write data to it successfully. Does anyone
know what function would do that (I guess it is a devctl operation but I
cannot find any documentation for it).
I would appreciate any replies.

Regards

Poseidon <a@b.com> wrote:

We are using a fairly standard devf-****** driver for our flash and by
running the driver with the -s option, we give it the base address of the
flash and the size. This gives us the /dev/fs0 and /dev/fs0p0 mount points.
By opening on the /dev/fs0p0 raw mountpoint, we can read the contents of the
flash successfully. We can write values to the flash using write but only to
turn existing 1’s to 0’s (as you would expect from a non-erased flash). What
I would like to be able to do is to erase a sector of the raw flash
programatically so that I can write data to it successfully. Does anyone
know what function would do that (I guess it is a devctl operation but I
cannot find any documentation for it).
I would appreciate any replies.

You could call system(“flashctl -e -o -l”);

Or:

#include <sys/dcmd_f3s.h>

f3s_erase_t erase;

/* fill in erase */

erase.offset = block_offset_to_erase_in_bytes;
erase.limit = block_size_in_bytes;
devctl(fd, DCMD_F3S_ERASE, &erase, sizeof(erase), NULL);

Many/most devctls aren’t documented – but if you look at
/usr/include/sys/dcmd*.h you’ll find many/most of them.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

David,
Thank you very much for your reply. We have used the devctl version of
the erase which works perfectly on our system.

Regards

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:bnbmdh$nla$1@nntp.qnx.com

Poseidon <> a@b.com> > wrote:
We are using a fairly standard devf-****** driver for our flash and
by
running the driver with the -s option, we give it the base address of
the
flash and the size. This gives us the /dev/fs0 and /dev/fs0p0 mount
points.
By opening on the /dev/fs0p0 raw mountpoint, we can read the contents of
the
flash successfully. We can write values to the flash using write but
only to
turn existing 1’s to 0’s (as you would expect from a non-erased flash).
What
I would like to be able to do is to erase a sector of the raw flash
programatically so that I can write data to it successfully. Does anyone
know what function would do that (I guess it is a devctl operation but I
cannot find any documentation for it).
I would appreciate any replies.

You could call system(“flashctl -e -o -l”);

Or:

#include <sys/dcmd_f3s.h

f3s_erase_t erase;

/* fill in erase */

erase.offset = block_offset_to_erase_in_bytes;
erase.limit = block_size_in_bytes;
devctl(fd, DCMD_F3S_ERASE, &erase, sizeof(erase), NULL);

Many/most devctls aren’t documented – but if you look at
/usr/include/sys/dcmd*.h you’ll find many/most of them.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Poseidon <a@b.com> wrote:

David,
Thank you very much for your reply. We have used the devctl version of
the erase which works perfectly on our system.

You’re very welcome, thanks for letting me know.

-David

You could call system(“flashctl -e -o -l”);

#include <sys/dcmd_f3s.h

f3s_erase_t erase;

/* fill in erase */

erase.offset = block_offset_to_erase_in_bytes;
erase.limit = block_size_in_bytes;
devctl(fd, DCMD_F3S_ERASE, &erase, sizeof(erase), NULL);

Many/most devctls aren’t documented – but if you look at
/usr/include/sys/dcmd*.h you’ll find many/most of them.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.