QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2442|回复: 5

开关中断问题

[复制链接]
发表于 2006-9-6 16:18:49 | 显示全部楼层 |阅读模式
各位大侠,怎样开关中断啊?
我包含了<asm/system.h>
编译程序,还是出"undefined reference to 'local_irq_disable'"和
"undefined reference to 'local_irq_enable'"错误。

怎么回事啊?帮帮忙吧。
 楼主| 发表于 2006-9-8 14:12:48 | 显示全部楼层
是不是程序在用户态没有开关中断的权限啊? 如果要关掉中断应该怎么办?
回复

使用道具 举报

发表于 2006-9-8 21:14:58 | 显示全部楼层
你在什么环境下编译的??编译参数是??
redhat9应该没有问题
回复

使用道具 举报

发表于 2006-9-11 10:59:12 | 显示全部楼层
能装redhat9真好啊,可惜我电脑硬盘是sata的,死活装不上,郁闷!
回复

使用道具 举报

 楼主| 发表于 2006-9-12 10:32:10 | 显示全部楼层
多谢support. RedHat 9 下一个示例文件和编译命令及结果:

#include <asm/system.h>

int main (void)
{
        int i=0;
       
        local_irq_disable();
        i++;
        local_irq_enable();

                return 0;
}

[root@localhost dsp]# gcc -o irq irq.c
In file included from /usr/include/linux/bitops.h:69,
                 from /usr/include/asm/system.h:7,
                 from irq.c:1:
/usr/include/asm/bitops.h:327:2: warning: #warning This includefile is not available on all architectures.
/usr/include/asm/bitops.h:328:2: warning: #warning Using kernel headers in userspace: atomicity not guaranteed

编译命令需要加什么选项?
回复

使用道具 举报

发表于 2006-9-12 23:19:07 | 显示全部楼层
当时是在驱动中编译的
用户空间没有用过,google一下在用户空间应该用那个接口吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-25 20:22 , Processed in 0.064784 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表