Add specific check routine for compiling under OS X
[bertos.git] / bertos / drv / flash25.c
index 1bb50fc8d2637b3ffcaf8e593293279823ab5ecd..e2356bdf7d0c1d32398e7d8ef529abba0eccb1a3 100644 (file)
@@ -45,9 +45,7 @@
  * We use a spi bus, thus include hardware specific definition.
  * If you use another channel you must redefine this macros.
  */
-#include "hw_spi.h"
-
-#include <appconfig.h>
+#include "hw/hw_spi.h"
 
 #include <cfg/macros.h>
 #include <cfg/debug.h>
@@ -61,7 +59,7 @@
 #include <kern/proc.h>
 #endif
 
-#warning this file was change, but is untest!
+#warning FIXME:This file was change, but is untest!
 
 /**
  * Wait until flash memory is ready.
@@ -180,8 +178,8 @@ static size_t flash25_read(struct KFile *_fd, void *buf, size_t size)
 
        KFileFlash25 *fd = KFILEFLASH25(_fd);
 
-       ASSERT(fd->fd.seek_pos + size <= fd->fd.size);
-       size = MIN((uint32_t)size, fd->fd.size - fd->fd.seek_pos);
+       ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size);
+       size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos);
 
        //kprintf("Reading at addr[%lu], size[%d]\n", fd->seek_pos, size);
        CS_ENABLE();
@@ -233,9 +231,9 @@ static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size)
 
        KFileFlash25 *fd = KFILEFLASH25(_fd);
 
-       ASSERT(fd->fd.seek_pos + size <= fd->fd.size);
+       ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size);
 
-       size = MIN((flash25Size_t)size, fd->fd.size - fd->fd.seek_pos);
+       size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos);
 
        while (size)
        {
@@ -284,7 +282,7 @@ static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size)
                total_write += wr_len;
        }
 
-       kprintf("written %u bytes\n", total_write);
+       kprintf("written %lu bytes\n", total_write);
        return total_write;
 }
 
@@ -332,7 +330,7 @@ void flash25_sectorErase(KFileFlash25 *fd, Flash25Sector sector)
         */
        flash25_waitReady(fd);
 
-       DB(kprintf("Erased sector [%d] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time)));
+       DB(kprintf("Erased sector [%ld] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time)));
 
 }
 
@@ -366,7 +364,7 @@ void flash25_chipErase(KFileFlash25 *fd)
         */
        flash25_waitReady(fd);
 
-       DB(kprintf("Erased all memory in %d ms\n", ticks_to_ms(timer_clock() - start_time)));
+       DB(kprintf("Erased all memory in %ld ms\n", ticks_to_ms(timer_clock() - start_time)));
 
 }