Refactor the module to new kblock device.
[bertos.git] / bertos / cpu / avr / drv / flash_avr.h
index ecbe1b772cccda9f8e038b10b13eaa75e0e27e5f..6556e95d87ec70461b06ca25f422de76ff0c34cd 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 <io/kfile.h>
-
-#include <avr/io.h>
-
-
-#define FLASH_PAGE_SIZE SPM_PAGESIZE
-
-/**
- * Definition of type for avr flash module.
- */
-typedef uint16_t page_t;
+#ifndef FLASH_AVR_H
+#define FLASH_AVR_H
 
-/* Forward declaration */
-struct Flash;
+#include "cfg/cfg_emb_flash.h"
 
-/**
- * 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);
-}
+#if !CONFIG_FLASH_DISABLE_OLD_API
+       /* For backwards compatibility */
+       #define FlashAvr  Flash
+#endif /* !CONFIG_FLASH_DISABLE_OLD_API */
 
 #endif /* DRV_FLASH_AVR_H */