Re: [rtl] Re: [realtime] ESC attendence ... ?

2001-04-13 Thread Cort Dougan

Please, don't neglect our tireless efforts to sacrifice babies as well...

} Because they are not a "real" company, just a couple of people hoping to
} reap dot-com profits from a patent based on ancient prior art.  Do not
} confuse them with any of the for-profit RT Linux outfits with real
} products, or any of the GPL patriots that are working on real-time
} support.  All they want is a royalty check in the mailbox.  They couldn't
} care less about trade shows or such.
} 
} My advice is to ugnire FSMLabs and use RTAI.  It is better anyway.
} 
} :-)
} 
} On Thu, 12 Apr 2001, Robert Warner wrote:
} 
}  Why doesn't FSMLabs attend ESCs to make their realtime variant of Linux
}  more visible?
}  
} 
} -- [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/
-- [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/




[rtl] Re: [realtime] ESC attendence ... ?

2001-04-13 Thread Cort Dougan

We did attend.  Rather, I did.

} Why doesn't FSMLabs attend ESCs to make their realtime variant of Linux
} more visible?
-- [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/




Re: [realtime] Re: [rtl] ESC attendence ... ?

2001-04-13 Thread Peter Cavender

The discerning audience pays no heed to your specious, dangerous patent
claims.

Do you yet have a coherent statement regarding your alledged patent(s),
the preponderance of prior art, and whether RTAI is within the scope of
your patent?

:-(


On Thu, 12 Apr 2001 [EMAIL PROTECTED] wrote:

 We're interested in the discerning audience  that already knows about us -)
 
 On Thu, Apr 12, 2001 at 09:42:46PM -0400, Robert Warner wrote:
  Why doesn't FSMLabs attend ESCs to make their realtime variant of Linux
  more visible?
  
  -- [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 
 Finite State Machine Labs: The RTLinux Company.
  www.fsmlabs.com  www.rtlinux.com
 

-- [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/




[rtl] Re: [realtime] ESC attendence ... ?

2001-04-13 Thread Peter Cavender

Because they are not a "real" company, just a couple of people hoping to
reap dot-com profits from a patent based on ancient prior art.  Do not
confuse them with any of the for-profit RT Linux outfits with real
products, or any of the GPL patriots that are working on real-time
support.  All they want is a royalty check in the mailbox.  They couldn't
care less about trade shows or such.

My advice is to ugnire FSMLabs and use RTAI.  It is better anyway.

:-)

On Thu, 12 Apr 2001, Robert Warner wrote:

 Why doesn't FSMLabs attend ESCs to make their realtime variant of Linux
 more visible?
 

-- [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/




[rtl] Why RTLinux?

2001-04-13 Thread Mukaila olundegun

Dear and Fellow Engineers

I  received an invitation to give a lecture on RTLinux (i.e to support why I
recommend the use of RTLinux).

Though  there are common sense like free royalty, availability of source
code already in CD-ROM or at RTLinux related web site. But, what I really
want to emphasize is the broad knowlegde of RTLinux from the technical point
of view. i.e  by comparing Windows, RTOS, VxWorks or other  Real Time
OS(e.g. switching latency, memory usage, system drivers etc).

As things change everyday I will like to compare what I have prepared
already with other peoples facts.

I will really appreciate any kind of information you.

Regards,
Mukaila
- Original Message -
From: Raul [EMAIL PROTECTED]
To: Real Time Linux [EMAIL PROTECTED]
Sent: Friday, January 19, 2001 12:08 AM
Subject: [rtl] network programming


 hello
 this may be a simple question, but I cannot get any
 information on the net so there it goes:
 I have this program that sends data over a LAN. At
 this point I'm using UDP but in the future I may have
 to use TCP/IP.
 The program works well in the user-space, but I want
 it to run within rtl. I have included the rtl.h header
 in my program and try to compile it with the make file
 rtl.mk. But it comes up with hundreds of warnings,
 most of them redefinition problems.
 The header files included are:
 sys/socket.h
 netinet/in/h
 arpa/inet.h
 netdb.h

 the redifinition are found in:

 usr/src/rtlinux-2.3/linux/include/linux/

 Do I have to use rtlinux header files? Is there any
 example I could look at?

 thanks in advance
 RAul




 
 Do You Yahoo!?
 Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
 or your free @yahoo.ie address at http://mail.yahoo.ie
 -- [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/



-- [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/




Re: [rtl] Re: [realtime] ESC attendence ... ?

2001-04-13 Thread David Schleef

On Fri, Apr 13, 2001 at 01:36:59AM -0400, Peter Cavender wrote:
 Because they are not a "real" company, just a couple of people hoping to
 reap dot-com profits from a patent based on ancient prior art.  Do not
 confuse them with any of the for-profit RT Linux outfits with real
 products, or any of the GPL patriots that are working on real-time
 support.  All they want is a royalty check in the mailbox.  They couldn't
 care less about trade shows or such.
 
 My advice is to ugnire FSMLabs and use RTAI.  It is better anyway.
 
 :-)


Your abilities to write flaimbait have not gone unnoticed.  You
even got me to respond -- I usually just read flamewars in
amusement.

Please do not attempt to advocate RTAI at the same time as bashing
RTLinux and/or FSMlabs.  RTAI discussion holds a relatively amicable
position on this RTLinux mailing list, which we would like to keep.
Contrary to popular belief, many of the RTAI developers have no
specific dislike for RTLinux, and much of the software associated
with RTAI also works with RTLinux.




dave...  (one of the RTAI maintainers)


-- [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/




Re: [rtl] Is everyone still receiving OGJFAFOG.exe files from ....

2001-04-13 Thread Kai Mueller

On Fri, Apr 13, 2001 at 01:25:29AM -0400, Robert Warner wrote:
 I keep getting attachments of OGJAFOGx.exe from [EMAIL PROTECTED]  I
 believe this to be a virus (haven't checked it and do not plan on doing
 so).  Why would I (we) be continuing to receive this junk.  I have all the
 previous (junk) if anyone needs it for diagnosis to find at shoot the culprit.

You are right. The attached .EXE contains the so called
"W95/Hybrid.Worm". A widley spread virus. This virus will
be detected by most up-to-date scanner programs.

Kai

-- 
 Kai P. Mueller
 Control Department (Regelungstechnik) | Phone [+49] (531) 391-3835
 Technical University Braunschweig | Fax   [+49] (531) 391-5194
 D-38092 Braunschweig  | Email [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/




Re: [rtl] Why RTLinux?

2001-04-13 Thread Ivan Martinez

You may want to complicate things by considering RTAI... ;-)
www.rtai.org

- Original Message -
From: "Mukaila olundegun" [EMAIL PROTECTED]
To: "Real Time Linux" [EMAIL PROTECTED]
Sent: Friday, April 13, 2001 8:40 AM
Subject: [rtl] Why RTLinux?


 Dear and Fellow Engineers

 I  received an invitation to give a lecture on RTLinux (i.e to support why
I
 recommend the use of RTLinux).

 Though  there are common sense like free royalty, availability of source
 code already in CD-ROM or at RTLinux related web site. But, what I really
 want to emphasize is the broad knowlegde of RTLinux from the technical
point
 of view. i.e  by comparing Windows, RTOS, VxWorks or other  Real Time
 OS(e.g. switching latency, memory usage, system drivers etc).

 As things change everyday I will like to compare what I have prepared
 already with other peoples facts.

 I will really appreciate any kind of information you.

 Regards,
 Mukaila
 - Original Message -
 From: Raul [EMAIL PROTECTED]
 To: Real Time Linux [EMAIL PROTECTED]
 Sent: Friday, January 19, 2001 12:08 AM
 Subject: [rtl] network programming


  hello
  this may be a simple question, but I cannot get any
  information on the net so there it goes:
  I have this program that sends data over a LAN. At
  this point I'm using UDP but in the future I may have
  to use TCP/IP.
  The program works well in the user-space, but I want
  it to run within rtl. I have included the rtl.h header
  in my program and try to compile it with the make file
  rtl.mk. But it comes up with hundreds of warnings,
  most of them redefinition problems.
  The header files included are:
  sys/socket.h
  netinet/in/h
  arpa/inet.h
  netdb.h
 
  the redifinition are found in:
 
  usr/src/rtlinux-2.3/linux/include/linux/
 
  Do I have to use rtlinux header files? Is there any
  example I could look at?
 
  thanks in advance
  RAul
 
 
 
 
  
  Do You Yahoo!?
  Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
  or your free @yahoo.ie address at http://mail.yahoo.ie
  -- [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/
 
 

 -- [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/

-- [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/




[rtl] RTAI scheduling

2001-04-13 Thread Alex Plouznikoff

Hi,

I was wandering if anyone had a brief description of the rt_task_struct
variables in rtai_sched.h. There is absolutly no comments in this file.

Futhermore, what's the difference between the rt_schedule() and
rt_timer_handler() functions.

Thanks.

Alex


Get free email and a permanent address at http://www.netaddress.com/?N=1
-- [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/




Re: [rtl] RTAI scheduling

2001-04-13 Thread Erwin Rol

Alex Plouznikoff wrote:
 
 Hi,
 
 I was wandering if anyone had a brief description of the rt_task_struct
 variables in rtai_sched.h. There is absolutly no comments in this file.

Thats not true, there are atleast 5 lines of comments ;-)
I think the idea is that you use the (well documented) API to access
RTAI, and not mess with the structure directly. Unless you are of course
trying to extend the scheduler (or something like that) and than i have
to agree the comments are rather minimal, but hey, you have the source
to see how they are used :-)

 
 Futhermore, what's the difference between the rt_schedule() and
 rt_timer_handler() functions.
 
 Thanks.
 
 Alex


BTW there is a special RTAI list for special RTAI questions like this.

- Erwin

 
 
 Get free email and a permanent address at http://www.netaddress.com/?N=1
 -- [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/
-- [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/




[rtl] Linux equivalents to pthread_make_periodic_np and pthread_suspend_np

2001-04-13 Thread Ivan Martinez



Hello all:
I'm trying to make DSLib v2 generate 
adecuatedsystem calls depending on it beingLinux, RTLinux, or RTAI. 
I'm looking in the Linux threads functions and I don't see any equivalent to 
pthread_make_periodic_np and pthread_suspend_np. Is there any?. If not, how can 
I performsuch operations?.
Thank you.
Ivan Martinez


[rtl] Video Card Problems - Which Cards are Black Listed?

2001-04-13 Thread Stephen D. Cohen

Gang,

I recall a few weeks back hearing about some black listed video
cards due to driver problems in X11R4 (and possibly other versions).  As I
am about to buy a new laptop, I just want to check to see if the one I am
planning to purchase will have this problem.

I am looking at one of the IBM T20 series laptops with an "S3 Savage
IX8" video controller.  I will be using X11R3.X (probably) on it.  Has
anybody had any trouble with this combination, or can anybody suggest
whether I am likely to have trouble with it?

I am planning to do some serial communications testing with the
laptop, so I will need a deterministic response within reason (latencies
measured in microseconds not seconds, please).

Any experiences others have had or any advice is greatly
appreciated.

Regards,

Steve Cohen
-- [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/




Re: [rtl] Linux equivalents to pthread_make_periodic_np and pthread_suspend_np

2001-04-13 Thread David Schleef

On Fri, Apr 13, 2001 at 09:22:14PM +0200, Ivan Martinez wrote:
 Hello all:
 I'm trying to make DSLib v2 generate adecuated system calls depending on it being 
Linux, RTLinux, or RTAI. I'm looking in the Linux threads functions and I don't see 
any equivalent to pthread_make_periodic_np and pthread_suspend_np. Is there any?. If 
not, how can I perform such operations?.
 Thank you.
 Ivan Martinez


It can be duplicated using something similar to the attached
file.



dave...




/* Example of a periodic task using straight POSIX calls. */
/* Copyright 2001 David Schleef [EMAIL PROTECTED] */
/* Use, distribution, and modification are allowed under the LGPL. */

#include stdio.h
#include stdlib.h
#include sys/time.h
#include sys/types.h
#include unistd.h


#define PERIOD 10	/* 100 ms */

void tv_add_usec(struct timeval *tv,unsigned int usec);
int tv_compare(struct timeval *a,struct timeval *b);
void tv_sub(struct timeval *a,struct timeval *b);

int main(int argc,char *argv[])
{
	struct timeval now;
	struct timeval next_tick;

	gettimeofday(next_tick,NULL);
	tv_add_usec(next_tick,PERIOD);
	while(1){
		printf("tick\n");

		gettimeofday(now,NULL);
		if(tv_compare(next_tick,now)0){
			struct timeval timeout;

			timeout = next_tick;
			tv_sub(timeout,now);
			select(0,NULL,NULL,NULL,timeout);
		}
		tv_add_usec(next_tick,PERIOD);
	}
}

void tv_add_usec(struct timeval *tv,unsigned int usec)
{
	tv-tv_usec += usec;
	while(tv-tv_usec=100){
		tv-tv_usec -= 100;
		tv-tv_sec ++;
	}
}

int tv_compare(struct timeval *a,struct timeval *b)
{
	if(a-tv_sec==b-tv_sec)return b-tv_usec-a-tv_usec;
	return b-tv_sec-a-tv_sec;
}

void tv_sub(struct timeval *a,struct timeval *b)
{
	a-tv_sec -= b-tv_sec;
	if(a-tv_usec  b-tv_usec){
		a-tv_usec += 100;
		a-tv_sec --;
	}
	a-tv_usec -= b-tv_usec;
}





[rtl] RTAI scheduler - Part 2

2001-04-13 Thread Alex Plouznikoff

Hi,

I'm trying to understand the RTAI scheduler (rt_schedule()). Could anyone help
?

RT_TASK *task, *new_task;
RTIME intr_time, now;
int prio, delay, preempt;

task = new_task = rt_linux_task;

// SETTING DEFAULT PRIORITY TO LINUX PRIORITY ?
prio = RT_LINUX_PRIORITY;

//ONESHOT mode
if (oneshot_timer) {

   // GETTING ACTUAL TIME + SIGMA
   rt_time_h = rdtsc() + rt_half_tick;
   while ((task = task-next)) {
 if ((task-state  DELAYED)  task-resume_time = rt_time_h) {

// IF TASK IS WAITING FOR A RESSOURCE (SEMAPHORE..) DROP IT
// FROM THE TASKS LIST.
if (task-state  (SEMAPHORE | SEND | RPC)) {
(task-queue.prev)-next = task-queue.next;
(task-queue.next)-prev = task-queue.prev;
}
// DROP ALL STATE VARIABLES TO 0 
task-state = ~(DELAYED | SEMAPHORE | RECEIVE |
 SEND| RPC   | RETURN);
 }

 // SELECT THE HIGHTEST PRIORITY TASK THAT IS READY.
 if (task-state == READY  task-priority  prio) {
new_task = task;
prio = task-priority;
 }
}

Ok, so far, everything is fine except maybe from the

// DROP ALL STATE VARIABLES TO 0 
task-state = ~(DELAYED | SEMAPHORE | RECEIVE |
 SEND| RPC   | RETURN);

Why do you want to drop this bit field. If a task is waiting for a semaphore,
we don't want to give it access to the CPU, right ?? So, why drop the
SEMAPHORE bit to 0 ? If its priority is the highest, it will access the CPU
and do nothing...

preempt = 0;
task = rt_linux_task;
intr_time = shot_fired ? rt_times.intr_time :
rt_times.intr_time + rt_times.linux_tick;

Ok, there, what does shot_fired stand for ? And what intr_time is supposed to
mean ? When does a preemption will occur ? I understand that the following
lines will check, for each task resume_time E [rt_time_h; intr_time] if the
task state is DELAYED and see if its priority is higher than the current one
we have but why do we check this time interval, what does it represent ?

while ((task = task-next)) {
if ((task-state  DELAYED)  task-priority = prio 
task-resume_time  intr_time) 
{
intr_time = task-resume_time;
preempt = 1;
}
}
if (preempt || (!shot_fired  (prio == RT_LINUX_PRIORITY))) {
shot_fired = 1;
if (preempt) {
rt_times.intr_time = intr_time;
}
delay = (int)(rt_times.intr_time - (now = rdtsc())) - tuned.latency;

   if (delay = tuned.setup_time_TIMER_CPUNIT) {
delay = imuldiv(delay, TIMER_FREQ, tuned.cpu_freq);
} 
   else {
delay = tuned.setup_time_TIMER_UNIT;
rt_times.intr_time = now + (tuned.setup_time_TIMER_CPUNIT);
}
outb(delay  0xFF, 0x40);
outb(delay  8, 0x40);
   }

} 

Finally, for the ONESHOT mode, what does the delay stands for ?

//PERIODIC
else {
while ((task = task-next)) {
   if (task-state == READY  task-priority  prio) {
new_task = task;
prio = task-priority;
   }
}
 }

Ok, this one should be easy to reply to. I understand that in periodic mode,
each task is running at the minimal frequency or is a multiple of it but when
a task is created and resumed, it will call the rt_schedule function and the
current task will be preempted if the new task priority is higher. So, what's
the difference between the periodic and one-shot mode ? Each can preempt the
current task, each calls rt_schedule for the same reason (end of task, new
task...). So ?

Thanks

Alex.


Get free email and a permanent address at http://www.netaddress.com/?N=1
-- [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/




Re: [rtl] Linux equivalents to pthread_make_periodic_np and pthread_suspend_np

2001-04-13 Thread Bernhard Kuhn

David Schleef schrieb:

 It can be duplicated using something similar to the attached
 file.

select() is not bad, but you can't guarantee a stable
period (means a delay is propagated to the following
periods).

For this reason, i prefer pthread_cond_timedwait()
(see file attached).
Suspending can be done by using pthread_cond_wait().

Bernhard

// gcc -Wall -O2 -I/usr/src/rtai/include -D__KERNEL__ -DMODULE -c rt_thread.c

#include linux/module.h
#include linux/kernel.h
#include linux/version.h
#include asm/io.h

#include rtai.h
#include rtai_sched.h
#include rtai_pthread.h

#define PORT 0x378

pthread_t thread_data;

pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t wait_cond = PTHREAD_COND_INITIALIZER;

volatile int kill=0;

int position=0;
MODULE_PARM(position,"i");


void add_ns(struct timespec *time,long ns) {
  time-tv_nsec+=ns;
  time-tv_sec  +=  time-tv_nsec/(10LL);
  time-tv_nsec  =  time-tv_nsec%(10LL);
};


void thread_code(int arg) {

  struct timespec time;
  clock_gettime(CLOCK_REALTIME,time);

  while(!kill) {

outb(0xff,PORT);
add_ns(time,100+position);
pthread_mutex_lock(wait_mutex);
pthread_cond_timedwait(wait_cond,wait_mutex,time);
pthread_mutex_unlock(wait_mutex);

outb(0x00,PORT);
add_ns(time,1900-position);
pthread_mutex_lock(wait_mutex);
pthread_cond_timedwait(wait_cond,wait_mutex,time);
pthread_mutex_unlock(wait_mutex);

  };

  kill=2;
  pthread_exit(0);

};


int init_module(void) {
  printk("rt_task: started, position=%i\n",position);
  rt_set_oneshot_mode();
  start_rt_timer(0);
  pthread_create(thread_data,0,(void*)thread_code,0);
  return 0; 
};


void cleanup_module(void) {
  kill=1;
  while(kill!=2);

  pthread_cond_destroy(wait_cond);
  pthread_mutex_destroy(wait_mutex);

  stop_rt_timer();
  printk("rt_task: stopped, position=%i\n",position);
};



Re: [rtl] Linux equivalents to pthread_make_periodic_np and pthread_suspend_np

2001-04-13 Thread yodaiken

I've come to like pthread_cond_wait, although I admit that I found it
disgusting until recently -- when I wrote some applications where it
was quite pleasant. 

On Sat, Apr 14, 2001 at 02:43:03AM +0200, Bernhard Kuhn wrote:
 David Schleef schrieb:
 
  It can be duplicated using something similar to the attached
  file.
 
 select() is not bad, but you can't guarantee a stable
 period (means a delay is propagated to the following
 periods).
 
 For this reason, i prefer pthread_cond_timedwait()
 (see file attached).
 Suspending can be done by using pthread_cond_wait().
 
 Bernhard
 // gcc -Wall -O2 -I/usr/src/rtai/include -D__KERNEL__ -DMODULE -c rt_thread.c
 
 #include linux/module.h
 #include linux/kernel.h
 #include linux/version.h
 #include asm/io.h
 
 #include rtai.h
 #include rtai_sched.h
 #include rtai_pthread.h
 
 #define PORT 0x378
 
 pthread_t thread_data;
 
 pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_cond = PTHREAD_COND_INITIALIZER;
 
 volatile int kill=0;
 
 int position=0;
 MODULE_PARM(position,"i");
 
 
 void add_ns(struct timespec *time,long ns) {
   time-tv_nsec+=ns;
   time-tv_sec  +=  time-tv_nsec/(10LL);
   time-tv_nsec  =  time-tv_nsec%(10LL);
 };
 
 
 void thread_code(int arg) {
 
   struct timespec time;
   clock_gettime(CLOCK_REALTIME,time);
 
   while(!kill) {
 
 outb(0xff,PORT);
 add_ns(time,100+position);
 pthread_mutex_lock(wait_mutex);
 pthread_cond_timedwait(wait_cond,wait_mutex,time);
 pthread_mutex_unlock(wait_mutex);
 
 outb(0x00,PORT);
 add_ns(time,1900-position);
 pthread_mutex_lock(wait_mutex);
 pthread_cond_timedwait(wait_cond,wait_mutex,time);
 pthread_mutex_unlock(wait_mutex);
 
   };
 
   kill=2;
   pthread_exit(0);
 
 };
 
 
 int init_module(void) {
   printk("rt_task: started, position=%i\n",position);
   rt_set_oneshot_mode();
   start_rt_timer(0);
   pthread_create(thread_data,0,(void*)thread_code,0);
   return 0; 
 };
 
 
 void cleanup_module(void) {
   kill=1;
   while(kill!=2);
 
   pthread_cond_destroy(wait_cond);
   pthread_mutex_destroy(wait_mutex);
 
   stop_rt_timer();
   printk("rt_task: stopped, position=%i\n",position);
 };


-- 
-
Victor Yodaiken 
Finite State Machine Labs: The RTLinux Company.
 www.fsmlabs.com  www.rtlinux.com

-- [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/