Move flash related flags to the flash driver; refactor accordingly.
[bertos.git] / bertos / io / kblock.h
index 8d30ffc386bd5ca6f56e0ab736c29fb8007eecca..f2966bafea2fd4def8512452e760a98f6e03e6c1 100644 (file)
@@ -33,6 +33,8 @@
  * \author Francesco Sacchi <batt@develer.com>
  *
  * \brief KBlock interface
+ *
+ * $WIZ$ module_name = "kblock"
  */
 
 #ifndef IO_KBLOCK_H
@@ -70,7 +72,7 @@ typedef void   (* kblock_clearerr_t)    (struct KBlock *b);
 typedef int    (* kblock_close_t)       (struct KBlock *b);
 /* \} */
 
-/**
+/*
  * Table of interface functions for a KBlock device.
  */
 typedef struct KBlockVTable
@@ -83,31 +85,32 @@ typedef struct KBlockVTable
        kblock_load_t  load;
        kblock_store_t store;
 
-       kblock_error_t    error;    ///< \sa kblock_error()
-       kblock_clearerr_t clearerr; ///< \sa kblock_clearerr()
+       kblock_error_t    error;    // \sa kblock_error()
+       kblock_clearerr_t clearerr; // \sa kblock_clearerr()
 
-       kblock_close_t  close; ///< \sa kblock_close()
+       kblock_close_t  close; // \sa kblock_close()
 } KBlockVTable;
 
 
-#define KB_BUFFERED    BV(0) ///< Internal flag: true if the KBlock has a buffer
-#define KB_CACHE_DIRTY BV(1) ///< Internal flag: true if the cache is dirty
-#define KB_PARTIAL_WRITE BV(2) ///< Internal flag: true if the device allows partial block write
+#define KB_BUFFERED        BV(0) ///< Internal flag: true if the KBlock has a buffer
+#define KB_CACHE_DIRTY     BV(1) ///< Internal flag: true if the cache is dirty
+#define KB_PARTIAL_WRITE   BV(2) ///< Internal flag: true if the device allows partial block write
 
-/**
+
+/*
  * KBlock private members.
  * These are the private members of the KBlock interface, please do not
  * access these directly, use the KBlock API.
  */
 typedef struct KBlockPriv
 {
-       DB(id_t type);         ///< Used to keep track, at runtime, of the class type.
-       int flags;             ///< Status and error flags.
-       void *buf;             ///< Pointer to the page buffer for RAM-cached KBlocks.
-       block_idx_t blk_start; ///< Start block number when the device is trimmed. \sa kblock_trim().
-       block_idx_t curr_blk;  ///< Current cached block number in cached KBlocks.
+       DB(id_t type);         // Used to keep track, at runtime, of the class type.
+       int flags;             // Status and error flags.
+       void *buf;             // Pointer to the page buffer for RAM-cached KBlocks.
+       block_idx_t blk_start; // Start block number when the device is trimmed. \sa kblock_trim().
+       block_idx_t curr_blk;  // Current cached block number in cached KBlocks.
 
-       const struct KBlockVTable *vt; ///< Virtual table of interface functions.
+       const struct KBlockVTable *vt; // Virtual table of interface functions.
 } KBlockPriv;
 
 /**
@@ -202,7 +205,6 @@ INLINE int kblock_error(struct KBlock *b)
  *
  * \param b KBlock device.
  *
- * \return 0 on success, EOF on errors.
  *
  * \sa kblock_error()
  */
@@ -363,5 +365,6 @@ int kblock_swLoad(struct KBlock *b, block_idx_t index);
 int kblock_swStore(struct KBlock *b, block_idx_t index);
 size_t kblock_swReadBuf(struct KBlock *b, void *buf, size_t offset, size_t size);
 size_t kblock_swWriteBuf(struct KBlock *b, const void *buf, size_t offset, size_t size);
+int kblock_swClose(struct KBlock *b);
 
 #endif /* IO_KBLOCK_H */