[an error occurred while processing this directive]
[an error occurred while processing this directive]
|
UART UART_Detect(unsigned short BaseAddr)
{
{
// detect serial port
EXP lcr,tmp;
_IN(LCR,lcr);
tmp=lcr^255;
_OUT(LCR,tmp);
_IN(LCR,tmp);
if (lcr==tmp)
return EMPTY;
_OUT(LCR,lcr);
}
{
// detect UART_8250
EXP d,e;
_IN(EXP,d);
e=0x5a;
_OUT(EXP,e);
_IN(EXP,e);
if (e!=0x5a)
{
_OUT(EXP,d);
return _8250;
}
e=0xa5;
_OUT(EXP,e);
_IN(EXP,e);
_OUT(EXP,d);
if (e!=0xa5)
return _8250;
}
{
// detect another
IIDR d;
FCR fcr;
fcr.fifo_on=1;
_OUT(FCR,fcr);
_IN(IIDR,d);
fcr.fifo_on=0;
_OUT(FCR,fcr);
if (d.D6)
return _16550A;
if (d.D7)
return _16550;
return _16450;
}
}
E-mail: info@telesys.ru