Refactor the module to new kblock device.
[bertos.git] / bertos / cpu / avr / drv / flash_avr.h
index bb7698aba42bb9072f9b1457d332edb7c5d60519..6556e95d87ec70461b06ca25f422de76ff0c34cd 100644 (file)
  *
  * -->
  *
- * \brief Self programming routines (interface).
- *
- * \version $Id$
  * \author Francesco Sacchi <batt@develer.com>
  * \author Daniele Basile <asterix@develer.com>
+ *
+ * \brief AVR Internal flash read/write driver.
  */
 
-#ifndef DRV_FLASH_AVR_H
-#define DRV_FLASH_AVR_H
-
-#include <cfg/compiler.h>
-#include <kern/kfile.h>
-
-
-/**
- * Definition of type for avr flash module.
- */
-typedef uint16_t avr_page_t;
-
-
-/**
- * FlashAvr KFile context structure.
- */
-typedef struct KFileFlashAvr
-{
-       /**
-       * File descriptor.
-       */
-       KFile fd;
-
-       /**
-       * Current buffered page.
-       */
-       avr_page_t curr_page;
-
-       /**
-       * Flag for checking if current page is modified.
-       */
-       bool page_modified;
-
-} KFileFlashAvr;
-
-
-
-/**
- * ID for FlashAvr
- */
-#define KFT_FLASHAVR MAKE_ID('F', 'L', 'A', 'V')
-
-/**
- * Convert + ASSERT from generic KFile to KFileFlashAvr.
- */
-INLINE KFileFlashAvr * KFILEFLASHAVR(KFile *fd)
-{
-       ASSERT(fd->_type == KFT_FLASHAVR);
-       return (KFileFlashAvr *)fd;
-}
-
-
-void flash_avr_init(struct KFileFlashAvr *fd);
+#ifndef FLASH_AVR_H
+#define FLASH_AVR_H
 
+#include "cfg/cfg_emb_flash.h"
 
+#if !CONFIG_FLASH_DISABLE_OLD_API
+       /* For backwards compatibility */
+       #define FlashAvr  Flash
+#endif /* !CONFIG_FLASH_DISABLE_OLD_API */
 
 #endif /* DRV_FLASH_AVR_H */