Messages in this thread | | | From | Chris.Arguin@unh ... | Date | Mon, 3 Aug 1998 18:15:26 -0400 (EDT) | Subject | RS-485 |
| |
I've been working on a project that uses RS-485. Unfortunately, not all goes well. The only card I've got is an old Metrabyte card, which requires some extra work and has no documentation (of course. I'm beginning to suspect that older documentation retires to Miami). I'd like to ask a few questions about some stuff in drivers/char/serial.c (I'm working under the 2.0.x series... )
First off, there is this comment:
/* * * Purpose: Let user call ioctl() to get info when the UART physically * is emptied. On bus types like RS485, the transmitter must * release the bus after transmitting. This must be done when * the transmit shift register is empty, not be done when the * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. */
Since this comment is RS485 specific, it seemed a good starting place. But how exactly does one go about using this tidbit of information? I'm a supposed to go looping around waiting for all the data to be transmitted, and then somehow release the bus? I didn't see any ioctl calls that seemed suited to the task anyway. What exactly is intended here?
More importantly, to me at least, wouldn't it be better to have the 485 support in the kernel. The devices I work with work under both RS-232 and RS-485, and I would like to be able to use relatively simple scripts (with calls to echo(1), for example) to access them, no matter which bus I use. Having to write a user-land driver would seem to make that impossible, or at least a lot more difficult.
What is more important (to me) is how exactly the Metrabyte card works. After messing around for a bit, I was able to run the only program that could access the card under DOSEMU. It didn't work (DOSEMU doesn't allow direct access to the serial ports, but uses /dev/ttyS? devices), but the debugging information let me know exactly what the program was trying to do. Before each transmit, it would write 0x02 to the IO Scratch register, and after it would write 0x01. This would be, I imagine, how I can get and relinquish the bus. There are no ioctl's to access this, however.
So, what I am asking is... Do people thing it is worth making RS-485 available in the kernel? Should I just add the ioctl to access that register, as a get/relinquish line command (simple commands like echo still wouldn't work with this), or should I try to do it right, and make the Metrabyte card look as much like regular 232 as possible, by making the kernel try to decide when to give up the line.
For my own purposes, I would do the latter. However, I would like to make this a kernel-patch available to all (although probably not part of the standard kernel... I doubt there is much demand :), and so I want to do it right.
Thank you for your time.
-- Chris Arguin | "While I'm still confused and uncertain, it's on a Chris.Arguin@unh.edu | much higher plane... at least I know I'm bewildered | about the really fundamental and important facts of | the universe." - Equal Rites, Terry Pratchett
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |