Reformat to kblock api.
[bertos.git] / bertos / cpu / arm / drv / flash_at91.h
index 1dcd9829131d6a0b00c20ce5b9bdb687cb199fdd..a706e5e5d10a8c4d2e431170e809d5dc89f67702 100644 (file)
 #ifndef FLASH_AT91_H
 #define FLASH_AT91_H
 
-#include <cpu/types.h>
+#include "cfg/cfg_emb_flash.h"
 
-#include <kern/kfile.h>
+#if !CONFIG_FLASH_DISABLE_OLD_API
 
-#include <io/arm.h>
+       /* For backwards compatibility */
+       #define FlashAt91  Flash
+       #define flash_at91_init(fls)   flash_init(fls);
+#endif /* !CONFIG_FLASH_DISABLE_OLD_API */
 
-
-/**
- * Define data type to manage page and memory address.
- */
-typedef uint32_t arm_page_t;
-typedef uint32_t arm_page_addr_t;
-
-/**
- * FlashAt91 KFile context structure.
- */
-typedef struct FlashAt91
-{
-       /**
-        * File descriptor.
-        */
-       KFile fd;
-
-       /**
-        * Flag for checking if current page is modified.
-        */
-       bool page_dirty;
-
-       /**
-        * Current buffered page.
-        */
-       arm_page_t curr_page;
-
-       /**
-        * Temporary buffer cointaing data block to
-        * write on flash.
-        */
-       uint8_t page_buf[FLASH_PAGE_SIZE_BYTES];
-
-
-} FlashAt91;
-
-/**
- * ID for FlashAt91
- */
-#define KFT_FLASHAT91 MAKE_ID('F', 'A', '9', '1')
-
-/**
- * Convert + ASSERT from generic KFile to FlashAt91.
- */
-INLINE FlashAt91 * FLASHAT91_CAST(KFile *fd)
-{
-       ASSERT(fd->_type == KFT_FLASHAT91);
-       return (FlashAt91 *)fd;
-}
-
-
-void flash_at91_init(FlashAt91 *fd);
-
-#endif
+#endif /* DRV_FLASH_ARM_H */