X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Favr%2Fdrv%2Fflash_avr.h;h=6c06eaf345e95021da79811da003697a071a770b;hb=51157819d281eeca3d8afa8c27e22353c301e2ca;hp=11838ebacf466864e28a29d64231a087ed1c0bde;hpb=393cbf1be81da0ba8fd5c7eb57f70b3fa76487bf;p=bertos.git diff --git a/bertos/cpu/avr/drv/flash_avr.h b/bertos/cpu/avr/drv/flash_avr.h index 11838eba..6c06eaf3 100644 --- a/bertos/cpu/avr/drv/flash_avr.h +++ b/bertos/cpu/avr/drv/flash_avr.h @@ -30,31 +30,44 @@ * * --> * - * \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 + #include +#define FLASH_PAGE_SIZE SPM_PAGESIZE + /** * Definition of type for avr flash module. */ -typedef uint16_t avr_page_t; +typedef uint16_t page_t; +/* Forward declaration */ +struct Flash; /** * FlashAvr KFile context structure. + * DEPREACTED STRUCTURE! + * Use Flash instead + * + * \{ */ -typedef struct KFileFlashAvr +typedef struct FlashAvr { /** * File descriptor. @@ -62,43 +75,33 @@ typedef struct KFileFlashAvr KFile fd; /** - * Current buffered page. + * Flag for checking if current page is modified. */ - avr_page_t curr_page; + bool page_dirty; /** - * Flag for checking if current page is modified. + * Current buffered page. */ - bool page_dirty; + page_t curr_page; /** * Temporary buffer cointaing data block to * write on flash. */ uint8_t page_buf[SPM_PAGESIZE]; +} FlashAvr; +/* \} */ - -} KFileFlashAvr; - - - -/** - * ID for FlashAvr - */ -#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V') +void flash_hw_init(struct Flash *fd); /** - * Convert + ASSERT from generic KFile to KFileFlashAvr. + * WARNING! + * This function is DEPRECADED! + * use the flash module instead. */ -INLINE KFileFlashAvr * KFILEFLASHAVR(KFile *fd) +INLINE void flash_avr_init(struct FlashAvr *fd) { - ASSERT(fd->_type == KFT_FLASHAVR); - return (KFileFlashAvr *)fd; + flash_hw_init((struct Flash *)fd); } - -void flash_avr_init(struct KFileFlashAvr *fd); - - - #endif /* DRV_FLASH_AVR_H */