X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fflash.h;h=eccaf7519a6ec20e8baec1a820aadc324dc2580d;hb=02da7e0db83863a2efe15b490c7713ffe0526aeb;hp=c1844e314b62439b5bf0084d811234d4c8ba88b2;hpb=06c52c673046e0c9de065a21a9ba22ad78ace7e1;p=bertos.git diff --git a/bertos/drv/flash.h b/bertos/drv/flash.h index c1844e31..eccaf751 100644 --- a/bertos/drv/flash.h +++ b/bertos/drv/flash.h @@ -36,7 +36,8 @@ * \author Daniele Basile * * $WIZ$ module_name = "flash" -* $WIZ$ module_depends = "kfile" +* $WIZ$ module_depends = "kfile", "kfile_block", "kblock" +* $WIZ$ module_configuration = "bertos/cfg/cfg_emb_flash.h" */ #ifndef DRV_FLASH_H @@ -51,6 +52,14 @@ #include #include +#include + +#if COMPILER_C99 + #define flash_init(...) PP_CAT(flash_init ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__) +#else + #define flash_init(args...) PP_CAT(flash_init ## _, COUNT_PARMS(args)) (args) +#endif + /* * Embedded flash error flags */ @@ -91,24 +100,21 @@ INLINE Flash *FLASH_CAST(KBlock *fls) return (Flash *)fls; } -void flash_hw_init(Flash *fls); -void flash_hw_initUnbuffered(Flash *fls); +void flash_hw_init(Flash *fls, int flags); +void flash_hw_initUnbuffered(Flash *fls, int flags); #include CPU_HEADER(flash) -INLINE void flash_init(Flash *fls) -{ - flash_hw_init(fls); - - #if !CONFIG_FLASH_DISABLE_OLD_API - kfileblock_init(&fls->fdblk, &fls->blk); - #endif /* !CONFIG_FLASH_DISABLE_OLD_API */ -} +#define flash_init_2(fls, flags) (flags & KB_OPEN_UNBUFF) ? \ + flash_hw_initUnbuffered(fls, flags) : flash_hw_init(fls, flags) -INLINE void flash_initUnbuffered(Flash *fls) +#if !CONFIG_FLASH_DISABLE_OLD_API +INLINE DEPRECATED void flash_init_1(Flash *fls) { - flash_hw_initUnbuffered(fls); + flash_hw_init(fls, 0); + kfileblock_init(&fls->fdblk, &fls->blk); } +#endif /* !CONFIG_FLASH_DISABLE_OLD_API */ #include CPU_HEADER(flash)