linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Réf. : Re: mpc / linux kernel - user space
@ 2003-11-28  9:21 Aain_Devarenne%ZODIAC
  2003-11-28  9:49 ` Jaap-Jan Boor
  0 siblings, 1 reply; 3+ messages in thread
From: Aain_Devarenne%ZODIAC @ 2003-11-28  9:21 UTC (permalink / raw)
  To: linuxppc-embedded


Hi everybody

I 'm pending on the same problem as Juergen,
- How can a User Space Thread Wait for a signaling event set by KERNEL  ?
- Can an IOCTL return pending,  and then do a completion after the event ?
- Can we pass an Handle by IOCTL to Kernel from user space ?

Ps: Calling a pointeur in UserSpce seems a bit weird and unsecure !!!


Regards Alain Devarenne




Hi Juergen,

That's normally not something you do and I don't know if it's possible.
Application code normally communicates with your driver code using
system
calls (read/write). So either your appl procedure must be part
of your module, or you must signal e.g. a user thread the timer
interrupt happened, so the thread can execute that code.
Hope this helps,

Jaap-Jan


On 27-nov-03, at 17:07, Juergen Oberhofer wrote:

>
> Hi,
>
> I have a module and an application program in user space:
>
> The Module performs the following task: at init it initializes the cpm
> timer register of the mpc823,
> such that an interrupt is generated every x microseconds. Thus, I
> installed an interrupt handling function f that handles the timer
> interrupts.
>
> My problem is that the module / the interrupt handling function should
> execute a procedure defined in the application program. How can I pass
> a
> pointer (which points to that function) from the appl.program to the
> module, such that the handler can execute this function every x
> milliseconds? I thought to create a procedure in the module that
> accepts
> a function pointer as argument. But how can I achieve, that this module
> procedure is visible to the application program? Does somebody have a
> suggestion or know another way to do it?
>
> Regards,
> Juergen
>
>


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

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

* Re: Réf. : Re: mpc / linux kernel - user space
  2003-11-28  9:21 Réf. : Re: mpc / linux kernel - user space Aain_Devarenne%ZODIAC
@ 2003-11-28  9:49 ` Jaap-Jan Boor
  0 siblings, 0 replies; 3+ messages in thread
From: Jaap-Jan Boor @ 2003-11-28  9:49 UTC (permalink / raw)
  To: Aain_Devarenne%ZODIAC; +Cc: linuxppc-embedded


On Fri, 2003-11-28 at 10:21, Aain_Devarenne%ZODIAC@zodiac.com wrote:
> Hi everybody
>
> I 'm pending on the same problem as Juergen,
> - How can a User Space Thread Wait for a signaling event set by KERNEL  ?

e.g. issue a read on some device driver (/dev/<your driver>
which will block until an interrupt has occured.
something like this:

DECLARE_WAIT_QUEUE_HEAD(mydriver_queue);

ssize_t mydriver_read(
    struct file *filp,
    char *buf,
    size_t count,
    loff_t *f_pos)
{
    /* wait on interrupt */
    while (1) {
       interruptible_sleep_on(&mydriver_queue);
       if (signal_pending (current))  /* a signal arrived */
           return -ERESTARTSYS; /* tell the fs layer to handle it */
       else break;
    }
    return 0;
}

void mydriver_irqhandler(unsigned long arg)
{
    wake_up_interruptible(&mydriver_queue);
}

Jaap-Jan

> - Can an IOCTL return pending,  and then do a completion after the event ?
> - Can we pass an Handle by IOCTL to Kernel from user space ?
>
> Ps: Calling a pointeur in UserSpce seems a bit weird and unsecure !!!
>
>
> Regards Alain Devarenne
>
>
>
>
> Hi Juergen,
>
> That's normally not something you do and I don't know if it's possible.
> Application code normally communicates with your driver code using
> system
> calls (read/write). So either your appl procedure must be part
> of your module, or you must signal e.g. a user thread the timer
> interrupt happened, so the thread can execute that code.
> Hope this helps,
>
> Jaap-Jan
>
>
> On 27-nov-03, at 17:07, Juergen Oberhofer wrote:
>
> >
> > Hi,
> >
> > I have a module and an application program in user space:
> >
> > The Module performs the following task: at init it initializes the cpm
> > timer register of the mpc823,
> > such that an interrupt is generated every x microseconds. Thus, I
> > installed an interrupt handling function f that handles the timer
> > interrupts.
> >
> > My problem is that the module / the interrupt handling function should
> > execute a procedure defined in the application program. How can I pass
> > a
> > pointer (which points to that function) from the appl.program to the
> > module, such that the handler can execute this function every x
> > milliseconds? I thought to create a procedure in the module that
> > accepts
> > a function pointer as argument. But how can I achieve, that this module
> > procedure is visible to the application program? Does somebody have a
> > suggestion or know another way to do it?
> >
> > Regards,
> > Juergen
> >
> >
>
>


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

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

* RE: Réf. : Re: mpc / linux kernel - user space
@ 2003-11-30 19:00 Rod Boyce
  0 siblings, 0 replies; 3+ messages in thread
From: Rod Boyce @ 2003-11-30 19:00 UTC (permalink / raw)
  To: 'Aain_Devarenne%ZODIAC@zodiac.com'; +Cc: linuxppc-embedded


All,

A quick search on this mailing list will point to a replay by Wolfgang Denk
to exactly the same question.  Try
http://lists.linuxppc.org/linuxppc-embedded/200107/msg00154.html

The subject is Interfacing user application and interrupt.  I have just done
exactly this using Wolfgang's reply to this e-mail.  You use either select
or poll and wait in a thread for the interrupt to occure.

Regards,
Rod Boyce.

-----Original Message-----
From: Aain_Devarenne%ZODIAC@zodiac.com
[mailto:Aain_Devarenne%ZODIAC@zodiac.com]
Sent: Friday, November 28, 2003 10:22 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: Réf. : Re: mpc / linux kernel - user space



Hi everybody

I 'm pending on the same problem as Juergen,
- How can a User Space Thread Wait for a signaling event set by KERNEL  ?
- Can an IOCTL return pending,  and then do a completion after the event ?
- Can we pass an Handle by IOCTL to Kernel from user space ?

Ps: Calling a pointeur in UserSpce seems a bit weird and unsecure !!!


Regards Alain Devarenne




Hi Juergen,

That's normally not something you do and I don't know if it's possible.
Application code normally communicates with your driver code using
system
calls (read/write). So either your appl procedure must be part
of your module, or you must signal e.g. a user thread the timer
interrupt happened, so the thread can execute that code.
Hope this helps,

Jaap-Jan


On 27-nov-03, at 17:07, Juergen Oberhofer wrote:

>
> Hi,
>
> I have a module and an application program in user space:
>
> The Module performs the following task: at init it initializes the cpm
> timer register of the mpc823,
> such that an interrupt is generated every x microseconds. Thus, I
> installed an interrupt handling function f that handles the timer
> interrupts.
>
> My problem is that the module / the interrupt handling function should
> execute a procedure defined in the application program. How can I pass
> a
> pointer (which points to that function) from the appl.program to the
> module, such that the handler can execute this function every x
> milliseconds? I thought to create a procedure in the module that
> accepts
> a function pointer as argument. But how can I achieve, that this module
> procedure is visible to the application program? Does somebody have a
> suggestion or know another way to do it?
>
> Regards,
> Juergen
>
>


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

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

end of thread, other threads:[~2003-11-30 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-28  9:21 Réf. : Re: mpc / linux kernel - user space Aain_Devarenne%ZODIAC
2003-11-28  9:49 ` Jaap-Jan Boor
  -- strict thread matches above, loose matches on Subject: below --
2003-11-30 19:00 Rod Boyce

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).