日志
来源:互联网 发布:财务报表数据下载 编辑:程序博客网 时间:2024/05/18 08:09
9/19
*内核中的DEBUG宏
#ifdef DEBUG_S3C_MEM
#define DEBUG(fmt, args...) printk(fmt, ##args)
#else
#define DEBUG(fmt, args...) do {} while (0)
#endif
用来定义无效的指针
(void *)0 就是将0强制转化为(void *)类型的指针
char *ch = (void *)0;//ch指向地址0
2017-10-29 21:39:49
试着写一下每天的记录吧!!
跑步:没跑 外面下雨!!!
晚上又吃了零食-.-
uboot:
2.8.3.3、uboot管理命令的方法:给结构体定义段属性(自定义),连接时链在一起。就会在u-boot.bin中,
到时候重定位到ddr,起始地址在u-boot.lds中,有点类似数组。
2.8.4、看具体的实现:
struct cmd_tbl_s {
char*name;/* Command Name*/
intmaxargs;/* maximum number of arguments*/
intrepeatable;/* autorepeat allowed?*/
/* Implementation function*/
int(*cmd)(struct cmd_tbl_s *, int, int, char *[]);
char*usage;/* Usage message(short)*/
#ifdefCFG_LONGHELP
char*help;/* Help message(long)*/
#endif
#ifdef CONFIG_AUTO_COMPLETE
/* do auto completion on the arguments */
int(*complete)(int argc, char *argv[], char last_char, int maxv, char *cmdv
[]);
#endif
};
//用下面的宏给结构体填充
U_BOOT_CMD宏:#define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \//cmd是个函数指针
cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage, help}
//##在gcc中是个连字符: ##name==name,#name是用来给char*赋值(变成字符串);
//用到的宏Struct_Section
#define Struct_Section __attribute__ ((unused,section (".u_boot_cmd"))) //这个就是添加段属性
实列:do_version (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
extern char version_string[];
printf ("\n%s\n", version_string);
return 0;
}
U_BOOT_CMD(
version,1,1,do_version,
"version - print monitor version\n",
NULL
);
2.8.4.2、find_cmd
cmd_tbl_t *find_cmd (const char *cmd)
{
cmd_tbl_t *cmdtp;
cmd_tbl_t *cmdtp_temp = &__u_boot_cmd_start;/*Init value */链接脚本中定义
const char *p;
int len;
int n_found = 0;
/*
* Some commands allow length modifiers (like "cp.b");
* compare command name only until first dot.
*/
len = ((p = strchr(cmd, '.')) == NULL) ? strlen (cmd) : (p - cmd); //strchr是在cmd中
找"."
for (cmdtp = &__u_boot_cmd_start;
cmdtp != &__u_boot_cmd_end;
cmdtp++) {
if (strncmp (cmd, cmdtp->name, len) == 0) { //返回值==0,相等
if (len == strlen (cmdtp->name))
return cmdtp;/* full match */
cmdtp_temp = cmdtp;/* abbreviated command ? */细节不考虑
n_found++;
}
}
if (n_found == 1) {/* exactly one match */
return cmdtp_temp;
}
return NULL;/* not found or ambiguous command */
}
阅读全文
0 0
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- 日志
- uva11090 给你一个有向图,求出平均权值最小的环
- ScrollView中EditText导致自动滚动问题
- 一、FFMPEG源码编译
- (转)“AI售前”,一根被忽略的敏感神经
- paper.js 官方教程学习,顺手翻译(意译)二
- 日志
- 第八周项目1——建立顺序串的算法库
- 【实战】7-1 商品管理模块接口定义
- BAT常用命令
- linux挂载windows nfs文件夹
- 关于c++的初接触
- hdu 1573 中国剩余定理
- getContextpath、getServletPath、getRealpath的不同
- mysql 事务的概念,事务的特性,事务的隔离级别的设置,