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: Networking With Open Transport / Part 2 - Open Transport Reference
Chapter 31 - Serial Endpoint Reference


Constants

This section describes the constants used by serial endpoints. You can use the constant names kSerialName, kSerialPortAName, kSerialPortBName, and kSerialABName when calling the OTCreateConfiguration function to configure a serial endpoint.

#define kSerialName 'serial'
#define kSerialPortAName 'serialA'
#define kSerialPortBName 'serialB'
#define kSerialPortABName 'serialAB'

You use the values in the next enumeration to define the type of framing your serial port is using. These values are used in the fCapabilities field in the OTPortRecord structure, described in the chapter "Ports Reference" in this book.

enum{
   kOTSerialFramingAsync        = 0x01, /* Supports asynchronous serial framing */
   kOTSerialFramingHDLC         = 0x02, /* Supports serial HDLC framing */
   kOTSerialFramingSDLC         = 0x04, /* Supports serial SDLC framing */
   kOTSerialFramingAsyncPackets = 0x08, /* Supports async packet serial mode */};
}
The OTIoctl commands use the constants listed below.

Use these constants with I_SetSerialDTR:

kOTSerialSetDTROn       = 1         /* Turn the DTR signal on */
kOTSerialSetDTROff      = 0         /* Turn the DTR signal off */
Use these constants with I_SetSerialBreak:
kOTSerialSetBreakOn  = 0xfffffff/* Turn the break signal on */
kOTSerialSetBreakOff = 0        /* Turn the break signal off */
Use these constants with I_SetSerial/XOFFState:


kOTSerialForceXOffTrue  = 1  /* Unconditional set XOFF state */
kOTSerialForceXOffFalse = 0  /* Unconditional clear XOFF state */

Use these constants with I_SetSerial/XONState:


kOTSerialSendXOnAlways     = 1  /* Always send XON character */
kOTSerialSendXOnIfXOffTrue = 0  /* Send XON char if XOFF state */

Use these constants with I_SetSerial/XOFFState:

kOTSerialSendXOffAlways    = 1    /* Always send XOFF character */
kOTSerialSendXOffIfXOnTrue = 0    /* Send XOFF char if XON state */
This define statement, which is identical to the C++ inline function Open Transport provides for this task, creates the 4-byte option value you use for the SERIAL_OPT_HANDSHAKE option:

#define SerialHandshakeData(type, onChar, offChar)\
   ((((UInt32)type) << 16) | (((UInt32)onChar) << 8) | offChar)
These define statements, which are similar to the C++ inline functions Open Transport provides for these tasks, set the correct placement for the characters you use with the SERIAL_OPT_ERRORCHARACTER option:

#define OTSerialSetErrorCharacter(rep) \
   ((rep) & 0xff)

#define OTSerialSetErrorCharacterWithAlternate(rep, alternate) \
   ((((rep) & 0xff) | (((alternate) & 0xff) << 8)) | 0x80000000L)
This enumeration lists the default values for serial endpoint providers:

enum{
   kOTSerialDefaultBaudRate   = 19200,             /* 19200 baud rate */
   kOTSerialDefaultDataBits   = 8,                 /* 8 data bits */
   kOTSerialDefaultStopBits   = 10,                /* 1 stop bit */
   kOTSerialDefaultParity     = kOTSerialNoParity, /* no parity */
   kOTSerialDefaultHandshake  = 0,                 /* no handshaking */
   kOTSerialDefaultOnChar     = ('Q' & ~0x40),     /* XON = Control-Q */
   kOTSerialDefaultOffChar    = ('S' & ~0x40),     /* XOFF = Control-S */
   kOTSerialDefaultSndBufSize = 1024,              /* send buffer = 1024characters */
   kOTSerialDefaultRcvBufSize = 1024,              /* recv buffer = 1024characters */
   kOTSerialDefaultSndLoWat   = 96,                /* send low-water mark */
   kOTSerialDefaultRcvLoWat   = 1,                 /* recv low-water mark */ 
   kOTSerialDefaultRcvTimeout = 10                 /* recv timeout, in seconds*/ 
}; 

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998