Skip to contentSkip to conversation

isr

Xenomai-help Keinen Namen 3 participants 6 messages Jul 10, 2006

lore
Share & tools
lore
#0 lore raw

Hi I useing Xenomai 2.1 and the native skin

I want create a intr in kernel space with rt_intr_create, the 4th argument is the pointer is the ISR.

My Question is which form does the ISR must have

rt_isr_t myisr ( ??? )
{
...
}

Regards
Memory

Signature · 2 lines
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
#1 lore raw
Quoted 11 lines · Keinen Namen

Hi I useing Xenomai 2.1 and the native skin

I want create a intr in kernel space with rt_intr_create, the 4th argument is the pointer is the ISR.

My Question is which form does the ISR must have

rt_isr_t myisr ( ??? )
{
...
}

int my_isr(rt_intr_t *intr);

That's indeed undocumented, you had to browse the code for this information. :-/

[Note: unless you are writing some specialised or experimental code, developing drivers over the RTDM skin is recommended now. This aims at unifying the device interfaces for all skins.]

Jan

#2 lore raw

Sorry here is my source code.

My Problem ist how can I call the ISR.

Regards Memory

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>

#include <native/intr.h>

MODULE_DESCRIPTION("My kernel module"); MODULE_AUTHOR("Nobody"); MODULE_DESCRIPTION("Dei Mudda"); MODULE_LICENSE("my own");

RT_INTR my_rt_intr;

int helloworld_isr(rt_intr_t *intr){
	printk( KERN_ALERT "IRQ\n");
	return IRQ_HANDLED;
}
struct file_operations helloworld_fops = {
	.owner 		= THIS_MODULE,
	.llseek		= NULL,
	.read		= NULL,
	.write		= NULL,
	.readdir	= NULL,
	.poll		= NULL,
	.ioctl		= NULL,
	.mmap		= NULL,
	.open		= NULL,
	.flush		= NULL,
	.release	= NULL,
	.fsync		= NULL,
	.fasync		= NULL,
	.lock		= NULL,
	.readv		= NULL,
	.writev		= NULL,
};
static int helloworld_init_module(void) {
	int x;
	printk( KERN_ALERT "Module helloworld init startet Version 0.1\n" );
	x = rt_intr_create(&my_rt_intr,"ein Name",SIU_INT_TIMER2,&helloworld_isr,NULL,0);
	if(!x){
		printk( KERN_ALERT "Interrupt erfolgreich erstellt\n");
		if(!(rt_intr_enable(&my_rt_intr))){
			printk( KERN_ALERT "Interrupt erfolgreich aktiviert\n");
		}
	}else{
		printk( KERN_ALERT "Interrupt Erstellung fehlgeschlagen %i\n",x);
	}
}

static void helloworld_exit_module(void) {

	if(!(rt_intr_disable(&my_rt_intr))){
		printk( KERN_ALERT "Interrupt Cleared !\n" );
		if(!(rt_intr_delete(&my_rt_intr))){
	 		printk(KERN_ALERT "Interrupt deleted\n" );
		}
	}

	printk( KERN_ALERT "Module helloworld exit\n" );
}

module_init(helloworld_init_module); module_exit(helloworld_exit_module);

-------- Original-Nachricht --------
Datum: Mon, 10 Jul 2006 10:30:16 +0200
Von: Jan Kiszka <[email protected]>
An: Keinen Namen <[email protected]>
Betreff: Re: [Xenomai-help] isr

Quoted 25 lines
Quoted 3 lines · Keinen Namen

Hi I useing Xenomai 2.1 and the native skin

I want create a intr in kernel space with rt_intr_create, the 4th

argument is the pointer is the ISR.

Quoted 8 lines

My Question is which form does the ISR must have

rt_isr_t myisr ( ??? )
{
...
}

int my_isr(rt_intr_t *intr);

That's indeed undocumented, you had to browse the code for this information. :-/

[Note: unless you are writing some specialised or experimental code, developing drivers over the RTDM skin is recommended now. This aims at unifying the device interfaces for all skins.]

Jan

Signature · 2 lines
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
#3 lore raw
Quoted 3 lines · Keinen Namen

Sorry here is my source code.

My Problem ist how can I call the ISR.

Well, the basic idea behind IRQs is that the hardware "call" them for you, isn't it? :)

See /proc/xenomai/irq if something is happening on your IRQ line.

Quoted 34 lines

Regards Memory

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>

#include <native/intr.h>

MODULE_DESCRIPTION("My kernel module"); MODULE_AUTHOR("Nobody"); MODULE_DESCRIPTION("Dei Mudda"); MODULE_LICENSE("my own");

RT_INTR my_rt_intr;

int helloworld_isr(rt_intr_t *intr){
	printk( KERN_ALERT "IRQ\n");
	return IRQ_HANDLED;
}
struct file_operations helloworld_fops = {
	.owner 		= THIS_MODULE,
	.llseek		= NULL,
	.read		= NULL,
	.write		= NULL,
	.readdir	= NULL,
	.poll		= NULL,
	.ioctl		= NULL,
	.mmap		= NULL,
	.open		= NULL,
Quoted 8 lines
	.flush		= NULL,
	.release	= NULL,
	.fsync		= NULL,
	.fasync		= NULL,
	.lock		= NULL,
	.readv		= NULL,
	.writev		= NULL,
};

What's this for? Keep in mind that mixing Linux file operations with Xenomai is almost always not cleanly working. That's also what RTDM is
for: providing a stripped down file operations interface to real-time users.

Quoted 6 lines

static int helloworld_init_module(void) {
	int x;
	printk( KERN_ALERT "Module helloworld init startet Version 0.1\n" );
	x = rt_intr_create(&my_rt_intr,"ein Name",SIU_INT_TIMER2,&helloworld_isr,NULL,0);

Are you sure your hardware is already set up to fire on SIU_INT_TIMER2?

If you are looking for some working examples, check the new irqbench test over RS232 or the timer-related part of Hannes' example driver on
http://www.captain.at/xenomai-real-time-driver-example-driver-source-code.php

What's your goal, BTW?

Quoted 55 lines
	if(!x){
		printk( KERN_ALERT "Interrupt erfolgreich erstellt\n");
		if(!(rt_intr_enable(&my_rt_intr))){
			printk( KERN_ALERT "Interrupt erfolgreich aktiviert\n");
		}
	}else{
		printk( KERN_ALERT "Interrupt Erstellung fehlgeschlagen %i\n",x);
	}
}

static void helloworld_exit_module(void) {

	if(!(rt_intr_disable(&my_rt_intr))){
		printk( KERN_ALERT "Interrupt Cleared !\n" );
		if(!(rt_intr_delete(&my_rt_intr))){
	 		printk(KERN_ALERT "Interrupt deleted\n" );
		}
	}

	printk( KERN_ALERT "Module helloworld exit\n" );
}

module_init(helloworld_init_module); module_exit(helloworld_exit_module);

-------- Original-Nachricht --------
Datum: Mon, 10 Jul 2006 10:30:16 +0200
Von: Jan Kiszka <[email protected]>
An: Keinen Namen <[email protected]>
Betreff: Re: [Xenomai-help] isr

Quoted 23 lines
Quoted 3 lines · Keinen Namen

Hi I useing Xenomai 2.1 and the native skin

I want create a intr in kernel space with rt_intr_create, the 4th

argument is the pointer is the ISR.

Quoted 7 lines

My Question is which form does the ISR must have

rt_isr_t myisr ( ??? )
{
...
}

int my_isr(rt_intr_t *intr);

That's indeed undocumented, you had to browse the code for this information. :-/

[Note: unless you are writing some specialised or experimental code, developing drivers over the RTDM skin is recommended now. This aims at unifying the device interfaces for all skins.]

Jan

#4 lore raw

[Xenomai-help] ISR Again

hi Again

witch from have a RT_ISR?

I simply want a Programm that run helloworld_isr when Interrupt 13 is fired.

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>

#include <native/intr.h>

MODULE_DESCRIPTION("My kernel module");
MODULE_AUTHOR("Nobody");
MODULE_DESCRIPTION("Dei Mudda");
MODULE_LICENSE("my own");

RT_INTR my_rt_intr;

static int helloworld_isr(rt_intr_t *intr){
	printk( KERN_ALERT "IRQ\n");
	return IRQ_HANDLED;
}
static int helloworld_init_module(void) {
	int x;
	printk( KERN_ALERT "Module helloworld init startet Version 0.1\n" );
	
	x = rt_intr_create(&my_rt_intr,"einName",13,helloworld_isr,NULL,0);
	if(!x){
		printk( KERN_ALERT "Interrupt erfolgreich erstellt\n");
	
		if(!(rt_intr_enable(&my_rt_intr))){
			printk( KERN_ALERT "Interrupt erfolgreich aktiviert\n");
		}
	}else{
		printk( KERN_ALERT "Interrupt Erstellung fehlgeschlagen %i\n",x);
	}
}

static void helloworld_exit_module(void) {

	if(!(rt_intr_disable(&my_rt_intr))){
		printk( KERN_ALERT "Interrupt Cleared !\n" );
		if(!(rt_intr_delete(&my_rt_intr))){
	 		printk(KERN_ALERT "Interrupt deleted\n" );
		}
	}

	printk( KERN_ALERT "Module helloworld exit\n" );
}

module_init(helloworld_init_module);
module_exit(helloworld_exit_module);

Signature · 2 lines
"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
#5 lore raw

[Xenomai-help] Re: ISR Again

Hi Keinen,

"Keinen Namen" <[email protected]> [2006-07-10]:

Quoted 5 lines

hi Again

witch from have a RT_ISR?

I simply want a Programm that run helloworld_isr when Interrupt 13 is fired.

Why not using the RTDM?

Just use:

rtdm_irq_t rt_irq_handle;

err = rtdm_irq_request(&rt_irq_handle, 13, helloworld_isr, 0,

		"your_driver", NULL);

if (unlikely(err != 0)) {
/* error handling here */
}

err = rtdm_irq_enable(&rt_irq_handle);

  if (unlikely(err != 0)) {
	/* error handling here */

}

And in the cleanup function:

  rtdm_irq_free(&rt_irq_handle);

And the ISR:

  static int helloworld_isr(rtdm_irq_t *irq_handle)
  {
        return RTDM_IRQ_HANDLED;
  }

Regards,
Bernhard

Signature · 3 lines
"Mankind invented the atomic bomb, but no mouse would ever construct a 
mousetrap."
        -- Albert Einstein