Ctrl_status sd_mmc_usb_read_10_0(uint32_t addr, uint16_t nb_sector) { #ifdef USE_ARRAY while (addr < sizeof(first_bytes)/SD_MMC_BLOCK_SIZE && nb_sector) { #ifdef FAKE_RW bool cached = false; for (uint8_t i = 0; i < NUM_CACHED_SECTORS && i < cached_sector_count; i++) { if (cached_sectors[i].sector == addr) { memcpy(sector_buf_0, cached_sectors[i].contents, SD_MMC_BLOCK_SIZE); cached = true; break; } } if (!cached) #endif // FAKE_RW memcpy(sector_buf_0, first_bytes + addr*SD_MMC_BLOCK_SIZE, SD_MMC_BLOCK_SIZE); if (!udi_msc_trans_block(true, sector_buf_0, SD_MMC_BLOCK_SIZE, NULL)) return CTRL_FAIL; addr++; nb_sector--; } if (nb_sector == 0) return CTRL_GOOD; else #endif // USE_ARRAY return sd_mmc_usb_read_10(0, addr, nb_sector); }
Ctrl_status sd_mmc_usb_read_10_1(uint32_t addr, uint16_t nb_sector) { return sd_mmc_usb_read_10(1, addr, nb_sector); }