ya16@mrcu (Ian Powell) (10/22/90)
Does anyone know how to get the current RS232 parameters (modes an baud rate) form the ST, so that I can reset the RS232 as it was after use. Answers in any language or assembler would be useful. Thank you for any answers in advance. Ian Powell, CAL |INTERNET: ya16%gec-mrc.co.uk@nsfnet-relay.ac.uk GEC-Marconi Research Centre|UUCP: ...!mcvax!ukc!mrca!ya16 or ya16%uucp.mrca West Hanningfield Road |Other: ya16@uk.co.gec-mrc Great Baddow, Chelmsford |Tel: +44 245 73331 x 3231 Fax: +44 245 75244 Essex, UK CM2 8HN |Telcom Gold 74: SKK196 -- Ian Powell, CAL |INTERNET: ya16%gec-mrc.co.uk@nsfnet-relay.ac.uk GEC-Marconi Research Centre|UUCP:...!mcvax!ukc!mrca!ya16 or ya16%uucp.mrca Great Baddow, Chelmsford |Telcom Gold 74:SKK196|Other: ya16@uk.co.gec-mrc Essex, UK. CM2 8HN |Tel: +44 245 73331 x 3231 Fax: +44 245 7524
logajan@ns.network.com (John Logajan) (10/23/90)
In article <671@mrcu> ya16@mrcu (Ian Powell) writes: >Does anyone know how to get the current RS232 parameters (modes an baud >rate) form the ST, so that I can reset the RS232 as it was after use. This state information is not saved by the OS as far as any of us have been able to determine. In addtion, the serial hardware will not report what its current configuration is. It can't be done. :-) -- - John Logajan @ Network Systems; 7600 Boone Ave; Brooklyn Park, MN 55428 - logajan@ns.network.com, 612-424-4888, Fax 612-424-2853
saj@chinet.chi.il.us (Stephen Jacobs) (10/23/90)
In article <1990Oct23.035636.21144@ns.network.com> logajan@ns.network.com (John Logajan) writes: >In article <671@mrcu> ya16@mrcu (Ian Powell) writes: >>Does anyone know how to get the current RS232 parameters (modes an baud >>rate) form the ST, so that I can reset the RS232 as it was after use. > >This state information is not saved by the OS as far as any of us have >been able to determine. In addtion, the serial hardware will not report >what its current configuration is. > >It can't be done. :-) > Normally I wouldn't reply to this without the example in front of me, but when an ST wizard (my compliments, John, really) says something a program I've hacked on does is impossible, it seems worthwhile to pipe up. At the very least, the 1040 running TOS 1.0 and the Mega running TOS 1.2 can be made to report SOMETHING about the state of the serial port. I believe this behavior was even made official under TOS 1.4. The tricky part, and the reason I wouldn't have posted normally, is that I forget how. As I faintly remember, Rsconf (-1L) returns a longword which, if passed back to Rsconf() will restore the state of the serial port. I'll check to be sure if nobody beats me to it. Steve J.
hyc@math.lsa.umich.edu (Howard Chu) (10/24/90)
In article <1990Oct23.035636.21144@ns.network.com> logajan@ns.network.com (John Logajan) writes: >In article <671@mrcu> ya16@mrcu (Ian Powell) writes: >>Does anyone know how to get the current RS232 parameters (modes an baud >>rate) form the ST, so that I can reset the RS232 as it was after use. >This state information is not saved by the OS as far as any of us have >been able to determine. In addtion, the serial hardware will not report >what its current configuration is. >It can't be done. :-) As pointed out in the TOS 1.4 release notes, the Rsconf call has been documented incorrectly for a long time. I think it mentions there that since TOS 1.2, passing a value of -2 for the baud rate parameter will cause the other parameters to be ignored, and the return value will be the current baud rate. Anyway, in all versions of TOS, Rsconf returns a long, but is usually documented to be of type void. The longword returned contains the 4 USART config bytes - receive status register, transmit control register, uart control reg, and sync character. You can use these return values to pick out the word size, parity, etc. as was described in a previous article. If you can't rely on the Rsconf behavior (e.g., will run on TOS 1.0) you can determine the baud rate with a simple timer loop. At the start of the loop you pick up the value of the 200hz system clock. Loop until the clock has incremented, say, a half second. (I don't remember the actual time to wait.) Set a countdown value for timer D at the startt of the loop. Retrieve the countdown value after the loop. By counting how many ticks occurred, you get the baud rate, since timer D is the baud rate generator. This is the technique used by Zmodem as hacked by Jwahar Bammi. This method is independent of CPU speed, so it works with accelerators and such. But, it doesn't work in MiNT. (Process switching throws the loop off. This really is a critical section, but I don't know how you can set it up appropriately.) -- -- Howard Chu @ University of Michigan one million data bits stored on a chip, one million bits per chip if one of those data bits happens to flip, one million data bits stored on the chip...