How to write a device driver for data acquisition via ISA card

How to write a device driver for data acquisition via ISA card

Post by Chun Seong N » Sun, 31 Dec 1899 09:00:00



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;

Quote:}

note: I also wrote CAN_ISR interrupt service routine.

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

 
 
 

How to write a device driver for data acquisition via ISA card

Post by Daniel Hartma » Sun, 31 Dec 1899 09:00:00


A good place to start is the Linux Lab Project:

  http://www.llp.fu-berlin.de/


> 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.

> 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

--
Daniel A. Hartman, Ph.D.
MST-6: Welding and Joining
Los Alamos National Laboratory

 
 
 

1. How to write a device driver for data acquisition via ISA card?

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.

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

2. Apache Scripting Languages querry

3. Data Acquisition using linux with [Data Acquisition Processor] DAP

4. ATI264VT2 (3D Charger) at 135MHz dot-clock

5. Data acquisition device drivers

6. QT includes?

7. Device Driver for NuDAQ PCI-7200 data acquisition

8. Please help me with modelines!!!

9. user space device driver can't write to isa device

10. Data acquisition card drivers under linux. Intelligent Instrumentation.

11. Driver for PCI-20428W series data acquisition cards.

12. serial port data acquisition without data loss?

13. writing device driver for connecting terminal program via tcpip