COMTEST - 2


aux_stat(&amd, 0);

printf("\n COM1:"

"\n : %d"

"\n -: %d"

"\n : %d"

"\n : %lu",

amd.ctl_aux.ctl_word.len,

amd.ctl_aux.ctl_word.stop,

amd.ctl_aux.ctl_word.parity,

(unsigned long)amd.baud);

printf("\n\n ."

"\n !"

"\n <Contril+C>\n");

for(;;)

{

//

//

aux_outp((char)getch(), 0);

//

//

putchar(aux_inp(0));

}

return 0;

}

/**

*.Name aux_stat

*.Title

*

*.Descr

*

* AUX_MODE

*

*.Proto void aux_stat(AUX_MODE *mode, int port);

*

*.Params AUX_MODE mode - ,

* :

*

* int port - :

* 0 - COM1, 1 - COM2

**/

void aux_stat(AUX_MODE *mode, int port)

{

unsigned long b;

//

mode->ctl_aux.ctl = (char)inp(0x3fb - 0x100 * port);

//

//

outp(0x3fb - 0x100 * port, mode->ctl_aux.ctl | 0x80);

//

b = inp(0x3f9 - 0x100 * port); b = b << 8;

b += inp(0x3f8 - 0x100 * port);

//

switch (b)

{

case 1040: b = 110; break;

case 768: b = 150; break;

case 384: b = 300; break;

case 192: b = 600; break;

case 96: b = 1200; break;