Lines Matching +full:- +full:i

5  * SPDX-License-Identifier: BSD-3-Clause
16 (void*)cfg, cfg->context, in lfs_rambd_createcfg()
17 (void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog, in lfs_rambd_createcfg()
18 (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, in lfs_rambd_createcfg()
19 cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count, in lfs_rambd_createcfg()
20 (void*)bdcfg, bdcfg->erase_value, bdcfg->buffer); in lfs_rambd_createcfg()
21 lfs_rambd_t *bd = cfg->context; in lfs_rambd_createcfg()
22 bd->cfg = bdcfg; in lfs_rambd_createcfg()
25 if (bd->cfg->buffer) { in lfs_rambd_createcfg()
26 bd->buffer = bd->cfg->buffer; in lfs_rambd_createcfg()
28 bd->buffer = lfs_malloc(cfg->block_size * cfg->block_count); in lfs_rambd_createcfg()
29 if (!bd->buffer) { in lfs_rambd_createcfg()
30 LFS_RAMBD_TRACE("lfs_rambd_createcfg -> %d", LFS_ERR_NOMEM); in lfs_rambd_createcfg()
36 if (bd->cfg->erase_value != -1) { in lfs_rambd_createcfg()
37 memset(bd->buffer, bd->cfg->erase_value, in lfs_rambd_createcfg()
38 cfg->block_size * cfg->block_count); in lfs_rambd_createcfg()
41 LFS_RAMBD_TRACE("lfs_rambd_createcfg -> %d", 0); in lfs_rambd_createcfg()
50 (void*)cfg, cfg->context, in lfs_rambd_create()
51 (void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog, in lfs_rambd_create()
52 (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, in lfs_rambd_create()
53 cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count); in lfs_rambd_create()
54 static const struct lfs_rambd_config defaults = {.erase_value=-1}; in lfs_rambd_create()
56 LFS_RAMBD_TRACE("lfs_rambd_create -> %d", err); in lfs_rambd_create()
63 lfs_rambd_t *bd = cfg->context; in lfs_rambd_destroy()
64 if (!bd->cfg->buffer) { in lfs_rambd_destroy()
65 lfs_free(bd->buffer); in lfs_rambd_destroy()
67 LFS_RAMBD_TRACE("lfs_rambd_destroy -> %d", 0); in lfs_rambd_destroy()
76 lfs_rambd_t *bd = cfg->context; in lfs_rambd_read()
79 LFS_ASSERT(off % cfg->read_size == 0); in lfs_rambd_read()
80 LFS_ASSERT(size % cfg->read_size == 0); in lfs_rambd_read()
81 LFS_ASSERT(block < cfg->block_count); in lfs_rambd_read()
84 memcpy(buffer, &bd->buffer[block*cfg->block_size + off], size); in lfs_rambd_read()
86 LFS_RAMBD_TRACE("lfs_rambd_read -> %d", 0); in lfs_rambd_read()
95 lfs_rambd_t *bd = cfg->context; in lfs_rambd_prog()
98 LFS_ASSERT(off % cfg->prog_size == 0); in lfs_rambd_prog()
99 LFS_ASSERT(size % cfg->prog_size == 0); in lfs_rambd_prog()
100 LFS_ASSERT(block < cfg->block_count); in lfs_rambd_prog()
103 if (bd->cfg->erase_value != -1) { in lfs_rambd_prog()
104 for (lfs_off_t i = 0; i < size; i++) { in lfs_rambd_prog() local
105 LFS_ASSERT(bd->buffer[block*cfg->block_size + off + i] == in lfs_rambd_prog()
106 bd->cfg->erase_value); in lfs_rambd_prog()
111 memcpy(&bd->buffer[block*cfg->block_size + off], buffer, size); in lfs_rambd_prog()
113 LFS_RAMBD_TRACE("lfs_rambd_prog -> %d", 0); in lfs_rambd_prog()
119 lfs_rambd_t *bd = cfg->context; in lfs_rambd_erase()
122 LFS_ASSERT(block < cfg->block_count); in lfs_rambd_erase()
125 if (bd->cfg->erase_value != -1) { in lfs_rambd_erase()
126 memset(&bd->buffer[block*cfg->block_size], in lfs_rambd_erase()
127 bd->cfg->erase_value, cfg->block_size); in lfs_rambd_erase()
130 LFS_RAMBD_TRACE("lfs_rambd_erase -> %d", 0); in lfs_rambd_erase()
138 LFS_RAMBD_TRACE("lfs_rambd_sync -> %d", 0); in lfs_rambd_sync()