On Fri, May 05, 2000 at 09:56:50AM +0200, Alexander Lichius wrote:
> Hi all,
> 
> besides the thing with the zero period. shouldn't there be a call to
> pthread_wait_np() in the thread code routine "fun"? i am new to
> rt-linux and i only checked the examples coming with it and there i
> found in the parallel port example (which is very similar to this one)
> the stated call.
> am i right that in this case the task never waits for the next period?

Yes. Good spotting.


> 
> bye
> alexander
> 
> 
> Friday, May 05, 2000, 12:46:55 AM, you wrote:
> 
> yfc> On Thu, May 04, 2000 at 02:34:44PM -0400, Elliott Wolin wrote:
> >> Hi,
> >> 
> >> I must be missing something fundamental.  I don't know why the program below
> >> doesn't generate a single rectangular pulse on the parallel port with a width of
> >> 50 microsec. (rtlinux 2.2.13, PIII 450).
> >> 
> >> Rather than the 2nd thread running 50 microsec after the 1st, it runs
> >> immediately after the 1st, giving 10 microsec pulses.
> >> 
> >> How do you delay the startup of a thread?
> 
> 
> yfc> You gave them 0 period and RTL scheduler picked a semi-safe 10microseconds
> yfc> Try making the period 50000 -- see below.
> 
> >> 
> >> 
> >>                               Sincerely,
> >>                                       Elliott Wolin
> >>  
> >> 
> >> 
>===================================================================================
> >> 
> >> 
> >> /* Produce a single rectangular pulse on parallel port */
> >> 
> >> #include <asm/io.h>
> >> #include <rtl.h>
> >> #include <pthread.h>
> >> 
> >> #define LPT_PORT 0x378
> >> 
> >> pthread_t t1,t2;
> >> 
> >> 
> >> void *fun(void *arg) {
> >>   outb((int)arg, LPT_PORT);
>      pthread_wait_np();       // ??
> >>   return(0);
> >> }
> >> 
> >> 
> >> int init_module(void) {
> >>   pthread_create (&t1, NULL, fun, (void*)~0x0);  /* rising edge */
> >>   pthread_create (&t2, NULL, fun, (void*) 0x0);  /* falling edge */
> >>   
> >>   /* pulse width is 50 microsec */
> >>   pthread_make_periodic_np (t1, gethrtime(),       0);  /* rising edge */
> yfc>                                               50000
> >>   pthread_make_periodic_np (t2, gethrtime()+50000, 0);  /* falling edge */
> yfc>                                                      50000
> 
> >>   
> >>   return(0);
> >> }
> >> 
> >> 
> >> void cleanup_module(void) {
> >>   pthread_delete_np (t1);
> >>   pthread_delete_np (t2);
> >> }
> yfc> Content-Description: Card for Elliott Wolin
> 
> 
> 
> 
> 
> CU
>  Alexander                            mailto:[EMAIL PROTECTED]
> 
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/

-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to