X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Farm%2Fdrv%2Fflash_lpc2.c;h=a78ade27c8bfe111e560d10a4a165071d3cc37c4;hb=23f95752ffe03a5f0c262b1f896211aedb185dda;hp=a9ffcc67e73828281cccbbf4b1cdced7917377e9;hpb=776f6be6887e4803e9a103be87a3e7e38017f4d3;p=bertos.git diff --git a/bertos/cpu/arm/drv/flash_lpc2.c b/bertos/cpu/arm/drv/flash_lpc2.c index a9ffcc67..a78ade27 100644 --- a/bertos/cpu/arm/drv/flash_lpc2.c +++ b/bertos/cpu/arm/drv/flash_lpc2.c @@ -94,7 +94,7 @@ struct FlashHardware #define FLASH_PAGE_CNT FLASH_MEM_SIZE / FLASH_PAGE_SIZE_BYTES -ALLOC_BITARRAY(page_dirty, FLASH_PAGE_CNT); +BITARRAY_ALLOC(page_dirty, FLASH_PAGE_CNT); static BitArray lpc2_bitx; uint8_t erase_group[] = { @@ -179,10 +179,7 @@ static uint32_t addr_to_sector(size_t addr) static size_t lpc2_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size) { - ASSERT(offset == 0); - ASSERT(size == blk->blk_size); - - memcpy(buf, (void *)(idx * blk->blk_size), size); + memcpy(buf, (void *)(idx * blk->blk_size + offset), size); return size; } @@ -342,7 +339,7 @@ static void common_init(Flash *fls) fls->blk.blk_size = FLASH_PAGE_SIZE_BYTES; fls->blk.blk_cnt = FLASH_MEM_SIZE / FLASH_PAGE_SIZE_BYTES; - init_bitarray(&lpc2_bitx, FLASH_PAGE_CNT, page_dirty, sizeof(page_dirty)); + bitarray_init(&lpc2_bitx, FLASH_PAGE_CNT, page_dirty, sizeof(page_dirty)); } void flash_hw_init(Flash *fls, int flags)