[Armadillo:08913] Re: 割り込み制御について質問です
Koyo Takenoshita
email@hidden
2013年 6月 21日 (金) 22:19:35 JST
竹之下です。
作ろうとされているのは、カーネルモジュールでしょうか?それとも、
ユーザー空間で動作するアプリケーションプログラムでしょうか?
> gcc hoge.c だと<module.h>がみつからないとでたので
> gcc -I /usr/src/linux/include hoge.cと入力したところ以下のエラーがでました。
このコンパイル方法だと、アプリケーションプログラムになってしまいます。
が、割り込み番号を指定して何かを処理したいのであれば、カーネル空間で動作する
プログラムにする必要があります。
下記 Howto でカーネルモジュールの作り方を紹介していますので、参考にしてください。
http://armadillo.atmark-techno.com/howto/kernel-module-hello-world
(2013/06/19 19:04), linux armadillo wrote:
> はじめまして。
> Armadillo440を使用し、組み込みLinuxの勉強中で、割り込みのプログラムのコンパイルがうまくいかずに詰まっております。
>
> Armadillo 実践開発ガイド〜組み込みLinux の導入から製品化まで〜を参考にコンパイルしています。
>
> 環境は以下の通りで設定はすべてデフォルトのままです。
> VMware ATDE3
> Linux 2.6.26-2-686
>
> gcc hoge.c だと<module.h>がみつからないとでたので
> gcc -I /usr/src/linux/include hoge.cと入力したところ以下のエラーがでました。
> インクルードパスが間違っているのでしょうか?
> ご教授お願いします。
>
> 以下、ソース・エラーです
> --------------------------------------------------------------------------------ソース
>
> #include <linux/module.h>
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/sched.h>
>
> static char *devname="inttest";
> static int irq=158;
> static char *id="interrupt test";
> #if LINUX_VERSION_CODE > 0x20115
> MODULE_PARM(devname, "s");
> MODULE_PARM(irq, "i");
> MODULE_PARM(id, "s");
> #endif
>
> static void inttest_interrupt(int irq, void *dev_id, struct pt_regs *regs)
> {
> printk("interrupted irq:%d dev_id:%s jiffies:%ld\n",
> irq,(char *)dev_id,jiffies);
> }
>
> int init_module(void)
> {
> printk("install '%s' into irq %d\n",devname,irq);
> if (request_irq(irq, inttest_interrupt, SA_INTERRUPT|SA_SHIRQ,
> devname, id))
> return -EBUSY;
>
> return 0;
> }
>
> void cleanup_module(void)
> {
> printk("remove '%s' from irq %d\n",devname,irq);
> free_irq(irq,id);
> };
>
> --------------------------------------------------------------------------------エラー
>
> /usr/src/linux/include/linux/interrupt.h:58: error: conflicting types for ‘irqreturn_t’
> /usr/src/linux/include/linux/irqreturn.h:19: error: previous definition of ‘irqreturn_t’ was here
> /usr/src/linux/include/linux/interrupt.h:61: error: expected specifier-qualifier-list before ‘irq_handler_t’
> /usr/src/linux/include/linux/interrupt.h:60: warning: empty declaration
> /usr/src/linux/include/linux/interrupt.h:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘no_action’
> /usr/src/linux/include/linux/interrupt.h:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘request_irq’
> /usr/src/linux/include/linux/interrupt.h:74: error: storage class specified for parameter ‘free_irq’
> /usr/src/linux/include/linux/interrupt.h:76: warning: empty declaration
> /usr/src/linux/include/linux/interrupt.h:78: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘devm_request_irq’
> /usr/src/linux/include/linux/interrupt.h:81: error: storage class specified for parameter ‘devm_free_irq’
> /usr/src/linux/include/linux/interrupt.h:101: error: storage class specified for parameter ‘disable_irq_nosync’
> /usr/src/linux/include/linux/interrupt.h:102: error: storage class specified for parameter ‘disable_irq’
> /usr/src/linux/include/linux/interrupt.h:103: error: storage class specified for parameter ‘enable_irq’
> /usr/src/linux/include/linux/interrupt.h:113: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:118: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:206: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:211: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:225: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cli’
> /usr/src/linux/include/linux/interrupt.h:229: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘sti’
> /usr/src/linux/include/linux/interrupt.h:233: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘save_flags’
> /usr/src/linux/include/linux/interrupt.h:238: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘restore_flags’
> /usr/src/linux/include/linux/interrupt.h:243: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘save_and_cli’
> /usr/src/linux/include/linux/interrupt.h:266: warning: empty declaration
> /usr/src/linux/include/linux/interrupt.h:285: warning: empty declaration
> /usr/src/linux/include/linux/interrupt.h:293: error: storage class specified for parameter ‘open_softirq’
> /usr/src/linux/include/linux/interrupt.h:294: error: storage class specified for parameter ‘softirq_init’
> /usr/src/linux/include/linux/interrupt.h:296: error: storage class specified for parameter ‘raise_softirq_irqoff’
> /usr/src/linux/include/linux/interrupt.h:297: error: storage class specified for parameter ‘raise_softirq’
> /usr/src/linux/include/linux/interrupt.h:320: warning: empty declaration
> /usr/src/linux/include/linux/interrupt.h:336: warning: empty declaration
> /usr/src/linux/include/linux/interrupt.h:364: error: storage class specified for parameter ‘__tasklet_schedule’
> /usr/src/linux/include/linux/interrupt.h:367: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:372: error: storage class specified for parameter ‘__tasklet_hi_schedule’
> /usr/src/linux/include/linux/interrupt.h:375: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:382: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:388: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:395: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:401: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:406: error: storage class specified for parameter ‘tasklet_kill’
> /usr/src/linux/include/linux/interrupt.h:407: error: storage class specified for parameter ‘tasklet_kill_immediate’
> /usr/src/linux/include/linux/interrupt.h:409: error: storage class specified for parameter ‘tasklet_init’
> /usr/src/linux/include/linux/interrupt.h:453: error: storage class specified for parameter ‘probe_irq_on’
> /usr/src/linux/include/linux/interrupt.h:454: error: storage class specified for parameter ‘probe_irq_off’
> /usr/src/linux/include/linux/interrupt.h:455: error: storage class specified for parameter ‘probe_irq_mask’
> /usr/src/linux/include/linux/interrupt.h:463: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> /usr/src/linux/include/linux/interrupt.h:467: warning: ‘struct seq_file’ declared inside parameter list
> irq_3.c:6: error: storage class specified for parameter ‘devname’
> irq_3.c:6: error: parameter ‘devname’ is initialized
> irq_3.c:7: error: storage class specified for parameter ‘irq’
> irq_3.c:7: error: parameter ‘irq’ is initialized
> irq_3.c:8: error: storage class specified for parameter ‘id’
> irq_3.c:8: error: parameter ‘id’ is initialized
> irq_3.c:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> irq_3.c:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> irq_3.c:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> irq_3.c:36: error: expected declaration specifiers before ‘;’ token
> irq_3.c:8: error: declaration for parameter ‘id’ but no such parameter
> irq_3.c:7: error: declaration for parameter ‘irq’ but no such parameter
> irq_3.c:6: error: declaration for parameter ‘devname’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:467: error: declaration for parameter ‘show_interrupts’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:455: error: declaration for parameter ‘probe_irq_mask’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:454: error: declaration for parameter ‘probe_irq_off’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:453: error: declaration for parameter ‘probe_irq_on’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:408: error: declaration for parameter ‘tasklet_init’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:407: error: declaration for parameter ‘tasklet_kill_immediate’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:406: error: declaration for parameter ‘tasklet_kill’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:372: error: declaration for parameter ‘__tasklet_hi_schedule’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:364: error: declaration for parameter ‘__tasklet_schedule’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:297: error: declaration for parameter ‘raise_softirq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:296: error: declaration for parameter ‘raise_softirq_irqoff’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:294: error: declaration for parameter ‘softirq_init’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:293: error: declaration for parameter ‘open_softirq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:292: error: declaration for parameter ‘__do_softirq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:291: error: declaration for parameter ‘do_softirq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:103: error: declaration for parameter ‘enable_irq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:102: error: declaration for parameter ‘disable_irq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:101: error: declaration for parameter ‘disable_irq_nosync’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:81: error: declaration for parameter ‘devm_free_irq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:74: error: declaration for parameter ‘free_irq’ but no such parameter
> /usr/src/linux/include/linux/interrupt.h:58: error: declaration for parameter ‘irqreturn_t’ but no such parameter
> /usr/src/linux/include/linux/hardirq.h:162: error: declaration for parameter ‘irq_exit’ but no such parameter
> /usr/src/linux/include/linux/hardirq.h:146: error: declaration for parameter ‘irq_enter’ but no such parameter
>
>
> _______________________________________________
> armadillo mailing list
> email@hidden
> http://lists.atmark-techno.com/cgi-bin/mailman/listinfo/armadillo
>
--
Koyo Takenoshita
armadillo メーリングリストの案内