X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fflash.h;h=d9cf8070448fe38572a2b4edf4dad4b105ad3e37;hb=41718ab2098bd5640da265c34f1ecb79a4123d39;hp=f07980e9dc4d0b3c2e9a865cafce7d7c1935969b;hpb=d49a3c80ba504db32d50f1a45593d58669ee601b;p=bertos.git diff --git a/bertos/drv/flash.h b/bertos/drv/flash.h index f07980e9..d9cf8070 100644 --- a/bertos/drv/flash.h +++ b/bertos/drv/flash.h @@ -29,10 +29,32 @@ * Copyright 2005 Develer S.r.l. (http://www.develer.com/) * --> * +* \defgroup drv_emb_flash Embedded flash driver +* \ingroup drivers +* \{ * -* \addtogroup drv_emb_flash * \brief Embedded flash for cpu. * +* This module allows to access in reading and writing to the internal +* flash memory of the micro. It is a block device, so it must be +* accessed using the KBlock interface functions (see kblock.h). +* +* Once you have opened the flash for writing, you may want to use +* kblock_trim() to avoid overwriting data on other flash banks. +* +* Example usage: +* \code +* Flash fls; +* flash_init(&fls, 0); +* // enable access only on desired blocks +* // start block = 50, num blocks = 20 +* kblock_trim(&fls.blk, 50, 20); +* // ... +* // now write to the flash +* // block number is automatically converted +* kblock_write(&fls.blk, 0, buf, 0, 128); +* \endcode +* * \author Francesco Sacchi * \author Daniele Basile * @@ -55,11 +77,6 @@ #include -/** - * \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 @@ -96,7 +113,7 @@ struct FlashHardware; */ typedef struct Flash { - KBlock blk; + KBlock blk; ///< KBlock context struct FlashHardware *hw; #if !CONFIG_FLASH_DISABLE_OLD_API union { @@ -106,7 +123,7 @@ typedef struct Flash #endif /* !CONFIG_FLASH_DISABLE_OLD_API */ } Flash; -/** +/* * ID for FLASH */ #define KBT_FLASH MAKE_ID('F', 'L', 'A', 'S')