摘要: #define s ((((((((0#define X )*2+1#define _ )*2unsigned char Font8x16[] = {s _ _ _ _ _ _ _ _ , s _ _ _ _ _ _ _ _ ,s _ X X X X X _ _ , s _ X _ _ _ _ X _ , // ((((((((0 )*2 )*2+1 )*2 )*2 )*2 )*2 )*2+1 )*2 = 66 = 0100 0010,s _ X _ _ _ _ X _ ,s _ X _ _ _ _ X _ ,s _ X _ _ _ _ X _ ,s _ X X X ... 阅读全文
posted @ 2013-08-06 12:04 永不指步 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 在看《linux设备驱动开发详解》时,有如下代码,中间代码省略:struct globalmem_dev *globalmem_devp; /*设备结构体指针*/globalmem_devp = kmalloc(2*sizeof(struct globalmem_dev), GFP_KERNEL);globalmem_setup_cdev(&globalmem_devp[0], 0);globalmem_setup_cdev(&globalmem_devp[1], 1);#include <stdio.h>#include <stdlib.h>struc 阅读全文
posted @ 2012-12-25 13:08 永不指步 阅读(364) 评论(0) 推荐(0) 编辑
摘要: 在运用指针时,最多的错误就是指针的初始化。在程序中,一个未初始化的指针将会引起意想不到的问题。所以将指针初始化为NULL是个好习惯;在运用指针时,首先判断指针是否初始化,以防止指针指向一个未定义的地址。今天在写2.6内核的驱动时,就犯了这个问题。 1 #include <linux/module.h> 2 #include <linux/kernel.h> 3 #include <linux/fs.h> 4 #include <linux/cdev.h> 5 6 static struct cdev *my_dev; 7 static dev_t 阅读全文
posted @ 2012-12-23 21:21 永不指步 阅读(213) 评论(0) 推荐(0) 编辑
摘要: redhat 2.4.20.8内核编译 天嵌提供的 2.6.25.8无法生成zImae提示:cannot stat "arch/arm/boot/zImage" no such file or directory ,但是编译韦东山配套光盘提供的2.6.22.6内核能编译成功。ubuntu 9.0 2.6.30内核 两个都能编译成功。且redhat 和 ubuntu都是用的天嵌提供的4.3.3的GCC。- -!留下印记,待续! 阅读全文
posted @ 2012-12-23 13:20 永不指步 阅读(218) 评论(0) 推荐(0) 编辑
摘要: lcled_drv.c 1 #include <linux/module.h> 2 #include <linux/kernel.h> 3 #include <linux/fs.h> 4 #include <linux/init.h> 5 #include <linux/delay.h> 6 #include <asm/uaccess.h> 7 #include <asm/irq.h> 8 #include <asm/io.h> 9 #include <asm/arch/regs-gpio.h 阅读全文
posted @ 2012-12-22 17:27 永不指步 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 今天终于成功让第一个驱动跑起来了。前面没成功出现的问题主要有: 0.第0个- -!!编译驱动时指定的内核版本要和开发板上的相同。 1.驱动编译不成功,提示 cc1: error: invalid option `abi=aapcs-linux' 其原因是编译内核的GCC版本和编译驱动的不同。 2.驱动编译成功,加载成功,但执行测试程序时,提示:not't find test 其原因是编译根文件系统Busybox的GCC版本和编译驱动的不同,导致制作根文件系统时,用的lib库与编译驱动时用的lib库不同,用用静态编译可以解决,如:arm-linux-gcc test.c test 阅读全文
posted @ 2012-12-21 22:05 永不指步 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 首先虚拟机上设置:$sudo vi /etc/exports/home/book/lc_mini_fs *(rw,sync,no_root_squash)$sudo /etc/init.d/nfs-kernel-server restart开发板上:# ifconfig eth0# ifconfig eth0 10.15.11.134# mount -t nfs -o nolock 10.15.11.132:/home/book/lc_mini_fs /mnt 在设置好主机后,可以先尝试自己挂载自己,能挂载成功,再尝试用开发板来挂载。挂接命令(mount) 命令格式:mount [-t vf. 阅读全文
posted @ 2012-12-19 12:50 永不指步 阅读(375) 评论(0) 推荐(0) 编辑
摘要: iconeditor.h 1 #ifndef ICONEDITOR_H 2 #define ICONEDITOR_H 3 4 #include <QColor> 5 #include <QImage> 6 #include <QWidget> 7 8 class IconEditor : public QWidget 9 {10 Q_OBJECT11 Q_PROPERTY(QColor penColor READ penColor WRITE setPenColor)12 Q_PROPERTY(QImage iconImage READ iconImage 阅读全文
posted @ 2012-12-17 22:25 永不指步 阅读(344) 评论(0) 推荐(0) 编辑
摘要: hexspinbox.h 1 #ifndef HEXSPINBOX_H 2 #define HEXSPINBOX_H 3 4 #include <QSpinBox> 5 6 class QRegExpValidator; //正则表达式验证器 validator验证器 7 8 class HexSpinBox : public QSpinBox 9 {10 Q_OBJECT11 public:12 HexSpinBox(QWidget *parent = 0); 13 14 protected:15 QValidator::State validate(QStri... 阅读全文
posted @ 2012-12-15 21:54 永不指步 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 今天终于成功将u-boot-1.16移植到开发板上了(参考的《移植u-boot-1.1.6到TQ2440文档》和其补充——《U-boot移植笔记》,在在这里感谢无私网友的帮助)。用到终于,感觉像多难似的,其实点都不难,有众多热心网友的文档,只用照着做就是了,但前两天确实就没搞出来,大大的打击积极性。 这里总结一下,主要还是因为自己太急功近利了,都没仔细读别人写的文档,就照着改代码,结果改再多,再久,代码就是跑不了,白白浪费时间。所以: 1、看资料时,不可走马观花,这和看小说是不一样的。 2、要找对资源,现在网上资源丰富,但要会甄别哪些是自己真正需要的,切不可盲目,比如在较移植时,连别... 阅读全文
posted @ 2012-12-15 19:42 永不指步 阅读(164) 评论(0) 推荐(0) 编辑