主题 : lcd驱动,在mini2440开发板上insmod出错 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 16112
精华: 0
发帖: 7
金钱: 35 两
威望: 7 点
综合积分: 14 分
注册时间: 2010-03-14
最后登录: 2017-09-13
楼主  发表于: 2010-03-14 19:22

 lcd驱动,在mini2440开发板上insmod出错

请问前辈,我仿照2440test里lcd.c程序,写了一个lcd的驱动,编译通过了,然后在开发板上insmod时,串口输出如下错误,请问是什么原因啊?
lcd_driver: module license 'MYGPL' taints kernel.
Unable to handle kernel paging request at virtual address 56000028
pgd = c3aa8000
[56000028] *pgd=00000000
Internal error: Oops: 805 [#1]
Modules linked in: lcd_driver(P+)
CPU: 0 Tainted: P (2.6.29.4-FriendlyARM #3)
PC is at Setup_LCDInit+0x20/0xc8 [lcd_driver]
LR is at 0xaaaaaaaa
pc : [<bf0008c4>] lr : [<aaaaaaaa>] psr: 60000013
sp : c3a5bec0 ip : c3a5bee0 fp : c3a5bedc
r10: c03ff260 r9 : bf02a000 r8 : c0029008
r7 : c3a5a000 r6 : 00000000 r5 : 000a18b7 r4 : ffffffff
r3 : 00000646 r2 : 56000000 r1 : 4d000000 r0 : bf02a000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: c000717f Table: 33aa8000 DAC: 00000015
Process insmod (pid: 567, stack limit = 0xc3a5a268)
Stack: (0xc3a5bec0 to 0xc3a5c000)
bec0: 000022fc 000a18b7 00000000 c3a5a000 c3a5beec c3a5bee0 bf02a010 bf0008b4
bee0: c3a5bf7c c3a5bef0 c0028284 bf02a010 00000013 00000008 00000000 c02d392c
bf00: 0000006b 0000006b c009e320 00000002 00000002 c4828750 00000015 00000000
bf20: 00000015 00000015 00000000 00000000 00000000 00000000 00000000 00000000
bf40: 00000000 000022fc 000a18b7 bf0019a8 00000000 000022fc 000a18b7 bf0019a8
bf60: 00000000 c0029008 c3a5a000 00000000 c3a5bfa4 c3a5bf80 c005e79c c0028258
bf80: c0086914 c0086804 4001d838 00000000 bec76e68 00000080 00000000 c3a5bfa8
bfa0: c0028e60 c005e718 4001d838 00000000 000b5038 000022fc 000a18b7 00000000
bfc0: 4001d838 00000000 bec76e68 00000080 bec76e64 bec76e68 00000001 00000000
bfe0: 00000069 bec76b34 0001778c 401d3c24 60000010 000b5038 304b5031 304b5431
Backtrace:
[<bf0008a4>] (Setup_LCDInit+0x0/0xc8 [lcd_driver]) from [<bf02a010>] (init_modul
e+0x10/0x84 [lcd_driver])
r7:c3a5a000 r6:00000000 r5:000a18b7 r4:000022fc
[<bf02a000>] (init_module+0x0/0x84 [lcd_driver]) from [<c0028284>] (__exception_
text_end+0x3c/0x1bc)
[<c0028248>] (__exception_text_end+0x0/0x1bc) from [<c005e79c>] (sys_init_module
+0x94/0x1a0)
[<c005e708>] (sys_init_module+0x0/0x1a0) from [<c0028e60>] (ret_fast_syscall+0x0
/0x2c)
r7:00000080 r6:bec76e68 r5:00000000 r4:4001d838
Code: e59f309c e3a0144d e3a02456 e3e04000 (e5824028)
---[ end trace 965224445f57bdd1 ]---
Segmentation fault
级别: 新手上路
UID: 16112
精华: 0
发帖: 7
金钱: 35 两
威望: 7 点
综合积分: 14 分
注册时间: 2010-03-14
最后登录: 2017-09-13
1楼  发表于: 2010-03-14 19:27
以下代码是我的部分头文件
#definerGPCCON    (*(volatile unsigned *)0x56000020)    //Port C control
#definerGPCUP     (*(volatile unsigned *)0x56000028)    //Pull-up control C

#define GPDCON    (*(volatile unsigned *)0x56000030)    //Port D control
#define GPDUP     (*(volatile unsigned *)0x56000038)    //Pull-up control D

部分.c代码:
GPCUP = 0xffffffff; // Disable Pull-up register
GPCCON= 0xaaaaaaaa; //Initialize VD[7:0],LCDVF[2:0],VM,VFRAME,VLINE,VCLK,LEND
GPDUP = 0xffffffff; // Disable Pull-up register
GPDCON= 0xaaaaaaaa; //Initialize VD[23:8]

我觉得是执行到GPCUP = 0xffffffff; 这里就出错了,因为GPCUP地址就是56000028。请问是什么原因啊?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2010-03-14 20:23

 回 1楼(zcy_6001) 的帖子

通常情况下,在Linux内核中,驱动不能直接访问像0x56000028这样的物理地址,可以访问的是通过MMU映射的虚拟地址。
你可以用ioremap()将所需要的GPIO寄存器映射到虚拟地址空间里来。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 16112
精华: 0
发帖: 7
金钱: 35 两
威望: 7 点
综合积分: 14 分
注册时间: 2010-03-14
最后登录: 2017-09-13
3楼  发表于: 2010-03-22 10:35

 回 2楼(kasim) 的帖子

谢谢总版主,按照您所说的,现在没有那问题了,可是安装好以后,又出现画屏了,我又发表了一个帖子,请有空帮我看看,非常感谢!
新帖地址:http://www.aiothome.net/read.php?tid-5286.html