integrated SD_WaitIOOperation, removed some duplication in disk_read and
disk_write functions