#include <cfg/compiler.h>
#include <kern/kfile.h>
+#include <avr/io.h>
/**
/**
* FlashAvr KFile context structure.
*/
-typedef struct KFileFlashAvr
+typedef struct FlashAvr
{
/**
- * File descriptor.
- */
+ * File descriptor.
+ */
KFile fd;
/**
- * Current buffered page.
- */
+ * Current buffered page.
+ */
avr_page_t curr_page;
/**
- * Flag for checking if current page is modified.
- */
+ * Flag for checking if current page is modified.
+ */
bool page_dirty;
-} KFileFlashAvr;
+ /**
+ * Temporary buffer cointaing data block to
+ * write on flash.
+ */
+ uint8_t page_buf[SPM_PAGESIZE];
+
+
+} FlashAvr;
#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
/**
- * Convert + ASSERT from generic KFile to KFileFlashAvr.
+ * Convert + ASSERT from generic KFile to FlashAvr.
*/
-INLINE KFileFlashAvr * KFILEFLASHAVR(KFile *fd)
+INLINE FlashAvr * FLASHAVR_CAST(KFile *fd)
{
ASSERT(fd->_type == KFT_FLASHAVR);
- return (KFileFlashAvr *)fd;
+ return (FlashAvr *)fd;
}
-void flash_avr_init(struct KFileFlashAvr *fd);
+void flash_avr_init(struct FlashAvr *fd);