- kprintf("Writing at pos[%u]\n", fd->seek_pos);
- while (size)
- {
- page = fd->seek_pos / SPM_PAGESIZE;
- page_addr = fd->seek_pos % SPM_PAGESIZE;
-
- flash_avr_loadPage(page);
-
- size_t wr_len = MIN(size, SPM_PAGESIZE - page_addr);
- memcpy(page_buf + page_addr, buf, wr_len);
- page_modified = true;
-
- buf += wr_len;
- fd->seek_pos += wr_len;
- size -= wr_len;
- total_write += wr_len;
- }
- kprintf("written %u bytes\n", total_write);
- return total_write;
-}
-
-/**
- * Open flash file \a fd
- * \a name and \a mode are unused, cause flash memory is
- * threated like one file.
- */
-static void flash_avr_open(struct KFile *fd)