Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 7 - Serial Driver / Serial Driver Reference


Low-Level Routines

This section describes the low-level Serial Driver routines that you can call using the Device Manager control and status functions. These calls should be made to the output device driver--they affect the input driver as well.

Serial Driver Version [status code 9]

csCode = 9 csParam = word

This status routine returns the version number of the Serial Driver in the csParam field. The version number is an integer value.

Set Baud Rate [control code 13]

csCode = 13 csParam = word

This control routine provides an additional method (besides the SerReset function) of setting the baud rate. You specify the baud rate value as an integer in the csParam field (for example, 9600). The Serial Driver attempts to set the serial port to the specified baud rate, or the closest baud rate supported by the hardware. The actual baud rate selected is returned in the csParam field.

Set Handshaking Options [control code 14]

csCode = 14 csParam = SerShk record

This control routine is identical to the SerHShake function (control code 10) with the additional specification of the fDTR flag in the eighth byte of the SerShk record. You enable DTR input flow control by setting this flag to a non-zero value. See the description of the SerHShake function on page 7-21 for information about the other fields of the SerShk record.

Set Miscellaneous Options [control code 16]

csCode = 16 csParam = byte

This control routine sets miscellaneous control options. Bits 0-5 are reserved and should be set to 0 for compatibility with future options. Bit 6 enables external clocking through the CTS handshake line (the HSKi signal on pin 2 of the serial port). Set bit 6 to 1 to allow an external device to drive the serial data clock. Set bit 6 to 0 to restore internal clocking. Bit 7 controls the state of the DTR signal when the driver is closed. When bit 7 is 0 (the default) the DTR signal is automatically negated when the driver closes. Set bit 7 to 1 if you want the DTR signal to be left unchanged when the driver is closed. This can be used to prevent a modem from hanging up or a printer from going offline when the driver closes.

Assert DTR [control code 17]

csCode = 17

This control routine asserts the DTR signal.

Negate DTR [control code 18]

csCode = 18

This control routine negates the DTR signal.

Simple Parity Error Replacement [control code 19]

csCode = 19 csParam = char

This control routine enables simple parity error replacement, in which incoming characters with parity errors are replaced by the ASCII character specified in csParam (for example, $FF). If a valid incoming character matches the replacement character, the most significant bit of the character is cleared. Therefore, if it is possible for your replacement character to appear in the data stream, you should use control code 20 instead. Set csParam to 0 to disable parity error replacement.

Extended Parity Error Replacement [control code 20]

csCode = 20 csParam[0] = char csParam[1] = char

This control routine enables extended parity error replacement. Incoming characters with parity errors are replaced by the ASCII character specified in csParam[0]. The difference between this routine and the simple version (control code 19) is that if a valid incoming character matches the parity replacement character, it is replaced by the alternate character specified in csParam[1]. Set csParam[0] to 0 to disable parity error replacement.

Note
The ASCII NUL character ($00) can be used as the alternate character but not as the parity replacement.

Set XOFF State [control code 21]

csCode = 21

This control routine unconditionally sets the xOffHold flag, which is equivalent to receiving an XOFF character. If software handshaking is enabled, data transmission is halted until an XON character is received, or until you clear the XOFF state using control code 22.

Clear XOFF State [control code 22]

csCode = 22

This control routine unconditionally clears the xOffHold flag, which is equivalent to receiving an XON character. If software handshaking is enabled, data transmission is resumed.

Send XON Conditional [control code 23]

csCode = 23

This control routine sends an XON character for input flow control if the last input flow control character sent was XOFF.

Send XON Unconditional [control code 24]

csCode = 24

This control routine unconditionally sends an XON character for input flow control, regardless of the current state of input flow control.

Send XOFF Conditional [control code 25]

csCode = 25

This control routine sends an XOFF character for input flow control if the last input flow control character sent was XON.

Send XOFF Unconditional [control code 26]

csCode = 26

This control routine unconditionally sends an XOFF character for input flow control, regardless of the current state of input flow control.

Serial Hardware Reset [control code 27]

csCode = 27

This control routine resets the serial port hardware for a channel. Because this routine may leave the serial port in an unknown state, you must call the SerReset function before you use the port.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996