简体   繁体   中英

Reading block from MTD flash with ioremap

I would like to know the expected result of reading block data from MTD flash, as per the code below:

#define PHY_ADDR 0x80000000   // certain physical memory location
void *dst;
dst = ioremap(PHY_ADDR,len);  // ioremapping
mtd_image->_read(mtd, from, len, retlen, dst);  // reading from MTD flash to dst buffer with len length

So will this code write the read data to the physical memory address 0x80000000 ? or will just put the data in the pointer dst? Where I can find the read data in the physical memory (using gdb x/16x memory address for example)?

With ioremap you map physical memory to the pointer dst . This means that mtd_read reads the address range from to from + len on device mtd and writes it to physical address 0x80000000 through pointer dst .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM