Module Issue
Hi guys. I'm currently trying to test the interrupt line on a PowerPC device. To do this I am creating a module that does a simple printk when the Interrupt is triggered. It cross-compiles without any errors or warnings but the problem I'm encountering is that when I try to do an insmod on the target device there is an error that prevents the module from being loaded. The code for the module is:
Code:
//int_test.c Code:
obj-m := int_test.o Code:
[root@p1021mds /root]# insmod int_test.ko Code:
PHY: mdio@ffe24000:02 - Link is Up - 1000/Full Thanks a lot. EDIT: Forgot to mention that the kernel version is "3.0.4+ #14 SMP" on the target board. |
Is the code getting compiled without any errors?
Quote:
Code:
obj-m += hello.o by a TAB. For getting rid of the Kernel taint message, you need to add the following to your code. Code:
MODULE_LICENSE ("GPL"); |
Thanks for the reply. The code is getting compiled error free and with regards to the make file I've omitted that and just enter the Linux directory in the terminal. Found that the reason insmod was not loading the module was due to request_irq() returning an error value and not 0. Apparently one of the parameters is invalid so I'm not trying to hunt down the source code for request_irq() to work out exactly what is going on.
|
Quote:
AFAIK, for "executing" a kernel module, one has to "insmod" it. Am I missing a point here? |
I changed the hi.c code to:
Quote:
|
Problem is with the irq number. In case of Powerpc, the irq number should be mapped to a virtual irq and that will be passed to the request_irq(). Generally irq will be specified in the device tree and the function of_irq_to_resource() is called to get the virq for the irq that is taken from the device tree.
|
Thanks for the reply. That sounds pretty promising so I'll give it a go.
|
Hi everyone. I had a look through the kernel looking for some examples of virtual IRQs and from that edited my code to the following:
Code:
//IRQF_SHARED Code:
Setting up IRQ5 Code:
[root@p1021mds /root]# cat /proc/interrupts |
It turned out to be a problem in hardware and it's working now. Thanks for the help.
|
All times are GMT -5. The time now is 12:57 AM. |