Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Doubt with irq handler....... Post 302388729 by webquinty on Thursday 21st of January 2010 08:39:40 AM
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
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
PAPI_remove_event(3)						       PAPI						      PAPI_remove_event(3)

NAME
PAPI_remove_event - removes a hardware event from a PAPI event set. SYNOPSIS
Detailed Description A hardware event can be either a PAPI Preset or a native hardware event code. For a list of PAPI preset events, see PAPI_presets or run the papi_avail utility in the PAPI distribution. PAPI Presets can be passed to PAPI_query_event to see if they exist on the underlying architecture. For a list of native events available on the current platform, run papi_native_avail in the PAPI distribution. @par C Interface: int PAPI_remove_event( int EventSet, int EventCode ); @param[in] EventSet -- an integer handle for a PAPI event set as created by PAPI_create_eventset @param[in] EventCode -- a defined event such as PAPI_TOT_INS or a native event. @retval PAPI_OK Everything worked. @retval PAPI_EINVAL One or more of the arguments is invalid. @retval PAPI_ENOEVST The EventSet specified does not exist. @retval PAPI_EISRUN The EventSet is currently counting events. @retval PAPI_ECNFLCT The underlying counter hardware can not count this event and other events in the EventSet simultaneously. @retval PAPI_ENOEVNT The PAPI preset is not available on the underlying hardware. @par Example: * int EventSet = PAPI_NULL; * int ret; * * // Create an empty EventSet * ret = PAPI_create_eventset(&EventSet); * if (ret != PAPI_OK) handle_error(ret); * * // Add Total Instructions Executed to our EventSet * ret = PAPI_add_event(EventSet, PAPI_TOT_INS); * if (ret != PAPI_OK) handle_error(ret); * * // Start counting * ret = PAPI_start(EventSet); * if (ret != PAPI_OK) handle_error(ret); * * // Stop counting, ignore values * ret = PAPI_stop(EventSet, NULL); * if (ret != PAPI_OK) handle_error(ret); * * // Remove event * ret = PAPI_remove_event(EventSet, PAPI_TOT_INS); * if (ret != PAPI_OK) handle_error(ret); * See Also: PAPI_cleanup_eventset PAPI_destroy_eventset PAPI_event_name_to_code PAPI_presets PAPI_add_event PAPI_add_events Author Generated automatically by Doxygen for PAPI from the source code. Version 5.2.0.0 Tue Jun 17 2014 PAPI_remove_event(3)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy