Fix FAT32 bug

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1829 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-05-27 21:44:20 +00:00
parent f937ea210c
commit 75604f27d0
5 changed files with 28 additions and 19 deletions
+7 -1
View File
@@ -734,8 +734,14 @@
* examples/nsh: Added MMC/SD support for the LM3S6918 * examples/nsh: Added MMC/SD support for the LM3S6918
* arch/arm/src/lm3s: Fix logic for setting and clearing output GPIOs (critical * arch/arm/src/lm3s: Fix logic for setting and clearing output GPIOs (critical
fix!). fix!).
* drivers/mmcsd: Found numerous errors in current MMC/SD SPI driver. Bad frequency * drivers/mmcsd: Found numerous errors in current MMC/SD SPI driver. Bad frequency
calculation based on CSD settings, inappropriate timeouts, odd code that looks like calculation based on CSD settings, inappropriate timeouts, odd code that looks like
a bad search and replace. Also needs support for SDHC ver 2.x. New MMC/SD is a bad search and replace. Also needs support for SDHC ver 2.x. New MMC/SD is
largely redesigned and probably non-functional in the first check-in. largely redesigned and probably non-functional in the first check-in.
* drivers/mmcsd: Changes verified on 4Gb Kingston SHDC card. Still having
issues with 2Gb SanDisk SDC card.
* fs/fat: With the 4Gb card, the first tests of FAT32 were (finally) performed.
Found a correct a problem that prevented use of FAT32: It was not updating
the sector cache before checking the FAT32 FSINFO sector.
+7 -2
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: May 26, 2009</p> <p>Last Updated: May 27, 2009</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1424,10 +1424,15 @@ nuttx-0.4.7 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* examples/nsh: Added MMC/SD support for the LM3S6918 * examples/nsh: Added MMC/SD support for the LM3S6918
* arch/arm/src/lm3s: Fix logic for setting and clearing output GPIOs (critical * arch/arm/src/lm3s: Fix logic for setting and clearing output GPIOs (critical
fix!). fix!).
* drivers/mmcsd: Found numerous errors in current MMC/SD SPI driver. Bad frequency * drivers/mmcsd: Found numerous errors in current MMC/SD SPI driver. Bad frequency
calculation based on CSD settings, inappropriate timeouts, odd code that looks like calculation based on CSD settings, inappropriate timeouts, odd code that looks like
a bad search and replace. Also needs support for SDHC ver 2.x. New MMC/SD is a bad search and replace. Also needs support for SDHC ver 2.x. New MMC/SD is
largely redesigned and probably non-functional in the first check-in. largely redesigned and probably non-functional in the first check-in.
* drivers/mmcsd: Changes verified on 4Gb Kingston SHDC card. Still having
issues with 2Gb SanDisk SDC card.
* fs/fat: With the 4Gb card, the first tests of FAT32 were (finally) performed.
Found a correct a problem that prevented use of FAT32: It was not updating
the sector cache before checking the FAT32 FSINFO sector.
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+1 -6
View File
@@ -10,7 +10,7 @@ NuttX TODO List (Last updated April 12, 2009)
(12) Network (net/, netutils/) (12) Network (net/, netutils/)
(1) USB (drivers/usbdev) (1) USB (drivers/usbdev)
(4) Libraries (lib/) (4) Libraries (lib/)
(6) File system/Generic drivers (fs/, drivers/) (7) File system/Generic drivers (fs/, drivers/)
(2) Graphics subystem (graphics/) (2) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/) (1) Pascal add-on (pcode/)
(0) Documentation (Documentation/) (0) Documentation (Documentation/)
@@ -289,11 +289,6 @@ o File system / Generic drivers (fs/, drivers/)
Priority: Low. I have mixed feelings about if NuttX should pay a Priority: Low. I have mixed feelings about if NuttX should pay a
performance penalty for better data integrity. performance penalty for better data integrity.
Description: FAT: FAT32 is untested -- because I don't have any large
enough devices yet to support a FAT32 FS.
Status: Open
Priority: Medium
Description: The simple SPI based MMCS/SD driver in fs/mmcsd does not Description: The simple SPI based MMCS/SD driver in fs/mmcsd does not
yet handle multiple block transfers. yet handle multiple block transfers.
Status: Open Status: Open
-2
View File
@@ -1575,7 +1575,6 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
result = mmcsd_sendcmd(slot, &g_cmd55, 0); result = mmcsd_sendcmd(slot, &g_cmd55, 0);
if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK)
{ {
SPI_SEND(spi, 0xff);
result = mmcsd_sendcmd(slot, &g_acmd41, 0); result = mmcsd_sendcmd(slot, &g_acmd41, 0);
if (result == MMCSD_SPIR1_OK) if (result == MMCSD_SPIR1_OK)
{ {
@@ -1586,7 +1585,6 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
else else
{ {
fvdbg("%d. Send CMD1\n", i); fvdbg("%d. Send CMD1\n", i);
SPI_SEND(spi, 0xff);
result = mmcsd_sendcmd(slot, &g_cmd1, 0); result = mmcsd_sendcmd(slot, &g_cmd1, 0);
if (result == MMCSD_SPIR1_OK) if (result == MMCSD_SPIR1_OK)
{ {
+13 -8
View File
@@ -262,15 +262,20 @@ static inline int fat_path2dirname(const char **path, struct fat_dirinfo_s *diri
static int fat_checkfsinfo(struct fat_mountpt_s *fs) static int fat_checkfsinfo(struct fat_mountpt_s *fs)
{ {
/* Verify that this is, indeed, an FSINFO sector */ /* Make sure that the fsinfo sector is in the cache */
if (FSI_GETLEADSIG(fs->fs_buffer) == 0x41615252 && if (fat_fscacheread(fs, fs->fs_fsinfo) == OK)
FSI_GETSTRUCTSIG(fs->fs_buffer) == 0x61417272 &&
FSI_GETTRAILSIG(fs->fs_buffer) == BOOT_SIGNATURE32)
{ {
fs->fs_fsinextfree = FSI_GETFREECOUNT(fs->fs_buffer); /* Verify that this is, indeed, an FSINFO sector */
fs->fs_fsifreecount = FSI_GETNXTFREE(fs->fs_buffer);
return OK; if (FSI_GETLEADSIG(fs->fs_buffer) == 0x41615252 &&
FSI_GETSTRUCTSIG(fs->fs_buffer) == 0x61417272 &&
FSI_GETTRAILSIG(fs->fs_buffer) == BOOT_SIGNATURE32)
{
fs->fs_fsinextfree = FSI_GETFREECOUNT(fs->fs_buffer);
fs->fs_fsifreecount = FSI_GETNXTFREE(fs->fs_buffer);
return OK;
}
} }
return -ENODEV; return -ENODEV;
} }
@@ -697,7 +702,7 @@ int fat_mount(struct fat_mountpt_s *fs, boolean writeable)
ret = fat_checkfsinfo(fs); ret = fat_checkfsinfo(fs);
if (ret != OK) if (ret != OK)
{ {
goto errout_with_buffer; goto errout_with_buffer;
} }
} }