天嵌 ARM开发社区

 找回密码
 注册
查看: 2467|回复: 4

uboot1.1.6 中的C 语法问题

[复制链接]
guobinname_301 发表于 2012-11-6 22:53:09 | 显示全部楼层 |阅读模式
void env_relocate_spec (void)代码搬运中有nand_read
{
。。。。。。
ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
。。。。。。}
这个nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);

最后真正执行的是这个函数nand_read_ecc (mtd, from, len, retlen, buf, NULL, NULL);
这个函数的代码如下:
static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
                          size_t * retlen, u_char * buf, u_char * oob_buf, struct nand_oobinfo *oobsel)
{
        。。。。。。。
}
问:为什么开始的nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
入口参数是4个,而最后调用的static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
                          size_t * retlen, u_char * buf, u_char * oob_buf, struct nand_oobinfo *oobsel)的入口参数却是7个???????????
多出来的3个参数如何理解????????

embedsky_lhh 发表于 2012-11-7 09:24:20 | 显示全部楼层
nand_read方法里边调用的nand_read_ecc ,并不是直接调用的,
 楼主| guobinname_301 发表于 2012-11-7 14:36:12 | 显示全部楼层
embedsky_lhh 发表于 2012-11-7 09:24
nand_read方法里边调用的nand_read_ecc ,并不是直接调用的,

static inline int nand_read(nand_info_t *info, ulong ofs, ulong *len, u_char *buf)
{
        return info->read(info, ofs, *len, (size_t *)len, buf);
}
那这个返回函数的入口参数是5个,而调用它的只有4个入口参数,怎么理解????
embedsky_lhh 发表于 2012-11-7 15:22:38 | 显示全部楼层
guobinname_301 发表于 2012-11-7 14:36
static inline int nand_read(nand_info_t *info, ulong ofs, ulong *len, u_char *buf)
{
        return inf ...

你看的不是同一函数,
 楼主| guobinname_301 发表于 2012-11-7 23:16:19 | 显示全部楼层
大侠,那我换个角度来提这个问题
那程序在执行void env_relocate_spec (void)
{
        ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);

}将调用
static inline int nand_read(nand_info_t *info, ulong ofs, ulong *len, u_char *buf)
{
        return info->read(info, ofs, *len, (size_t *)len, buf);
}
如果这个调用关系我没有搞错的话,
我想知道nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
的4个参数如何与info->read(info, ofs, *len, (size_t *)len, buf);
的5个参数发生关联?????
希望大侠能讲详细一点!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-5-5 00:43 , Processed in 1.062500 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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