X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fflash25.c;h=0f67e3d443689b921ba14249dcd09b90bffbf32c;hb=ce5ddc07440aeb1357c7133beac6959b90d21885;hp=807ff2114286be9b8b94600224c19487352337b7;hpb=8200b51bd42e69333cbb3d50532bbd8b45201da2;p=bertos.git diff --git a/bertos/drv/flash25.c b/bertos/drv/flash25.c index 807ff211..0f67e3d4 100644 --- a/bertos/drv/flash25.c +++ b/bertos/drv/flash25.c @@ -27,10 +27,9 @@ * the GNU General Public License. * * Copyright 2007 Develer S.r.l. (http://www.develer.com/) - * * --> * - * \brief Function library for serial Flash memory. + * \brief Function library for serial Flash memory. * * Module provide a kfile interface, that ensure an abstraction * from comunication channel and give a standard interface. @@ -55,13 +54,9 @@ #include -#if CONFIG_KERNEL - #include -#else - #define proc_yield() do {} while(0) -#endif +#include /* cpu_relax() */ -#warning FIXME:This file was change, but is untest! +#warning FIXME:This file was changed, but is untested! /** * Wait until flash memory is ready. @@ -81,8 +76,8 @@ static void flash25_waitReady(Flash25 *fd) if (!(stat & RDY_BIT)) break; - else - proc_yield(); + + cpu_relax(); } } @@ -178,8 +173,8 @@ static size_t flash25_read(struct KFile *_fd, void *buf, size_t size) Flash25 *fd = FLASH25_CAST(_fd); - 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); + 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); //kprintf("Reading at addr[%lu], size[%d]\n", fd->seek_pos, size); CS_ENABLE(); @@ -231,9 +226,9 @@ static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size) Flash25 *fd = FLASH25_CAST(_fd); - ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size); + ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= 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); while (size) { @@ -330,8 +325,7 @@ void flash25_sectorErase(Flash25 *fd, Flash25Sector sector) */ flash25_waitReady(fd); - DB(kprintf("Erased sector [%ld] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time))); - + DB(kprintf("Erased sector [%ld] in %ld ms\n", (unsigned long)sector, (unsigned long)ticks_to_ms(timer_clock() - start_time))); } /**