home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
PARADIS1
/
16550CHK.PAS
next >
Wrap
Pascal/Delphi Source File
|
1992-05-27
|
3KB
|
92 lines
(6844) Sun 17 May 92 23:07
By: Jan Feijes
To: Trevor Carlsen
Re: Re: 16550 chip
St:
---------------------------------------------------------------------------
@MSGID: 2:281/506 488f57d6
And I quote :
Trevor Carlsen said to All about 16550 chip on the 05-01-92 23:06
TC> Does anybody have any Pascal (or assembler) code that will
TC> demonstrate a fool-proof way of determining if the UART is a 16550,
TC> 16450 or 8250?
If asked this question some time ago, and have found some routines
which I adapted and allow me to see the difference between an 16550
and a 8250, 16450. this is I can tell when I am dealing with an
16550 or not :
Function Check16550Present : Boolean;Assembler;
{
-------------------------------------------------------------------------
Checks if 16550 UART is present
-------------------------------------------------------------------------
}
Var
OldState : Byte;
ASM
MOV DX,COM
ADD DX,2 { Use interrupt ID Regs
}
IN AL,DX { Read old value for 16550
}
AND AL,$C0 { Check bit 7 & 6
}
XOR AL,$C0 { BOTH bits are set ?
)
JZ @BitsSet { returns zero if both bits are set
}
MOV AL,$00 { Bits not set then set back to zero
}
JMP @StartCheck
@BitsSet: MOV AL,$07 { Bits were set then set back to 1
}
@StartCheck: MOV OldState,AL { Store it somewhere
}
MOV AL,$07 { Switch buffers on
}
CLI { Disable interrupts
}
OUT DX,AL { Write to interrupt ID register
}
IN AL,DX { Read fifo settings
}
MOV BL,AL { Put value in BL
}
MOV AL,OldState { Restore old value for fifo's
}
OUT DX,AL { Set int ID back to old value
}
STI { Enable interrupts
}
XOR AX,AX
AND BL,$C0 { Only leave bit 6 & 7
}
XOR BL,$C0 { If both were set -> zero
}
JNZ @GetOut
INC AL { Both zero, $C0 was set
}
@GetOut:
end; {Check16550Present}
This simply enables the fifo's. On UARTS without the fifo this doesn't work,
on the 16550 it does. Com holds the base adress of the communications port.
Grtx
Jan Feijes
... MCOMM : Tagging files by using the mouse
--- GEcho/beta
* Origin: >> INTERFACE << +31-70-3361380/3361381/3360698 1,2 GIGA! (2:281/
506.50)
@PATH: 281/506 515 1 280/0 500/9 512/0 1007