摘要: char* filename; 1.先判断参数个数 if(argc != 3) { printf("xxx"); } filename = argc[1]; fd = open(filename,O_RDWR); if(fd < 0) { printf("can't open!\n"); retur 阅读全文
posted @ 2018-01-22 21:33 梦提三尺剑 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1.首先在驱动文件开头定义用于保存带操作IOK口的unsigned long变量,并且要用volatile修饰。 volatile unsigned long *gpfcon = NULL; volatile unsigned long *gpfdat = NULL; 2.在入口函数中对寄存器进行映射。 gpfcon = (volatile unsigned long ... 阅读全文
posted @ 2018-01-22 20:17 梦提三尺剑 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 1 头文件: 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 13 定义变量 14 int major; 15 static struct class *firstdrv_cl... 阅读全文
posted @ 2018-01-22 19:08 梦提三尺剑 阅读(167) 评论(0) 推荐(0) 编辑