Download DCON Utility (DOS)

Transcript
switch(lBaudRate)
{
case 1200L : break;
case 2400L : break;
case 4800L : break;
case 9600L : break;
case 19200L: break;
case 38400L: break;
case 57600L: break;
case 115200L: break;
default : return 2;
/* baud rate error */
}
bb=115200L;
cc=bb/lBaudRate;
ratehi=(cc&0xff00)>>8;
ratelo=cc&0xff;
outportb(iBase+Lcr,0x80); /* set DLAB */
outportb(iBase+Dll,ratelo);
outportb(iBase+Dlh,ratehi);
outportb(iBase+Lcr,0x03); /* data format */
/* 0000 0011 --> 8_bit+1_stop+no_parity */
outportb(iBase+Ier,0);
/* disable interrupt */
outportb(iBase+Fcr,0x07); /* clear input/output FIFO*/
for (i=0; i<8; i++) inportb(iBase+i); /* clear R */
outportb(iBase+Fcr,0x01); /* enable FIFO */
return 0;
}
/* ----------------------------------------------------------------------- */
/* return : 0 --> OK
1 --> error
*/
int CLOSE_COM(int iPort)
{
/* use polling, so do nothing here */
return 0;
}
DCON Utility (DOS) User’s Manual, Mar/2003, Ver. 1.0.1------------ 21