Lines Matching refs:offset
39 static bool flash_b91_is_range_valid(off_t offset, size_t len) in flash_b91_is_range_valid() argument
42 if ((offset < 0) || (len < 1)) { in flash_b91_is_range_valid()
47 if ((offset + len) > FLASH_SIZE) { in flash_b91_is_range_valid()
65 static int flash_b91_erase(const struct device *dev, off_t offset, size_t len) in flash_b91_erase() argument
76 if (!flash_b91_is_range_valid(offset, len)) { in flash_b91_erase()
81 if (((offset % PAGE_SIZE) != 0) || ((len % PAGE_SIZE) != 0)) { in flash_b91_erase()
92 if ((page_nums >= BLOCK_64K_PAGES) && ((offset % BLOCK_64K_SIZE) == 0)) { in flash_b91_erase()
94 flash_erase_64kblock(offset); in flash_b91_erase()
96 offset += BLOCK_64K_SIZE; in flash_b91_erase()
97 } else if ((page_nums >= BLOCK_32K_PAGES) && ((offset % BLOCK_32K_SIZE) == 0)) { in flash_b91_erase()
99 flash_erase_32kblock(offset); in flash_b91_erase()
101 offset += BLOCK_32K_SIZE; in flash_b91_erase()
102 } else if ((page_nums >= SECTOR_PAGES) && ((offset % SECTOR_SIZE) == 0)) { in flash_b91_erase()
104 flash_erase_sector(offset); in flash_b91_erase()
106 offset += SECTOR_SIZE; in flash_b91_erase()
109 flash_erase_page(offset); in flash_b91_erase()
111 offset += PAGE_SIZE; in flash_b91_erase()
122 static int flash_b91_write(const struct device *dev, off_t offset, in flash_b91_write() argument
134 if (!flash_b91_is_range_valid(offset, len)) { in flash_b91_write()
161 flash_write_page(offset, len, (unsigned char *)data); in flash_b91_write()
175 static int flash_b91_read(const struct device *dev, off_t offset, in flash_b91_read() argument
186 if (!flash_b91_is_range_valid(offset, len)) { in flash_b91_read()
191 flash_read_page(offset, len, (unsigned char *)data); in flash_b91_read()