X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Favr%2Fdrv%2Fflash_avr.h;h=99abf9a1830583397d3b7e8b5b44e2468e058cc8;hb=e863779405806aeea209a213eeb82caa8f029acc;hp=390f648d92c78541329dd9741686e78cb05c1b22;hpb=2b1ef1c4e079e86db8512cec4dac031a0d19cb2f;p=bertos.git diff --git a/bertos/cpu/avr/drv/flash_avr.h b/bertos/cpu/avr/drv/flash_avr.h index 390f648d..99abf9a1 100644 --- a/bertos/cpu/avr/drv/flash_avr.h +++ b/bertos/cpu/avr/drv/flash_avr.h @@ -42,6 +42,13 @@ #include #include +#include + + +/** + * Definition of type for avr flash module. + */ +typedef uint16_t avr_page_t; /** @@ -49,7 +56,28 @@ */ typedef struct KFileFlashAvr { - KFile fd; ///< File descriptor. + /** + * File descriptor. + */ + KFile fd; + + /** + * Current buffered 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]; + + } KFileFlashAvr; @@ -69,9 +97,7 @@ INLINE KFileFlashAvr * KFILEFLASHAVR(KFile *fd) } - -bool flash_avr_test(void); -void flash_avr_init(struct KFile *fd); +void flash_avr_init(struct KFileFlashAvr *fd);