hello all,
I have,
i. a thread, named IOthread, that does EPP-mode i/o (both reads and writes)
on the parallel port of a PC when woken up, and thereafter suspends
itself once more, the threads code looks like:
while (1) {
pthread_suspend_np (pthread_self ());
...
reads and writes to the epp address and data registers,
using outb_p and inb_p.
send data read to linux, get data written from linux,
both through a rt-fifo
...
}
ii. an interrupt service routine bound to a hardware interrupt,
the ACK line in the par.port interface (IRQ 7):
unsigned int pp_AckIsr (unsigned int irq, struct pt_regs *regs) {
rtl_hard_enable_irq (IRQ7);
pthread_wakeup_np (IOthread);
return 0;
}
iii. a thread that either suspends or runs periodically with
a period of P microseconds. this thread initially sleeps
but can be made periodic and woken up. it then runs until the flag
'isr_configured` clears. the threadcode is:
void *run (void *arg) {
again:
pthread_suspend_np (pthread_self ());
while (isr_configured&1) {
pthread_wait_np();
pthread_wakeup_np (IOthread);
}
goto again;
return 0;
}
now the interresting stuff,
IOthread will handle its i/o as programmed to do, ONLY IF i wake it from
the periodic thread, the period can be down to 500 microsec., linux
stays alive, no buffers flow over or run out of data, data send to
linux through a fifo are written to disk, the system can
sustain this for at least 15 min..
the application required period is 'only' 640 usec,
a 10 minute run would supply us with ample data to analyse.
a PC with the aid of RT-Linux can do the job,
HOWEVER
IF IOthread is woken up by the interrupt service routine, linux somehow
gets damaged, maybe not at the first interrupt, but allmost certainly
within the first 10.
i want to stress that it is not the rate at which the io processing is
done that causes trouble, the interrupts can be evoked by hand, still
at some moment the damage (a tell-tale sign is that the real-time clock
stops, seen with eg. 'xclock -u 1') is done.
the processing in RTL is not hampered, but disk-io does 'halt'.
NOW, whatever IOthread does, that is why i did not tell you (i can send
you the full programcode if you want to), the system CAN HANDLE it!!.
the question then is:
is it REALLY save to call pthread_wakeup_np from an interrupt service
routine, does linux guarantee some minimum stack-space left in any
and all contexts that can, and at some time will, be interrupted??
now, anticipating the answer is no, the next question,
is there an alternative, SAVE, method to control a thread from an isr.
(PS. i reported on the problem before (same subject), the problem then
was stated too vague, as i hardly knew what and foremost where,
the problem was.
yet richard basham and tomasz motylewski did reply, i want to thank
them for their suggestions)
greetings, jaap schuurmans.
-- [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/