- FlashLM3S *fd = FLASHLM3S_CAST(_fd);
- uint8_t *buf =(uint8_t *)_buf, *addr;
-
- size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos);
-
- LOG_INFO("Reading at pos[%lx]\n", fd->fd.seek_pos);
- /* Check if we can get current cached page */
- if ((size_t)fd->fd.seek_pos / FLASH_PAGE_SIZE_BYTES ==
- (size_t)fd->curr_page)
- addr = (uint8_t *)fd->curr_page +
- fd->fd.seek_pos % FLASH_PAGE_SIZE_BYTES;
- else
- addr = (uint8_t *)fd->fd.seek_pos;
- memcpy(buf, (uint8_t *)addr, size);
- fd->fd.seek_pos += size;
-
- LOG_INFO("Read %u bytes\n", size);
- return size;
+ memset(fls, 0, sizeof(*fls));
+ DB(fls->blk.priv.type = KBT_FLASH);
+
+ FLASH_USECRL_R = CPU_FREQ / 1000000 - 1;
+
+ fls->hw = &flash_lm3s_hw;
+
+ fls->blk.blk_size = FLASH_PAGE_SIZE;
+ fls->blk.blk_cnt = FLASH_SIZE / FLASH_PAGE_SIZE;