Lines Matching refs:len

100 static int write_synchronously(off_t addr, const void *data, size_t len);
104 static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, in is_within_bounds() argument
108 (len <= (boundary_start + boundary_size - addr))); in is_within_bounds()
112 static void commit_changes(off_t addr, size_t len) in commit_changes() argument
121 if ((len % (WRITE_BUFFER_MAX_SIZE)) == 0) { in commit_changes()
146 volatile uint8_t dummy_read = *(volatile uint8_t *)(addr + len - 1); in commit_changes()
154 static void rram_write(off_t addr, const void *data, size_t len) in rram_write() argument
163 memcpy((void *)addr, data, len); in rram_write()
165 memset((void *)addr, ERASE_VALUE, len); in rram_write()
171 commit_changes(addr, len); in rram_write()
190 w_ctx->len -= shift; in shift_write_context()
196 size_t len; in write_op() local
204 while (w_ctx->len > 0) { in write_op()
205 len = (WRITE_BUFFER_MAX_SIZE < w_ctx->len) ? WRITE_BUFFER_MAX_SIZE : w_ctx->len; in write_op()
207 rram_write(w_ctx->flash_addr, (const void *)w_ctx->data_addr, len); in write_op()
209 shift_write_context(len, w_ctx); in write_op()
211 if (w_ctx->len > 0) { in write_op()
225 static int write_synchronously(off_t addr, const void *data, size_t len) in write_synchronously() argument
230 .len = len, in write_synchronously()
242 static int nrf_write(off_t addr, const void *data, size_t len) in nrf_write() argument
246 if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { in nrf_write()
251 if (!len) { in nrf_write()
255 LOG_DBG("Write: %p:%zu", (void *)addr, len); in nrf_write()
261 ret = write_synchronously(addr, data, len); in nrf_write()
265 rram_write(addr, data, len); in nrf_write()
273 static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_t len) in nrf_rram_read() argument
277 if (!is_within_bounds(addr, len, 0, RRAM_SIZE)) { in nrf_rram_read()
282 memcpy(data, (void *)addr, len); in nrf_rram_read()
287 static int nrf_rram_write(const struct device *dev, off_t addr, const void *data, size_t len) in nrf_rram_write() argument
295 return nrf_write(addr, data, len); in nrf_rram_write()
298 static int nrf_rram_erase(const struct device *dev, off_t addr, size_t len) in nrf_rram_erase() argument
302 return nrf_write(addr, NULL, len); in nrf_rram_erase()