* 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.
* Typicaly this kind of memory use an SPI bus, but you should
* use another comunication channel you have defined.
*
- * \version $Id$
* \author Daniele Basile <asterix@develer.com>
*/
#include <drv/timer.h>
#include <drv/flash25.h>
-#include <kern/kfile.h>
+#include <io/kfile.h>
-#if CONFIG_KERNEL
- #include <kern/proc.h>
-#else
- #define proc_yield() do {} while(0)
-#endif
+#include <cpu/power.h> /* 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.
if (!(stat & RDY_BIT))
break;
- else
- proc_yield();
+
+ cpu_relax();
}
}
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();
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)
{
*/
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)));
}
/**