Category : Tutorials + Patches
Archive   : NAT_UART.ZIP
Filename : COMTEST2.DOC

 
Output of file : COMTEST2.DOC contained in archive : NAT_UART.ZIP


COMTEST2 - UART Diagnostic Program for the IBM PS/2, PC, AT, and Compatibles

National Semiconductor Corporation
Microcontroller Applications Group

Written By: Louis Shay 1/26/89


Introduction

Comtest.exe is a program that is used to test the serial port functions
of an IBM PC, AT, PS/2, or compatible machine. The program supports all
types of UART devices that are currently produced by National, and will
perform a complete internal diagnostic test of the device and report any
errors. This program will test devices located at system port addresses
COM1 (3f8-3ff) through COM8 (). The user must select which of these
port locations will be tested. The program will identify the type of device,
and test device functions depending on device type. The functions tested
include register read/write functionality, loopback mode diagnostic test
of basic device functions, and a FIFO functions test, which only applies
to the NS16550A type device.

To run this program on a PC, XT, AT or PS/2 type machine, go to the disk
or directory that contains the COMTEST2.EXE file and enter "comtest2".

To get a listing of error messages, type +, and the
error messages will be output to the printer. The program will prompt the
user for input when needed.


Modification of COMTEST2

Comtest2 calls modules in the following files:
comtest2.c
rwt450.c
rwt8250.c
i450.c
ififo.c
port_id.c

Comtest2 also needs the following 'include' files:
serio.h
stdhdr.h
NS16550A.h


Any modification to any of the files will require execution of the make
file included in this directory: comtest2.mak



Functional Description

The comtest.exe program will execute in the following manner:

1. UART Identification.
This routine performs several read/write operations on the selected
device. The data read back is unique to the UART, thus the part can
be identified. Lastly, functions which are unique to each type of UART
are tested that tell the program what type of device is at the selected
port address. The device types returned are:

0 = Port ID check failed. The read data did not match data necessary for
successful device identification.
1 = Device was found to be an INS8250 or INS8250-B.
2 = Device was found to be of type INS8250A, INS82C50A, NS16450, or
NS16C450.
3 = Device was fund to be of type NS16550A.

If the function returns type=0, the user is informed that the ID check
failed, and the user is given the opportunity to exit. If the user
wishes to continue, then the program prompts the user to select a
device type manually before going on.

2. Register Read/Write Test.
This function writes to selected device registers, depeding on
device type, then reads back the data and compares it to expected values.
If there are any read/write errors found, the error data is listed to
screen. Register offset, write data, read data, and expected data are
listed. If any read/write errors are found, they are assumed to be
potentially fatal, and the user is again given the opportunity to quit
the test before going on.

3. Loopback Diagnostic Test.
This function tests all basic UART functions, those that are common to
all device types. The functions are first tested individually, then
together in a comprehensive exercise.

Test 1. Internal Loopback Data Test.
In this excercise, the UART is programmed for internal loop-back
diagnostic mode by setting bit 4 of the Modem Control Register to
logic 1. The baud rate divisor is set at 12 ( 9600 baud with a 1.843
MHz clock input ). The Line Control register is programmed for values
of 00H to 3fH, and for each value of LCR, data bytes 00H to ffH are
transmitted, recieved, and compared against expected data. Error status
bits are also checked for each byte sent. Data or status errors are
reported by the following error message:
Error (1)..LCR = xx Tx = xx LSR = xx Rx = xx
where LCR is the Line control register value, Tx is the data sent,
LSR is the Line Status Register value, and Rx is the data received.
If the UART is incapable of receiving or transmitting data, the routine
will timeout and abort the routine.

Test 2. Modem Control/Modem Status test.
This tests the modem interface functions of the UART. The Modem Control
Register (MCR) is programmed with a series of values, and the Modem
Status register (MSR) and Interrupt ID Registers are read each time and
compared against expected read data. Errors are reported by:
Error (2).." "
where the number 2 refers to this test.

Test 3. Interrupt Functionality test.
Each interrupt is tested individually by enabling the interrupts one at
a time and setting error status bits that result in the interrupt being
generated. Then, with all device interrupts enabled, the interrupt
priority resolving mechanism is tested. Error message numbers
correspond as follows:
"Error (3a).." - Line Status interrupt test
"Error (3b).." - Modem Status interrupt test
"Error (3c).." - Receiver Data interrupt test
"Error (3d).." - Transmitter Empty interrupt test
"Error (3e).." - Interrupt Priority Resolver test

Test 4. Comprehensive test.
This tests combined device functions. The part is put through a
loop-back transmit/receive sequence with all interrupts enabled.
The read data sequence must precisely match an expected series of
read data values. Errors correspond as follows:
"Error (4a).." - Transmit data sequence
"Error (4b).." - Recieve data sequence

4. FIFO Functions Test
This function tests all FIFO mode functions of the NS16550A UART or
equivalent. The function will not be called if there were fatal errors
found in the previous loop-back test. The test covers the following
sections, with error numbers pertaining to each.

Test 1. FIFO Identification.
This test will initialize the UART for FIFO mode, check the FIFO ID
bits for validity.

Test 2. Basic FIFO Functionality
A character is sent and received using loop-back mode to test
data integrity, and fifo empty conditions, and receiver status.

Test 3. FIFO Reset Test
This tests the FIFO clear bits (FCR1 and FCR2) for functionality.

Test 4. FIFO-mode Loopback Data Test.
This section sends and receives blocks of 16 bytes (256 total) to test
the FIFO data, status, and empty conditions.

Test 5. Receiver FIFO Trigger Levels Test.
Each trigger level is programmed and then tested for its ability to
generate an interrupt when the expected trigger level is reached in the
receiver FIFO.

Test 6. Receiver Data Timeout Interrupt Test.
Data is loaded into the receiver FIFO and left there for four character
times without being read. The Interrupt ID register is then read and
tested for a receiver data timeout indication.

Test 7. FIFO-mode Line Status Functions Test
The Break Indicator (BI), Frame Error (FE), and Error-in-FIFO (EIF)
bits of the Line Status register are tested for functionality.



  3 Responses to “Category : Tutorials + Patches
Archive   : NAT_UART.ZIP
Filename : COMTEST2.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/