Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!tekig!tekig4!brianr From: brianr@tekig4.UUCP Newsgroups: comp.sys.amiga Subject: Re: amiga serial question Message-ID: <1434@tekig4.TEK.COM> Date: Thu, 23-Apr-87 20:11:56 EST Article-I.D.: tekig4.1434 Posted: Thu Apr 23 20:11:56 1987 Date-Received: Sat, 25-Apr-87 08:38:22 EST References: <8704190128.AA19495@cory.Berkeley.EDU> Reply-To: brianr@tekig4.UUCP (Brian Rhodefer) Organization: Tektronix, Inc., Beaverton, OR. Lines: 60 Responding to a plaintive posting from a frustrated novice, Matt Dillon encouraged: "...I have never had problems with the EXEC serial device...". I've recently spent two days figuring out how to open the serial device in exclusive-access mode, for TRANSMIT only, and send a single character to another piece of equipment. Matt's offhandedness struck me like Arnold Schwartzenegger remarking that no, he wasn't bothered by inconsiderate or discourteous behavior while traveling on subways. In case it is any benefit to fellow mortals, I'd like to explain how I managed to foul up such a simple operation: I allocated an IOExtSer structure, filled its appropriate slots with my desired baud rate settings, flags, parity modes, and so forth, and then passed it to OpenDevice. I then merrily set the io_Command field to CMD_WRITE, pointed io_Data at my transmit buffer, and tried to do SendIOs. It turned out that, regardless of how I initialized some of the serial device parameter fields (such as baud rate) in the IOrequest that gets passed to OpenDevice, they got RESET to default settings during the device open operation. If you don't want the default baud rate (9600 baud), you need to use the SDCMD_SETPARAMS IO command to set the baud rate as you want it, AFTER opening the serial device. I looked through the Kernel manuals pretty thoroughly, and I couldn't find any mention of this fact. In Basic, (I used a quick Basic program to assure myself that my hardware wasn't broken) the same statement that opens the serial device simultaneously sets baud rate, parity mode, and word size; it's not unreasonable to assume that, unless stated otherwise, the OpenDevice routine should work similarly. Unless I'm much mistaken, SOME of the parameters of the IOExtSer structure DO affect what OpenDevice does: the receive buffer-length control, for instance. I probably ought to try looking at what OpenDevice does to a completely filled-out IOExtSer form to learn which fields get overwritten with defaults. A question for the craftmasters: Is it possible to do "quick" I/O for serial transmissions (CMD_WRITE with IOF_QUICK set)? I tried it on a 4-byte message, and the IOF_QUICK flag came back cleared, which I gather is Exec's way of saying "I'll get back to you later". Doesn't the serial device driver maintain a transmit buffer, into which BeginIO could instantly copy my piddly 4-character message? Providing amusement for the competent, =================================================================== | Brian Rhodefer | uucp {ucbvax,decvax,ihnp4} | | Tektronix, Inc. | !tektronix!tekig4!brianr | | Lab Instruments Division | CSnet tekig4!brianr@tek | | MS 39-152, PO Box 500 | ARPAnet tekig4!brianr.tek@csnet-relay| | Beaverton OR 97077 | Verbal Net (503) 627-3898 | ===================================================================