int readBlock(int blockNum, void *ptr) { if (gUseRamdisk) { memcpy(ptr, RAMDISK_BASE + blockNum * BLOCK_SIZE, BLOCK_SIZE); return BLOCK_SIZE; } else return readSdmmcDevice(blockNum, ptr); }
int main() { char *buf = (char*) 0x200000; if (initSdmmcDevice() < 0) { printf("error initializing card\n"); return -1; } // Read blocks in reverse order to verify address is set correctly. for (int i = TRANSFER_LENGTH - 1; i >= 0; i--) readSdmmcDevice(i, buf + i * BLOCK_SIZE); return 0; }