Lines Matching full:offset
96 static int gd32_fmc_v2_bank0_write(off_t offset, const void *data, size_t len) in gd32_fmc_v2_bank0_write() argument
98 flash_prg_t *prg_flash = (flash_prg_t *)((uint8_t *)SOC_NV_FLASH_ADDR + offset); in gd32_fmc_v2_bank0_write()
168 static int gd32_fmc_v2_bank0_erase_block(off_t offset, size_t size) in gd32_fmc_v2_bank0_erase_block() argument
170 uint32_t page_addr = SOC_NV_FLASH_ADDR + offset; in gd32_fmc_v2_bank0_erase_block()
211 static int gd32_fmc_v2_bank1_write(off_t offset, const void *data, size_t len) in gd32_fmc_v2_bank1_write() argument
213 flash_prg_t *prg_flash = (flash_prg_t *)((uint8_t *)SOC_NV_FLASH_ADDR + offset); in gd32_fmc_v2_bank1_write()
283 static int gd32_fmc_v2_bank1_erase_block(off_t offset, size_t size) in gd32_fmc_v2_bank1_erase_block() argument
285 uint32_t page_addr = SOC_NV_FLASH_ADDR + offset; in gd32_fmc_v2_bank1_erase_block()
302 bool flash_gd32_valid_range(off_t offset, uint32_t len, bool write) in flash_gd32_valid_range() argument
304 if ((offset > SOC_NV_FLASH_SIZE) || in flash_gd32_valid_range()
305 ((offset + len) > SOC_NV_FLASH_SIZE)) { in flash_gd32_valid_range()
310 /* Check offset and len is flash_prg_t aligned. */ in flash_gd32_valid_range()
311 if ((offset % sizeof(flash_prg_t)) || in flash_gd32_valid_range()
317 if (offset < GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_valid_range()
318 if (offset % GD32_NV_FLASH_V2_BANK0_PAGE_SIZE) { in flash_gd32_valid_range()
322 if (((offset + len) <= GD32_NV_FLASH_V2_BANK0_SIZE) && in flash_gd32_valid_range()
329 /* Remove bank0 info from offset and len. */ in flash_gd32_valid_range()
330 if ((offset < GD32_NV_FLASH_V2_BANK0_SIZE) && in flash_gd32_valid_range()
331 ((offset + len) > GD32_NV_FLASH_V2_BANK0_SIZE)) { in flash_gd32_valid_range()
332 len -= (GD32_NV_FLASH_V2_BANK0_SIZE - offset); in flash_gd32_valid_range()
333 offset = GD32_NV_FLASH_V2_BANK0_SIZE; in flash_gd32_valid_range()
336 if (offset >= GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_valid_range()
337 if ((offset % GD32_NV_FLASH_V2_BANK1_PAGE_SIZE) || in flash_gd32_valid_range()
348 int flash_gd32_write_range(off_t offset, const void *data, size_t len) in flash_gd32_write_range() argument
353 if (offset < GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_write_range()
354 if ((offset + len) > GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_write_range()
355 len0 = GD32_NV_FLASH_V2_BANK0_SIZE - offset; in flash_gd32_write_range()
360 ret = gd32_fmc_v2_bank0_write(offset, data, len0); in flash_gd32_write_range()
373 /* Will programming bank1, remove bank0 offset. */ in flash_gd32_write_range()
374 if (offset < GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_write_range()
375 offset = GD32_NV_FLASH_V2_BANK0_SIZE; in flash_gd32_write_range()
378 ret = gd32_fmc_v2_bank1_write(offset, data, len1); in flash_gd32_write_range()
387 int flash_gd32_erase_block(off_t offset, size_t size) in flash_gd32_erase_block() argument
392 if (offset < GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_erase_block()
393 if ((offset + size0) > GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_erase_block()
394 size0 = GD32_NV_FLASH_V2_BANK0_SIZE - offset; in flash_gd32_erase_block()
399 ret = gd32_fmc_v2_bank0_erase_block(offset, size0); in flash_gd32_erase_block()
412 /* Will programming bank1, remove bank0 info from offset. */ in flash_gd32_erase_block()
413 if (offset < GD32_NV_FLASH_V2_BANK0_SIZE) { in flash_gd32_erase_block()
414 offset = GD32_NV_FLASH_V2_BANK0_SIZE; in flash_gd32_erase_block()
417 ret = gd32_fmc_v2_bank1_erase_block(offset, size1); in flash_gd32_erase_block()