Add support for more FAT partitions; support for SD cards greater than 4Gb; TSC2007 touchscreen driver improvements

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4092 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-11-15 16:44:45 +00:00
parent d5a6c4870e
commit 0fe0a10e9f
6 changed files with 251 additions and 70 deletions
+16 -6
View File
@@ -38,6 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -128,11 +129,15 @@ struct mmcsd_state_s
/* Memory card geometry (extracted from the CSD) */
uint8_t blockshift; /* Log2 of blocksize */
uint8_t blockshift; /* Log2 of blocksize */
uint16_t blocksize; /* Read block length (== block size) */
size_t nblocks; /* Number of blocks */
size_t capacity; /* Total capacity of volume */
uint32_t nblocks; /* Number of blocks */
#ifdef CONFIG_HAVE_LONG_LONG
uint64_t capacity; /* Total capacity of volume */
#else
uint32_t capacity; /* Total capacity of volume (Limited to 4Gb) */
#endif
/* Read-ahead and write buffering support */
#if defined(CONFIG_FS_WRITEBUFFER) || defined(CONFIG_FS_READAHEAD)
@@ -635,7 +640,11 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
*/
uint32_t csize = ((csd[1] & 0x3f) << 16) | (csd[2] >> 16);
#ifdef CONFIG_HAVE_LONG_LONG
priv->capacity = ((uint64_t)(csize + 1)) << 19;
#else
priv->capacity = (csize + 1) << 19;
#endif
priv->blockshift = 9;
priv->blocksize = 1 << 9;
priv->nblocks = priv->capacity >> 9;
@@ -802,8 +811,9 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
fvdbg(" FILE_FORMAT: %d ECC: %d (MMC) CRC: %d\n",
decoded.fileformat, decoded.mmcecc, decoded.crc);
fvdbg("Capacity: %dKb, Block size: %db, nblocks: %d wrprotect: %d\n",
priv->capacity / 1024, priv->blocksize, priv->nblocks, priv->wrprotect);
fvdbg("Capacity: %luKb, Block size: %db, nblocks: %d wrprotect: %d\n",
(unsigned long)(priv->capacity / 1024), priv->blocksize,
priv->nblocks, priv->wrprotect);
#endif
}
@@ -2759,7 +2769,7 @@ static int mmcsd_probe(FAR struct mmcsd_state_s *priv)
if (ret == OK)
{
/* Yes... */
fvdbg("Capacity: %lu Kbytes\n", (unsigned long)(priv->capacity / 1024));
priv->mediachanged = true;