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 » Mon, 24 Jul 2000 04: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 herman dumon » Mon, 24 Jul 2000 04: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;
> }

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

Hi,

take a look at:
http://www.llp.fu-berlin.de/frameset/

HTH

 
 
 

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. support for PCI CardBus bridge O2Micro OZ6832

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

4. Avance Logic and X windows

5. Data acquisition device drivers

6. printing from linux to win95 via samba

7. Device Driver for NuDAQ PCI-7200 data acquisition

8. Linux syslog messages

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