diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-05-27 21:44:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-05-27 21:44:20 +0000 |
commit | 2547315d49a4ee9f2fc61d54260a8b1f37f33cbd (patch) | |
tree | 56cf83810b788b5aa43d845ce3f4842275ed0e3c /nuttx | |
parent | 541f8a338b93b1d1cc58573765de286cf441ee6f (diff) | |
download | px4-nuttx-2547315d49a4ee9f2fc61d54260a8b1f37f33cbd.tar.gz px4-nuttx-2547315d49a4ee9f2fc61d54260a8b1f37f33cbd.tar.bz2 px4-nuttx-2547315d49a4ee9f2fc61d54260a8b1f37f33cbd.zip |
Fix FAT32 bug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1829 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/ChangeLog | 8 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 9 | ||||
-rw-r--r-- | nuttx/TODO | 7 | ||||
-rw-r--r-- | nuttx/drivers/mmcsd/mmcsd_spi.c | 2 | ||||
-rw-r--r-- | nuttx/fs/fat/fs_fat32util.c | 21 |
5 files changed, 28 insertions, 19 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 51abe18d0..7aed46af7 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -734,8 +734,14 @@ * examples/nsh: Added MMC/SD support for the LM3S6918 * arch/arm/src/lm3s: Fix logic for setting and clearing output GPIOs (critical 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 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. + * 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. + diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 7c22f7ea0..05a6ca377 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <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> </tr> </table> @@ -1424,10 +1424,15 @@ nuttx-0.4.7 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * examples/nsh: Added MMC/SD support for the LM3S6918 * arch/arm/src/lm3s: Fix logic for setting and clearing output GPIOs (critical 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 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. + * 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 <spudmonkey@racsa.co.cr> diff --git a/nuttx/TODO b/nuttx/TODO index 679077b22..6f3c9f809 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -10,7 +10,7 @@ NuttX TODO List (Last updated April 12, 2009) (12) Network (net/, netutils/) (1) USB (drivers/usbdev) (4) Libraries (lib/) - (6) File system/Generic drivers (fs/, drivers/) + (7) File system/Generic drivers (fs/, drivers/) (2) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (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 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 yet handle multiple block transfers. Status: Open diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c index da18cca80..e7f81e16f 100644 --- a/nuttx/drivers/mmcsd/mmcsd_spi.c +++ b/nuttx/drivers/mmcsd/mmcsd_spi.c @@ -1575,7 +1575,6 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) result = mmcsd_sendcmd(slot, &g_cmd55, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) { - SPI_SEND(spi, 0xff); result = mmcsd_sendcmd(slot, &g_acmd41, 0); if (result == MMCSD_SPIR1_OK) { @@ -1586,7 +1585,6 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) else { fvdbg("%d. Send CMD1\n", i); - SPI_SEND(spi, 0xff); result = mmcsd_sendcmd(slot, &g_cmd1, 0); if (result == MMCSD_SPIR1_OK) { diff --git a/nuttx/fs/fat/fs_fat32util.c b/nuttx/fs/fat/fs_fat32util.c index 16f47727b..7353dee88 100644 --- a/nuttx/fs/fat/fs_fat32util.c +++ b/nuttx/fs/fat/fs_fat32util.c @@ -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) { - /* 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 && - FSI_GETSTRUCTSIG(fs->fs_buffer) == 0x61417272 && - FSI_GETTRAILSIG(fs->fs_buffer) == BOOT_SIGNATURE32) + if (fat_fscacheread(fs, fs->fs_fsinfo) == OK) { - fs->fs_fsinextfree = FSI_GETFREECOUNT(fs->fs_buffer); - fs->fs_fsifreecount = FSI_GETNXTFREE(fs->fs_buffer); - return OK; + /* Verify that this is, indeed, an FSINFO sector */ + + 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; } @@ -697,7 +702,7 @@ int fat_mount(struct fat_mountpt_s *fs, boolean writeable) ret = fat_checkfsinfo(fs); if (ret != OK) { - goto errout_with_buffer; + goto errout_with_buffer; } } |