yaffs2檔案系統製作
阿新 • • 發佈:2019-02-05
#if defined(CONFIG_MTD_NAND_YAFFS2) //add yaffs2 file system support
int oldopsmode = 0;
if(mtd->rw_oob==1)
{
int i = 0;
int datapages = 0;
size_t oobsize = mtd->oobsize;
size_t datasize = mtd->writesize;
uint8_t oobtemp[oobsize];
datapages = len / (datasize);
for(i = 0; i < (datapages); i++)
{
memcpy((void *)oobtemp, (void *)(buf + datasize * (i + 1)), oobsize);
memmove((void *)(buf + datasize * (i + 1)), (void *)(buf + datasize * (i + 1) + oobsize), (datapages - (i + 1)) * (datasize) + (datapages - 1) * oobsize);
memcpy((void *)(buf+(datapages) * (datasize + oobsize) - oobsize), (void *)(oobtemp), oobsize);
}
}
#endif
int oldopsmode = 0;
if(mtd->rw_oob==1)
{
int i = 0;
int datapages = 0;
size_t oobsize = mtd->oobsize;
size_t datasize = mtd->writesize;
uint8_t oobtemp[oobsize];
datapages = len / (datasize);
for(i = 0; i < (datapages); i++)
{
memcpy((void *)oobtemp, (void *)(buf + datasize * (i + 1)), oobsize);
memmove((void *)(buf + datasize * (i + 1)), (void *)(buf + datasize * (i + 1) + oobsize), (datapages - (i + 1)) * (datasize) + (datapages - 1) * oobsize);
memcpy((void *)(buf+(datapages) * (datasize + oobsize) - oobsize), (void *)(oobtemp), oobsize);
}
}
#endif