From 2bc2b05bc4ee047d9287d97f504ae737507b5d5b Mon Sep 17 00:00:00 2001 From: batt Date: Sat, 3 Jul 2010 12:33:08 +0000 Subject: [PATCH] Update in order to use the new KBlock API. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3992 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/fs/battfs_test.c | 49 +++++++++++----------- bertos/io/kblock_file.c | 81 ++++++++++++++++++++++++++++++------ bertos/io/kblock_file.h | 3 +- bertos/io/kblock_ram.c | 92 ++++++++++++++++++++++++++++++++++------- bertos/io/kblock_ram.h | 3 +- 5 files changed, 172 insertions(+), 56 deletions(-) diff --git a/bertos/fs/battfs_test.c b/bertos/fs/battfs_test.c index 750f48d0..d385bb9d 100644 --- a/bertos/fs/battfs_test.c +++ b/bertos/fs/battfs_test.c @@ -50,6 +50,7 @@ #define DATA_SIZE (PAGE_SIZE - BATTFS_HEADER_LEN) #define PAGE_COUNT (FILE_SIZE / PAGE_SIZE) +#define HW_PAGEBUF false #if UNIT_TEST const char test_filename[]="battfs_disk.bin"; @@ -105,7 +106,7 @@ static void diskNew(BattFsSuper *disk) ref[i] = i; KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); battfs_mount(disk, &f.b, page_array, sizeof(page_array)); testCheck(disk, ref); @@ -122,7 +123,7 @@ static void disk1File(BattFsSuper *disk) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); for (int i = 0; i < PAGE_COUNT; i++) { @@ -148,7 +149,7 @@ static void diskHalfFile(BattFsSuper *disk) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); for (int i = 0; i < PAGE_COUNT / 2; i++) { @@ -180,7 +181,7 @@ static void oldSeq1(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 4); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); // page, inode, seq, fill, pgoff battfs_writeTestBlock(&f.b, 0, 0, 0, DATA_SIZE, 0); @@ -208,7 +209,7 @@ static void oldSeq2(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 4); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); // page, inode, seq, fill, pgoff battfs_writeTestBlock(&f.b, 0, 0, 0, DATA_SIZE, 0); @@ -236,7 +237,7 @@ static void oldSeq3(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 4); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); // page, inode, seq, fill, pgoff battfs_eraseBlock(&f.b, 0); @@ -264,7 +265,7 @@ static void oldSeq2File(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); // page, inode, seq, fill, pgoff battfs_eraseBlock(&f.b, 0); @@ -301,7 +302,7 @@ static void openFile(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -375,7 +376,7 @@ static void readFile(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -418,7 +419,7 @@ static void readAcross(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); const unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; inode_t INODE = 0; @@ -484,7 +485,7 @@ static void writeFile(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -535,7 +536,7 @@ static void writeAcross(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); const unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; inode_t INODE = 0; @@ -608,7 +609,7 @@ static void createFile(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); BattFs fd1; inode_t INODE = 0; @@ -628,7 +629,7 @@ static void createFile(BattFsSuper *disk) ASSERT(battfs_umount(disk)); fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); @@ -661,7 +662,7 @@ static void multipleWrite(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); BattFs fd1; @@ -697,7 +698,7 @@ static void multipleWrite(BattFsSuper *disk) ASSERT(battfs_umount(disk)); fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); @@ -726,7 +727,7 @@ static void increaseFile(BattFsSuper *disk) fputc(0xff, fpt); KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT / 10); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT / 10); BattFs fd1,fd2; @@ -778,7 +779,7 @@ static void readEOF(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 8; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 8); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 8); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; @@ -818,7 +819,7 @@ static void writeEOF(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE / 5; i++) fputc(0xff, fpt); KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT / 5); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT / 5); BattFs fd1; inode_t INODE = 0; @@ -902,7 +903,7 @@ static void endOfSpace(BattFsSuper *disk) for (int i = 0; i < PAGE_SIZE * 4; i++) fputc(0xff, fp); KBlockFile f; - kblockfile_init(&f, fp, page_buffer, PAGE_SIZE, 4); + kblockfile_init(&f, fp, HW_PAGEBUF, page_buffer, PAGE_SIZE, 4); unsigned int PAGE_FILL = PAGE_SIZE - BATTFS_HEADER_LEN; inode_t INODE = 0; @@ -938,7 +939,7 @@ static void multipleFilesRW(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); #define N_FILES 10 BattFs fd[N_FILES]; @@ -984,7 +985,7 @@ static void multipleFilesRW(BattFsSuper *disk) ASSERT(battfs_umount(disk)); fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); @@ -1024,7 +1025,7 @@ static void openAllFiles(BattFsSuper *disk) for (int i = 0; i < FILE_SIZE; i++) fputc(0xff, fpt); KBlockFile f; - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); BattFs fd[BATTFS_MAX_FILES]; unsigned int MODE = BATTFS_CREATE; @@ -1047,7 +1048,7 @@ static void openAllFiles(BattFsSuper *disk) fpt = fopen(test_filename, "r+"); - kblockfile_init(&f, fpt, page_buffer, PAGE_SIZE, PAGE_COUNT); + kblockfile_init(&f, fpt, HW_PAGEBUF, page_buffer, PAGE_SIZE, PAGE_COUNT); ASSERT(battfs_mount(disk, &f.b, page_array, sizeof(page_array))); ASSERT(battfs_fsck(disk)); diff --git a/bertos/io/kblock_file.c b/bertos/io/kblock_file.c index 67a4a779..c445612e 100644 --- a/bertos/io/kblock_file.c +++ b/bertos/io/kblock_file.c @@ -48,20 +48,20 @@ static int kblockfile_load(KBlock *b, block_idx_t index) { KBlockFile *f = KBLOCKFILE_CAST(b); fseek(f->fp, index * b->blk_size, SEEK_SET); - return (fread(f->pagebuf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; + return (fread(f->b.priv.buf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; } static int kblockfile_store(struct KBlock *b, block_idx_t index) { KBlockFile *f = KBLOCKFILE_CAST(b); fseek(f->fp, index * b->blk_size, SEEK_SET); - return (fwrite(f->pagebuf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; + return (fwrite(f->b.priv.buf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; } static size_t kblockfile_readBuf(struct KBlock *b, void *buf, size_t offset, size_t size) { KBlockFile *f = KBLOCKFILE_CAST(b); - memcpy(buf, f->pagebuf + offset, size); + memcpy(buf, (uint8_t *)f->b.priv.buf + offset, size); return size; } @@ -75,10 +75,28 @@ static size_t kblockfile_readDirect(struct KBlock *b, block_idx_t index, void *b static size_t kblockfile_writeBuf(struct KBlock *b, const void *buf, size_t offset, size_t size) { KBlockFile *f = KBLOCKFILE_CAST(b); - memcpy(f->pagebuf + offset, buf, size); + memcpy((uint8_t *)f->b.priv.buf + offset, buf, size); return size; } +static int kblockfile_writeBlock(struct KBlock *b, block_idx_t index, const void *buf) +{ + KBlockFile *f = KBLOCKFILE_CAST(b); + ASSERT(buf); + ASSERT(index < b->blk_cnt); + fseek(f->fp, index * b->blk_size, SEEK_SET); + return (fwrite(f->b.priv.buf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; +} + +static int kblockfile_readBlock(struct KBlock *b, block_idx_t index, void *buf) +{ + KBlockFile *f = KBLOCKFILE_CAST(b); + ASSERT(buf); + ASSERT(index < b->blk_cnt); + fseek(f->fp, index * b->blk_size, SEEK_SET); + return (fread(f->b.priv.buf, 1, b->blk_size, f->fp) == b->blk_size) ? 0 : EOF; +} + static int kblockfile_error(struct KBlock *b) { KBlockFile *f = KBLOCKFILE_CAST(b); @@ -102,13 +120,42 @@ static int kblockfile_close(struct KBlock *b) } -static KBlockVTable kblockfile_vt = +static const KBlockVTable kblockfile_hwbuffered_vt = { .readDirect = kblockfile_readDirect, .readBuf = kblockfile_readBuf, .writeBuf = kblockfile_writeBuf, .load = kblockfile_load, .store = kblockfile_store, + + .readBlock = kblock_swReadBlock, + .writeBlock = kblock_swWriteBlock, + + .error = kblockfile_error, + .clearerr = kblockfile_claererr, + .close = kblockfile_close, +}; + +static const KBlockVTable kblockfile_swbuffered_vt = +{ + .readDirect = kblock_swReadDirect, + .readBuf = kblock_swReadBuf, + .writeBuf = kblock_swWriteBuf, + .load = kblock_swLoad, + .store = kblock_swStore, + + .readBlock = kblockfile_readBlock, + .writeBlock =kblockfile_writeBlock, + + .error = kblockfile_error, + .clearerr = kblockfile_claererr, + .close = kblockfile_close, +}; + +static const KBlockVTable kblockfile_unbuffered_vt = +{ + .readBlock = kblockfile_readBlock, + .writeBlock =kblockfile_writeBlock, .error = kblockfile_error, .clearerr = kblockfile_claererr, @@ -116,11 +163,11 @@ static KBlockVTable kblockfile_vt = }; -void kblockfile_init(KBlockFile *f, FILE *fp, void *buf, size_t block_size, block_idx_t block_count) + +void kblockfile_init(KBlockFile *f, FILE *fp, bool hwbuf, void *buf, size_t block_size, block_idx_t block_count) { ASSERT(f); ASSERT(fp); - ASSERT(buf); ASSERT(block_size); memset(f, 0, sizeof(*f)); @@ -128,11 +175,21 @@ void kblockfile_init(KBlockFile *f, FILE *fp, void *buf, size_t block_size, bloc DB(f->b.priv.type = KBT_KBLOCKFILE); f->fp = fp; - f->pagebuf = buf; f->b.blk_size = block_size; f->b.blk_cnt = block_count; - f->b.priv.vt = &kblockfile_vt; - kblockfile_load(&f->b, 0); - f->b.priv.curr_blk = 0; - f->b.priv.cache_dirty = false; + + if (buf) + { + f->b.priv.flags |= KB_BUFFERED; + f->b.priv.buf = buf; + if (hwbuf) + f->b.priv.vt = &kblockfile_hwbuffered_vt; + else + f->b.priv.vt = &kblockfile_swbuffered_vt; + kblockfile_load(&f->b, 0); + f->b.priv.curr_blk = 0; + f->b.priv.cache_dirty = false; + } + else + f->b.priv.vt = &kblockfile_unbuffered_vt; } diff --git a/bertos/io/kblock_file.h b/bertos/io/kblock_file.h index 8f83f40b..77e52756 100644 --- a/bertos/io/kblock_file.h +++ b/bertos/io/kblock_file.h @@ -46,7 +46,6 @@ typedef struct KBlockFile { KBlock b; FILE *fp; - uint8_t *pagebuf; } KBlockFile; #define KBT_KBLOCKFILE MAKE_ID('K', 'B', 'F', 'L') @@ -58,6 +57,6 @@ INLINE KBlockFile *KBLOCKFILE_CAST(KBlock *b) return (KBlockFile *)b; } -void kblockfile_init(KBlockFile *f, FILE *fp, void *buf, size_t block_size, block_idx_t block_count); +void kblockfile_init(KBlockFile *f, FILE *fp, bool hwbuf, void *buf, size_t block_size, block_idx_t block_count); #endif /* KBLOCK_FILE_H */ diff --git a/bertos/io/kblock_ram.c b/bertos/io/kblock_ram.c index a6dc008c..3af08b80 100644 --- a/bertos/io/kblock_ram.c +++ b/bertos/io/kblock_ram.c @@ -43,21 +43,21 @@ static int kblockram_load(KBlock *b, block_idx_t index) { KBlockRam *r = KBLOCKRAM_CAST(b); - memcpy(r->pagebuf, r->membuf + index * r->b.blk_size, r->b.blk_size); + memcpy(r->b.priv.buf, r->membuf + index * r->b.blk_size, r->b.blk_size); return 0; } static int kblockram_store(struct KBlock *b, block_idx_t index) { KBlockRam *r = KBLOCKRAM_CAST(b); - memcpy(r->membuf + index * r->b.blk_size, r->pagebuf, r->b.blk_size); + memcpy(r->membuf + index * r->b.blk_size, r->b.priv.buf, r->b.blk_size); return 0; } static size_t kblockram_readBuf(struct KBlock *b, void *buf, size_t offset, size_t size) { KBlockRam *r = KBLOCKRAM_CAST(b); - memcpy(buf, r->pagebuf + offset, size); + memcpy(buf, (uint8_t *)r->b.priv.buf + offset, size); return size; } @@ -71,13 +71,28 @@ static size_t kblockram_readDirect(struct KBlock *b, block_idx_t index, void *bu static size_t kblockram_writeBuf(struct KBlock *b, const void *buf, size_t offset, size_t size) { KBlockRam *r = KBLOCKRAM_CAST(b); - memcpy(r->pagebuf + offset, buf, size); + memcpy((uint8_t *)r->b.priv.buf + offset, buf, size); return size; } -static int kblockram_error(struct KBlock *b) +static int kblockram_writeBlock(struct KBlock *b, block_idx_t index, const void *buf) { - return b->priv.flags; + KBlockRam *r = KBLOCKRAM_CAST(b); + ASSERT(buf); + ASSERT(index < b->blk_cnt); + + memcpy(r->membuf + index * r->b.blk_size, buf, r->b.blk_size); + return 0; +} + +static int kblockram_readBlock(struct KBlock *b, block_idx_t index, void *buf) +{ + KBlockRam *r = KBLOCKRAM_CAST(b); + ASSERT(buf); + ASSERT(index < b->blk_cnt); + + memcpy(buf, r->membuf + index * r->b.blk_size, r->b.blk_size); + return 0; } static int kblockram_dummy(UNUSED_ARG(struct KBlock *,b)) @@ -85,20 +100,50 @@ static int kblockram_dummy(UNUSED_ARG(struct KBlock *,b)) return 0; } -static KBlockVTable kblockram_vt = +static const KBlockVTable kblockram_hwbuffered_vt = { .readDirect = kblockram_readDirect, .readBuf = kblockram_readBuf, .writeBuf = kblockram_writeBuf, .load = kblockram_load, .store = kblockram_store, + + .readBlock = kblock_swReadBlock, + .writeBlock = kblock_swWriteBlock, + + .error = kblockram_dummy, + .clearerr = kblockram_dummy, + .close = kblockram_dummy, +}; + + +static const KBlockVTable kblockram_swbuffered_vt = +{ + .readDirect = kblock_swReadDirect, + .readBuf = kblock_swReadBuf, + .writeBuf = kblock_swWriteBuf, + .load = kblock_swLoad, + .store = kblock_swStore, + + .readBlock = kblockram_readBlock, + .writeBlock = kblockram_writeBlock, + + .error = kblockram_dummy, + .clearerr = kblockram_dummy, + .close = kblockram_dummy, +}; - .error = kblockram_error, +static const KBlockVTable kblockram_unbuffered_vt = +{ + .readBlock = kblockram_readBlock, + .writeBlock = kblockram_writeBlock, + + .error = kblockram_dummy, .clearerr = kblockram_dummy, .close = kblockram_dummy, }; -void kblockram_init(KBlockRam *ram, void *buf, size_t size, size_t block_size) +void kblockram_init(KBlockRam *ram, void *buf, size_t size, size_t block_size, bool buffered, bool hwbuffered) { ASSERT(buf); ASSERT(size); @@ -107,12 +152,27 @@ void kblockram_init(KBlockRam *ram, void *buf, size_t size, size_t block_size) memset(ram, 0, sizeof(*ram)); DB(ram->b.priv.type = KBT_KBLOCKRAM); - - // First page used as page buffer - ram->b.blk_cnt = (size / block_size) - 1; - ram->pagebuf = (uint8_t *)buf; - ram->membuf = (uint8_t *)buf + block_size; ram->b.blk_size = block_size; - ram->b.priv.vt = &kblockram_vt; - kblockram_load(&ram->b, 0); + + if (buffered) + { + ram->b.priv.flags |= KB_BUFFERED; + ram->b.blk_cnt = (size / block_size) - 1; + ram->b.priv.buf = buf; + // First page used as page buffer + ram->membuf = (uint8_t *)buf + block_size; + + if (hwbuffered) + ram->b.priv.vt = &kblockram_hwbuffered_vt; + else + ram->b.priv.vt = &kblockram_swbuffered_vt; + + kblockram_load(&ram->b, 0); + } + else + { + ram->b.blk_cnt = (size / block_size); + ram->membuf = (uint8_t *)buf; + ram->b.priv.vt = &kblockram_unbuffered_vt; + } } diff --git a/bertos/io/kblock_ram.h b/bertos/io/kblock_ram.h index f913b766..92582a99 100644 --- a/bertos/io/kblock_ram.h +++ b/bertos/io/kblock_ram.h @@ -44,7 +44,6 @@ typedef struct KBlockRam { KBlock b; - uint8_t *pagebuf; uint8_t *membuf; } KBlockRam; @@ -57,6 +56,6 @@ INLINE KBlockRam *KBLOCKRAM_CAST(KBlock *b) return (KBlockRam *)b; } -void kblockram_init(KBlockRam *ram, void *buf, size_t size, size_t block_size); +void kblockram_init(KBlockRam *ram, void *buf, size_t size, size_t block_size, bool buffered, bool hwbuffered); #endif /* KBLOCK_RAM_H */ -- 2.25.1