Note: this material was downloaded from the Hayes BBS... DESCRIPTION OF SOURCE CODE SET ============================== o ESPTEST.C is the main program. It utilizes ESP in DMA enhanced mode. It continually sends and receives data on one or both ports, and displays ESP status. All screen, keyboard and file I/O is confined to this module. This module does not directly access the ESP, but uses the interface functions in ESPFUNC.C. o ESPFUNC.C contains a set of functions which interface to the ESP. There is one function for each of the ESI commands (see ESI Technical Reference), as well as a few initialization functions. Also contains code to initiate a DMA transfer. o ESPFUNC.H contains function declarations for functions exported by ESPFUNC.C. o ESPTEST.EXE is a make file which will generate the sample ESI application ESPTEST.EXE. o ESPTEST.EXE is the sample ESI application. o ESPTEST.CFG is a text file used by ESPTEST.EXE to obtain configuration information. o ESPTEST.DAT is a text file used by ESPTEST.EXE. It contains the data pattern transmitted ESPTEST.EXE. This code was tested with the Microsoft C Compiler, v5.1. INSTRUCTIONS FOR RUNNING ESPTEST.EXE ==================================== 1. ESPTEST.EXE requires the configuration file ESPTEST.CFG, and the test file ESPTEST.DAT. 2. Using the Configuration File Edit the configuration file ESPTEST.CFG before running ESPTEST. The format of the configuration file must not be changed, but the right hand field of each line may be changed to one of the values in parentheses in the field descriptor. The fields are described below. Computer type (AT or PS2): Type of computer ESP is plugged into. Enhanced address (hex): The base address of the enhanced registers. DMA channel (1 or 3): 1 or 3 for AT bus, 1-3 or 5-7 for PS/2 bus. Enhanced IRQ ( 9 ,3 ,4, 5, or DISABLED): Self explanatory. Service Request Mask: See ESI Technical Reference. DMA Timeout: See ESI Technical Reference. Automatically Update Status (Y or N): 'Y' causes the status to be updated continuously. Issues the ESP initialization sequence (except Reset) continuously. Port 1 stuff: Test (ECHO, LOOPBACK, or NONE): "Echo" reads received data and echos it back to the transmit port. "Loopback" writes transmit data, then reads the received data and compares to what was written. This assumes a loopback path has been provided (see Loopback Type, below). The results of the compare are used to increment either the "good" or "bad" block counters. "None" turns off the test for this port. Loopback type (WIRE or INTERNAL): This is the loopback path used by the loopback test. If "wire" is selected, you must connect pins 2 and 3 on the connector. Also connect any hardware flow control pins used. "Internal" sets the LOOP test bit in the UART and the connecting is done internally -- no wire needed. Don't run the ECHO test with this field set to INTERNAL. RX Flow (x x x x), x=0 or 1 for XX, TXX, RTS, DTR: A 1 enables the corresponding receive flow type. TX Flow (x x x x), x=0 or 1 for XX, TXX, CTS, DSR: A 1 enables the corresponding transmit flow type. If Transparent XON/XOFF is used, it must be the only flow type used and it must be selected for both transmit and receive. RX transfer type (IO or DMA): Transfers of received data may be Programmed IO or DMA transfers. TX transfer type (IO or DMA): Transfers of transmitted data may be Programmed IO or DMA transfers. Transfer block size (1 - 1023): The size of the blocks sent and received between ESP and the host. Baud: Self explanatory. Data bits (5, 6, 7, or 8): Self explanatory. Parity (NONE, ODD, EVEN, MARK, or SPACE): Self explanatory. Stop bits (1, 1.5, or 2): Self explanatory. Error Status Mask (hex): See ESI Technical Reference. Receive timeout (ms): See ESI Technical Reference. Break duration (ms): See ESI Technical Reference. Flowed off timeout (s): See ESI Technical Reference. Port 2 stuff: Same fields as port 1. 3. Status Display The program displays these statuses. Two byte statuses are displayed with Status 1 = the MSB and Status 2 = the LSB. ready register (see ESI Technical Reference) service ID (see ESI Technical Reference) self test result address DIPs (see ESI Technical Reference) port 1 mode (see ESI Technical Reference) port 2 mode (see ESI Technical Reference) port 1 error status (see ESI Technical Reference) port 2 error status (see ESI Technical Reference) port 1 UART status (see ESI Technical Reference) port 2 UART status (see ESI Technical Reference) port 1 UART LCR port 2 UART LCR port 1 RX bytes port 2 RX bytes port 1 TX space port 2 TX space port 1 bad blocks port 2 bad blocks port 1 good blocks port 2 good blocks The bad blocks and good blocks statuses are the data transmission results. In loopback mode, these statuses show the number of blocks received--good blocks matched what was transmitted and bad blocks didn't. In echo mode, each block received increments the good counter, no matter what its contents. The good and bad block indicators are updated continuously. The other statuses are updated when the "s" key is hit, when there is a timeout error, or continuously if Automatic Status Update is selected. 4. Keys When ESPTEST is running, several keys may be used to exercise various functions. The action of these keys affects both ports at once. Key Action 1 send XOFF to remote 2 send XON to remote These keys just send DC1 or DC3 to the remote, regardless of what the flow control type is. 3 stop reading RX data 4 start reading RX data Causes the program to stop or resume reading data from the ESP's RX FIFOs. 5 issue XOFF local 6 issue XON local Issues the XOFF local or XON local command to ESP. 7 stop sending TX data 8 start sending TX data Causes the program to stop or resume sending data to the ESP's TX FIFOs. S update status Updates the status display on the screen. D abort DMA transfer. Causes the host to abort a DMA transfer if one is in progress at the time the key is pressed. Several attempts may be required to hit the key during a transfer. The abort causes the PS/2 computers to hang up with a stack overflow message. B send break Tells ESP to send a break. Remember ESP only sends the break when there is no data in the TX FIFO. Also remember ESP may stop sending RX data to the host after a break is received, causing the dumb ESP program to get stuck. R flush RX FIFO Issues the Flush RX FIFO command. T flush TX FIFO Issues the Flush TX FIFO command. Q quit esp Ends the test program.