Lines Matching refs:offset
33 static bool write_range_is_valid(off_t offset, uint32_t size);
34 static bool read_range_is_valid(off_t offset, uint32_t size);
35 static int erase_flash_block(off_t offset, size_t size);
38 static int flash_gecko_read(const struct device *dev, off_t offset, in flash_gecko_read() argument
42 if (!read_range_is_valid(offset, size)) { in flash_gecko_read()
50 memcpy(data, (uint8_t *)CONFIG_FLASH_BASE_ADDRESS + offset, size); in flash_gecko_read()
55 static int flash_gecko_write(const struct device *dev, off_t offset, in flash_gecko_write() argument
63 if (!write_range_is_valid(offset, size)) { in flash_gecko_write()
74 address = (uint8_t *)CONFIG_FLASH_BASE_ADDRESS + offset; in flash_gecko_write()
86 static int flash_gecko_erase(const struct device *dev, off_t offset, in flash_gecko_erase() argument
92 if (!read_range_is_valid(offset, size)) { in flash_gecko_erase()
96 if ((offset % FLASH_PAGE_SIZE) != 0) { in flash_gecko_erase()
97 LOG_ERR("offset 0x%lx: not on a page boundary", (long)offset); in flash_gecko_erase()
113 ret = erase_flash_block(offset, size); in flash_gecko_erase()
140 static bool write_range_is_valid(off_t offset, uint32_t size) in write_range_is_valid() argument
142 return read_range_is_valid(offset, size) in write_range_is_valid()
143 && (offset % sizeof(uint32_t) == 0) in write_range_is_valid()
147 static bool read_range_is_valid(off_t offset, uint32_t size) in read_range_is_valid() argument
149 return (offset + size) <= (CONFIG_FLASH_SIZE * 1024); in read_range_is_valid()
152 static int erase_flash_block(off_t offset, size_t size) in erase_flash_block() argument
158 for (off_t tmp = offset; tmp < offset + size; tmp += FLASH_PAGE_SIZE) { in erase_flash_block()