• «
  • 1
  • 2
  • »
  • Pages: 2/2     Go
主题 : 驱动中关于异步通知出现的一个语法错误 复制链接 | 浏览器收藏 | 打印
级别: 骑士
UID: 4234
精华: 0
发帖: 152
金钱: 1420 两
威望: 1142 点
综合积分: 304 分
注册时间: 2009-03-05
最后登录: 2012-08-18
10楼  发表于: 2009-08-31 10:28
我今天开始试了下带异步通知的button的驱动,发现一个问题,我的测试程序执行时会出现一堆的信息,第一次看到不知道时什么东西,看看师兄们是不是看到过
下面是出现的串口信息:
Not tainted  (2.6.22.6 #84)00b0 00020001 0000001d 00000037 30023
pc : [<c0091884>]    lr : [<c04ef03c>]    psr: 20000093IRQs off  FIQs on  Mode
5e80: 41129200 30023480 c0315e
sp : c3efdf30  ip : c071d174  fp : c3efdf50013Control: c000717f  Table: 33d48000
r7 : 00000001  r6 : c3d10d40  r5 : 00000000  r4 : c071d174
r3 : a0000093  r2 : c3cae438  r1 : 3159454b  r0 : c3cae438
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  Segment user
Control: c000717f  Table: 33ef0000  DAC: 00000015
Process button_test (pid: 767, stack limit = 0xc3efc258)
Stack: (0xc3efdf30 to 0xc3efe000)
df20:                                     c3d10d40 00000000 00002002 00000003
df40: 00000003 c3efdf60 c3efdf54 bf000148 c009181c c3efdf80 c3efdf64 c00914dc
df60: bf000140 00000004 fffffff7 00002002 c3d10d40 c3efdfa4 c3efdf84 c009165c
df80: c00912bc 00002002 00002002 00000004 000000dd c002e004 00000000 c3efdfa8
dfa0: c002de60 c00915f4 00002002 00002002 00000003 00000004 00002002 00000000
dfc0: 00002002 00002002 00000004 00000003 bea6fed4 00008220 00008604 bea6fcd8
dfe0: 00000000 bea6fc6c 0000fe18 0000fb88 60000010 00000003 6f6f7473 72632f6c
Backtrace:
Function entered at [<c009180c>] from [<bf000148>]
r8:00000003 r7:00000003 r6:00002002 r5:00000000 r4:c3d10d40
Function entered at [<bf000130>] from [<c00914dc>]
Function entered at [<c00912ac>] from [<c009165c>]
r7:c3d10d40 r6:00002002 r5:fffffff7 r4:00000004
Function entered at [<c00915e4>] from [<c002de60>]
r8:c002e004 r7:000000dd r6:00000004 r5:00002002 r4:00002002
Code: e5941000 e1a0c004 e3510000 0a00000e (e591300c)
Segmentation fault

这时什么东西啊?
我的测试程序如下:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
char buff_r;int fd;
void input_handler(int signum)
{
    int i;
    read(fd,buff_r,1);
      printf("the keynum is,signalnum:%d\n",signum);
      printf("\n\n");
}
main()
{
       int fd;
    int oflags;
        int err;
       fd=open("/dev/buttons", O_RDWR , S_IRUSR | S_IWUSR);
         if(fd!= -1)
        {
        printf("the buttons open ok!\n");
        signal(SIGIO, input_handler);
         fcntl(fd, F_SETOWN,getpid());
        oflags = fcntl(fd, F_GETFL);
        fcntl(fd,F_SETFL,oflags|FASYNC);
            while(1)                     {
            printf("entry to sleep\n");
                      sleep(100);
            }
        }
    else
        printf("device open failed\n");
}
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
11楼  发表于: 2009-08-31 11:17
这个基本上说明“你搞砸了”。
Backtrace:
Function entered at [<c009180c>] from [<bf000148>]
r8:00000003 r7:00000003 r6:00002002 r5:00000000 r4:c3d10d40
Function entered at [<bf000130>] from [<c00914dc>]
Function entered at [<c00912ac>] from [<c009165c>]
r7:c3d10d40 r6:00002002 r5:fffffff7 r4:00000004
Function entered at [<c00915e4>] from [<c002de60>]
r8:c002e004 r7:000000dd r6:00000004 r5:00002002 r4:00002002
Code: e5941000 e1a0c004 e3510000 0a00000e (e591300c)
Segmentation fault

这个是进程的call stack,其中内核部分的函数入口地址在内核源代码目录下生成的System.map里可以找得到
"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: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
12楼  发表于: 2009-08-31 11:18
复制代码
  1. char buff_r;int fd;
  2. void input_handler(int signum)
  3. {
  4.     int i;
  5.     read(fd,buff_r,1);
  6.       printf("the keynum is,signalnum:%d\n",signum);

另外,好好练练你的C语言基础,不要把变量和变量的地址搞混了
"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: 4234
精华: 0
发帖: 152
金钱: 1420 两
威望: 1142 点
综合积分: 304 分
注册时间: 2009-03-05
最后登录: 2012-08-18
13楼  发表于: 2009-08-31 19:20

 回 11楼(kasim) 的帖子

这个是不是说明问题还是出在测试程序上面?

今天另外那个语法我确实忽略了。在语法上面确实要加强下了,我的C和单片机的学习都是自己摸索下进行的,还有很多不足,尽量改进
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
14楼  发表于: 2009-09-01 09:38

 Re:回 11楼(kasim) 的帖子

引用第13楼feiyangczm于2009-08-31 19:20发表的 回 11楼(kasim) 的帖子 :
这个是不是说明问题还是出在测试程序上面?

今天另外那个语法我确实忽略了。在语法上面确实要加强下了,我的C和单片机的学习都是自己摸索下进行的,还有很多不足,尽量改进

我已经说了找到问题的方法,问题要靠你自己去找;
我的C和单片机也是自学的。
"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: 4234
精华: 0
发帖: 152
金钱: 1420 两
威望: 1142 点
综合积分: 304 分
注册时间: 2009-03-05
最后登录: 2012-08-18
15楼  发表于: 2009-09-01 09:56
呵呵,我今天又在试,还是那个问题,不过现在不是在运行测试程序的时候出现,是在我按按键的时候才会出现那一堆东西,好像是驱动的问题
  • «
  • 1
  • 2
  • »
  • Pages: 2/2     Go