-/* STATIC FUNCTIONS *********************************************************/
-
-static BOOLEAN
-KdpDoesComPortExist(
- IN ULONG BaseAddress)
-{
- BOOLEAN found;
- UCHAR mcr;
- UCHAR msr;
-
- found = FALSE;
-
- /* save Modem Control Register (MCR) */
- mcr = READ_PORT_UCHAR(SER_MCR(BaseAddress));
-
- /* enable loop mode (set Bit 4 of the MCR) */
- WRITE_PORT_UCHAR(SER_MCR(BaseAddress), SR_MCR_LOOP);
-
- /* clear all modem output bits */
- WRITE_PORT_UCHAR(SER_MCR(BaseAddress), SR_MCR_LOOP);
-
- /* read the Modem Status Register */
- msr = READ_PORT_UCHAR(SER_MSR(BaseAddress));
-
- /*
- * the upper nibble of the MSR (modem output bits) must be
- * equal to the lower nibble of the MCR (modem input bits)
- */
- if ((msr & 0xF0) == 0x00)
- {
- /* set all modem output bits */
- WRITE_PORT_UCHAR(SER_MCR(BaseAddress), SR_MCR_DTR | SR_MCR_RTS | SR_MCR_OUT1 | SR_MCR_OUT2 | SR_MCR_LOOP);
-
- /* read the Modem Status Register */
- msr = READ_PORT_UCHAR(SER_MSR(BaseAddress));
-
- /*
- * the upper nibble of the MSR (modem output bits) must be
- * equal to the lower nibble of the MCR (modem input bits)
- */
- if ((msr & 0xF0) == 0xF0)
- {
- /*
- * setup a resonable state for the port:
- * enable fifo and clear recieve/transmit buffers
- */
- WRITE_PORT_UCHAR(SER_FCR(BaseAddress),
- (SR_FCR_ENABLE_FIFO | SR_FCR_CLEAR_RCVR | SR_FCR_CLEAR_XMIT));
- WRITE_PORT_UCHAR(SER_FCR(BaseAddress), 0);
- READ_PORT_UCHAR(SER_RBR(BaseAddress));
- WRITE_PORT_UCHAR(SER_IER(BaseAddress), 0);
- found = TRUE;
- }
- }
-
- /* restore MCR */
- WRITE_PORT_UCHAR(SER_MCR(BaseAddress), mcr);
-
- return found;
-}
-
-