From: asterix Date: Tue, 10 Aug 2010 17:30:34 +0000 (+0000) Subject: Clean up. X-Git-Tag: 2.6.0~231 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=dab05c3c11467a2e62129df25983465285177df8;p=bertos.git Clean up. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4159 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/flash.h b/bertos/drv/flash.h index 50962742..9119b44d 100644 --- a/bertos/drv/flash.h +++ b/bertos/drv/flash.h @@ -42,9 +42,13 @@ #ifndef DRV_FLASH_H #define DRV_FLASH_H +#include "cfg/cfg_emb_flash.h" + #include #include +#include +#include /* * Embedded flash error flags @@ -63,6 +67,12 @@ typedef struct Flash { KBlock blk; struct FlashHardware *hw; + #if !CONFIG_FLASH_DISABLE_OLD_API + union { + KFile fd; + KFileBlock fdblk; + } DEPRECATED; + #endif /* !CONFIG_FLASH_DISABLE_OLD_API */ } Flash; /** @@ -87,6 +97,10 @@ void flash_hw_initUnbuffered(Flash *fls); 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 */ } INLINE void flash_initUnbuffered(Flash *fls) @@ -94,64 +108,6 @@ INLINE void flash_initUnbuffered(Flash *fls) flash_hw_initUnbuffered(fls); } -#if 0 -/** - * EmbFlash KFile context structure. - */ -typedef struct Flash -{ - /** - * File descriptor. - */ - KFile fd; - - /** - * Flag for checking if current page is modified. - */ - bool page_dirty; - - /** - * Current buffered page. - */ - page_t curr_page; - - /** - * Temporary buffer cointaing data block to - * write on flash. - */ - uint8_t page_buf[FLASH_PAGE_SIZE]; -} Flash; - -/** -* ID for FLASH -*/ -#define KFT_FLASH MAKE_ID('F', 'L', 'A', 'S') - -/** -* Convert + ASSERT from generic KFile to Flash. -*/ -INLINE Flash * FLASH_CAST(KFile *fd) -{ - ASSERT(fd->_type == KFT_FLASH); - return (Flash *)fd; -} - - -MOD_DEFINE(flash); - -/** - * - * Initialize PWM hw. - */ -INLINE void flash_init(Flash *fd) -{ - flash_hw_init(fd); - - MOD_INIT(flash); -} - -#endif - #endif /* DRV_FLASH_H */