flash_avr.h

Go to the documentation of this file.
00001 
00040 #ifndef DRV_FLASH_AVR_H
00041 #define DRV_FLASH_AVR_H
00042 
00043 #include <cfg/compiler.h>
00044 #include <kern/kfile.h>
00045 #include <avr/io.h>
00046 
00047 
00051 typedef uint16_t avr_page_t;
00052 
00053 
00057 typedef struct FlashAvr
00058 {
00062     KFile fd;
00063 
00067     avr_page_t curr_page;
00068 
00072     bool page_dirty;
00073 
00078     uint8_t page_buf[SPM_PAGESIZE];
00079 
00080 
00081 } FlashAvr;
00082 
00083 
00084 
00088 #define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
00089 
00093 INLINE FlashAvr * FLASHAVR_CAST(KFile *fd)
00094 {
00095     ASSERT(fd->_type == KFT_FLASHAVR);
00096     return (FlashAvr *)fd;
00097 }
00098 
00099 
00100 void flash_avr_init(struct FlashAvr *fd);
00101 
00102 
00103 
00104 #endif /* DRV_FLASH_AVR_H */