From d79a3f750f985e4e316758018d0ed3bf56d9c1b9 Mon Sep 17 00:00:00 2001 From: batt Date: Tue, 21 Oct 2008 14:26:08 +0000 Subject: [PATCH] Merged from external project: ********** r22525 | batt | 2008-10-21 16:25:29 +0200(mar, 21 ott 2008) | 1 line Fix some errors and warnings. ********** git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1895 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/drv/dataflash.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bertos/drv/dataflash.c b/bertos/drv/dataflash.c index b85942a8..69b4bdf0 100644 --- a/bertos/drv/dataflash.c +++ b/bertos/drv/dataflash.c @@ -50,6 +50,8 @@ #include +#include + #include #include /* cpu_relax() */ @@ -309,7 +311,7 @@ static size_t dataflash_disk_buffer_read(struct BattFsSuper *d, pgaddr_t addr, v kfile_putc((byte_addr >> 16) & 0xff, fd->channel); kfile_putc((byte_addr >> 8) & 0xff, fd->channel); - kfile_putc((byte_addr & 0xff, fd->channel); + kfile_putc(byte_addr & 0xff, fd->channel); /* Send additional don't care byte to start read operation */ kfile_putc(0, fd->channel); @@ -317,6 +319,7 @@ static size_t dataflash_disk_buffer_read(struct BattFsSuper *d, pgaddr_t addr, v kfile_read(fd->channel, buf, len); //Read len bytes ad put in buffer. kfile_flush(fd->channel); // Flush channel fd->setCS(false); + return len; } static bool dataflash_disk_page_save(struct BattFsSuper *d, pgcnt_t page) @@ -402,7 +405,7 @@ static size_t dataflash_read(struct KFile *_fd, void *buf, size_t size) uint8_t *data = (uint8_t *)buf; - ASSERT(fd->fd.seek_pos + size <= (kfile_off_t)fd->fd.size); + ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= fd->fd.size); size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); LOG_INFO("Reading at pos[%lu]\n", fd->fd.seek_pos); @@ -427,7 +430,7 @@ static size_t dataflash_read(struct KFile *_fd, void *buf, size_t size) dataflash_readBlock(fd, page_addr, byte_addr, data, size); fd->fd.seek_pos += size; - LOG_INFO("Read %ld bytes\n", size); + LOG_INFO("Read %ld bytes\n", (long int)size); return size; } @@ -453,7 +456,7 @@ static size_t dataflash_write(struct KFile *_fd, const void *_buf, size_t size) const uint8_t *data = (const uint8_t *) _buf; - ASSERT(fd->fd.seek_pos + size <= (kfile_off_t)fd->fd.size); + ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= fd->fd.size); size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); LOG_INFO("Writing at pos[%lu]\n", fd->fd.seek_pos); @@ -494,7 +497,7 @@ static size_t dataflash_write(struct KFile *_fd, const void *_buf, size_t size) total_write += wr_len; } - LOG_INFO("written %lu bytes\n", total_write); + LOG_INFO("written %lu bytes\n", (long unsigned)total_write); return total_write; } -- 2.25.1