Lines Matching refs:cache

297     mp_spiflash_cache_t *cache = self->config->cache;  in mp_spiflash_cached_read()  local
298 if (cache->user == self && cache->block != 0xffffffff) { in mp_spiflash_cached_read()
301 if (bis <= cache->block && cache->block <= bie) { in mp_spiflash_cached_read()
304 if (bis < cache->block) { in mp_spiflash_cached_read()
306 rest = cache->block * SECTOR_SIZE - addr; in mp_spiflash_cached_read()
317 memcpy(dest, &cache->buf[offset], rest); in mp_spiflash_cached_read()
340 mp_spiflash_cache_t *cache = self->config->cache; in mp_spiflash_cache_flush_internal() local
343 int ret = mp_spiflash_erase_block_internal(self, cache->block * SECTOR_SIZE); in mp_spiflash_cache_flush_internal()
350 uint32_t addr = cache->block * SECTOR_SIZE + i * PAGE_SIZE; in mp_spiflash_cache_flush_internal()
351 int ret = mp_spiflash_write_page(self, addr, PAGE_SIZE, cache->buf + i * PAGE_SIZE); in mp_spiflash_cache_flush_internal()
377 mp_spiflash_cache_t *cache = self->config->cache; in mp_spiflash_cached_write_part() local
380 if (cache->user != self) { in mp_spiflash_cached_write_part()
381 if (cache->user != NULL) { in mp_spiflash_cached_write_part()
382 mp_spiflash_cache_flush(cache->user); in mp_spiflash_cached_write_part()
384 cache->user = self; in mp_spiflash_cached_write_part()
385 cache->block = 0xffffffff; in mp_spiflash_cached_write_part()
388 if (cache->block != sec) { in mp_spiflash_cached_write_part()
391 if (cache->block != 0xffffffff) { in mp_spiflash_cached_write_part()
395 mp_spiflash_read_data(self, addr, SECTOR_SIZE, cache->buf); in mp_spiflash_cached_write_part()
400 cache->block = sec; in mp_spiflash_cached_write_part()
402 memcpy(cache->buf + offset, src, len); in mp_spiflash_cached_write_part()
410 if (cache->buf[offset + i] != src[i]) { in mp_spiflash_cached_write_part()
411 if (cache->buf[offset + i] != 0xff) { in mp_spiflash_cached_write_part()
425 cache->block = sec; in mp_spiflash_cached_write_part()
427 memcpy(cache->buf + offset, src, len); in mp_spiflash_cached_write_part()
432 …int ret = mp_spiflash_write_page(self, addr + i * PAGE_SIZE, PAGE_SIZE, cache->buf + i * PAGE_SIZE… in mp_spiflash_cached_write_part()
450 mp_spiflash_cache_t *cache = self->config->cache; in mp_spiflash_cached_write() local
451 if (cache->user == self && bis <= cache->block && bie >= cache->block) { in mp_spiflash_cached_write()
455 if (cache->block * SECTOR_SIZE >= addr) { in mp_spiflash_cached_write()
456 pre = cache->block * SECTOR_SIZE - addr; in mp_spiflash_cached_write()
460 offset = addr - cache->block * SECTOR_SIZE; in mp_spiflash_cached_write()
470 memcpy(&cache->buf[offset], &src[pre], len_in_buf); in mp_spiflash_cached_write()