Doubt with irq handler.......


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Doubt with irq handler.......
# 1  
Old 01-21-2010
Doubt with irq handler.......

Hello,

I have develop a driver for my hardware and now, I need to handle a IRQ but I does not work.

As I can understand, to handle a irq, it is necessary to make a request_irq(). If the return value is zero, ok, no problem to handle irq.

Here is a easy example of my driver:

Code:
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <linux/time.h>
#include <linux/ioport.h>
#include <linux/signal.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
#include <linux/irq.h>

#define    INTERRUPT_5    5
#define    INTERRUPT_10    10

//#define SIG_TEST 44
unsigned int contador;
unsigned int contador1;

//**********************************************************************
static irqreturn_t my_irq_handler_5 (void)
{
    printk("Interrupcion %d ejecutada\n", INTERRUPT_5);
    wait_event_interruptible();
    return 0;
}

static irqreturn_t my_irq_handler_10 (void)
{
    printk("Interrupcion %d ejecutada\n", INTERRUPT_10);
    return 0;
}

//**********************************************************************

int xinit_module(void)
{
int ret;
    contador = 0;
    contador1 = 0;

    ret = request_irq(INTERRUPT_5, (irq_handler_t) my_irq_handler_5, IRQF_DISABLED, "leicif_INT5", NULL);
    printk("Valor de request_irq 5 %d\n", ret);

    ret = request_irq(INTERRUPT_10, (irq_handler_t) my_irq_handler_10, IRQF_DISABLED, "leicif_INT10", NULL);
    printk("Valor de request_irq 10 %d\n", ret);

        printk("wait for interrupt\n");
        printk("return code 0 \n");
        return 0;
}

void xcleanup_module(void)
{
        disable_irq(INTERRUPT_5);
        free_irq(INTERRUPT_5, NULL);
        disable_irq(INTERRUPT_10);
        free_irq(INTERRUPT_10, NULL);

        printk("closed\n");
}

module_init(xinit_module);
module_exit(xcleanup_module);

MODULE_LICENSE("GPL");

If I connect a square wave to INT5 and INT10, nothing happen.

Could somebody tell where is the error??

Best reagards
# 2  
Old 01-21-2010
What hardware is this?
# 3  
Old 01-22-2010
Quote:
Originally Posted by Corona688
What hardware is this?
My own hardware, it is a voltage monitoring. Its give me two edge signals, one for low voltage and other for overvoltage.
# 4  
Old 01-22-2010
I meant the computer.
# 5  
Old 01-22-2010
Quote:
Originally Posted by Corona688
I meant the computer.
Oh!!!!!!!
Sorry, it is a ETX module, Geode LX800.
# 6  
Old 01-23-2010
I suspect your test setup isn't actually producing interrupts. Try not loading your driver and running your trigger: dmesg should overflow with 'IRQ 10, nobody cared' messages.

Or, check 'cat /proc/interrupts' to see what it thinks is on those interrupts, they may be routed elsewhere internally. What kind of bus are you triggering on? If you're using ISA, make sure you assign those interrupts to ISA in the CMOS.

Last edited by Corona688; 01-23-2010 at 12:47 AM..
# 7  
Old 01-25-2010
Quote:
Originally Posted by Corona688
I suspect your test setup isn't actually producing interrupts. Try not loading your driver and running your trigger: dmesg should overflow with 'IRQ 10, nobody cared' messages.

Or, check 'cat /proc/interrupts' to see what it thinks is on those interrupts, they may be routed elsewhere internally. What kind of bus are you triggering on? If you're using ISA, make sure you assign those interrupts to ISA in the CMOS.
Ok, tomorrow I will try it.

Thanks a lot.

---------- Post updated at 03:37 PM ---------- Previous update was at 03:36 PM ----------

Hello,
I have made test that you told me.

Quote:
I suspect your test setup isn't actually producing interrupts. Try not loading your driver and running your trigger: dmesg should overflow with 'IRQ 10, nobody cared' messages.
Ok, I startup my system and I dont load my driver. Then I have connect a square wave in pin INT5, INT7 and INT10 in PC-104 slot (B23, B21 and D4) but I dont see any text with "IRQX, nobody cared". I supposed that it is bad.

Output of dmesg after trigger interrupts:

Quote:
...............
EXT3 FS on hda2, internal journal
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
8139too Fast Ethernet driver 0.9.28
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
ACPI: PCI Interrupt 0000:00:0e.0[A] -> Link [LNKB] -> GSI 11 (level, low) -> IRQ 11
eth0: RealTek RTL8139 at 0xfc00, 00:04:5f:84:9f:a7, IRQ 11
eth0: Identified 8139 chip type 'RTL-8101'
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
leicif: module license 'Dual BSD/GLP' taints kernel.
LEICIFLectura de los parametros de la tarjeta PCI: Error al obtener el dispositivo
eth0: no IPv6 routers present
Quote:
Or, check 'cat /proc/interrupts' to see what it thinks is on those interrupts, they may be routed elsewhere internally. What kind of bus are you triggering on? If you're using ISA, make sure you assign those interrupts to ISA in the CMOS.
Before connect square wave....
Quote:
0: 4930 XT-PIC-XT timer
1: 2 XT-PIC-XT i8042
2: 0 XT-PIC-XT cascade
8: 0 XT-PIC-XT rtc
9: 0 XT-PIC-XT acpi
11: 125 XT-PIC-XT ehci_hcd:usb1, ohci_hcd:usb2, eth0
12: 3 XT-PIC-XT i8042
14: 713 XT-PIC-XT ide0
NMI: 0 Non-maskable interrupts
LOC: 0 Local timer interrupts
TRM: 0 Thermal event interrupts
SPU: 0 Spurious interrupts
ERR: 0
MIS: 0
and after.....

Quote:
CPU0
0: 28181 XT-PIC-XT timer
1: 2 XT-PIC-XT i8042
2: 0 XT-PIC-XT cascade
8: 0 XT-PIC-XT rtc
9: 0 XT-PIC-XT acpi
11: 493 XT-PIC-XT ehci_hcd:usb1, ohci_hcd:usb2, eth0
12: 3 XT-PIC-XT i8042
14: 724 XT-PIC-XT ide0
NMI: 0 Non-maskable interrupts
LOC: 0 Local timer interrupts
TRM: 0 Thermal event interrupts
SPU: 0 Spurious interrupts
ERR: 0
MIS: 0
In BIOS, I have configured IRQ5, IRQ7 and IRQ10 as legacy ISA.

Well, I supposed that I need to read more about it and how to setup correctly IRQ Handlers.

Anyway, Thank you very much for your help.

Best regards.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Serial port signal(IRQ) handler (using C)

Hello, I'm writing some serial(UART) handler but have stuck on few issues, maybe anyone can help to show me what I'm doing wrong. Basically I'm intending to write serial RX signal handler. Application receives defined packages of data over serial which contains header and payload. Handler... (3 Replies)
Discussion started by: Lauris_k
3 Replies

2. Hardware

IRQ and Number of Devices

Hello everyone. I feel that I'm about to answer my own question, but I just want to be sure that I'm right. I know computers all use, at a very low level, the IRQ system of interrupting the CPU when it needs something. My questions are as follows: 1. Does the device in question, say.. a mouse,... (1 Reply)
Discussion started by: Lost in Cyberia
1 Replies

3. Programming

What is unbalanced IRQ?

------------------------ WARNING: at kernel/irq/manage.c:225 __enable_irq+0x3b/0x57() Unbalanced enable for IRQ 4 Modules linked in: svsknfdrvr Pid: 634, comm: ash Tainted: G W 2.6.28 #1 Call Trace: warn_slowpath+0x76/0x8d profile_tick+0x2d/0x57 irq_exit+0x32/0x34 ... (3 Replies)
Discussion started by: dragonpoint
3 Replies

4. Linux

A question with respect to IRQ distribution

Hi all, I am a Linux newbie in kernel development. In class I was asked a question about IRQ distribution as followed. IRQs can be distributed among the available CPUs (in a multiple-CPU system) in two ways: (1) Static distribution The IRQ signal is delivered to the local APICs listed... (2 Replies)
Discussion started by: sunnyhay
2 Replies

5. SCO

IRQ conflict between USB and NIC SCO 5.0.7

I have a SCO 5.0.7 server.As there is no parellel port ,printing is done via USB port. After loading the Network Card driver ,during booting the server gets hanged and the NIC driver is not loaded.If the USB ports are disabled the NIC driver gets loaded. As both USB and NIC driver are essential... (0 Replies)
Discussion started by: vikramviky
0 Replies

6. UNIX for Advanced & Expert Users

IRQ priority in FC9

Hi, I want to increase IRQ4 priority to maximum in Fedora core 9 (kernel version 2.6.25.11-97).If anybody knows plz help me.... I will be very thankful .. regards, Raj (0 Replies)
Discussion started by: rajuprade
0 Replies

7. UNIX for Dummies Questions & Answers

irq complication

hi, i looked around already and had no luck finding anything. Im trying ot install a wpc11v3 linksys wireless card, and i have been for about a week now. :mad: Im near certain i have figured out my problem. When i plug in my card while knoppix is running, it crashes. When i plug it into... (0 Replies)
Discussion started by: jestra
0 Replies

8. UNIX for Dummies Questions & Answers

usb - deleting (irq)

FreeBSD 4.5 i installed my sound drivers (which are onboard) with the following lines in my kernel device pcm options PNPBIOS then cd /dev sh MAKEDEV snd0 output from cat /dev/sndstat show the devicedriver (correct one) ok this works nice untill i enter my kde and want to play a... (1 Reply)
Discussion started by: termiEEE
1 Replies

9. UNIX for Dummies Questions & Answers

forcing irq on PCMCIA card

ENV: linux Version: Mandrake 8.1, PCMCIA card: longshine lcs-8534TB. (supported according the PCMCIA docs) laptop is P-II lifetec /etc/sysconfig/pcmcia: PCMCIA=yes PCIC=i82365 ( found via probe -m ) PCIC_OPTS="cs_irq=11 pci_irq_list=11,11 do_scan=0" ( you see i want to force irq 11 )... (3 Replies)
Discussion started by: progressdll
3 Replies

10. UNIX for Dummies Questions & Answers

irq

where can i find the i/o and irq's in mandrake 8 help lost :D (2 Replies)
Discussion started by: RYRY46D9
2 Replies
Login or Register to Ask a Question