Lines Matching refs:len

50 static int write_synchronously(off_t addr, const void *data, size_t len);
89 static int write(off_t addr, const void *data, size_t len);
97 static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, in is_within_bounds() argument
102 (len <= (boundary_start + boundary_size - addr))); in is_within_bounds()
105 static inline bool is_regular_addr_valid(off_t addr, size_t len) in is_regular_addr_valid() argument
107 return is_within_bounds(addr, len, 0, nrfx_nvmc_flash_size_get()); in is_regular_addr_valid()
110 static inline bool is_uicr_addr_valid(off_t addr, size_t len) in is_uicr_addr_valid() argument
113 return is_within_bounds(addr, len, (off_t)NRF_UICR, sizeof(*NRF_UICR)); in is_uicr_addr_valid()
131 static void nrf_buffer_read_91_uicr(void *data, off_t addr, size_t len) in nrf_buffer_read_91_uicr() argument
134 nrf_nvmc_buffer_read(data, (uint32_t)addr, len); in nrf_buffer_read_91_uicr()
146 void *data, size_t len) in flash_nrf_read() argument
148 const bool within_uicr = is_uicr_addr_valid(addr, len); in flash_nrf_read()
150 if (is_regular_addr_valid(addr, len)) { in flash_nrf_read()
154 (unsigned long)addr, len); in flash_nrf_read()
158 if (!len) { in flash_nrf_read()
164 nrf_buffer_read_91_uicr(data, (uint32_t)addr, len); in flash_nrf_read()
169 nrf_nvmc_buffer_read(data, (uint32_t)addr, len); in flash_nrf_read()
175 const void *data, size_t len) in flash_nrf_write() argument
179 if (is_regular_addr_valid(addr, len)) { in flash_nrf_write()
181 } else if (!is_uicr_addr_valid(addr, len)) { in flash_nrf_write()
183 (unsigned long)addr, len); in flash_nrf_write()
188 if (!is_aligned_32(addr) || (len % sizeof(uint32_t))) { in flash_nrf_write()
190 (unsigned long)addr, len); in flash_nrf_write()
195 if (!len) { in flash_nrf_write()
203 ret = write_synchronously(addr, data, len); in flash_nrf_write()
207 ret = write(addr, data, len); in flash_nrf_write()
331 .len = size, in erase_synchronously()
347 static int write_synchronously(off_t addr, const void *data, size_t len) in write_synchronously() argument
352 .len = len, in write_synchronously()
405 e_ctx->len -= pg_size; in erase_op()
410 e_ctx->len -= pg_size; in erase_op()
427 } while (e_ctx->len > 0); in erase_op()
429 return (e_ctx->len > 0) ? FLASH_OP_ONGOING : FLASH_OP_DONE; in erase_op()
436 w_ctx->len -= shift; in shift_write_context()
455 if (count > w_ctx->len) { in write_op()
456 count = w_ctx->len; in write_op()
481 while (w_ctx->len >= sizeof(uint32_t)) { in write_op()
504 if (w_ctx->len) { in write_op()
511 w_ctx->len); in write_op()
513 shift_write_context(w_ctx->len, w_ctx); in write_op()
525 .len = size, in erase()
537 static int write(off_t addr, const void *data, size_t len) in write() argument
542 .len = len, in write()