X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fcpu%2Favr%2Fdrv%2Fflash_avr.h;h=4a0aea73f88eaacb05f61198121333d0c0ee1f8f;hb=ac4ffd37dc8234b555bf2f540bd09210febdd11b;hp=db6152a9244d5934b5eff0d5703094082e2d3346;hpb=20864a0b7de7b14931826c17f113f8435fea523c;p=bertos.git diff --git a/bertos/cpu/avr/drv/flash_avr.h b/bertos/cpu/avr/drv/flash_avr.h index db6152a9..4a0aea73 100644 --- a/bertos/cpu/avr/drv/flash_avr.h +++ b/bertos/cpu/avr/drv/flash_avr.h @@ -42,6 +42,7 @@ #include #include +#include /** @@ -53,24 +54,31 @@ typedef uint16_t avr_page_t; /** * FlashAvr KFile context structure. */ -typedef struct KFileFlashAvr +typedef struct FlashAvrKFile { /** - * 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]; + + +} FlashAvrKFile; @@ -80,16 +88,16 @@ typedef struct KFileFlashAvr #define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V') /** - * Convert + ASSERT from generic KFile to KFileFlashAvr. + * Convert + ASSERT from generic KFile to FlashAvrKFile. */ -INLINE KFileFlashAvr * KFILEFLASHAVR(KFile *fd) +INLINE FlashAvrKFile * FLASHAVRKFILE(KFile *fd) { ASSERT(fd->_type == KFT_FLASHAVR); - return (KFileFlashAvr *)fd; + return (FlashAvrKFile *)fd; } -void flash_avr_init(struct KFileFlashAvr *fd); +void flash_avr_init(struct FlashAvrKFile *fd);