2008-11-10 12:40:09 Try the exemple of linux:interrupts[Short exemple] and some error compilling!!
Aldric Molina (SWITZERLAND)
Message: 64959
Hello everybody (maybe Mike),
I try the exemple to use an interrupt but when I want to compiling the kernel I had some error?
Why I have this error and what I must do to correct them.
Down you have my modified code and the error are down the code.
Best regards
Aldric Molina
________________________________________________________________________________________________
The exemple with little modification in red:
#include <asm/irq.h>
#include <asm/mach-bf533/irq.h>
#define CONFIG_YOURDRIVERS_IRQ IRQ_TMR0
static irqreturn_t your_irq_handler (int irq, void *dev_id, int *my_data)
{
prinkt(KERN_INFO"your_irq_handler \n");
return IRQ_HANDLED;
}
static int __init your_drivers_init_function(void)
{
if (request_irq(CONFIG_YOURDRIVERS_IRQ, your_irq_handler, IRQF_TRIGGER_LOW, "Your IRQ",
my_data)) {
printk (KERN_WARNING "IRQ %d is not free.\n", CONFIG_YOURDRIVERS_IRQ);
return -EBUSY;
}
disable_irq(CONFIG_YOURDRIVERS_IRQ);
enable_irq(CONFIG_YOURDRIVERS_IRQ);
}
void __exit your_drivers_exit_function(void)
{
free_irq (CONFIG_YOURDRIVERS_IRQ, my_data);
}
________________________________________________________________________________________________
The compiling error are:
aldric@AL:~/blackfin-git/linux-kernel$ make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
CC arch/blackfin/mach-bf533/boards/timer0handle.o
arch/blackfin/mach-bf533/boards/timer0handle.c:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'your_irq_handler'
arch/blackfin/mach-bf533/boards/timer0handle.c:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'your_drivers_init_function'
arch/blackfin/mach-bf533/boards/timer0handle.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'your_drivers_exit_function'
make[1]: *** [arch/blackfin/mach-bf533/boards/timer0handle.o] Error 1
make: *** [arch/blackfin/mach-bf533/boards] Error 2
aldric@AL:~/blackfin-git/linux-kernel$
TranslateQuoteReplyEditDelete
2008-11-10 12:49:28 Re: Try the exemple of linux:interrupts[Short exemple] and some error compilling!!
Mike Frysinger (UNITED STATES)
Message: 64961
ive updated the example ... please use that
QuoteReplyEditDelete
2008-11-10 13:26:30 Re: Try the exemple of linux:interrupts[Short exemple] and some error compilling!!
Aldric Molina (SWITZERLAND)
Message: 64965
ok thanks for reply
TranslateQuoteReplyEditDelete
2008-11-11 03:20:06 Re: Try the exemple of linux:interrupts[Short exemple] and some error compilling!!
Aldric Molina (SWITZERLAND)
Message: 64987
Hello Mike,thank's for your update.
I found little problem with the exemple.
Down you have my code, with the correction in red. Can you tell me if it's right! Why I have some warning.
Best regards
Aldric Molina
________________________________________________________________________________________________
The code.
#include <linux/interrupt.h>
#define CONFIG_YOURDRIVERS_IRQ IRQ_TMR0
void *my_data;
static irqreturn_t your_irq_handler (int irq, void *dev_id, void *my_data)
{
printk(KERN_INFO"your_irq_handler \n");
return IRQ_HANDLED;
}
static int __init your_drivers_init_function(void)
{
int ret;
ret = request_irq(CONFIG_YOURDRIVERS_IRQ, your_irq_handler, IRQF_TRIGGER_LOW, "Your IRQ",my_data);
if (ret) {
printk(KERN_WARNING "IRQ %d is not free.\n", CONFIG_YOURDRIVERS_IRQ);
return ret;
}
disable_irq(CONFIG_YOURDRIVERS_IRQ);
printk(KERN_INFO "TIMER0 OK\n");
enable_irq(CONFIG_YOURDRIVERS_IRQ);
}
void __exit your_drivers_exit_function(void)
{
free_irq (CONFIG_YOURDRIVERS_IRQ, my_data);
}
________________________________________________________________________________________________
The compiler error.
aldric@AL:~/blackfin-git/linux-kernel$ make ARCH=blackfin
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
CC arch/blackfin/mach-bf533/boards/timer0handle.o
arch/blackfin/mach-bf533/boards/timer0handle.c: In function 'your_drivers_init_function':
arch/blackfin/mach-bf533/boards/timer0handle.c:16: warning: passing argument 2 of 'request_irq' from incompatible pointer type
arch/blackfin/mach-bf533/boards/timer0handle.c: At top level:
arch/blackfin/mach-bf533/boards/timer0handle.c:14: warning: 'your_drivers_init_function' defined but not used
LD arch/blackfin/mach-bf533/boards/built-in.o
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
KSYM .tmp_kallsyms1.S
AS .tmp_kallsyms1.o
LD .tmp_vmlinux2
KSYM .tmp_kallsyms2.S
AS .tmp_kallsyms2.o
LD vmlinux
SYSMAP System.map
SYSMAP .tmp_System.map
OBJCOPY arch/blackfin/boot/vmlinux.bin
GZIP arch/blackfin/boot/vmlinux.gz
UIMAGE arch/blackfin/boot/vmImage
Image Name: Linux-2.6.26.5-ADI-2009R1-pre-di
Created: Mon Nov 10 20:24:03 2008
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 1124547 Bytes = 1098.19 kB = 1.07 MB
Load Address: 0x00200000
Entry Point: 0x003FC770
Kernel: arch/blackfin/boot/vmImage is ready
Building modules, stage 2.
MODPOST 11 modules
TranslateQuoteReplyEditDelete
2008-11-11 03:31:49 Re: Try the exemple of linux:interrupts[Short exemple] and some error compilling!!
Mike Frysinger (UNITED STATES)
Message: 64989
why did you make those changes to the irq handler ? if you were supposed to, it'd be in the documentation.
QuoteReplyEditDelete
2008-11-11 07:18:32 Re: Try the exemple of linux:interrupts[Short exemple] and some error compilling!!
Aldric Molina (SWITZERLAND)
Message: 65019
You have right!It's ok, now.
Thanks for all.
Aldric Molina