shell cmd msdosfmt a NOOP (in 4.9.1) for SD/MMC
Gene Smith
gds at chartertn.net
Fri Jan 23 23:07:43 UTC 2009
I tried the shell command msdosfmt again on my MMC and still nothing
happens. I thought I had all my drivers working OK. It gets to the point
in the format code where it wants to write a block to flash but the
"write_entry" for the driver is NULL so nothing happens. However, no
error is flagged so the shell still prints "formatting successful."
The write_entry is the NULL entry for sd_card_disk_ops in spi-sd-card.c.
When I change it from NULL and set it to sd_card_driver_write (a
function in the same file that I had never seen called) msdosfmt
attempts to do the write of the block with this function.
However, it still fails inside sd_card_driver_write(). I think because
the driver table "e" that it gets with the call to
sd_card_driver_get_entry() is bad since the "major number" is 8 (a 2nd
instance) instead of "major number" 9 (the first instance with the flash
info set correctly). This kludge fixes it inside 4.9.1's
sd_card_driver_write():
/* Get driver entry */
#if 0
rv = sd_card_driver_get_entry(minor, &e);
CHECK_RVSC( rv, "Get driver entry");
#else
e = &sd_card_driver_table[0];
#endif
/* Start */
sc = sd_card_start(e); <---this failed with #if 0 code!
I made the same change in sd_card_driver_read(), not sure if it is called.
Looking at the HEAD version of spi-sd-card.c, I see it has been changed
so that there would only be a single "major" instance generated per bus
device (in my case one SPI device). Also functions
sd_card_driver_write/read() are removed from HEAD. However, the
"write_entry" function is now rtems_blkdev_generic_write (not defined in
4.9.1). Hopefully the correct function will be called when msdosfmt code
calls rtems_blkdev_generic_write().
-gene
More information about the users
mailing list