X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Fcortex-m3%2Fdrv%2Fflash_lm3s.h;h=e70a7919fb3ca0323f680b5541e080f7d70e6675;hb=911d2706a86d326786bfe721dcc3d63aeade7f28;hp=1830b9968f37970497b6ea5972baa566b85b31de;hpb=adf4a56dc7329b8add0891e0ff11fca3f5add6f6;p=bertos.git diff --git a/bertos/cpu/cortex-m3/drv/flash_lm3s.h b/bertos/cpu/cortex-m3/drv/flash_lm3s.h index 1830b996..e70a7919 100644 --- a/bertos/cpu/cortex-m3/drv/flash_lm3s.h +++ b/bertos/cpu/cortex-m3/drv/flash_lm3s.h @@ -39,53 +39,22 @@ #define FLASH_LM3S_H #include -#include +#include /* Flash memory mapping */ -#define FLASH_MEM_SIZE 0x40000 //< 256KiB +#define FLASH_MEM_SIZE 0x40000 //< 256KiB #define FLASH_PAGE_SIZE_BYTES 0x400 //< 1KiB -/** - * FlashLM3S KFile context structure. - */ -typedef struct FlashLM3S -{ - /** - * File descriptor. - */ - KFile fd; - - /** - * Flag for checking if current page is modified. - */ - bool page_dirty; - /** - * Current buffered page. - */ - uint32_t *curr_page; - - /** - * Temporary buffer cointaing data block to - * write on flash. - */ - uint32_t page_buf[FLASH_PAGE_SIZE_BYTES / sizeof(uint32_t)]; -} FlashLM3S; +#define FLASH_PAGE_SIZE FLASH_PAGE_SIZE_BYTES /** - * ID for FlashLM3S + * Define data type to manage page and memory address. */ -#define KFT_FLASHLM3S MAKE_ID('F', 'L', '3', 'S') +typedef uint32_t page_t; -/** - * Convert + ASSERT from generic KFile to FlashLM3S structure. - */ -INLINE FlashLM3S * FLASHLM3S_CAST(KFile *fd) -{ - ASSERT(fd->_type == KFT_FLASHLM3S); - return (FlashLM3S *)fd; -} +struct Flash; -void flash_lm3sInit(FlashLM3S *fd); +void flash_hw_init(struct Flash *fd); #endif /* FLASH_LM3S_H */