* [Xenomai-help] interrupts test
@ 2007-02-12 15:55 mani bhatti
2007-02-12 16:19 ` Jan Kiszka
2007-02-15 7:46 ` Wolfgang Grandegger
0 siblings, 2 replies; 3+ messages in thread
From: mani bhatti @ 2007-02-12 15:55 UTC (permalink / raw)
To: xenomai
[-- Attachment #1.1: Type: text/plain, Size: 642 bytes --]
Hi
I have attached a kernel module parint.c.When i insert parint.ko into kernel i get the following message from kernel .
Request_irq returns 0
Interrupt generated. You should see the handler-message
Badness in enable_irq at kernel/irq/manage.c:126
[<c012da81>] enable_irq+0x68/0xdf
[<c80be033>] init_module+0x22/0x52 [parint]
[<c80be000>] handler+0x0/0x11 [parint]
[<c012c78a>] sys_init_module+0xb5/0x221
[<c0102898>] syscall_call+0x7/0xb
Please if some one can point out the mistake i would be very helpful.
Thanks.
---------------------------------
Get your own web address.
Have a HUGE year through Yahoo! Small Business.
[-- Attachment #1.2: Type: text/html, Size: 942 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 4109319093-parint.c --]
[-- Type: text/x-csrc; name="parint.c", Size: 864 bytes --]
#include <linux/module.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#define BASEPORT 0x378
static int handler(void)
{
// do stuff
printk(">>> PARALLEL PORT INT HANDLED\n");
return IRQ_HANDLED;
}
int xinit_module(void)
{
int ret;
ret = request_irq(7, handler, SA_INTERRUPT, "parallelport", NULL);
enable_irq(7);
printk("\nRequest_irq returns %d \n",ret);
//set port to interrupt mode; pins are output
outb_p(0x10, BASEPORT + 2);
// printk("Generating interrupt now on all output pins (intr/ACK = pin 10)\n");
//generate interrupt
outb_p(0, BASEPORT);
outb_p(255, BASEPORT);
outb_p(0, BASEPORT);
// printk("Interrupt generated. You should see the handler-message\n");
return 0;
}
void xcleanup_module(void)
{
disable_irq(7);
free_irq(7, NULL);
}
module_init(xinit_module);
module_exit(xcleanup_module);
MODULE_LICENSE("GPL");
[-- Attachment #3: 402397780-Makefile --]
[-- Type: application/octet-stream, Size: 138 bytes --]
obj-m := parint.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] interrupts test
2007-02-12 15:55 [Xenomai-help] interrupts test mani bhatti
@ 2007-02-12 16:19 ` Jan Kiszka
2007-02-15 7:46 ` Wolfgang Grandegger
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2007-02-12 16:19 UTC (permalink / raw)
To: mani bhatti; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 2218 bytes --]
mani bhatti wrote:
> Hi
> I have attached a kernel module parint.c.When i insert parint.ko into kernel i get the following message from kernel .
This is not Xenomai-related.
>
> Request_irq returns 0
> Interrupt generated. You should see the handler-message
> Badness in enable_irq at kernel/irq/manage.c:126
> [<c012da81>] enable_irq+0x68/0xdf
> [<c80be033>] init_module+0x22/0x52 [parint]
> [<c80be000>] handler+0x0/0x11 [parint]
> [<c012c78a>] sys_init_module+0xb5/0x221
> [<c0102898>] syscall_call+0x7/0xb
>
>
>
> Please if some one can point out the mistake i would be very helpful.
> Thanks.
>
>
> ---------------------------------
> Get your own web address.
> Have a HUGE year through Yahoo! Small Business.
>
>
> ------------------------------------------------------------------------
>
> #include <linux/module.h>
> #include <linux/interrupt.h>
> #include <asm/io.h>
>
> #define BASEPORT 0x378
>
> static int handler(void)
> {
> // do stuff
> printk(">>> PARALLEL PORT INT HANDLED\n");
> return IRQ_HANDLED;
> }
>
> int xinit_module(void)
> {
> int ret;
> ret = request_irq(7, handler, SA_INTERRUPT, "parallelport", NULL);
> enable_irq(7);
I think someone already suggested to study the Linux Device Drivers
book. That one shouldn't state that you need the line above.
> printk("\nRequest_irq returns %d \n",ret);
>
> //set port to interrupt mode; pins are output
> outb_p(0x10, BASEPORT + 2);
>
> // printk("Generating interrupt now on all output pins (intr/ACK = pin 10)\n");
>
> //generate interrupt
> outb_p(0, BASEPORT);
> outb_p(255, BASEPORT);
> outb_p(0, BASEPORT);
> // printk("Interrupt generated. You should see the handler-message\n");
> return 0;
> }
>
> void xcleanup_module(void)
> {
> disable_irq(7);
> free_irq(7, NULL);
> }
>
> module_init(xinit_module);
> module_exit(xcleanup_module);
> MODULE_LICENSE("GPL");
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-help] interrupts test
2007-02-12 15:55 [Xenomai-help] interrupts test mani bhatti
2007-02-12 16:19 ` Jan Kiszka
@ 2007-02-15 7:46 ` Wolfgang Grandegger
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Grandegger @ 2007-02-15 7:46 UTC (permalink / raw)
To: mani bhatti; +Cc: xenomai
Hello,
you program does not use Xenomai services and is therefore off-topic
here, nevertheless...
mani bhatti wrote:
> Hi
> I have attached a kernel module parint.c.When i insert parint.ko into
> kernel i get the following message from kernel .
>
> Request_irq returns 0
> Interrupt generated. You should see the handler-message
> Badness in enable_irq at kernel/irq/manage.c:126
> [<c012da81>] enable_irq+0x68/0xdf
> [<c80be033>] init_module+0x22/0x52 [parint]
> [<c80be000>] handler+0x0/0x11 [parint]
> [<c012c78a>] sys_init_module+0xb5/0x221
> [<c0102898>] syscall_call+0x7/0xb
>
>
>
> Please if some one can point out the mistake i would be very helpful.
> Thanks.
>
> ------------------------------------------------------------------------
> Get your own web address.
> <http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL>
> Have a HUGE year through Yahoo! Small Business. <
> http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL>
>
>
>
> ------------------------------------------------------------------------
>
> #include <linux/module.h>
> #include <linux/interrupt.h>
> #include <asm/io.h>
>
> #define BASEPORT 0x378
>
> static int handler(void)
> {
> // do stuff
> printk(">>> PARALLEL PORT INT HANDLED\n");
> return IRQ_HANDLED;
> }
>
> int xinit_module(void)
> {
> int ret;
> ret = request_irq(7, handler, SA_INTERRUPT, "parallelport", NULL);
> enable_irq(7);
I think that's the reason for the oops. Remove the unbalanced
enable_irq() and disable_irq() from you code example. request_irq() and
disable_irq() already enabled/disable the interrupts.
> printk("\nRequest_irq returns %d \n",ret);
>
> //set port to interrupt mode; pins are output
> outb_p(0x10, BASEPORT + 2);
>
> // printk("Generating interrupt now on all output pins (intr/ACK = pin 10)\n");
>
> //generate interrupt
> outb_p(0, BASEPORT);
> outb_p(255, BASEPORT);
> outb_p(0, BASEPORT);
> // printk("Interrupt generated. You should see the handler-message\n");
> return 0;
> }
>
> void xcleanup_module(void)
> {
> disable_irq(7);
> free_irq(7, NULL);
> }
>
> module_init(xinit_module);
> module_exit(xcleanup_module);
> MODULE_LICENSE("GPL");
In gerneral, you should use RTDM services in a Xenomai driver module.
Wolfgang.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-15 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12 15:55 [Xenomai-help] interrupts test mani bhatti
2007-02-12 16:19 ` Jan Kiszka
2007-02-15 7:46 ` Wolfgang Grandegger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.