X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fio%2Fkfile_block.h;h=c5dc26c5591363db131a6d5d1260fbf086b068cc;hb=4a71fb58e067d3dc00fe1c29927f945bd34be49a;hp=40aed6762472108cf206b74b78080a64d53daa44;hpb=3b00f26ad80c3ee5b691f083fd086847b131f261;p=bertos.git diff --git a/bertos/io/kfile_block.h b/bertos/io/kfile_block.h index 40aed676..c5dc26c5 100644 --- a/bertos/io/kfile_block.h +++ b/bertos/io/kfile_block.h @@ -30,11 +30,41 @@ * * --> * + * \defgroup kfile_block KFile interface over KBlock + * \ingroup core + * \{ + * * \brief KFile interface over a KBlock. * * With this module, you can access a KBlock device * with the handy KFile interface. * In order to achieve this, the block device must support partial block write. + * + * Error codes returned by kfile_error() are specific of the underlying + * KBlock implementation. + * + * Make sure you have trimmed the KBlock to avoid overwriting something. + * Example: + * \code + * // init a derived instance of KBlock + * // any will do. + * Flash flash; + * flash_init(&flash, 0); + * kblock_trim(&flash.blk, trim_start, internal_flash.blk.blk_cnt - trim_start); + * + * // now create and initialize the kfile_block instance + * KFileBlock kfb; + * kfileblock_init(&kfb, &flash.blk); + * + * // now you can access the Flash in a file like fashion + * kfile_read(&kfb.fd, buf, 20); + * \endcode + * + * \author Francesco Sacchi + * \author Daniele Basile + * + * $WIZ$ module_name = "kfile_block" + * $WIZ$ module_depends = "kfile", "kblock" */ #ifndef IO_KFILE_BLOCK_H @@ -49,7 +79,7 @@ */ typedef struct KFileBlock { - KFile fd; ///< KFile context + KFile fd; ///< KFile context KBlock *blk; ///< KBlock device } KFileBlock; @@ -57,7 +87,7 @@ typedef struct KFileBlock * Init a KFile over KBlock. * After this you can access your KBlock device with a handy KFile interface. * - * \note The block device must support partial block write in order support + * \note The block device must support partial block write in order to support * random write access. * * \param fb KFileBlock context. @@ -65,4 +95,6 @@ typedef struct KFileBlock */ void kfileblock_init(KFileBlock *fb, KBlock *blk); +/** \} */ //defgroup kfile_block + #endif /* IO_KFILE_KBLOCK_H */