[okl4-developer] okl4 system call or API about "delay" and "interrupt"

Jorge Torres jorge.torres.maldonado at gmail.com
Sat Dec 1 12:20:53 EST 2007


Hi kashin,

Having a delay is very simple and clean, simpler than saying it,

#include <interfaces/timer_client.h>
#include <timer/timer.h>

timer_t tim, tim_ret;
int r;

timer_init();
tim = timer_create();
r = timer_request(tim, MICROSECS(10), TIMER_ONESHOT);
do {
      tim_ret = timer_wait();
} while(tim_ret!=tim) ;

And that's it, or you can always go dirty with for(i=0;i<N;i++);

Hope it helps,

Cheers,

Jorge

On Nov 30, 2007 8:18 PM, Jorge Torres <jorge.torres.maldonado at gmail.com>
wrote:

> Hi kashin,
>
> Having a delay is very simple and clean, simpler than saying it,
>
> #include <interfaces/timer_client.h>
> #include <timer/timer.h>
>
> timer_t tim, tim_ret;
> int r;
>
> timer_init();
> tim = timer_create();
> r = timer_request(tim, MICROSECS(10), TIMER_ONESHOT);
> tim_ret = timer_wait();
>
> while(tim_ret!=tim);
>
> And that's it, or you can always go dirty with for(i=0;i<N;i++);
>
> Hope it helps,
>
> Cheers,
>
> Jorge
>
> On Nov 29, 2007 10:19 AM, kashin Lin <kashin08 at gmail.com> wrote:
>
> > Hi,
> >
> > thanks for your reply.
> >
> > the reason of the need for delay is that :
> > i want to add some milliseconds delay between contiguous hardware
> > configuration instruction.
> > so maybe it's no need to use this powerful method  such as timer.
> > so are there any alternative way to achieve this goal?
> > p.s. where are those examples use timer server i can refer to?
> >        ( i want to learn how to use timer too )
> >
> >
> >
> > another questions for register irq handler:
> > if i want to use function_A as irq #B's handler
> >
> >        thread_ref_t thrd;
> >        thrd = thread_create_simple( function_A, NULL, 100 );
> >        hardware_register_interrupt( thread_l4tid(thrd), B );
> >
> > is the right way to register it?
> >
> >
> >
> >
> > 2007/11/29, Jorge Torres < jorge.torres.maldonado at gmail.com>:
> >
> > > Hi,
> > >
> > > You can use iguana's timer server, there are some examples, at which
> > > you can look at,
> > >
> > > Cheers,
> > >
> > > Jorge
> > >
> > > On Nov 28, 2007 2:49 AM, kashin Lin <kashin08 at gmail.com> wrote:
> > >
> > > > Hi,
> > > >
> > > > i wonder know if OKL4 or Iguana has any system call or API that can
> > > > delay
> > > >
> > > > several msec,( similar to uDelay or mDelay in linux kernel). and how
> > > > to use it?
> > > >
> > > > ex: which header
> > > > file i should include, and what function i can call?
> > > >
> > > >
> > > > another quetion is about request IRQ:
> > > >
> > > > in linux kernel there is a functin named request_irq whitch can map
> > > > a IRQ# to a handler routine.
> > > >
> > > > i noticed there is a function named hardware_register_interrupt in
> > > > iguana, but the parameters are
> > > >
> > > > IRQ# and a thread id. it doesn't make sense for me. why not a
> > > > handler routine instead of a thread id?
> > > >
> > > > if i want to rigster a handler routine for a IRQ#, how should i do?
> > > >
> > > > _______________________________________________
> > > > Developer mailing list
> > > > Developer at okl4.org
> > > > https://lists.okl4.org/mailman/listinfo/developer
> > > >
> > > >
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20071130/dc20f5f4/attachment.htm 


More information about the Developer mailing list