X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fflash25.c;h=e2356bdf7d0c1d32398e7d8ef529abba0eccb1a3;hb=70ad497f49e2c9283a0abf0866ef21d2017bf55f;hp=a36bbb38b2f8013feddfa24c8997040a24433348;hpb=e3467ccc87640e20dfe5b0b45c11cc06858d2392;p=bertos.git diff --git a/bertos/drv/flash25.c b/bertos/drv/flash25.c index a36bbb38..e2356bdf 100644 --- a/bertos/drv/flash25.c +++ b/bertos/drv/flash25.c @@ -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 +#include "hw/hw_spi.h" #include #include @@ -61,7 +59,7 @@ #include #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,7 +178,7 @@ 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); + 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); @@ -233,7 +231,7 @@ 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((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); @@ -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))); }