projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactoring code. Redefined TagPacket struct and keytag_init to support the new imple...
[bertos.git]
/
bertos
/
drv
/
flash25.c
diff --git
a/bertos/drv/flash25.c
b/bertos/drv/flash25.c
index 1bb50fc8d2637b3ffcaf8e593293279823ab5ecd..e2356bdf7d0c1d32398e7d8ef529abba0eccb1a3 100644
(file)
--- a/
bertos/drv/flash25.c
+++ b/
bertos/drv/flash25.c
@@
-45,9
+45,7
@@
* We use a spi bus, thus include hardware specific definition.
* If you use another channel you must redefine this macros.
*/
* We use a spi bus, thus include hardware specific definition.
* If you use another channel you must redefine this macros.
*/
-#include "hw_spi.h"
-
-#include <appconfig.h>
+#include "hw/hw_spi.h"
#include <cfg/macros.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
@@
-61,7
+59,7
@@
#include <kern/proc.h>
#endif
#include <kern/proc.h>
#endif
-#warning
t
his file was change, but is untest!
+#warning
FIXME:T
his file was change, but is untest!
/**
* Wait until flash memory is ready.
/**
* Wait until flash memory is ready.
@@
-180,8
+178,8
@@
static size_t flash25_read(struct KFile *_fd, void *buf, size_t size)
KFileFlash25 *fd = KFILEFLASH25(_fd);
KFileFlash25 *fd = KFILEFLASH25(_fd);
- ASSERT(fd->fd.seek_pos + size <= fd->fd.size);
- size = MIN((
uint32
_t)size, fd->fd.size - fd->fd.seek_pos);
+ 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);
//kprintf("Reading at addr[%lu], size[%d]\n", fd->seek_pos, size);
CS_ENABLE();
//kprintf("Reading at addr[%lu], size[%d]\n", fd->seek_pos, size);
CS_ENABLE();
@@
-233,9
+231,9
@@
static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size)
KFileFlash25 *fd = KFILEFLASH25(_fd);
KFileFlash25 *fd = KFILEFLASH25(_fd);
- ASSERT(fd->fd.seek_pos + size <= fd->fd.size);
+ ASSERT(fd->fd.seek_pos +
(kfile_size_t)
size <= fd->fd.size);
- size = MIN((
flash25S
ize_t)size, fd->fd.size - fd->fd.seek_pos);
+ size = MIN((
kfile_s
ize_t)size, fd->fd.size - fd->fd.seek_pos);
while (size)
{
while (size)
{
@@
-284,7
+282,7
@@
static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size)
total_write += wr_len;
}
total_write += wr_len;
}
- kprintf("written %u bytes\n", total_write);
+ kprintf("written %
l
u bytes\n", total_write);
return total_write;
}
return total_write;
}
@@
-332,7
+330,7
@@
void flash25_sectorErase(KFileFlash25 *fd, Flash25Sector sector)
*/
flash25_waitReady(fd);
*/
flash25_waitReady(fd);
- DB(kprintf("Erased sector [%d] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time)));
+ DB(kprintf("Erased sector [%
l
d] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time)));
}
}
@@
-366,7
+364,7
@@
void flash25_chipErase(KFileFlash25 *fd)
*/
flash25_waitReady(fd);
*/
flash25_waitReady(fd);
- DB(kprintf("Erased all memory in %d ms\n", ticks_to_ms(timer_clock() - start_time)));
+ DB(kprintf("Erased all memory in %
l
d ms\n", ticks_to_ms(timer_clock() - start_time)));
}
}