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?
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);
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 */
pthread_make_periodic_np (t2, gethrtime()+50000, 0); /* falling edge */
return(0);
}
void cleanup_module(void) {
pthread_delete_np (t1);
pthread_delete_np (t2);
}
begin:vcard
n:Wolin;Elliott
tel;fax:757-269-5800
tel;home:757-229-2724
tel;work:757-269-7365
x-mozilla-html:FALSE
org:Jefferson Lab;Physics Department
version:2.1
email;internet:[EMAIL PROTECTED]
title:Physicist
note:A218 CEBAF Center
adr;quoted-printable:;;12000 Jefferson Ave MS12H=0D=0A;Newport News;VA;23606;US
x-mozilla-cpt:;21408
fn:Elliott Wolin
end:vcard