linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Precise timing in ldisc? tty_put_char() in hrtimer context?
@ 2025-01-07 18:07 Tomáš Mudruňka
  2025-01-07 18:20 ` Greg KH
  2025-01-08 12:56 ` Theodore Ts'o
  0 siblings, 2 replies; 4+ messages in thread
From: Tomáš Mudruňka @ 2025-01-07 18:07 UTC (permalink / raw)
  To: linux-serial

Hello,
i am implementing niche rs485-based serial protocol as a tty line
discipline linux module. Requirement is to hit transmission window
with precision in low hundreds of microseconds (eg. +-200 uS).
Transmit window starts 500 uS after message is received.

It seems that hardware driver calls tty_receive_buf2() with sufficient
latency, so my idea was to start hrtimer using hrtimer_start() inside
of tty_receive_buf2(). And then in hrtimer handler call
for(...){tty_put_char(tty,...)} or tty->ops->write(), but it seems not
to be a good practice according to my online research. They say it's
recommended to call tty_put_char() from workqueue, but documentation
also says that calling a workqueue might introduce latency of couple
milliseconds, since it's scheduled thread context.

What would you suggest to handle such a strict timing requirements
between RX and TX data?

Thank you

Best regards
      Tomas Mudrunka

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-08 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 18:07 Precise timing in ldisc? tty_put_char() in hrtimer context? Tomáš Mudruňka
2025-01-07 18:20 ` Greg KH
2025-01-07 18:44   ` Tomáš Mudruňka
2025-01-08 12:56 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).