From: asterix Date: Mon, 26 May 2008 09:14:24 +0000 (+0000) Subject: Cast some variable to corret size type. X-Git-Tag: 2.0.0~585 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=44f501a2cd0ff526d5a0c46a20f0940c5656d402;p=bertos.git Cast some variable to corret size type. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1349 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/dataflash.c b/bertos/drv/dataflash.c index c2ba9b07..20844aa9 100644 --- a/bertos/drv/dataflash.c +++ b/bertos/drv/dataflash.c @@ -348,7 +348,7 @@ static size_t dataflash_read(struct KFile *_fd, void *buf, size_t size) ASSERT(fd->fd.seek_pos + size <= fd->fd.size); - size = MIN((uint32_t)size, fd->fd.size - fd->fd.seek_pos); + size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); kprintf("Reading at pos[%lu]\n", fd->fd.seek_pos); @@ -399,7 +399,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 <= fd->fd.size); - size = MIN((uint32_t)size, fd->fd.size - fd->fd.seek_pos); + size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); kprintf("Writing at pos[%lu]\n", fd->fd.seek_pos); @@ -412,7 +412,7 @@ static size_t dataflash_write(struct KFile *_fd, const void *_buf, size_t size) offset = fd->fd.seek_pos % mem_info[fd->dev].page_size; - size_t wr_len = MIN(size, mem_info[fd->dev].page_size - offset); + size_t wr_len = MIN((dataflash_size_t)size, mem_info[fd->dev].page_size - offset); kprintf(" [page-<%ld>, byte-<%ld>]",new_page, offset); diff --git a/bertos/drv/dataflash.h b/bertos/drv/dataflash.h index 69f3217b..e9ef00af 100644 --- a/bertos/drv/dataflash.h +++ b/bertos/drv/dataflash.h @@ -32,8 +32,8 @@ * * \brief Function library for AT45DB081D Flash memory. * - * * \version $Id: dataflash.h 20677 2008-02-19 14:29:52Z batt $ + * * \author Daniele Basile */ @@ -41,9 +41,10 @@ #ifndef DRV_DATAFLASH_H #define DRV_DATAFLASH_H -#include #include +#include + /** * Type definitions for dflash memory. * \{ @@ -69,9 +70,10 @@ typedef void (dataflash_setCS_t)(bool); */ typedef enum DataflashType { - DFT_AT45DB041B, + DFT_AT45DB041B = 0, DFT_AT45DB081D, DFT_AT45DB161D, + DFT_AT45DB642D, DFT_CNT } DataflashType;