int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
u_char *buffer)
{
int rval;
size_t left_to_write = *length;
size_t len_incl_bad;
u_char *p_buffer = buffer;
#if defined(CONFIG_SYS_NAND_YAFFS_WRITE)
if(nand->rw_oob==1)
{
size_t oobsize=nand->oobsize;
size_t datasize = nand->writesize;
int datapages = 0;
if(((*length)%(nand->oobsize+nand->writesize))!=0)
{
printf("Attempt to write error lenght data!/n");
return -EINVAL;
}
datapages = *length/(datasize+oobsize);
*length = datapages*datasize;
left_to_write = *length;
}
#endif
........
len_incl_bad = get_len_incl_bad (nand, offset, *length);
if ((offset + len_incl_bad) > nand->size) {
printf ("Attempt to write outside the flash area/n");
return -EINVAL;
}
#if !defined(CONFIG_SYS_NAND_YAFFS_WRITE)
if (len_incl_bad == *length) {
rval = nand_write (nand, offset, length, buffer);
if (rval != 0)
printf ("NAND write to offset %llx failed %d/n",
offset, rval);
return rval;
}
#endif
while (left_to_write > 0) {
size_t block_offset = offset & (nand->erasesize - 1);
size_t write_size;
WATCHDOG_RESET ();
if (nand_block_isbad (nand, offset & ~(nand->erasesize - 1))) {
printf ("Skip bad block 0x%08llx/n",
offset & ~(nand->erasesize - 1));
offset += nand->erasesize - block_offset;
continue;
}
#if defined(CONFIG_SYS_NAND_YAFFS_WRITE)
if (nand->skipfirstblk==1)
{
nand->skipfirstblk = 0;
printf("Skip the first good block%llx/n",offset&~(nand->erasesize-1));
offset+=nand->erasesize-block_offset;
continue;
}
#endif
....
left_to_write -= write_size;
printf("%d%% is complete",100-(left_to_write/(*length/100)));
offset
+= write_size;
//
p_buffer
+= write_size;
#if defined(CONFIG_SYS_NAND_YAFFS_WRITE)
if(nand->rw_oob==1)
{
p_buffer+=write_size+(write_size/nand->writesize*nand->oobsize);
}
else
{
p_buffer+=write_size;
}
#else
p_buffer
+= write_size;
#endif
}
return 0;
}
|
相关推荐
u-boot-2010.06移植到TQ2440,串口可以打印出东西,支持nor flash、nand flash、DM9000.
u-boot最新版本,支持更多的处理器,可以很方便的移植到你自己的开发板 平台。
TI的AM335X EVM板的Uboot源码u-boot-2011.09-psp04.06.00.08.tar.gz
u-boot-tiny6410.tar.gz支持sd卡启动,修改u-boot - mini6410 - 20101106.tar.gz而来,屡试不爽
u-boot-2011.03在TQ2440上的移植--最新uboot移植文档.
u-boot-2010.03.tar.bz2 u-boot-2020.01.tar.bz2 u-boot-2020.04.tar.bz2 u-boot-2020.07.tar.bz2 u-boot-2020.10.tar.bz2 u-boot-2021.01.tar.bz2 u-boot-2021.04.tar.bz2 u-boot-2021.07.tar.bz2 u-boot-2021.10....
u-boot-1.1.6.tar.bz & u-boot-1.1.6_jz2440.patch
u-boot-2014.04-tq210,实现uboot初步移植,适用于S5PV210平台
赠送jar包:spring-boot-autoconfigure-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-autoconfigure-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-autoconfigure-2.3.12.RELEASE-sources.jar; 赠送...
u-boot-xlnx-xilinx-v2017.4.tar,zynq7000系列UBOOT源文件,可以使用petalinux进行编译。
赠送jar包:spring-boot-actuator-autoconfigure-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-actuator-autoconfigure-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-actuator-autoconfigure-2.3.12....
很多同学都喜欢学习嵌入式,但是个人觉得u-boot 可以很明显的体现个人的嵌入式水平。这里是u-boot-2013.01.tar.bz2的源代码。
现在网上已经有了u-boot-2012.04.01移植到TQ2440的过程,我也是看的别人的移植笔记,但是还是有些地方没有那么详细。所以细化了一下!给对u-boot移植不太熟悉的同学参考一下!
u-boot-2011.03在TQ2440上的移植文档,详细解答
u-boot-2011.03.tar.bz2
终于和linux内核一样通过图形界面配置 make menuconfig值得期待
关于arm mini2440的U-Boot-2010.03移植详解
嵌入式Linux之我行——u-boot-2009.08在2440上的移植详解.doc
u-boot 三星 s5pv210芯片
tekkamanninja opensource u-boot-2010.03_tekkaman for Friendly-ARM mini2440