Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1056590
  • 博文数量: 573
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 66
  • 用 户 组: 普通用户
  • 注册时间: 2016-06-28 16:21
文章分类

全部博文(573)

文章存档

2018年(3)

2016年(48)

2015年(522)

分类: LINUX

2015-12-07 14:35:29

makefile文件

点击(此处)折叠或打开

  1. # File: Makefile
  2. # wangxiancai

  3. MODEXT = ko
  4. INSTALLDIR=/home/wangxc/linux/rootfs/nfs_2.6.13/wxc/driver/chardriver/ko
  5. # INSTALLDIR=/home/wangxc/linux/rootfs/nfs_2.6.30/wxc/driver/chardriver/ko
  6. CROSS=/home/wangxc/linux/toolchain/crosstools_3.4.1_softfloat/arm-linux/gcc-3.4.1-glibc-2.3.3/bin/arm-linux-
  7. # CROSS=/home/wangxc/linux/toolchain/crosstools_4.4.3_softfloat/bin/arm-linux-
  8. KERNELDIR=/home/wangxc/linux/kernel/kernel-2.6.13
  9. # KERNELDIR=/home/wangxc/linux/kernel/kerner-2.6.30

  10. CC= $(CROSS)gcc
  11. LD= $(CROSS)ld

  12. #############################################################################
  13. # Compiler Flags
  14. #############################################################################
  15. EXTRA_CFLAGS += -I$(KERNELDIR)/include
  16. #############################################################################
  17. # Make Targets
  18. #############################################################################
  19. obj-m := regeditor.o
  20. default:
  21.     $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
  22. # Otherwise we were called directly from the command line; invoke the kernel build system.

  23. install: default
  24.     rm -rf $(INSTALLDIR)/regeditor.$(MODEXT)
  25.     cp -rf $(PWD)/regeditor.$(MODEXT) $(INSTALLDIR)

  26. clean:
  27.     rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.bak modules.order Module.symvers


regeditor.c文件

点击(此处)折叠或打开

  1. #include <linux/module.h>
  2. #include <linux/kernel.h>
  3. #include <linux/errno.h>
  4. #include <linux/string.h>
  5. #include <linux/mm.h>
  6. #include <linux/tty.h>
  7. #include <linux/slab.h>
  8. #include <linux/delay.h>
  9. #include <linux/fb.h>
  10. #include <linux/init.h>
  11. #include <linux/dma-mapping.h>
  12. #include <linux/string.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/workqueue.h>
  15. #include <linux/wait.h>
  16. #include <linux/fs.h>
  17. #include <linux/irq.h>
  18. #include <asm/hardware.h>
  19. #include <linux/poll.h>
  20. #include <linux/device.h>

  21. #include <asm/io.h>
  22. #include <asm/irq.h>
  23. #include <asm/uaccess.h>
  24. #include <asm/div64.h>

  25. #include <asm/mach/map.h>
  26. #include <asm/arch/regs-lcd.h>
  27. #include <asm/arch/regs-gpio.h>
  28. #include <asm/arch/fb.h>
  29. #include <asm/hardware/clock.h>

  30. #include <asm/arch/tq2440-map.h> // HJ MMU setting

  31. /*注意 :每个地址值,其实只对应8位
  32. *例如 : 地址 0x56000054 其实只有 8位
  33.                 地址 0x56000055 其实只有 8位
  34.                 地址 0x56000056 其实只有 8位
  35.                 地址 0x56000057 其实只有 8位
  36. */
  37. #define REG_R8 0        /*读取 指定地址的8位的数据*/
  38. #define REG_R16 1        /*读取 指定地址的8位+后8位的数据*/
  39. #define REG_R32 2        /*读取 指定地址的8位+后24位的数据*/

  40. #define REG_W8     3        /*写 8位数据 到 指定地址的8位*/
  41. #define REG_W16 4        /*写 16位数据 到 指定地址的连续16位*/
  42. #define REG_W32 5        /*写 32位数据 到 指定地址的连续32位*/

  43. #define DEVICE_NAME    "regeditor"
  44. static int MYDRIVER_Major = 0;

  45. static struct class * mydriver_class;
  46. static struct class_device    * mydriver_class_dev;

  47. /*
  48. *应用层 ioctl函数的原型 : int ioctl(int filedes, int request, ...); //参数个数是可变个数。
  49. *读取的时候,地址存放在 arg变量,应用程序传递进来的arg是指定的地址。
  50. *写的时候,地址和值都存放在 arg变量,应用程序传递进来的arg是个数组的地址(是int型数组,2个元素)
  51. */
  52. static int regeditor_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
  53. {
  54.     volatile unsigned char * p8;
  55.     volatile unsigned short * p16;
  56.     volatile unsigned int * p32;
  57.     
  58.     unsigned int buf[2]; /*2个int,共8个字节*/
  59.     unsigned int addr; //用来指示寄存器的地址
  60.     unsigned int val; //用来指示寄存器的值
  61.     
  62.     //printk("DEVICE:regeditor_ioctl Called!\n");
  63.     //printk("DEVICE:cmd=[%d], arg=[0x%x]\n", cmd, (unsigned int)arg);

  64.     /*功能 : 从用户空间指定的地址里面取得8个字节的数据。
  65.     *arg : 表示用户空间的int型数组buf的地址,该数组2个元素,刚好8个字节长度。
  66.     *注意 : 和应用程序约定好的 :
  67.     *                写入命令时 : buf[0]是写入的地址,做输入参数; buf[1]是欲写入的值,做输入参数。
  68.     *                读取命令时 : buf[0]是读取的地址,做输入参数; buf[1]是将要存放的值,做输出参数。
  69.     */
  70.     if(copy_from_user(buf, (const char __user *)arg, 8))
  71.     {
  72.             return - EFAULT;
  73.     }
  74.     addr = buf[0];
  75.     
  76.     /*读取时 : val=buf[1]初始值是0; 写入时 : val=buf[1]值是欲写入的值;*/
  77.     val = buf[1];

  78.     //printk("DEVICE:cmd=[%d], buf[0]=[0x%x], buf[1]=[%d]\n", cmd, buf[0], buf[1]);

  79.     p8 = (volatile unsigned char *)ioremap(addr, 4); /*映射4个字节*/
  80.     p16 = (volatile unsigned short * )p8;
  81.     p32 = (volatile unsigned int *)p8;
  82.     /*注意 : 上面3行处理之后,*p8只表示8位数据了,*p16只表示16位数据了,*p32只表示32位数据了,*/

  83.     switch(cmd)
  84.     {
  85.         case REG_R8: /*读取 指定地址的8位的数据*/
  86.         {
  87.             val = *p8; /*指定地址的8位数据 赋值 给 val*/
  88.             /* 拷贝数据到用户空间 */
  89.             /* arg+4 指向buf[1]了,即将val中的值,写入到用户空间的buf[1]*/
  90.             if(copy_to_user((void __user *)arg+4, &val, 4))
  91.             {
  92.                     return - EFAULT;
  93.             }
  94.             break;
  95.         }
  96.         case REG_R16: /*读取 指定地址的8位+后8位的数据*/
  97.         {
  98.             val = *p16; /*指定地址的16位数据 赋值 给 val*/
  99.             /* 拷贝数据到用户空间 */
  100.             /* arg+4 指向buf[1]了,即将val中的值,写入到用户空间的buf[1]*/
  101.             if(copy_to_user((void __user *)arg+4, &val, 4))
  102.             {
  103.                     return - EFAULT;
  104.             }
  105.             break;
  106.         }
  107.         case REG_R32: /*读取 指定地址的8位+后24位的数据*/
  108.         {
  109.             val = *p32; /*指定地址的32位数据 赋值 给 val*/
  110.             /* 拷贝数据到用户空间 */
  111.             /* arg+4 指向buf[1]了,即将val中的值,写入到用户空间的buf[1]*/
  112.             if(copy_to_user((void __user *)arg+4, &val, 4))
  113.             {
  114.                     return - EFAULT;
  115.             }
  116.             break;
  117.         }
  118.         case REG_W8: /*写 8位数据 到 指定地址的8位*/
  119.         {
  120.             *p8 = (unsigned char)val; /*val截取底8位 赋值 给 指定的8位地址*/
  121.             break;
  122.         }
  123.         case REG_W16: /*写 16位数据 到 指定地址的连续16位*/
  124.         {
  125.             *p16 = (unsigned short)val; /*val截取底16位 赋值 给 指定的16位地址*/
  126.             break;
  127.         }
  128.         case REG_W32: /*写 16位数据 到 指定地址的连续24位*/
  129.         {
  130.             *p32 = (unsigned int)val; /*val的32位 赋值 给 指定的32位地址*/
  131.             break;
  132.         }
  133.     }
  134.     iounmap((void *)p8);
  135.     return 0;
  136. }

  137. static struct file_operations kernel_rw_fops =
  138. {
  139.     .owner =        THIS_MODULE,
  140.     .ioctl = regeditor_ioctl,
  141. };

  142. static int __init regeditor_init(void)
  143. {
  144.     //printk("DEVICE : regeditor_init\n");

  145.     MYDRIVER_Major = register_chrdev(0, DEVICE_NAME, &kernel_rw_fops);
  146.     if (MYDRIVER_Major < 0)
  147.     {
  148.         printk(DEVICE_NAME " can't register major number\n");
  149.         return MYDRIVER_Major;
  150.     }
  151.     printk("DEVICE : register regeditor OK! Major = [%d]\n", MYDRIVER_Major);

  152.     /*注册一个类,使mdev可以自动在"/dev/"目录下面建立设备节点
  153.     静态编译进内核的,可以依赖mdev来建立设备节点,
  154.     编译成模块的,也只使用insmod 即可建立设备节点
  155.     */
  156.     mydriver_class = class_create(THIS_MODULE, DEVICE_NAME);
  157.     if(IS_ERR(mydriver_class))
  158.     {
  159.         printk("DEVICE:class_create err!\n");
  160.         return -1;
  161.     }
  162.     //创建一个设备节点,节点名为DEVICE_NAME
  163.     //device_create(mydriver_class, NULL, MKDEV(MYDRIVER_Major, 0), NULL, DEVICE_NAME);
  164.     mydriver_class_dev = class_device_create(mydriver_class, MKDEV(MYDRIVER_Major, 0), NULL, DEVICE_NAME); // dev/mydriver

  165.     //printk("DEVICE:initialized\n");

  166.     return 0;
  167. }

  168. static void __exit regeditor_exit(void)
  169. {
  170.     //printk("DEVICE : regeditor_exit####################\n");
  171.     unregister_chrdev(MYDRIVER_Major, DEVICE_NAME);
  172.     class_device_destroy(mydriver_class, MKDEV(MYDRIVER_Major, 0));
  173.     class_destroy(mydriver_class);
  174.     
  175.     return;
  176. }

  177. module_init(regeditor_init);
  178. module_exit(regeditor_exit);

  179. MODULE_AUTHOR("wangxiancai");
  180. MODULE_DESCRIPTION("DEVICE : regeditor");
  181. MODULE_LICENSE("GPL");


  182. /*
  183. 测试 :
  184. 1, # insmod regeditor.ko
  185. DEVICE : register regeditor Major = [253]

  186. 2, # mknod /dev/regeditor c 253 0
  187.      # ls -lrt /dev/reg*
  188. crw-r--r-- 1 root root 253, 0 Jan 1 01:15 /dev/regeditor

  189. 3, 点亮LED灯
  190. GPBCON = 0x56000010
  191. GPBDAT = 0x56000014
  192. GPBUP = 0x56000018

  193. # ./regeditor w32 0x56000010 0x55555555 //全部配置成输出引脚
  194. # ./regeditor r32 0x56000010
  195.     [00.] [0x56000010] = [0x00155555]
  196. # ./regeditor r8 0x56000010 4
  197.     [00.] [0x56000010] = [0x55]
  198.     [01.] [0x56000011] = [0x55]
  199.     [02.] [0x56000012] = [0x15]
  200.     [03.] [0x56000013] = [0x00]

  201. # ./regeditor w32 0x56000018 0x00000000
  202. # ./regeditor r32 0x56000018
  203.     [00.] [0x56000018] = [0x00000000]
  204. # ./regeditor r8 0x56000018 4
  205.     [00.] [0x56000018] = [0x00]
  206.     [01.] [0x56000019] = [0x00]
  207.     [02.] [0x5600001a] = [0x00]
  208.     [03.] [0x5600001b] = [0x00]

  209. # ./regeditor w32 0x56000014 0xffffffff //灯全灭,蜂鸣器响了。最后1位,1:蜂鸣器响,0:蜂鸣器不响
  210. # ./regeditor w32 0x56000014 0xfffffffe //灯全灭,蜂鸣器不响。
  211. # ./regeditor r32 0x56000014
  212.     [00.] [0x56000014] = [0x000007fe]
  213. # ./regeditor r8 0x56000014 4
  214.     [00.] [0x56000014] = [0xfe]
  215.     [01.] [0x56000015] = [0x07]
  216.     [02.] [0x56000016] = [0x00]
  217.     [03.] [0x56000017] = [0x00]
  218. # ./regeditor w32 0x56000014 0x00000000 //灯全亮,蜂鸣器不响。

  219. # ./regeditor r8 0x56000010 8 //读取8个字节时,读取到 地址 0x56000017 的值。
  220.     [00.] [0x56000010] = [0x55]
  221.     [01.] [0x56000011] = [0x55]
  222.     [02.] [0x56000012] = [0x15]
  223.     [03.] [0x56000013] = [0x00]
  224.     [04.] [0x56000014] = [0xfe]
  225.     [05.] [0x56000015] = [0x07]
  226.     [06.] [0x56000016] = [0x00]
  227.     [07.] [0x56000017] = [0x00]
  228. # ./regeditor r32 0x56000010 3 //一次读取3个寄存器(GPBCON,GPBDAT,GPBUP)的值
  229.     [00.] [0x56000010] = [0x00155555]
  230.     [01.] [0x56000014] = [0x000007fe]
  231.     [02.] [0x56000018] = [0x00000000]
  232.     
  233. # ./regeditor r32 0x48000000 12 //一次读取存储控制器相关的12个寄存器的值。
  234. [00.] [0x48000000] = [0x220dd112]
  235. [01.] [0x48000004] = [0x00000700]
  236. [02.] [0x48000008] = [0x00001c10]
  237. [03.] [0x4800000c] = [0x00001c10]
  238. [04.] [0x48000010] = [0x00001f4c]
  239. [05.] [0x48000014] = [0x00000700]
  240. [06.] [0x48000018] = [0x00000700]
  241. [07.] [0x4800001c] = [0x00018005]
  242. [08.] [0x48000020] = [0x00018005]
  243. [09.] [0x48000024] = [0x008e04f4]
  244. [10.] [0x48000028] = [0x00000032]
  245. [11.] [0x4800002c] = [0x00000030]
  246. */
应用程序:
makefile文件

点击(此处)折叠或打开

  1. CROSS=/home/wangxc/linux/toolchain/crosstools_3.4.1_softfloat/arm-linux/gcc-3.4.1-glibc-2.3.3/bin/arm-linux-gcc
  2. all: regeditor
  3. regeditor:regeditor.c
  4.     $(CROSS) -o regeditor regeditor.c
  5. clean:
  6.     @rm -vf regeditor.o regeditor
regeditor.c文件

点击(此处)折叠或打开

  1. /*
  2. 本程序的功能 : 可以读取指定寄存器的值,也可以直接修改指定寄存器的值。
  3. 自己制作的驱动调试的工具 : 可以作为一个很强大的调试驱动程序工具
  4. 工作中会遇到各种各样的驱动程序,需要根据实际要求来写各种各样的驱动调试工具。
  5. 用法示例 :
  6.         程序名称 读取命令 读取的地址 顺序读取地址的值的个数
  7.    ./regeditor r16 addr [num]

  8. 1, ./regeditor r8 0x56000054 4 //表示读取 0x56000054+0x56000055+0x56000056+0x56000057 4个地址的值 每个读取8位 共32位。
  9. 2, ./regeditor r8 0x56000054
  10. 3, ./regeditor r16 0x56000054 4
  11. 4, ./regeditor r16 0x56000054
  12. 5, ./regeditor r32 0x56000054 2
  13. 6, ./regeditor r32 0x56000054

  14.         程序名称 写入命令 写入的地址 写入的值
  15.    ./regeditor w8 addr val
  16. 1, ./regeditor w32 0x56000054 0x7f
  17. */

  18. #include <sys/types.h>
  19. #include <sys/stat.h>
  20. #include <fcntl.h>
  21. #include <stdio.h>
  22. #include <poll.h>
  23. #include <signal.h>
  24. #include <sys/types.h>
  25. #include <unistd.h>
  26. #include <fcntl.h>
  27. #include <stdlib.h>
  28. #include <string.h>

  29. /*注意 :每个地址值,其实只对应8位
  30. *例如 : 地址 0x56000054 其实只有 8位
  31.                 地址 0x56000055 其实只有 8位
  32.                 地址 0x56000056 其实只有 8位
  33.                 地址 0x56000057 其实只有 8位
  34. */
  35. #define REG_R8 0        /*读取 指定地址的8位的数据*/
  36. #define REG_R16 1        /*读取 指定地址的8位+后8位的数据*/
  37. #define REG_R32 2        /*读取 指定地址的8位+后24位的数据*/

  38. #define REG_W8     3        /*写 8位数据 到 指定地址的8位*/
  39. #define REG_W16 4        /*写 16位数据 到 指定地址的连续16位*/
  40. #define REG_W32 5        /*写 32位数据 到 指定地址的连续32位*/

  41. /*函数功能 : 打印本程序的用法
  42. */
  43. void print_usage(char * cmd)
  44. {
  45.     printf("Usage:\n");
  46.     printf("%s [num]\n", cmd);
  47.     printf("%s \n", cmd);
  48. }

  49. int main(int argc, char **argv)
  50. {
  51.     int fd;
  52.     
  53.     /*
  54.     写入命令时 : buf[0]是写入的地址,做输入参数; buf[1]是欲写入的值,做输入参数
  55.     读取命令时 : buf[0]是读取的地址,做输入参数; buf[1]是将要存放的值,做输出参数
  56.     */
  57.     unsigned int buf[2];
  58.     unsigned int i;
  59.     unsigned int num; /*连续读取的次数*/
  60.     
  61.     memset(buf, 0, sizeof(buf));
  62.     
  63.     if((argc != 3) && (argc != 4))
  64.     {
  65.         /* argv[0]:是程序名称 */
  66.         print_usage(argv[0]);
  67.         return -1;
  68.     }

  69.     fd = open("/dev/regeditor", O_RDWR);
  70.     if(fd < 0)
  71.     {
  72.         printf("can't open /dev/regeditor\n");
  73.         return -2;
  74.     }

  75.     /* argv[2]:是地址 */
  76.     buf[0] = strtoul(argv[2], NULL, 0);
  77.     
  78.     //printf("&buf=[%p]\n", buf);

  79.     if(argc == 4) /*如果有4个参数(argv[3])*/
  80.     {
  81.         /*则第4个参数是 写入命令 : 写入的值; 读取命令 : 顺序读取地址的值的个数*/
  82.         buf[1] = strtoul(argv[3], NULL, 0); /* argv[3]:是将写入的值 */
  83.         num = buf[1];                                        /* argv[3]:顺序读取地址的值的个数 */
  84.     }
  85.     else /*如果只有3个参数*/
  86.     {
  87.         num = 1; /* 肯定是读取命令:则默认只读取1个地址的值,buf[1]是空,准备接受数据*/
  88.     }

  89.     /* r8 R8,r16 R16,r32 R32 表示argv[1]:是读取命令 */
  90.     if((strcmp(argv[1], "r8") == 0) || (strcmp(argv[1], "R8") == 0)) /*读取 指定地址的8位的数据*/
  91.     {
  92.         for(i = 0; i < num; i++)
  93.         {
  94.             ioctl(fd, REG_R8, buf); /* buf[0]是读取的地址,buf[1]是存放读取的值 */
  95.             printf("[%02d.] [0x%08x] = [0x%02x]\n", i, buf[0], (unsigned char)buf[1]);
  96.             buf[0] += 1; /*int型的地址值+1*/
  97.         }
  98.     }
  99.     else if((strcmp(argv[1], "r16") == 0) || (strcmp(argv[1], "R16") == 0)) /*读取 指定地址的8位+后8位的数据*/
  100.     {
  101.         for (i = 0; i < num; i++)
  102.         {
  103.             ioctl(fd, REG_R16, buf); /* buf[0]是读取的地址,buf[1]是存放读取的值 */
  104.             printf("[%02d.] [0x%08x] = [0x%04x]\n", i, buf[0], (unsigned short)buf[1]);
  105.             buf[0] += 2;
  106.         }
  107.     }
  108.     else if((strcmp(argv[1], "r32") == 0) || (strcmp(argv[1], "R32") == 0)) /*读取 指定地址的8位+后24位的数据*/
  109.     {
  110.         for (i = 0; i < num; i++)
  111.         {
  112.             ioctl(fd, REG_R32, buf); /* buf[0]是读取的地址,buf[1]是存放读取的值 */
  113.             printf("[%02d.] [0x%08x] = [0x%08x]\n", i, buf[0], (unsigned int)buf[1]);
  114.             buf[0] += 4;
  115.         }
  116.     }
  117.     /* w8 W8,w16 W16,w32 W32 表示argv[1]:是写入命令 */
  118.     else if((strcmp(argv[1], "w8") == 0) || (strcmp(argv[1], "W8") == 0)) /*写 8位数据 到 指定地址的8位*/
  119.     {
  120.         ioctl(fd, REG_W8, buf); /* buf[0]是写入的地址,buf[1]是写入的值 */
  121.     }
  122.     else if((strcmp(argv[1], "w16") == 0) || (strcmp(argv[1], "W16") == 0)) /*写 16位数据 到 指定地址的连续16位*/
  123.     {
  124.         ioctl(fd, REG_W16, buf); /* buf[0]是写入的地址,buf[1]是写入的值 */
  125.     }
  126.     else if((strcmp(argv[1], "w32") == 0) || (strcmp(argv[1], "W32") == 0)) /*写 32位数据 到 指定地址的连续32位*/
  127.     {
  128.         ioctl(fd, REG_W32, buf); /* buf[0]是写入的地址,buf[1]是写入的值 */
  129.     }
  130.     else
  131.     {
  132.         printf("[%s] err!!!", argv[1]);
  133.         return -1;
  134.     }

  135.     return 0;

  136. }


  137. /*
  138. 测试 :
  139. 1, # insmod regeditor.ko
  140. DEVICE : register regeditor Major = [253]

  141. 2, # mknod /dev/regeditor c 253 0
  142.      # ls -lrt /dev/reg*
  143. crw-r--r-- 1 root root 253, 0 Jan 1 01:15 /dev/regeditor

  144. 3, 点亮LED灯
  145. GPBCON = 0x56000010
  146. GPBDAT = 0x56000014
  147. GPBUP = 0x56000018

  148. # ./regeditor w32 0x56000010 0x55555555 //全部配置成输出引脚
  149. # ./regeditor r32 0x56000010
  150.     [00.] [0x56000010] = [0x00155555]
  151. # ./regeditor r8 0x56000010 4
  152.     [00.] [0x56000010] = [0x55]
  153.     [01.] [0x56000011] = [0x55]
  154.     [02.] [0x56000012] = [0x15]
  155.     [03.] [0x56000013] = [0x00]

  156. # ./regeditor w32 0x56000018 0x00000000
  157. # ./regeditor r32 0x56000018
  158.     [00.] [0x56000018] = [0x00000000]
  159. # ./regeditor r8 0x56000018 4
  160.     [00.] [0x56000018] = [0x00]
  161.     [01.] [0x56000019] = [0x00]
  162.     [02.] [0x5600001a] = [0x00]
  163.     [03.] [0x5600001b] = [0x00]

  164. # ./regeditor w32 0x56000014 0xffffffff //灯全灭,蜂鸣器响了。最后1位,1:蜂鸣器响,0:蜂鸣器不响
  165. # ./regeditor w32 0x56000014 0xfffffffe //灯全灭,蜂鸣器不响。
  166. # ./regeditor r32 0x56000014
  167.     [00.] [0x56000014] = [0x000007fe]
  168. # ./regeditor r8 0x56000014 4
  169.     [00.] [0x56000014] = [0xfe]
  170.     [01.] [0x56000015] = [0x07]
  171.     [02.] [0x56000016] = [0x00]
  172.     [03.] [0x56000017] = [0x00]
  173. # ./regeditor w32 0x56000014 0x00000000 //灯全亮,蜂鸣器不响。

  174. # ./regeditor r8 0x56000010 8 //读取8个字节时,读取到 地址 0x56000017 的值。
  175.     [00.] [0x56000010] = [0x55]
  176.     [01.] [0x56000011] = [0x55]
  177.     [02.] [0x56000012] = [0x15]
  178.     [03.] [0x56000013] = [0x00]
  179.     [04.] [0x56000014] = [0xfe]
  180.     [05.] [0x56000015] = [0x07]
  181.     [06.] [0x56000016] = [0x00]
  182.     [07.] [0x56000017] = [0x00]
  183. # ./regeditor r32 0x56000010 3 //一次读取3个寄存器(GPBCON,GPBDAT,GPBUP)的值
  184.     [00.] [0x56000010] = [0x00155555]
  185.     [01.] [0x56000014] = [0x000007fe]
  186.     [02.] [0x56000018] = [0x00000000]
  187.     
  188. # ./regeditor r32 0x48000000 12 //一次读取存储控制器相关的12个寄存器的值。
  189. [00.] [0x48000000] = [0x220dd112]
  190. [01.] [0x48000004] = [0x00000700]
  191. [02.] [0x48000008] = [0x00001c10]
  192. [03.] [0x4800000c] = [0x00001c10]
  193. [04.] [0x48000010] = [0x00001f4c]
  194. [05.] [0x48000014] = [0x00000700]
  195. [06.] [0x48000018] = [0x00000700]
  196. [07.] [0x4800001c] = [0x00018005]
  197. [08.] [0x48000020] = [0x00018005]
  198. [09.] [0x48000024] = [0x008e04f4]
  199. [10.] [0x48000028] = [0x00000032]
  200. [11.] [0x4800002c] = [0x00000030]
  201. */


阅读(684) | 评论(0) | 转发(0) |
0

上一篇:内核线程

下一篇:自己编写一个printk函数

给主人留下些什么吧!~~