当前位置: 技术问答>linux和unix
程序编译不过去
来源: 互联网 发布时间:2015-12-26
本文导语: #include #include #include int count = 0; //时钟中断 void short_interrupt(int irq, void *dev_id, struct pt_regs *regs) { count++; } int main() { int result; result = request_irq(1, short_interrupt,SA_INTERRUPT, "short", NULL); usleep ( 1000000...
#include
#include
#include
int count = 0;
//时钟中断
void short_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
count++;
}
int main()
{
int result;
result = request_irq(1, short_interrupt,SA_INTERRUPT, "short", NULL);
usleep ( 1000000 );
free_irq(1,NULL);
printf ("%d " , count );
}
#include
#include
int count = 0;
//时钟中断
void short_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
count++;
}
int main()
{
int result;
result = request_irq(1, short_interrupt,SA_INTERRUPT, "short", NULL);
usleep ( 1000000 );
free_irq(1,NULL);
printf ("%d " , count );
}
|
request_irq和free_irq是内核函数,不能在运行在用户空间的代码里使用。