When the serial device is opened, default values for baud rate and other parameters are automatically filled in from the serial settings in Preferences. The parameters may be changed by using the sdcmd_setparams command. the flags are defined in the include file devices/serial.h. SERIAL DEVICE PARAMETERS (ioextser) IOExtSer Field Name Serial Device Parameter It Controls --------- ----------------------------------- io_CtlChar Control characters to use for xON, xOFF, INQ, ACK respectively. Positioned within an unsigned longword in the sequence from low address to high as listed. INQ and ACK handshaking is not currently supported. io_RBufLen Recommended size of the buffer that the serial device should allocate for incoming data. For some hardware the buffer size will not be adjustable. Changing the value may cause the device to allocate a new buffer, which might fail due to lack of memory. In this case the old buffer will continue to be used. For the built-in unit, the minimum size is 64 bytes. Out-of-range numbers will be truncated by the device. When you do an sdcmd_setparams command, the driver senses the difference between its current value and the value of buffer size you request. All characters that may already be in the old buffer will be discarded. Thus it is wise to make sure that you do not attempt buffer size changes (or any change to the serial device, for that matter) while any I/O is actually taking place. io_ExtFlags An unsigned long that contains the flags SEXTF_MSPON and SEXTF_MARK. SEXTF_MSPON enables either mark or space parity. SEXTF_MARK selects mark parity (instead of space parity). Unused bits are reserved. io_Baud The real baud rate you request. This is an unsigned long value in the range of 1 to 4,294,967,295. The device will reject your baud request if the hardware is unable to support it. For the built-in driver, any baud rate in the range of 110 to about 1 megabaud is acceptable. The built-in driver may round 110 baud requests to 112 baud. Although baud rates above 19,200 are supported by the hardware, software overhead will limit your ability to "catch" every single character that should be received. Output data rate, however, is not software-dependent. io_BrkTime If you issue a break command, this variable specifies how long, in microseconds, the break condition lasts. This value controls the break time for all future break commands until modified by another sdcmd_setparams. io_TermArray A byte-array of eight termination characters, must be in descending order. If the EOFMODE bit is set in the serial flags, this array specifies eight possible choices of character to use as an end of file mark. See the section above "ending a read or write using termination characters" and the sdcmd_setparams summary page in the autodocs. io_ReadLen How many bits per read character; typically a value of 7 or 8. Generally must be the same as io_WriteLen. io_WriteLen How many bits per write character; typically a value of 7 or 8. Generally must be the same as io_ReadLen. io_StopBits How many stop bits are to be expected when reading a character and to be produced when writing a character; typically 1 or 2. The built-in driver does not allow values above 1 if io_WriteLen is larger than 7. io_SerFlags See the "serial flags" section below. io_Status Contains status information filled in by the sdcmd_query command. Break status is cleared by the execution of SDCMD_QUERY. You set the serial parameters by passing an ioextser to the device with sdcmd_setparams set in io_command and with the flags and parameters set to the values you want. SerialIO->io_SerFlags &= ~SERF_PARTY_ON; /* set parity off */ SerialIO->io_SerFlags |= SERF_XDISABLED; /* set xON/xOFF disabled */ SerialIO->io_Baud = 9600; /* set 9600 baud */ SerialIO->IOSer.io_Command = SDCMD_SETPARAMS;/* Set params command */ if (DoIO((struct IORequest *)SerialIO)) printf("Error setting parameters!\n"); The above fragment modifies two bits in io_SerFlags and changes the baud rate. If the parameters you request are unacceptable or out of range, the sdcmd_setparams command will fail. you are responsible for checking the error code and informing the user. Proper Time for Parameter Changes. ---------------------------------- A parameter change should not be performed while an I/O request is actually being processed because it might invalidate the request handling already in progress. To avoid this, you should use sdcmd_setparams only when you have no serial i/o requests pending. serial flags (bit definitions for io_serflags)