* How to register a user-space function as an interrupt handler ?
@ 2005-05-26 10:09 Garcia Jérémie
2005-05-26 12:35 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Garcia Jérémie @ 2005-05-26 10:09 UTC (permalink / raw)
To: linuxppc-dev
Hi everybody, I'm tryin to adapt a vxWorks-designed application to a =
Linux montavista 3.1 on a board=20
running a powerPC 405 EP. In our application, that will be run from the =
linux user-space, we connect a
routine to an interrupt vector as the example below:
/**************************/
/* /home/JG/appli/ppcos.c */
/**************************/
RET_CODE_TYPE enable_and_connect_DMA(MY_DMA_CTRL * my_param)
{
BS_RET_CODE_TYPE rc1 =3D BS_RET_OK;=20
/* Connect interrupt handler for each channel */
rc =3D intConnect((VOIDFUNCPTR *)INT_VEC_DMA, my_handler, =
(int)my_param);
=20
if(!rc)
/* Enable interrupt for first channel in the interrupt =
controller */
intEnable(INT_LVL_DMA_CH0);
else
rc1 =3D BS_RET_ERROR;
=20
return rc1;
}
What I would like to do is to make an emulation of both vxWorks routines =
(intConnect() and intEnable()) in the linux world
cause I'm not allowed to change that code.
I guess that I will have to use :
intConnect() <=3D=3D> request_irq()
intEnable() <=3D=3D> enable_irq()
(Is that correct??).
Furthermore, I'm a newbie in linux developpment and if I understand =
well, I need to be in kernel-space to call those routines.=20
But here is my problem: the interrupt handler that we call is part of =
the application and uses a lot of #define,semaphores and other=20
ressources of the user-application. So can I implement a new linux =
system call, that will register our user-space-function (my_handler())
as the interrupt handler for the given vector?? Indeed, we do that for =
several interrupts (each with a different handler) and it would
be comfortable to have a system call that would take (the handler + the =
interrupt vector + the parameters) as parameters.
Don't forget that I have to respect two conditions: my application must =
be run from user-space and I cannot modify the=20
code (my team does not want to support versions).
Please help or give me a clue.
Thanks for your precious help.
J=E9r=E9mie
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: How to register a user-space function as an interrupt handler ?
2005-05-26 10:09 How to register a user-space function as an interrupt handler ? Garcia Jérémie
@ 2005-05-26 12:35 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2005-05-26 12:35 UTC (permalink / raw)
To: Garcia Jérémie; +Cc: linuxppc-dev
Hello,
in message <D4FDDD1349B5AC46B68FC26AD8AF42D6226B2C@exnet.3il.fr> you wrote:
> Hi everybody, I'm tryin to adapt a vxWorks-designed application to a
...
> What I would like to do is to make an emulation of both vxWorks routines
> (intConnect() and intEnable()) in the linux world
> cause I'm not allowed to change that code.
This makes no sense. You cannot "port" such code from VxWorks to
Linux without making any changes.
As for your question: in Linux interrupt hadling happens in kernel
context only. You cannot register user space functions as interrupt
handlers.
> Furthermore, I'm a newbie in linux developpment and if I understand
> well, I need to be in kernel-space to call those routines.
Right.
> But here is my problem: the interrupt handler that we call is part of
> the application and uses a lot of #define,semaphores and other
> ressources of the user-application. So can I implement a new linux
> system call, that will register our user-space-function (my_handler())
This cannot and should not be done. You will have to go through your
software design and adapt it for the new operating system
environment. Unix has somewhat different concepts how some things get
done, and instead of fighting with this envrionment you should adapt
to it.
> Don't forget that I have to respect two conditions: my application must
> be run from user-space and I cannot modify the
> code (my team does not want to support versions).
Simple answer: The job cannot be done under such constraints.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"It is better to have tried and failed than to have failed to try,
but the result's the same." - Mike Dennison
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-26 12:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-26 10:09 How to register a user-space function as an interrupt handler ? Garcia Jérémie
2005-05-26 12:35 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox