X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fdataflash.c;h=0f0d06041e39ca6142f5cbca7dba2eef95a0ba12;hb=47c8eef49f66490e23d139c2dda0d561620cae16;hp=ac1eeaf551b72bc4de4167dd5920d7cc06a27194;hpb=8200b51bd42e69333cbb3d50532bbd8b45201da2;p=bertos.git diff --git a/bertos/drv/dataflash.c b/bertos/drv/dataflash.c index ac1eeaf5..0f0d0604 100644 --- a/bertos/drv/dataflash.c +++ b/bertos/drv/dataflash.c @@ -27,12 +27,10 @@ * the GNU General Public License. * * Copyright 2007 Develer S.r.l. (http://www.develer.com/) - * * --> * * \brief Function library for dataflash AT45DB family (implementation). * - * * \version $Id: dataflash.c 21658 2008-06-05 16:42:54Z asterix $ * \author Daniele Basile * \author Francesco Sacchi @@ -54,11 +52,7 @@ #include -#if CONFIG_KERNEL - #include -#else - #define proc_yield() do {} while(0) -#endif +#include /* cpu_relax() */ #include @@ -215,7 +209,7 @@ static uint8_t dataflash_cmd(DataFlash *fd, dataflash_page_t page_addr, dataflas * is high. */ while (!(dataflash_stat(fd) & BUSY_BIT)) - proc_yield(); + cpu_relax(); stat = dataflash_stat(fd); @@ -349,8 +343,8 @@ 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_size_t)fd->fd.size); - size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); + ASSERT(fd->fd.seek_pos + size <= (kfile_off_t)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); @@ -401,7 +395,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); - size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); + size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); LOG_INFO("Writing at pos[%lu]\n", fd->fd.seek_pos);