X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Favr%2Fdrv%2Fflash_avr.h;h=ecbe1b772cccda9f8e038b10b13eaa75e0e27e5f;hb=911d2706a86d326786bfe721dcc3d63aeade7f28;hp=7b4317d97106029c5bbab80e341f88a153ef6060;hpb=345f93de1963f49bdb194d2b06c8c5d7ba0a3e5f;p=bertos.git diff --git a/bertos/cpu/avr/drv/flash_avr.h b/bertos/cpu/avr/drv/flash_avr.h index 7b4317d9..ecbe1b77 100644 --- a/bertos/cpu/avr/drv/flash_avr.h +++ b/bertos/cpu/avr/drv/flash_avr.h @@ -30,21 +30,78 @@ * * --> * - * \brief Self programming routines (interface). - * - * \version $Id$ * \author Francesco Sacchi * \author Daniele Basile + * + * \brief AVR Internal flash read/write driver. + * + * */ -#ifndef DRV_FLASH_AVR_H -#define DRV_FLASH_AVR_H +#ifndef FLASH_AT91_H +#define FLASH_AT91_H + +#include #include -#include -bool flash_avr_test(void); -void flash_avr_init(struct KFile *fd); +#include + +#include + + +#define FLASH_PAGE_SIZE SPM_PAGESIZE + +/** + * Definition of type for avr flash module. + */ +typedef uint16_t page_t; + +/* Forward declaration */ +struct Flash; + +/** + * FlashAvr KFile context structure. + * DEPREACTED STRUCTURE! + * Use Flash instead + * + * \{ + */ +typedef struct FlashAvr +{ + /** + * File descriptor. + */ + KFile fd; + + /** + * Flag for checking if current page is modified. + */ + bool page_dirty; + /** + * Current buffered page. + */ + page_t curr_page; + + /** + * Temporary buffer cointaing data block to + * write on flash. + */ + uint8_t page_buf[SPM_PAGESIZE]; +} FlashAvr; +/* \} */ + +void flash_hw_init(struct Flash *fd); + +/** + * WARNING! + * This function is DEPRECADED! + * use the flash module instead. + */ +INLINE void flash_avr_init(struct FlashAvr *fd) +{ + flash_hw_init((struct Flash *)fd); +} #endif /* DRV_FLASH_AVR_H */