From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-serial@vger.kernel.org
Subject: Re: interrupt programming
Date: Mon, 26 Jul 2004 10:08:08 +0200 [thread overview]
Message-ID: <20040726080808.GW18676@lug-owl.de> (raw)
In-Reply-To: <BAY15-F21ZXn97cvZvK00022be7@hotmail.com>
[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]
On Mon, 2004-07-26 09:24:42 +0200, Sayang Oin <sayangoin@hotmail.com>
wrote in message <BAY15-F21ZXn97cvZvK00022be7@hotmail.com>:
>
> I have to use timer because I have to communicate with other programm via
> filestream
> and I use this timer also for scheduling the time that I have to send data
> to my device.
That's quite DOSsish thinking. You've got several variants you can
choose from:
1. Use non-blocking I/O with select() and toggle between your
two (or several) tasks.
2. Separate all workplaces into one thread each.
2b. Mix both variants.
> people said if I use interrupt so I can be sure I will not lose my datas.
You can't be *sure* to not loose data. Even with using interrupts, there
are possible conditions in which you'd loose some bytes of data due to
overflows. Think eg. about long-running IDE interrupts. While they're
running, no other IRQs will be serviced (unless you've got several
CPUs--it may be different in that case). That is, if eg. a 16byte FIFO
of a serial UART fills up, it'll overrun. At 115200 Baud, you need
little less than 1.5ms -- IDE interrupts can go up over 500ms easily, at
least with no DMA:)
> here is my routine
> ....
>
> while(1)
> {
> res=select(fd+1, &rfds, NULL, NULL, &tv);
Hopefully you re-initialize tv before each call to select:)
> return rd;
> }
But that's all not your problem. Your UART (or it's driver) thinks it's
not allowed to send out data. There's the problem.
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-07-26 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-26 7:24 interrupt programming Sayang Oin
2004-07-26 8:08 ` Jan-Benedict Glaw [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-07-22 10:02 Sayang Oin
2004-07-22 12:20 ` Jan-Benedict Glaw
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040726080808.GW18676@lug-owl.de \
--to=jbglaw@lug-owl.de \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox