Comtrol API (6508) for the MS-DOS User Manual
Page 13

Developing Applications
13
Developing Applications
2.8.1. Understanding Device Numbers
Each serial device is identified by a device number. Most
API
functions take
the device number as a parameter. The number of ports that exist on each
controller determines which device numbers map to which serial ports on
which controllers.
The device numbers always count sequentially from 0, with the first port on the
first controller in the configuration file assigned device number 0. Each
subsequent controller in the configuration file begins counting where the
previous controller left off. If there are more than one RocketPort controllers in
the system, the controller in the lowest numbered slot is the first controller.
For example, if there are three controllers located in slots 2, 4, and 5, having 8,
16, and 8 ports respectively, the device numbers would map out as shown in
Table 2-3.
You can determine how many controllers are installed in your system, the first
device number on each controller, and the number of devices on each controller
with the aaGetCtlStatus() function.
2.8.2. Configuration Parameters for Serial Devices
Before the application can use a serial device, it must be opened with
aaOpen(). To change the communication parameters while the device is open,
use aaReconfigure(). Once the line is no longer in use it should be closed with
aaClose().
There are a number of communication parameters used with one or more of the
aaOpen(), aaReconfigure(), and aaClose() functions. Each of these parameters is
described in the following subsections.
2.8.2.1. Open Type Parameter
The open type parameter is used in aaOpen() to identify whether the line is
being opened for transmit, receive, or both. The flags used for open type are
given in Table 2-4. This parameter is declared as follows:
unsigned int OpenType;
2.8.2.2. Baud Parameter
The baud parameter is used with aaOpen() and aaReconfigure() to set the baud
rate that the channel will operate at. You can assign only one of the flags
shown in Table 2-5 to the baud parameter. The baud parameter is declared as
follows:
unsigned char Baud;
Table 2-3. Mapping Device Numbers
Device Number
Controller
Number
Slot
Port Number on
the Controller
0 through 7
1
2
0 through 7
8 through 23
2
4
0 through 15
24 through 31
3
5
0 through 7
Table 2-4. Open Type Flags
Flag
Meaning When the Flag is Set
COM_TX
Open for transmit
COM_RX
Open for receive
Table 2-5. Baud Flags
Flag
Meaning When the
Flag is Set
COM_BAUD_50
50 baud
COM_BAUD_75
75 baud
COM_BAUD_110
110 baud
COM_BAUD_134
134 baud
COM_BAUD_150
150 baud
COM_BAUD_200
200 baud
COM_BAUD_300
300 baud
COM_BAUD_600
600 baud
COM_BAUD_1200
1,200 baud
COM_BAUD_1800
1,800 baud
COM_BAUD_2400
2,400 baud
COM_BAUD_3600
3,600 baud
COM_BAUD_4800
4,800 baud