linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Hardware interrupts routines
  2004-06-16 14:28 Hardware interrupts routines Garcia Jérémie
@ 2004-06-16 13:46 ` Jeff Angielski
  2004-06-16 13:49 ` Bret Indrelee
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Jeff Angielski @ 2004-06-16 13:46 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: LinuxPPC


On Wed, 2004-06-16 at 10:28, Garcia Jérémie wrote:
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> The only hardware interrupts routine I found through my investigations is the
> request_irq(...). But the problem is that request_irq do not allow me to pass
> an argument to the handler... So is there a routine that allows it or is there
> a way to adapt the request_irq() to my case.

Reread the kernel source code.  request_irq() does allow you to pass a
parameter.  Its the last argument to the function.

Jeff Angielski
The PTR Group


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hardware interrupts routines
  2004-06-16 14:28 Hardware interrupts routines Garcia Jérémie
  2004-06-16 13:46 ` Jeff Angielski
@ 2004-06-16 13:49 ` Bret Indrelee
  2004-06-16 14:24   ` Mark Chambers
  2004-06-16 14:24 ` Jaap-Jan Boor
  2004-06-16 14:59 ` Jean-Christophe Dubois
  3 siblings, 1 reply; 7+ messages in thread
From: Bret Indrelee @ 2004-06-16 13:49 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: linuxppc-embedded


On Wed, 16 Jun 2004, [Windows-1252] Garcia Jérémie wrote:
[ nnip ]
> The only hardware interrupts routine I found through my investigations
> is the request_irq(...). But the problem is that request_irq do not
> allow me to pass an argument to the handler... So is there a routine
> that allows it or is there a way to adapt the request_irq() to my case.

The last parameter of request_irq() gets passed as the second parameter
to the interrupt routine when it is called.

-Bret

--
Bret Indrelee                 QLogic Corporation
Bret.Indrelee@qlogic.com      6321 Bury Drive, St 13, Eden Prairie, MN 55346


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hardware interrupts routines
  2004-06-16 14:28 Hardware interrupts routines Garcia Jérémie
  2004-06-16 13:46 ` Jeff Angielski
  2004-06-16 13:49 ` Bret Indrelee
@ 2004-06-16 14:24 ` Jaap-Jan Boor
  2004-06-16 14:59 ` Jean-Christophe Dubois
  3 siblings, 0 replies; 7+ messages in thread
From: Jaap-Jan Boor @ 2004-06-16 14:24 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: linuxppc-embedded


Hi,

Only when you are in kernel mode (i.e. in a driver/module)
it is possible to register for an interrupt, e.g. like
this:


	#include <asm/irq.h> /* e.g. SIU_INT_IRQ1 for 82xx */

	static void irq_handler(int irq, void *my_data,
				struct pt_regs *regs)
	{
		/* handle the irq */

	}

	init()
	{
		int irq_flags = 0;
		long my_data = 0x12345678;

		request_irq(SIU_INT_IRQ1, &irq_handler,
			    irq_flags, "my irq", (void*)my_data);

	}


When some user land C routine needs to be called when
your interrupt arrives, you need to make a driver
like above that wakes up your user mode program
in "irq_handler". This will not give you very
good interrupt latencies however.

Jaap-Jan

On Wed, 2004-06-16 at 16:28, Garcia Jérémie wrote:
> Hi everybody !
> As you guess I need some help... Indeed I'm a newbie in Linux embedded development and I have to work on a linux ppc based board project.
> In fact, I have to adapt an existing VxWorks application to a linux montavista hardhat application.
> My problem is the following : I need to find a linux equivalent routine of the intConnect() VxWorks routine. You can see the man page of taht function below :
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> NAME
>
> intConnect( ) - connect a C routine to a hardware interrupt
> SYNOPSIS
>
> STATUS intConnect
>     (
>     VOIDFUNCPTR * vector,   /* interrupt vector to attach to */
>     VOIDFUNCPTR   routine,  /* routine to be called */
>     int           parameter /* parameter to be passed to routine */
>     )
>
> DESCRIPTION
>
> This routine connects a specified C routine to a specified interrupt vector. The address of routine is generally stored at vector so that routine is called with parameter when the interrupt occurs. The routine is invoked in supervisor mode at interrupt level. A proper C environment is established, the necessary registers saved, and the stack set up.
>
> The routine can be any normal C code, except that it must not invoke certain operating system functions that may block or perform I/O operations.
>
> This routine generally simply calls intHandlerCreate( ) and intVecSet( ). The address of the handler returned by intHandlerCreate( ) is what actually goes in the interrupt vector.
>
> This routine takes an interrupt vector as a parameter, which is the byte offset into the vector table. Macros are provided to convert between interrupt vectors and interrupt numbers, see intArchLib.
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> The only hardware interrupts routine I found through my investigations is the request_irq(...). But the problem is that request_irq do not allow me to pass an argument to the handler... So is there a routine that allows it or is there a way to adapt the request_irq() to my case.
> I thougt to declare a global variable to store my param but I use multitasking. So bad way...
>
>
> Thanks a lot for helping the newbie that I am...
>
--
J.G.J. Boor                       Anton Philipsweg 1
Software Engineer                 1223 KZ Hilversum
AimSys bv                         tel. +31 35 689 1941
Postbus 2194, 1200 CD Hilversum   mailto:jjboor@aimsys.nl


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hardware interrupts routines
  2004-06-16 13:49 ` Bret Indrelee
@ 2004-06-16 14:24   ` Mark Chambers
  2004-06-16 14:52     ` Bret Indrelee
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Chambers @ 2004-06-16 14:24 UTC (permalink / raw)
  To: Bret Indrelee; +Cc: linuxppc-embedded


But isn't he going to have to write a device driver in order to call
request_irq()?  You can't just call request_irq() from an application, can
you?  If not, is there any way to grab an interrupt other than writing a
device driver?

Mark Chambers

----- Original Message -----
From: "Bret Indrelee" <Bret.Indrelee@qlogic.com>
To: "Garcia Jérémie" <GARCIAJ@3il.fr>
> On Wed, 16 Jun 2004, [Windows-1252] Garcia Jérémie wrote:
> [ nnip ]
> > The only hardware interrupts routine I found through my investigations
> > is the request_irq(...). But the problem is that request_irq do not
> > allow me to pass an argument to the handler... So is there a routine
> > that allows it or is there a way to adapt the request_irq() to my case.
>
> The last parameter of request_irq() gets passed as the second parameter
> to the interrupt routine when it is called.
>
> -Bret
>
> --
> Bret Indrelee                 QLogic Corporation
> Bret.Indrelee@qlogic.com      6321 Bury Drive, St 13, Eden Prairie, MN
55346
>
>
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Hardware interrupts routines
@ 2004-06-16 14:28 Garcia Jérémie
  2004-06-16 13:46 ` Jeff Angielski
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Garcia Jérémie @ 2004-06-16 14:28 UTC (permalink / raw)
  To: linuxppc-embedded


Hi everybody !
As you guess I need some help... Indeed I'm a newbie in Linux embedded development and I have to work on a linux ppc based board project.
In fact, I have to adapt an existing VxWorks application to a linux montavista hardhat application.
My problem is the following : I need to find a linux equivalent routine of the intConnect() VxWorks routine. You can see the man page of taht function below :

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NAME

intConnect( ) - connect a C routine to a hardware interrupt
SYNOPSIS

STATUS intConnect
    (
    VOIDFUNCPTR * vector,   /* interrupt vector to attach to */
    VOIDFUNCPTR   routine,  /* routine to be called */
    int           parameter /* parameter to be passed to routine */
    )

DESCRIPTION

This routine connects a specified C routine to a specified interrupt vector. The address of routine is generally stored at vector so that routine is called with parameter when the interrupt occurs. The routine is invoked in supervisor mode at interrupt level. A proper C environment is established, the necessary registers saved, and the stack set up.

The routine can be any normal C code, except that it must not invoke certain operating system functions that may block or perform I/O operations.

This routine generally simply calls intHandlerCreate( ) and intVecSet( ). The address of the handler returned by intHandlerCreate( ) is what actually goes in the interrupt vector.

This routine takes an interrupt vector as a parameter, which is the byte offset into the vector table. Macros are provided to convert between interrupt vectors and interrupt numbers, see intArchLib.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The only hardware interrupts routine I found through my investigations is the request_irq(...). But the problem is that request_irq do not allow me to pass an argument to the handler... So is there a routine that allows it or is there a way to adapt the request_irq() to my case.
I thougt to declare a global variable to store my param but I use multitasking. So bad way...


Thanks a lot for helping the newbie that I am...

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hardware interrupts routines
  2004-06-16 14:24   ` Mark Chambers
@ 2004-06-16 14:52     ` Bret Indrelee
  0 siblings, 0 replies; 7+ messages in thread
From: Bret Indrelee @ 2004-06-16 14:52 UTC (permalink / raw)
  To: Mark Chambers; +Cc: Bret Indrelee, linuxppc-embedded


On Wed, 16 Jun 2004, Mark Chambers wrote:
> But isn't he going to have to write a device driver in order to call
> request_irq()?

He is going to have to write a loadable module, which may or may not
have the normal driver entry points. If he is handling a PCI device,
he definately should be writing a device driver.

-Bret

> You can't just call request_irq() from an application, can
> you?

That is correct.

> If not, is there any way to grab an interrupt other than writing a
> device driver?

Any kernel code (i.e. loadable module) can call the routine.

-Bret

--
Bret Indrelee                 QLogic Corporation
Bret.Indrelee@qlogic.com      6321 Bury Drive, St 13, Eden Prairie, MN 55346


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Hardware interrupts routines
  2004-06-16 14:28 Hardware interrupts routines Garcia Jérémie
                   ` (2 preceding siblings ...)
  2004-06-16 14:24 ` Jaap-Jan Boor
@ 2004-06-16 14:59 ` Jean-Christophe Dubois
  3 siblings, 0 replies; 7+ messages in thread
From: Jean-Christophe Dubois @ 2004-06-16 14:59 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: linuxppc-embedded


Hello Jérémie

A good reference for you would be:

http://www.xml.com/ldd/chapter/book/bookindexpdf.html

In particular:
http://www.xml.com/ldd/chapter/book/pdf/ch09.pdf

Enjoy

JC

On Wed, 2004-06-16 at 16:28, Garcia Jérémie wrote:
> Hi everybody !
> As you guess I need some help... Indeed I'm a newbie in Linux embedded development and I have to work on a linux ppc based board project.
> In fact, I have to adapt an existing VxWorks application to a linux montavista hardhat application.
> My problem is the following : I need to find a linux equivalent routine of the intConnect() VxWorks routine. You can see the man page of taht function below :
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> NAME
>
> intConnect( ) - connect a C routine to a hardware interrupt
> SYNOPSIS
>
> STATUS intConnect
>     (
>     VOIDFUNCPTR * vector,   /* interrupt vector to attach to */
>     VOIDFUNCPTR   routine,  /* routine to be called */
>     int           parameter /* parameter to be passed to routine */
>     )
>
> DESCRIPTION
>
> This routine connects a specified C routine to a specified interrupt vector. The address of routine is generally stored at vector so that routine is called with parameter when the interrupt occurs. The routine is invoked in supervisor mode at interrupt level. A proper C environment is established, the necessary registers saved, and the stack set up.
>
> The routine can be any normal C code, except that it must not invoke certain operating system functions that may block or perform I/O operations.
>
> This routine generally simply calls intHandlerCreate( ) and intVecSet( ). The address of the handler returned by intHandlerCreate( ) is what actually goes in the interrupt vector.
>
> This routine takes an interrupt vector as a parameter, which is the byte offset into the vector table. Macros are provided to convert between interrupt vectors and interrupt numbers, see intArchLib.
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> The only hardware interrupts routine I found through my investigations is the request_irq(...). But the problem is that request_irq do not allow me to pass an argument to the handler... So is there a routine that allows it or is there a way to adapt the request_irq() to my case.
> I thougt to declare a global variable to store my param but I use multitasking. So bad way...
>
>
> Thanks a lot for helping the newbie that I am...
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-06-16 14:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-16 14:28 Hardware interrupts routines Garcia Jérémie
2004-06-16 13:46 ` Jeff Angielski
2004-06-16 13:49 ` Bret Indrelee
2004-06-16 14:24   ` Mark Chambers
2004-06-16 14:52     ` Bret Indrelee
2004-06-16 14:24 ` Jaap-Jan Boor
2004-06-16 14:59 ` Jean-Christophe Dubois

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).