Warren Peece <warren@nospam.com> wrote:
: I’m not quite sure where to post this, so here it is 
: I’ve got an Nto 2.0 developer’s seat, with what I think is the latest release,
: and I’m trying to customize a FLASH filesystem driver for my embedded project.
: I started with devf-explr2 and had to modify very little in order to get things
: to work. I’m now revisiting the driver to ensure that I’m getting access to
: all of my devices, which caused me to realize that even though the thing seems
: to work I don’t understand the setup I’ve done.
: Specifically in f3s_xxx_open.c, I have:
: socket->name = “enc”;
: socket->window_size = 0; // Docs say “0 for non-windowed”
: socket->address = FLASHADDR;
: socket->bus_width = 2;
I’m not sure why the docs indicate zero for non-windowed; perhaps that was
documented early in the development of the ffs. As I see it, the flash
filesystem treats all flash as windowed, where linear flash is simply
treated as one big window, and uses the default paging function, which
in that case does nothing.
Any time I’ve done a flash driver, I’ve always set the window size to the
total size of the flash array. In your case, if you have four 28F160’s, for a
total of 8M, you should put the following in your open function:
#define FLASHSIZE 0x800000
…
socket->window_size=FLASHSIZE;
and change the constant when you switch to the 28F320 parts.
To have the driver automatically detect the size and number of the parts
that you have installed on the board, you’ll need to insert some code into
the open function to probe the flash; just read the jedec ID’s to determine
which flash part is installed, and if you know the offsets that each chip
would reside at if it were installed, probe at each address range where the
flash part would sit.
For example, if you know the flash array would start at address 0x1000000
regardless, read the jedec ID at that address. Now that you know the size
of the parts installed, probe at the next address (0x1200000) accordingly.
Once you probe and don’t get back a jedec ID, you’ll know how many of the
parts are installed.
: The devices on my board are 4 Intel 28F160B3’s linearly and sequentially
: mapped, and they’re identified (at least one of them is), and things are just
: lovely if I set socket->window_size = 2. When I try to set it to zero, the
: call to mmap_device_memory() references socket->window_size for the size of
: memory to map in (which is zero) so needless to say the driver gets a segment
: violation and dies. My main question is how do I go about describing a
: non-windowed array that will be probed so as I can install either 2 or 4 of
: these 28F160’s or 28F320’s and it’ll “just figure it out”? The 160’s are
: 2-megabyte parts, the 320’s are 4-megabyte parts. Let me know if you need more
: details.
: Regards,
: -Warren
Dave Green (dgreen@qnx.com)
Custom Engineering Services
QNX Software Systems Ltd.
http://www.qnx.com