t

Dependencies:   DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos

Fork of DMSupport by Embedded Artists

Revision:
29:b1ec19000e15
Parent:
22:1a58a518435c
Child:
33:8a0a99d54bf8
--- a/FileSystems/QSPIFileSystem.cpp	Fri Jan 23 17:31:56 2015 +0100
+++ b/FileSystems/QSPIFileSystem.cpp	Mon Jan 26 10:12:57 2015 +0100
@@ -29,7 +29,7 @@
 
 #define MEM_SIZE    (memInfo.memSize)
 #define ERASE_SIZE  (memInfo.eraseBlockSize)
-#define NUM_BLOCKS  (memInfo.numEraseBlocks)
+#define NUM_BLOCKS  ((int)(memInfo.numEraseBlocks))
 
 typedef uint32_t toc_entry_t;
 
@@ -348,7 +348,7 @@
 
   // Search for the first unused TOC, keeping track of the valid
   // ones as we go.
-  for (i = 0; (i < NUM_TOCS) && !invalid; i++)
+  for (i = 0; (i < (int)NUM_TOCS) && !invalid; i++)
   {
     p = (toc_entry_t*)(TOC_BLOCK_ADDR + i*TOC_SIZE);
     for (j = 0; j < NUM_BLOCKS; j++)
@@ -457,7 +457,7 @@
     opers.scratch = NULL;
     opers.protect = 0;
     opers.options = S_VERIFY_PROG | S_CALLER_ERASE;
-    for (int i = 0; i < (TOC_SIZE / PROG_SIZE); i++) 
+    for (uint32_t i = 0; i < (TOC_SIZE / PROG_SIZE); i++)
     {
       opers.dest = (char *)(TOC_BLOCK_ADDR + activeTOC*TOC_SIZE + i*PROG_SIZE);
       rc = spifi->spifi_program(obj, ((char*)TOC)+i*PROG_SIZE, &opers);
@@ -800,12 +800,12 @@
  *****************************************************************************/
 static fresult qspifs_format(unsigned int minReservedBytes)
 {
-  int i, rc;
-  int numReserved = 0;
+  int rc;
+  uint32_t i, numReserved = 0;
   
   if (minReservedBytes > 0) {
     numReserved = (minReservedBytes + ERASE_SIZE - 1) / ERASE_SIZE;
-    if (numReserved >= (NUM_BLOCKS - 2)) {
+    if (numReserved >= (uint32_t)(NUM_BLOCKS - 2)) {
       // Too many of the erase blocks are reserved - not even room for one file
       return FS_ERR_INVALID_PARAM;
     }
@@ -845,7 +845,7 @@
   for (; i < (NUM_BLOCKS - NUM_TOC_BLOCKS); i++) {
     TOC[i] = ~TOC_VALID_MASK;
   }
-  for (; i < NUM_BLOCKS; i++) {
+  for (; i < (uint32_t)NUM_BLOCKS; i++) {
     TOC[i] = ~(TOC_VALID_MASK | TOC_RESERVED_MASK);
   }