Merge contributed patch to extend support of atxmega.
[bertos.git] / bertos / cpu / avr / drv / flash_avr.h
index 6c06eaf345e95021da79811da003697a071a770b..b75a38b8b3ef1f80654116b8a0dbd0865abc1566 100644 (file)
  * \author Daniele Basile <asterix@develer.com>
  *
  * \brief AVR Internal flash read/write driver.
- *
- *
- */
-
-#ifndef FLASH_AT91_H
-#define FLASH_AT91_H
-
-#include <cpu/types.h>
-
-#include <cfg/compiler.h>
-
-#include <kern/kfile.h>
-
-#include <avr/io.h>
-
-
-#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;
+#ifndef FLASH_AVR_H
+#define FLASH_AVR_H
 
-       /**
-        * Temporary buffer cointaing data block to
-        * write on flash.
-        */
-       uint8_t page_buf[SPM_PAGESIZE];
-} FlashAvr;
-/* \} */
+#include "cfg/cfg_emb_flash.h"
 
-void flash_hw_init(struct Flash *fd);
+#if !CONFIG_FLASH_DISABLE_OLD_API
 
-/**
- * WARNING!
- * This function is DEPRECADED!
- * use the flash module instead.
- */
-INLINE void flash_avr_init(struct FlashAvr *fd)
-{
-       flash_hw_init((struct Flash *)fd);
-}
+       /* For backwards compatibility */
+       #define FlashAvr  Flash
+       #define flash_avr_init(fls)   flash_init(fls);
+#endif /* !CONFIG_FLASH_DISABLE_OLD_API */
 
 #endif /* DRV_FLASH_AVR_H */