I am new to the boot loader world, i have a question about when we send a write command how we assign the data source, which is relate to the function argument *src? I traced the source code but i can't find where it assign the data source in c code.
Answer by myself: I found when we do #mmc write 1 0x4 2 the argument means dev # 1, block # 4, count 2 which as below function's argument mmc->block_dev.block_write(curr_device, blk, cnt, addr);
BUT, i still want to know, is it Is it possible assign a external data source directly?
Is mmc write or mmc read could only write/read from internal memory?
Is it possible assign a external data source, such as from USB port or SD card?
best & regard.
static unsigned long mmc_bwrite(int dev_num, unsigned long start, lbaint_t blkcnt, const void *src){
int err;
struct mmc *mmc = find_mmc_device(dev_num);
if (!mmc) {
printf("MMC Device %d not found\n", dev_num);
return 0;
}
if (blkcnt > 1)
return mmc_bwrite_multi(mmc, start, blkcnt, src);
else if (blkcnt == 1)
return mmc_bwrite_single(mmc, start, src);
return 0;
}
How should i trace code like below?
mmc->block_dev.block_write = mmc_bwrite;