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

kashin Lin kashin08 at gmail.com
Sun Dec 2 03:07:51 EST 2007


Hi Sergio & Jorge,

thanks for all your suggestions and help. i will try to see

what's the suit way to resolve my problem !

and about my second quetion mentioned at my last letter:
   (  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?  )
any comment?

thanks in adcance!



best,

kashin lin

2007/12/1, Sergio Ruocco <sergio.ruocco at gmail.com>:
>
> Jorge Torres 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);
> > do {
> >       tim_ret = timer_wait();
> > } while(tim_ret!=tim) ;
>
> I am not familiar with Iguana timers, so I won't comment on this code.
>
> However...
>
>
> > And that's it, or you can always go dirty with for(i=0;i<N;i++);
>
> Busy looping to get microsecond-level delays (or any delay) is DEAD
> WRONG on multiple levels.
>
> Level 0: the compiler optimises out your empty loop.
> Level 1: you waste CPU and energy
> ....
> Level oo: the delay is typically wrong
>
>
> FYI, a couple of years ago now, to get lightweight, fine-grained
> (us-level) delays on Iguana/L4 I programmed my own low-level timer
> driver. Things are surely better now: ask OKL guys.
>
>
>
> > Hope it helps,
> >
> > Cheers,
> >
> > Jorge
>
>         Sergio
>
>
>
> Sergio Ruocco, PhD
> home page: http://www.disco.unimib.it/ruocco             Research Fellow
> mail:ruocco at disco.unimib.it / sergio.ruocco at gmail.com        NOMADIS Lab
> phone: +39-02-6448-7914               Mobile, embedded real-time systems
> skype: 'sergioruocco'  Dip. di Informatica, Sistemistica e COmunicazione
> Building U14, room 1003  Università degli Studi di Milano-Bicocca, Italy
>
> Your manuscript is both good and original; but the part that is good is
> not original, and the part that is original is not good.
> Samuel Johnson
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20071202/1a1550aa/attachment-0001.htm 


More information about the Developer mailing list