All of lore.kernel.org
 help / color / mirror / Atom feed
From: Federico Tula Rovaletti <fedetula@gmail.com>
To: linux-serial@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk
Subject: function read() isn't quick enough for reading in ttyS*
Date: Thu, 31 Jul 2008 03:17:21 -0300	[thread overview]
Message-ID: <489158F1.2030402@gmail.com> (raw)

Hi all! I'm a novice in Linux

In a program I'm writing in c and, when I use the read() function for 
reading a byte in the port serial with a configuration: 115200 bps, 8N2

takes from 2ms to 6ms (aleatory, even if a read up to 10 bytes takes the 
same time), which is  too long.
(ioctl(fd, FIONREAD, &bytes) last the same)

This is the time is suppose to last:
8 bits: data
2 bits: stop
1 bit: start
time = ((8+2+1)bits/115200bps) = 0.095ms,

then when I read the byte with the function inb_p() takes ~ 0.1ms which 
is perfect, what I'm needing for my project.

The problem I'm having is that I use signals (with fcntl(fd, F_SETFL, 
O_ASYNC) ) but this signals last the same time in occur that the read() 
(unacceptable) so I guess that this is a problem of the driver that is 
to slow.

So the question is, is there any way to improve the performance of the 
driver or using read? (doing inb_p is very nasty). Do I'm doing 
something wrong?

Thanks in advance!, I expect as soon as possible any answer

PD: sorry for my English,

             reply	other threads:[~2008-07-31  6:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-31  6:17 Federico Tula Rovaletti [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-08-01 23:13 function read() isn't quick enough for reading in ttyS* Federico Tula Rovaletti
2008-08-04  5:44 ` Stalin Kenny
2008-08-04 17:35 ` Glynn Clements

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=489158F1.2030402@gmail.com \
    --to=fedetula@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.