DRESULT disk_write(BYTE drv, const BYTE *buff, DWORD sector, BYTE count) { DRESULT res=RES_PARERR; U32 result; void * tmp; tmp = (void *) buff; U32 addr, len; if(sdMed.blockSize < SECTOR_SIZE_DEFAULT) { addr = sector * (SECTOR_SIZE_DEFAULT / sdMed.blockSize); len = count * (SECTOR_SIZE_DEFAULT / sdMed.blockSize); } else { addr = sector; len = count; } result = MEDIA_Write(addr, (void*)tmp, len, NULL, NULL); if( result == MED_STATUS_SUCCESS ) { res = RES_OK; } else { TRACE_ERR("MED_Write pb: 0x%X", result); res = RES_ERROR; } return res; }
DRESULT PPP_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) { DRESULT res = RES_OK; if(MEDIA_Write((uint32_t*)buff, sector, count) != PPP_OK) { res = RES_ERROR; } return res; }