QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1156|回复: 0

uboot的bug?

[复制链接]
发表于 2006-7-5 11:06:56 | 显示全部楼层 |阅读模式
u-boot-1.1.4/commond/cmd_nand.c

1080行左右(我的程序改过,行数可能不同),nand_write_page函数里

/* Calculate and write the ECC if we have enough data */
if ((col < nand->eccsize) && (last >= nand->eccsize))
{
        nand_calculate_ecc (&nand->data_buf[0], &(ecc_code[0]));
        for (i = 0; i < 3; i++)
        {
                nand->data_buf[(nand->oobblock + oob_config.ecc_pos)] = ecc_code;
        }
        if (oob_config.eccvalid_pos != -1)
        {
                nand->data_buf[nand->oobblock + oob_config.eccvalid_pos] = 0xf0;
        }
}

/* Calculate and write the second ECC if we have enough data */
if ((nand->oobblock == 512) && (last == nand->oobblock))
{
        nand_calculate_ecc (&nand->data_buf[256], &(ecc_code[3]));
        for (i = 3; i < 6; i++)
        {
                nand->data_buf[(nand->oobblock + oob_config.ecc_pos)] = ecc_code;
        }
        if (oob_config.eccvalid_pos != -1)
        {
                nand->data_buf[nand->oobblock + oob_config.eccvalid_pos] &= 0x0f;
        }
}
在这里进行了两次ecc,而且ecc_code也写进了data_buf,512-527中

再后面
for (i = 0; i < col; i++)
        nand->data_buf = 0xff;

/* Postpad for partial page programming !!! oob is already padded */
for (i = last; i < nand->oobblock; i++)
        nand->data_buf = 0xff;

为什么又把data_buf的某些部分置成0xff,前面按不是0xff校验了,置成0xff不就错了吗?这里是怎么回事?(不懂ecc算法)
有人调通nand write命令没?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-23 04:28 , Processed in 0.035793 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表