doc: Improve documentation for Flash driver.
authorlottaviano <lottaviano@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 9 Nov 2010 12:05:26 +0000 (12:05 +0000)
committerlottaviano <lottaviano@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 9 Nov 2010 12:05:26 +0000 (12:05 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4546 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/drv/flash.h

index 9ea5665075e815793a0e9daf8ccaa2a2d903e8a0..f07980e9dc4d0b3c2e9a865cafce7d7c1935969b 100644 (file)
@@ -30,6 +30,7 @@
 * -->
 *
 *
+* \addtogroup drv_emb_flash
 * \brief Embedded flash for cpu.
 *
 * \author Francesco Sacchi <batt@develer.com>
 
 #include <cpu/attr.h>
 
+/**
+ * \defgroup drv_emb_flash Embedded flash driver
+ * \ingroup drivers
+ * \{
+ */
 #if COMPILER_C99
        #define flash_init(...)           PP_CAT(flash_init_, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__)
 #else
+       /**
+        * Init function for flash driver.
+        *
+        * This macro cannot fail, so no error conditions are reported.
+        *
+        * This macro expands to
+        *  - flash_init_2(Flash *fls, flags), the new KBlock API
+        *  - flash_init_1(Flash *fls), old API, provided for compatibility
+        *
+        * Do NOT use the above functions directly, use flash_init() instead.
+        * Disable old API if you are not upgrading an existing project.
+        */
        #define flash_init(args...)       PP_CAT(flash_init_, COUNT_PARMS(args)) (args)
 #endif
 
-/*
- * Embedded flash error flags
+/**
+ * \name Embedded flash error values
+ * \{
  */
 #define FLASH_WR_OK             0     ///< Write ok.
 #define FLASH_NOT_ERASED     BV(1)    ///< Flash memory was not erased before to write it.
 #define FLASH_WR_PROTECT     BV(2)    ///< Write not allowed the flash memory was protected.
 #define FLASH_WR_TIMEOUT     BV(3)    ///< Timeout while writing
 #define FLASH_WR_ERR         BV(4)    ///< Invalid command and/or a bad keywords
+/** \} */
 
 struct FlashHardware;
 
 /**
- * EmbFlash KFile context structure.
+ * EmbFlash KBlock context structure.
  */
 typedef struct Flash
 {
@@ -105,9 +125,19 @@ void flash_hw_initUnbuffered(Flash *fls, int flags);
 
 #include CPU_HEADER(flash)
 
+/**
+ * \name Flash init flags
+ * \{
+ */
 #define FLASH_WRITE_ONCE   BV(0) ///< Allow only one write per block.
 #define FLASH_UNBUFFERED   BV(1) ///< Open flash memory disabling page caching, no modification and partial write are allowed.
+/** \} */
 
+/**
+ * Initialize \a fls Flash context structure.
+ * \param fls Flash context structure
+ * \param flags A combination of flash init flags
+ */
 #define flash_init_2(fls, flags)    (flags & FLASH_UNBUFFERED) ? \
                                                                                flash_hw_initUnbuffered(fls, flags) : flash_hw_init(fls, flags)
 
@@ -119,4 +149,6 @@ INLINE DEPRECATED void flash_init_1(Flash *fls)
 }
 #endif /* !CONFIG_FLASH_DISABLE_OLD_API */
 
+/** \} */
+
 #endif /* DRV_FLASH_H */