projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refomart.
[bertos.git]
/
bertos
/
cpu
/
avr
/
drv
/
flash_avr.h
diff --git
a/bertos/cpu/avr/drv/flash_avr.h
b/bertos/cpu/avr/drv/flash_avr.h
index 5115d10befde2431238b2b82c6808b5401ce028d..0897132c358809eb3c024c0c9779a739479a7345 100644
(file)
--- a/
bertos/cpu/avr/drv/flash_avr.h
+++ b/
bertos/cpu/avr/drv/flash_avr.h
@@
-42,6
+42,7
@@
#include <cfg/compiler.h>
#include <kern/kfile.h>
#include <cfg/compiler.h>
#include <kern/kfile.h>
+#include <avr/io.h>
/**
/**
@@
-53,17
+54,31
@@
typedef uint16_t avr_page_t;
/**
* FlashAvr KFile context structure.
*/
/**
* FlashAvr KFile context structure.
*/
-typedef struct
KFile
FlashAvr
+typedef struct FlashAvr
{
{
- KFile fd; ///< File descriptor.
+ /**
+ * File descriptor.
+ */
+ KFile fd;
/**
/**
- * Current buffered page.
- */
+
* Current buffered page.
+
*/
avr_page_t curr_page;
avr_page_t curr_page;
+ /**
+ * Flag for checking if current page is modified.
+ */
+ bool page_dirty;
+
+ /**
+ * Temporary buffer cointaing data block to
+ * write on flash.
+ */
+ uint8_t page_buf[SPM_PAGESIZE];
+
-}
KFile
FlashAvr;
+} FlashAvr;
@@
-73,16
+88,16
@@
typedef struct KFileFlashAvr
#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
/**
#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
/**
- * Convert + ASSERT from generic KFile to
KFile
FlashAvr.
+ * Convert + ASSERT from generic KFile to FlashAvr.
*/
*/
-INLINE
KFileFlashAvr * KFILEFLASHAVR
(KFile *fd)
+INLINE
FlashAvr * FLASHAVR_CAST
(KFile *fd)
{
ASSERT(fd->_type == KFT_FLASHAVR);
{
ASSERT(fd->_type == KFT_FLASHAVR);
- return (
KFile
FlashAvr *)fd;
+ return (FlashAvr *)fd;
}
}
-void flash_avr_init(struct
KFile
FlashAvr *fd);
+void flash_avr_init(struct FlashAvr *fd);