nx_emmc_bis: Count clusters to flush

This commit is contained in:
shchmue 2020-07-05 14:06:08 -06:00
parent 25aa483bd5
commit 73fce1da86
2 changed files with 6 additions and 3 deletions

View File

@ -89,7 +89,7 @@ DRESULT disk_write (
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR; return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
case DRIVE_BIS: case DRIVE_BIS:
return nx_emmc_bis_write(sector, count, buff); return nx_emmc_bis_write(sector, count, (void *)buff);
} }
return RES_ERROR; return RES_ERROR;

View File

@ -365,10 +365,13 @@ void nx_emmc_bis_finalize()
return; return;
u32 limit = cache_filled == 1 ? MAX_CLUSTER_CACHE_ENTRIES : cluster_cache_end_index; u32 limit = cache_filled == 1 ? MAX_CLUSTER_CACHE_ENTRIES : cluster_cache_end_index;
for (u32 i = 0; i < limit; i++) u32 clusters_to_flush = dirty_cluster_count;
for (u32 i = 0; i < limit && clusters_to_flush; i++)
{ {
if (bis_cache->cluster_cache[i].dirty) if (bis_cache->cluster_cache[i].dirty) {
_nx_emmc_bis_flush_cluster(&bis_cache->cluster_cache[i]); _nx_emmc_bis_flush_cluster(&bis_cache->cluster_cache[i]);
clusters_to_flush--;
}
} }
} }