From: Theodore Ts'o <tytso@mit.edu>
To: Matt Schulte <matts@commtech-fastcom.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-serial@vger.kernel.org
Subject: Re: New serial card development
Date: Fri, 19 Oct 2012 17:21:58 -0400 [thread overview]
Message-ID: <20121019212158.GB4721@thunk.org> (raw)
In-Reply-To: <CAJp1Oe4n-TtxDM8D82bFQxjBtx8rSAX8mWrFk0bSM6uGL9X=Eg@mail.gmail.com>
On Wed, Oct 17, 2012 at 03:24:06PM -0500, Matt Schulte wrote:
>
> What I would need to have happen is for a flag to be set that says
> "enable 9-bit mode transmit" or something. When set, the first byte
> of data of a given write will go out with mark parity, then the rest
> of the bytes will have space parity. The one byte with mark is the
> address byte.
Why not just have a userspace library routine which simply uses
tcgetattr/tcsetattr to toggle a bit (probably a new bit in c_cflag) in
struct termios, issue the single byte write, and then toggle the bit
back?
If you really want to implement a special case "the first byte should
treated differently from the rest", that gets problemtic for a number
of reasons. First of all, it's just a lot more kernel code; you'd
probably need to implement a new line displine, and secondly, if
userspace sends too much data so that it can't fit in the kernel
buffer, you might get a partial write. In which case, when you send a
second write call to send the rest of the data, you'd have to go
through extra work to make sure the first byte of that second,
follow-up byte doesn't have the high 9th bit set.
Of course, you could hack in even more changes to make the write
system call behave entirely differently in your magic "9th bit mode",
where the write system call becomes a "all or nothing" sort of thing,
but that's even more evil hackery that almost certainly would be
rejected with extreme prejudice by the kernel maintainers.
In Linux, system calls are fast, so using some extra ioctl's to toggle
the termios structure is probably the way to go. It's also much more
general since it doesn't presume a very specific protocol (i.e., your
magic multi-drop protocol).
> In the receive direction I would need to optionally enable a station
> address which the chip will use to verify all incoming data and will
> reject anything that is not of the appropriate address.
For the receive direction, my suggestion is to encode it as an
extension for how PARMRK does things, and then leave the parsing of
the address bits to userspace. Otherwise you'll end up needing to
make the kernel know what are "appropriate" addresses, which again is
a lot of very protocol specific knowledge that you would have to push
into the kernel.
Alan's advice to get your card working as a basic serial card is very
good one. Get basic functionality working, and then you can add the
support for the extra bits later....
- Ted
next prev parent reply other threads:[~2012-10-19 21:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 18:43 New serial card development Matt Schulte
2012-10-14 9:37 ` Theodore Ts'o
2012-10-15 19:08 ` Matt Schulte
2012-10-15 23:26 ` Alan Cox
2012-10-16 2:32 ` Theodore Ts'o
2012-10-17 20:24 ` Matt Schulte
2012-10-19 21:21 ` Theodore Ts'o [this message]
2012-10-23 16:27 ` Matt Schulte
2012-10-23 16:31 ` Matt Schulte
2012-10-23 18:38 ` Greg KH
2012-10-29 20:04 ` Matt Schulte
2012-10-31 21:55 ` Matt Schulte
2012-11-01 22:03 ` Matt Schulte
2012-11-01 22:26 ` Alan Cox
2012-11-02 18:47 ` Matt Schulte
2012-11-02 20:21 ` Alan Cox
2012-10-23 18:06 ` Grant Edwards
2012-10-23 18:26 ` Alan Cox
2012-10-23 18:45 ` Grant Edwards
2012-10-23 19:16 ` Greg KH
2012-10-23 19:42 ` Grant Edwards
2012-10-23 20:10 ` Greg KH
2012-10-23 19:24 ` Alan Cox
2012-10-23 19:48 ` Grant Edwards
2012-10-23 20:31 ` Theodore Ts'o
2012-10-23 20:41 ` Grant Edwards
[not found] ` <CAJp1Oe6k7NWqdbYkJnd787JiT55-wSbG+tX1tP7Cy-oPShdVaA@mail.gmail.com>
2012-10-17 20:23 ` Matt Schulte
2012-10-17 21:53 ` Alan Cox
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=20121019212158.GB4721@thunk.org \
--to=tytso@mit.edu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-serial@vger.kernel.org \
--cc=matts@commtech-fastcom.com \
/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.