Re: function read() isn't quick enough for reading in ttyS*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> In a program I'm writing in c, when I use the read() function for
> reading a byte in the serial port with a configuration: 115200 bps,
> 8N2
>
> takes from 2ms to 6ms (aleatory, even if 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.
>

I guess the context switch that is taking place when you issue ioctl
is contributing to the extra time that you are noticing.

Stalin
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux