Hey everybody, I want to respond to a hardware interrupt from a data
acquisition card via ISA card. I manage to communicate with the card
throught simply I/O program. And now I would like to write a user program
with an interrupt handler.
My questions are:
1) My first step is to install the interrupt handler to the kernel. The
following is my source code. Is my structure of source code to install
interrupt handler correct? What am I missing? And what functions and header
files I need to install and service an interrupt routine?
#include <linux/sched.h>
main()
{
unsigned int CAN_irq = 9;
if (CAN_irq >= 0)
{
int result = request_irq(CAN_irq, CAN_ISR, SA_INTERRUPT, "CAN", NULL);
if (result)
{
printk(KERN_INFO "CAN card can't get assigned irq %i/n", CAN_irq);
CAN_ISR = -1;
}
return 0;
note: I also wrote CAN_ISR interrupt service routine.Quote:}
2) Is there any example of device driver codes like this?
3) How to compile it? Is "gcc -O -D__KERNEL__ -o test test.c" correct?
4) Is it possible (reasonable, etc) to write a user program that uses a
hardware interrupt without writing a device driver?
For your information, I'm using RH 6.1 with gcc-2.91.66. I'm referring Linux
Device Driver by Alessandro Rubini and Linux Kernel Internal by M Beck, U
Kunitz and etc. Any other good references?
Thank you.
Regards,
Chun Seong