Move kfile interface to the io/ directory.
[bertos.git] / bertos / drv / flash25.h
index 09579c0ef2af0423c165ad018ab50cf354860fab..921e1b5cf6560a12373530baca559d68f1af772d 100644 (file)
  * \brief Function library for serial Flash memory.
  *
  *
- * \version $Id$
  * \author Daniele Basile <asterix@develer.com>
+ *
+ * $WIZ$ module_name = "flash25"
+ * $WIZ$ module_depends = "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_flash25.h"
  */
 
 
 #ifndef DRV_FLASH25_H
 #define DRV_FLASH25_H
 
+#include "cfg/cfg_flash25.h"
 #include <cfg/compiler.h>
-#include <cfg/cfg_flash25.h>
 
-#include <kern/kfile.h>
+#include <io/kfile.h>
 
 /**
  * Type definition for serial flash memory.
@@ -56,11 +59,11 @@ typedef uint8_t flash25Offset_t;
 /**
  * Flash25 KFile context structure.
  */
-typedef struct KFileFlash25
+typedef struct Flash25
 {
        KFile fd;                       ///< File descriptor.
        KFile *channel;                 ///< Dataflash comm channel (usually SPI).
-} KFileFlash25;
+} Flash25;
 
 /**
  * ID for dataflash.
@@ -69,12 +72,12 @@ typedef struct KFileFlash25
 
 
 /**
- * Convert + ASSERT from generic KFile to KFileFlash25.
+ * Convert + ASSERT from generic KFile to Flash25.
  */
-INLINE KFileFlash25 * KFILEFLASH25(KFile *fd)
+INLINE Flash25 * FLASH25_CAST(KFile *fd)
 {
        ASSERT(fd->_type == KFT_FLASH25);
-       return (KFileFlash25 *)fd;
+       return (Flash25 *)fd;
 }
 
 /**
@@ -83,7 +86,8 @@ INLINE KFileFlash25 * KFILEFLASH25(KFile *fd)
  * \note Below are defined valid serial flash memory support to
  * this drive. Every time we call flash25_init() function we check
  * if memory defined are right (see flash25.c form more detail).
- * \{
+ *
+ * $WIZ$ flash25_list = "FLASH25_AT25F2048"
  */
 #define FLASH25_AT25F2048         1
 
@@ -95,12 +99,11 @@ INLINE KFileFlash25 * KFILEFLASH25(KFile *fd)
        #define FLASH25_SECTOR_SIZE        65536UL // Section size in byte
        #define FLASH25_MEM_SIZE           FLASH25_NUM_SECTOR * FLASH25_SECTOR_SIZE
        #define FLASH25_NUM_PAGE           FLASH25_MEM_SIZE / FLASH25_PAGE_SIZE
-#elif
+#else
        #error Nothing memory defined in CONFIG_FLASH25 are support.
 #endif
 
 #define RDY_BIT     0x1 // Statuts of write cycle
-/* \} */
 
 /**
  * Serial flash opcode commands.
@@ -131,9 +134,9 @@ typedef enum {
        FLASH25_SECT4            = 0x30000,  ///< Sector 4 (0x30000 -0x3FFFF)
 } Flash25Sector;
 
-void flash25_init(KFileFlash25 *fd, KFile *ch);
-void flash25_chipErase(KFileFlash25 *fd);
-void flash25_sectorErase(KFileFlash25 *fd, Flash25Sector sector);
+void flash25_init(Flash25 *fd, KFile *ch);
+void flash25_chipErase(Flash25 *fd);
+void flash25_sectorErase(Flash25 *fd, Flash25Sector sector);
 bool flash25_test(KFile *channel);
 
 #endif /* DRV_FLASH25_H */