Jump to content

ASYNC_EXTSETBAUDRATE

From EDM2
(Redirected from ASYNC EXTSETBAUDRATE (43h))

This function sets the bit rate in doublewords to cover bit rates higher than 19200 bps.

Category
IOCTL_ASYNC (01h)
Function
ASYNC_EXTSETBAUDRATE (43h)

Parameter Packet Format

Field Length C Datatype
Bit Rate DWORD ULONG
Fraction BYTE UCHAR
Bit Rate
The Bit Rate field is a binary integer representing the actual bit rate (bits-per-second) that the physical device driver uses to set the bit rate of the COM device. For a COM port that is supported by Enhanced UART or compatible serial communication devices, the range is 10 bps - 345600 bps. The user can get the minimum and maximum bit rates supported by the physical device driver on a COM port by using "Function 63h - Extended Query Bit Rate".
Note
Due to system overhead and the physical limits on the hardware cables, actual bit rates might be restricted.
When this function is used for a COM port that has no support of the Enhanced UART or compatibles, then the bit range supported by the device driver is from 2 bps - 19200 bps. A call with a bit rate out of range fails with the ERROR_INVALID_PARAMETER return code.
Fraction
This field is a binary integer value that represents the fraction of the bit rate to set. It is used for setting a very precise bit rate. In most cases, this field is set to 0.
If the Fraction field needs to be set, the user must understand how bit rates are handled in the system. Bit rate is calculated using the following formula:
  DIVISOR COUNT - BAUD CLOCK / SCALER / BINARY BIT RATE
For the Enhanced UART, the BAUD CLOCK is 22.1184 MHz and the SCALER is 32. The DIVISOR COUNT is a 16-bit value that is loaded into the ASYNC device's divisor latch to generate the final bit rate clock. Any fractional amount is rounded to the nearest divisor count to get the closest bit rate. This integer is put into the following formula to get the actual output bit rate value:
  OUTPUT BIT RATE = BAUD CLOCK / SCALER / DIVISOR COUNT
For the value of the Fraction field, the resultant fraction obtained from the above formula is multiplied by 256. When setting a bit rate the physical device driver passes the bit rate and fraction directly to ABIOS.
For bit rates up to 19200 bps, the physical device driver sets the rate only if the hardware can support the rate within .01% margin of error to maintain compatibility. The exceptions are for 110 and 2000 bps, which can have an error of up to .026% and .69%, respectively. In all other cases, if the requested rate cannot be achieved by the hardware within .01% tolerance, the IOCtl fails with an ERROR_INVALID_PARAMETER return code.
For bit rates beyond 19200 bps, the physical device driver does not check the .01% margin of error. It is the user's responsibility to maintain the bit rate tolerance. After calling Function 43h, the user should call Function 63h to check the actual bit rate set on a COM port.

The recommended bit rate values are:

  • 110
  • 150
  • 300
  • 600
  • 1200
  • 1800
  • 2000
  • 2400
  • 3600
  • 4800
  • 7200
  • 9600
  • 19200
  • 38400
  • 57600
  • 76800 *
  • 115200 *
  • 230400 *
  • 345600 *
* Note: Use IOCtl Function 74h.

Data Packet Format

None. Packet pointer must be NULL.

Returns

If the call is made with invalid Parameter Packet values or an invalid Data Packet pointer, a general failure error is reported.

Remarks

If a general failure error is not returned, the physical device driver performs the action described in the Bit Rate field. An OPEN request packet does not cause the physical device driver to change the bit rate from its previous value. The initial value is 1200 bps.

The physical ASYNC device driver is designed to handle high bit rates under optimum conditions. To achieve successful data transfer operations at high bit rates and to obtain high data throughput, the following conditions must be met:

  • The connecting cables must be free from electrical noise and must maintain the voltage conforming to the RS232-C standard. IBM Personal Computer* Communication adapter cables (P/N 6323741 or 1502067) can guarantee this for up to 20 feet.
  • DMA capability must be available.
  • There is little system overhead. Operations at high bit rates require many CPU cycles. It is important that no other tasks be active and that the ASYNC Communication application be written to reduce the CPU overhead as much as possible.

ASYNC Communication applications should have optimal data block sizes for DosRead or DosWrite requests to the physical ASYNC device driver. In general, as block size increases, the overhead related to making those requests decreases. However, these applications might need more time to handle large data chunks for CRC checking or saving the data into a file as this takes CPU cycles away from the physical ASYNC device driver.

  • Appropriate communication protocols might be required for the prevention of the physical ASYNC device driver receive buffer overflow.
  • Applications should not use the Error or Break Replacement operations. If these options are taken, the physical ASYNC device driver runs in Data/Status mode and cannot take advantage of 80386 machine instructions, such as REP MOVED. The physical device driver then has to check each status byte, which slows down the performance.

This function is extended from ASYNC_SETBAUDRATE.