//--------------------------------------------------------------------------------- void sdmmc_sdcard_writesectors(u32 sector_no, u32 numsectors, void *in) { //--------------------------------------------------------------------------------- u16 *in16 = (u16*)in; if(numsectors==1) { return sdmmc_sdcard_writesector(sector_no, in); } if(!sdmmc_sdhc) sector_no *= 512; sdmmc_mask16(0x100, 2, 0); sdmmc_write16(0xd8, 0); sdmmc_write16(REG_SDSTOP, 0x100); sdmmc_write16(REG_SDBLKCOUNT, numsectors); sdmmc_mask16(REG_SDCLKCTL, 0, 0x100); sdmmc_write16(REG_SDBLKLEN, 0x200); set_irqhandler(2, in16, numsectors); // CMD25 - write multiple blocks sdmmc_send_command(25, sector_no & 0xffff, (sector_no >> 16)); if(sdmmc_timeout) { sdmmc_mask16(REG_SDCLKCTL, 0x100, 0); fifoSendValue32(FIFO_SDMMC, 1); } }
int writef() { // Flush changes on current buffer to the file (can modify only positions allocated on disk) return sdmmc_sdcard_writesector(curfilesect + curfilesectorcluster, (void*)& filesect); }