Lines Matching refs:c

39 static int cx_compute_buf_len (cx_chan_t *c)  in cx_compute_buf_len()  argument
42 if (c->mode == M_ASYNC) { in cx_compute_buf_len()
43 rbsz = (c->rxbaud + 800 - 1) / 800 * 2; in cx_compute_buf_len()
73 cx_chan_t *c; in cx_open_board() local
79 for (c=b->chan; c<b->chan+NCHAN; ++c) { in cx_open_board()
80 c->call_on_tx = 0; in cx_open_board()
81 c->call_on_rx = 0; in cx_open_board()
82 c->call_on_msig = 0; in cx_open_board()
83 c->call_on_err = 0; in cx_open_board()
110 void cx_start_chan (cx_chan_t *c, cx_buf_t *cb, unsigned long phys) in cx_start_chan() argument
117 c->overflow = 0; in cx_start_chan()
121 c->arbuf = cb->rbuffer[0]; in cx_start_chan()
122 c->brbuf = cb->rbuffer[1]; in cx_start_chan()
123 c->atbuf = cb->tbuffer[0]; in cx_start_chan()
124 c->btbuf = cb->tbuffer[1]; in cx_start_chan()
125 c->arphys = phys + ((char*)c->arbuf - (char*)cb); in cx_start_chan()
126 c->brphys = phys + ((char*)c->brbuf - (char*)cb); in cx_start_chan()
127 c->atphys = phys + ((char*)c->atbuf - (char*)cb); in cx_start_chan()
128 c->btphys = phys + ((char*)c->btbuf - (char*)cb); in cx_start_chan()
132 outb (CAR(c->port), c->num & 3); in cx_start_chan()
135 outw (ARBADRU(c->port), (unsigned short) (c->arphys>>16)); in cx_start_chan()
136 outw (ARBADRL(c->port), (unsigned short) c->arphys); in cx_start_chan()
139 outw (BRBADRU(c->port), (unsigned short) (c->brphys>>16)); in cx_start_chan()
140 outw (BRBADRL(c->port), (unsigned short) c->brphys); in cx_start_chan()
143 outw (ATBADRU(c->port), (unsigned short) (c->atphys>>16)); in cx_start_chan()
144 outw (ATBADRL(c->port), (unsigned short) c->atphys); in cx_start_chan()
147 outw (BTBADRU(c->port), (unsigned short) (c->btphys>>16)); in cx_start_chan()
148 outw (BTBADRL(c->port), (unsigned short) c->btphys); in cx_start_chan()
153 if (c->board->dma) { in cx_start_chan()
155 if (c->mode == M_ASYNC) in cx_start_chan()
161 ier |= (c->mode == M_ASYNC) ? IER_TXD : (IER_TXD | IER_TXMPTY); in cx_start_chan()
162 if (c->board->dma) in cx_start_chan()
166 outb (CMR(c->port), mode | (c->mode == M_ASYNC ? CMR_ASYNC : CMR_HDLC)); in cx_start_chan()
169 cx_cmd (c->port, CCR_CLRCH); in cx_start_chan()
170 cx_cmd (c->port, CCR_INITCH | command); in cx_start_chan()
171 if (c->mode == M_ASYNC) in cx_start_chan()
172 cx_cmd (c->port, CCR_ENTX); in cx_start_chan()
175 rbsz = cx_compute_buf_len(c); in cx_start_chan()
176 outw (ARBCNT(c->port), rbsz); in cx_start_chan()
177 outw (BRBCNT(c->port), rbsz); in cx_start_chan()
178 outw (ARBSTS(c->port), BSTS_OWN24); in cx_start_chan()
179 outw (BRBSTS(c->port), BSTS_OWN24); in cx_start_chan()
181 if (c->mode == M_ASYNC) in cx_start_chan()
185 outb (IER(c->port), ier); in cx_start_chan()
188 cx_set_dtr (c, 0); in cx_start_chan()
189 cx_set_rts (c, 0); in cx_start_chan()
195 void cx_enable_receive (cx_chan_t *c, int on) in cx_enable_receive() argument
199 if (cx_receive_enabled(c) && ! on) { in cx_enable_receive()
200 outb (CAR(c->port), c->num & 3); in cx_enable_receive()
201 if (c->mode == M_ASYNC) { in cx_enable_receive()
202 ier = inb (IER(c->port)); in cx_enable_receive()
203 outb (IER(c->port), ier & ~ (IER_RXD | IER_RET)); in cx_enable_receive()
205 cx_cmd (c->port, CCR_DISRX); in cx_enable_receive()
206 } else if (! cx_receive_enabled(c) && on) { in cx_enable_receive()
207 outb (CAR(c->port), c->num & 3); in cx_enable_receive()
208 ier = inb (IER(c->port)); in cx_enable_receive()
209 if (c->mode == M_ASYNC) in cx_enable_receive()
210 outb (IER(c->port), ier | (IER_RXD | IER_RET)); in cx_enable_receive()
212 outb (IER(c->port), ier | IER_RXD); in cx_enable_receive()
213 cx_cmd (c->port, CCR_ENRX); in cx_enable_receive()
220 void cx_enable_transmit (cx_chan_t *c, int on) in cx_enable_transmit() argument
222 if (cx_transmit_enabled(c) && ! on) { in cx_enable_transmit()
223 outb (CAR(c->port), c->num & 3); in cx_enable_transmit()
224 if (c->mode != M_ASYNC) in cx_enable_transmit()
225 outb (STCR(c->port), STC_ABORTTX | STC_SNDSPC); in cx_enable_transmit()
226 cx_cmd (c->port, CCR_DISTX); in cx_enable_transmit()
227 } else if (! cx_transmit_enabled(c) && on) { in cx_enable_transmit()
228 outb (CAR(c->port), c->num & 3); in cx_enable_transmit()
229 cx_cmd (c->port, CCR_ENTX); in cx_enable_transmit()
236 int cx_receive_enabled (cx_chan_t *c) in cx_receive_enabled() argument
238 outb (CAR(c->port), c->num & 3); in cx_receive_enabled()
239 return (inb (CSR(c->port)) & CSRA_RXEN) != 0; in cx_receive_enabled()
242 int cx_transmit_enabled (cx_chan_t *c) in cx_transmit_enabled() argument
244 outb (CAR(c->port), c->num & 3); in cx_transmit_enabled()
245 return (inb (CSR(c->port)) & CSRA_TXEN) != 0; in cx_transmit_enabled()
248 unsigned long cx_get_baud (cx_chan_t *c) in cx_get_baud() argument
250 return (c->opt.tcor.clk == CLK_EXT) ? 0 : c->txbaud; in cx_get_baud()
253 int cx_get_loop (cx_chan_t *c) in cx_get_loop() argument
255 return c->opt.tcor.llm ? 1 : 0; in cx_get_loop()
258 int cx_get_nrzi (cx_chan_t *c) in cx_get_nrzi() argument
260 return c->opt.rcor.encod == ENCOD_NRZI; in cx_get_nrzi()
263 int cx_get_dpll (cx_chan_t *c) in cx_get_dpll() argument
265 return c->opt.rcor.dpll ? 1 : 0; in cx_get_dpll()
268 void cx_set_baud (cx_chan_t *c, unsigned long bps) in cx_set_baud() argument
272 c->txbaud = c->rxbaud = bps; in cx_set_baud()
275 outb (CAR(c->port), c->num & 3); in cx_set_baud()
277 if (c->mode == M_ASYNC || c->opt.rcor.dpll || c->opt.tcor.llm) { in cx_set_baud()
279 cx_clock (c->oscfreq, c->rxbaud, &clock, &period); in cx_set_baud()
280 c->opt.rcor.clk = clock; in cx_set_baud()
281 outb (RCOR(c->port), BYTE c->opt.rcor); in cx_set_baud()
282 outb (RBPR(c->port), period); in cx_set_baud()
285 c->opt.rcor.clk = CLK_EXT; in cx_set_baud()
286 outb (RCOR(c->port), BYTE c->opt.rcor); in cx_set_baud()
287 outb (RBPR(c->port), 1); in cx_set_baud()
291 cx_clock (c->oscfreq, c->txbaud, &clock, &period); in cx_set_baud()
292 c->opt.tcor.clk = clock; in cx_set_baud()
293 c->opt.tcor.ext1x = 0; in cx_set_baud()
294 outb (TBPR(c->port), period); in cx_set_baud()
295 } else if (c->mode != M_ASYNC) { in cx_set_baud()
297 c->opt.tcor.llm = 0; in cx_set_baud()
298 c->opt.rcor.dpll = 0; in cx_set_baud()
301 c->opt.tcor.ext1x = 1; in cx_set_baud()
302 c->opt.tcor.clk = CLK_EXT; in cx_set_baud()
303 outb (TBPR(c->port), 1); in cx_set_baud()
306 c->opt.rcor.clk = CLK_EXT; in cx_set_baud()
307 outb (RCOR(c->port), BYTE c->opt.rcor); in cx_set_baud()
308 outb (RBPR(c->port), 1); in cx_set_baud()
310 if (c->opt.tcor.llm) in cx_set_baud()
311 outb (COR2(c->port), (BYTE c->hopt.cor2) & ~3); in cx_set_baud()
313 outb (COR2(c->port), BYTE c->hopt.cor2); in cx_set_baud()
314 outb (TCOR(c->port), BYTE c->opt.tcor); in cx_set_baud()
317 void cx_set_loop (cx_chan_t *c, int on) in cx_set_loop() argument
319 if (! c->txbaud) in cx_set_loop()
322 c->opt.tcor.llm = on ? 1 : 0; in cx_set_loop()
323 cx_set_baud (c, c->txbaud); in cx_set_loop()
326 void cx_set_dpll (cx_chan_t *c, int on) in cx_set_dpll() argument
328 if (! c->txbaud) in cx_set_dpll()
331 c->opt.rcor.dpll = on ? 1 : 0; in cx_set_dpll()
332 cx_set_baud (c, c->txbaud); in cx_set_dpll()
335 void cx_set_nrzi (cx_chan_t *c, int nrzi) in cx_set_nrzi() argument
337 c->opt.rcor.encod = (nrzi ? ENCOD_NRZI : ENCOD_NRZ); in cx_set_nrzi()
338 outb (CAR(c->port), c->num & 3); in cx_set_nrzi()
339 outb (RCOR(c->port), BYTE c->opt.rcor); in cx_set_nrzi()
342 static int cx_send (cx_chan_t *c, char *data, int len, in cx_send() argument
350 outb (CAR(c->port), c->num & 3); in cx_send()
353 if (inb (DMABSTS(c->port)) & DMABSTS_NTBUF) { in cx_send()
354 if (inb (BTBSTS(c->port)) & BSTS_OWN24) { in cx_send()
355 buf = c->atbuf; in cx_send()
356 cnt_port = ATBCNT(c->port); in cx_send()
357 sts_port = ATBSTS(c->port); in cx_send()
358 attp = &c->attach[0]; in cx_send()
360 buf = c->btbuf; in cx_send()
361 cnt_port = BTBCNT(c->port); in cx_send()
362 sts_port = BTBSTS(c->port); in cx_send()
363 attp = &c->attach[1]; in cx_send()
366 if (inb (ATBSTS(c->port)) & BSTS_OWN24) { in cx_send()
367 buf = c->btbuf; in cx_send()
368 cnt_port = BTBCNT(c->port); in cx_send()
369 sts_port = BTBSTS(c->port); in cx_send()
370 attp = &c->attach[1]; in cx_send()
372 buf = c->atbuf; in cx_send()
373 cnt_port = ATBCNT(c->port); in cx_send()
374 sts_port = ATBSTS(c->port); in cx_send()
375 attp = &c->attach[0]; in cx_send()
391 if (c->mode != M_ASYNC) { in cx_send()
392 if ((inb(ATBSTS(c->port)) & BSTS_OWN24) && in cx_send()
393 (inb(BTBSTS(c->port)) & BSTS_OWN24)) { in cx_send()
394 outb (IER(c->port), IER_RXD | IER_TXD | IER_TXMPTY); in cx_send()
396 outb (IER(c->port), IER_RXD | IER_TXD); in cx_send()
404 int cx_buf_free (cx_chan_t *c) in cx_buf_free() argument
406 return ! (inb (ATBSTS(c->port)) & BSTS_OWN24) + in cx_buf_free()
407 ! (inb (BTBSTS(c->port)) & BSTS_OWN24); in cx_buf_free()
413 int cx_send_packet (cx_chan_t *c, char *data, int len, void *attachment) in cx_send_packet() argument
417 if (c->mode == M_ASYNC) { in cx_send_packet()
425 return cx_send (c, buf, t-buf, attachment); in cx_send_packet()
427 return cx_send (c, data, len, attachment); in cx_send_packet()
430 static int cx_receive_interrupt (cx_chan_t *c) in cx_receive_interrupt() argument
435 ++c->rintr; in cx_receive_interrupt()
436 risr = inw (RISR(c->port)); in cx_receive_interrupt()
439 rbsz = cx_compute_buf_len(c); in cx_receive_interrupt()
440 if (c->mode == M_ASYNC && (risr & RISA_TIMEOUT)) { in cx_receive_interrupt()
441 unsigned long rcbadr = (unsigned short) inw (RCBADRL(c->port)) | in cx_receive_interrupt()
442 (long) inw (RCBADRU(c->port)) << 16; in cx_receive_interrupt()
446 if (rcbadr >= c->brphys && rcbadr < c->brphys+DMABUFSZ) { in cx_receive_interrupt()
447 buf = c->brbuf; in cx_receive_interrupt()
448 len = rcbadr - c->brphys; in cx_receive_interrupt()
449 cnt_port = BRBCNT(c->port); in cx_receive_interrupt()
450 sts_port = BRBSTS(c->port); in cx_receive_interrupt()
451 } else if (rcbadr >= c->arphys && rcbadr < c->arphys+DMABUFSZ) { in cx_receive_interrupt()
452 buf = c->arbuf; in cx_receive_interrupt()
453 len = rcbadr - c->arphys; in cx_receive_interrupt()
454 cnt_port = ARBCNT(c->port); in cx_receive_interrupt()
455 sts_port = ARBSTS(c->port); in cx_receive_interrupt()
459 c->ibytes += len; in cx_receive_interrupt()
460 c->received_data = buf; in cx_receive_interrupt()
461 c->received_len = len; in cx_receive_interrupt()
472 ++c->ierrs; in cx_receive_interrupt()
473 if (c->call_on_err) in cx_receive_interrupt()
474 c->call_on_err (c, CX_OVERRUN); in cx_receive_interrupt()
475 } else if (c->mode != M_ASYNC && (risr & RISH_CRCERR)) { in cx_receive_interrupt()
476 ++c->ierrs; in cx_receive_interrupt()
477 if (c->call_on_err) in cx_receive_interrupt()
478 c->call_on_err (c, CX_CRC); in cx_receive_interrupt()
479 } else if (c->mode != M_ASYNC && (risr & (RISH_RXABORT | RISH_RESIND))) { in cx_receive_interrupt()
480 ++c->ierrs; in cx_receive_interrupt()
481 if (c->call_on_err) in cx_receive_interrupt()
482 c->call_on_err (c, CX_FRAME); in cx_receive_interrupt()
483 } else if (c->mode == M_ASYNC && (risr & RISA_PARERR)) { in cx_receive_interrupt()
484 ++c->ierrs; in cx_receive_interrupt()
485 if (c->call_on_err) in cx_receive_interrupt()
486 c->call_on_err (c, CX_CRC); in cx_receive_interrupt()
487 } else if (c->mode == M_ASYNC && (risr & RISA_FRERR)) { in cx_receive_interrupt()
488 ++c->ierrs; in cx_receive_interrupt()
489 if (c->call_on_err) in cx_receive_interrupt()
490 c->call_on_err (c, CX_FRAME); in cx_receive_interrupt()
491 } else if (c->mode == M_ASYNC && (risr & RISA_BREAK)) { in cx_receive_interrupt()
492 if (c->call_on_err) in cx_receive_interrupt()
493 c->call_on_err (c, CX_BREAK); in cx_receive_interrupt()
495 ++c->ierrs; in cx_receive_interrupt()
498 len = (risr & RIS_BB) ? inw(BRBCNT(c->port)) : inw(ARBCNT(c->port)); in cx_receive_interrupt()
506 } else if (c->mode != M_ASYNC && ! (risr & RIS_EOFR)) { in cx_receive_interrupt()
510 if (! c->overflow) { in cx_receive_interrupt()
511 if (c->call_on_err) in cx_receive_interrupt()
512 c->call_on_err (c, CX_OVERFLOW); in cx_receive_interrupt()
513 c->overflow = 1; in cx_receive_interrupt()
514 ++c->ierrs; in cx_receive_interrupt()
516 } else if (! c->overflow) { in cx_receive_interrupt()
518 c->received_data = c->brbuf; in cx_receive_interrupt()
519 c->received_len = len; in cx_receive_interrupt()
521 c->received_data = c->arbuf; in cx_receive_interrupt()
522 c->received_len = len; in cx_receive_interrupt()
524 if (c->mode != M_ASYNC) in cx_receive_interrupt()
525 ++c->ipkts; in cx_receive_interrupt()
526 c->ibytes += len; in cx_receive_interrupt()
528 c->overflow = 0; in cx_receive_interrupt()
532 if (! (inb (ARBSTS(c->port)) & BSTS_OWN24)) { in cx_receive_interrupt()
533 outw (ARBCNT(c->port), rbsz); in cx_receive_interrupt()
534 outb (ARBSTS(c->port), BSTS_OWN24); in cx_receive_interrupt()
536 if (! (inb (BRBSTS(c->port)) & BSTS_OWN24)) { in cx_receive_interrupt()
537 outw (BRBCNT(c->port), rbsz); in cx_receive_interrupt()
538 outb (BRBSTS(c->port), BSTS_OWN24); in cx_receive_interrupt()
542 if ((risr & RISA_SCMASK) && c->aopt.cor2.ixon) in cx_receive_interrupt()
548 static void cx_transmit_interrupt (cx_chan_t *c) in cx_transmit_interrupt() argument
553 ++c->tintr; in cx_transmit_interrupt()
554 tisr = inb (TISR(c->port)); in cx_transmit_interrupt()
556 if (c->call_on_err) in cx_transmit_interrupt()
557 c->call_on_err (c, CX_UNDERRUN); in cx_transmit_interrupt()
558 ++c->oerrs; in cx_transmit_interrupt()
562 len = inw(BTBCNT(c->port)); in cx_transmit_interrupt()
563 if (c->call_on_tx) in cx_transmit_interrupt()
564 c->call_on_tx (c, c->attach[1], len); in cx_transmit_interrupt()
566 len = inw(ATBCNT(c->port)); in cx_transmit_interrupt()
567 if (c->call_on_tx) in cx_transmit_interrupt()
568 c->call_on_tx (c, c->attach[0], len); in cx_transmit_interrupt()
570 if (c->mode != M_ASYNC && len != 0) in cx_transmit_interrupt()
571 ++c->opkts; in cx_transmit_interrupt()
572 c->obytes += len; in cx_transmit_interrupt()
577 if (c->mode != M_ASYNC) { in cx_transmit_interrupt()
578 if ((inb (ATBSTS(c->port)) & BSTS_OWN24) && in cx_transmit_interrupt()
579 (inb (BTBSTS(c->port)) & BSTS_OWN24)) { in cx_transmit_interrupt()
580 outb (IER(c->port), IER_RXD | IER_TXD | IER_TXMPTY); in cx_transmit_interrupt()
582 outb (IER(c->port), IER_RXD | IER_TXD); in cx_transmit_interrupt()
589 cx_chan_t *c; in cx_int_handler() local
595 c = b->chan + (livr>>2 & 0xf); in cx_int_handler()
596 if (c->type == T_NONE) in cx_int_handler()
600 ++c->mintr; in cx_int_handler()
601 if (c->call_on_msig) in cx_int_handler()
602 c->call_on_msig (c); in cx_int_handler()
603 outb (MEOIR(c->port), 0); in cx_int_handler()
607 outb (REOIR(c->port), cx_receive_interrupt (c)); in cx_int_handler()
608 if (c->call_on_rx && c->received_data) { in cx_int_handler()
609 c->call_on_rx (c, c->received_data, in cx_int_handler()
610 c->received_len); in cx_int_handler()
611 c->received_data = 0; in cx_int_handler()
615 cx_transmit_interrupt (c); in cx_int_handler()
616 outb (TEOIR(c->port), 0); in cx_int_handler()
625 void cx_register_transmit (cx_chan_t *c, in cx_register_transmit() argument
626 void (*func) (cx_chan_t *c, void *attachment, int len)) in cx_register_transmit()
628 c->call_on_tx = func; in cx_register_transmit()
631 void cx_register_receive (cx_chan_t *c, in cx_register_receive() argument
632 void (*func) (cx_chan_t *c, char *data, int len)) in cx_register_receive()
634 c->call_on_rx = func; in cx_register_receive()
637 void cx_register_modem (cx_chan_t *c, void (*func) (cx_chan_t *c)) in cx_register_modem() argument
639 c->call_on_msig = func; in cx_register_modem()
642 void cx_register_error (cx_chan_t *c, void (*func) (cx_chan_t *c, int data)) in cx_register_error() argument
644 c->call_on_err = func; in cx_register_error()
654 void cx_transmitter_ctl (cx_chan_t *c,int start) in cx_transmitter_ctl() argument
656 outb (CAR(c->port), c->num & 3); in cx_transmitter_ctl()
657 cx_cmd (c->port, start ? CCR_ENTX : CCR_DISTX); in cx_transmitter_ctl()
663 void cx_flush_transmit (cx_chan_t *c) in cx_flush_transmit() argument
665 outb (CAR(c->port), c->num & 3); in cx_flush_transmit()
666 cx_cmd (c->port, CCR_CLRTX); in cx_flush_transmit()
672 void cx_xflow_ctl (cx_chan_t *c, int on) in cx_xflow_ctl() argument
674 outb (CAR(c->port), c->num & 3); in cx_xflow_ctl()
675 outb (STCR(c->port), STC_SNDSPC | (on ? STC_SSPC_1 : STC_SSPC_2)); in cx_xflow_ctl()
681 void cx_send_break (cx_chan_t *c, int msec) in cx_send_break() argument
706 cx_send (c, buf, p-buf, 0); in cx_send_break()
712 void cx_set_async_param (cx_chan_t *c, int baud, int bits, int parity, in cx_set_async_param() argument
727 c->aopt.cor2.ctsae = rtscts ? 1 : 0; in cx_set_async_param()
731 c->aopt.cor2.etc = 1; in cx_set_async_param()
734 c->aopt.cor2.ixon = ixon ? 1 : 0; in cx_set_async_param()
735 c->aopt.cor2.ixany = ixany ? 1 : 0; in cx_set_async_param()
739 c->aopt.cor3.stopb = STOPB_2; in cx_set_async_param()
741 c->aopt.cor3.stopb = STOPB_1; in cx_set_async_param()
744 c->aopt.cor3.scde = ixon ? 1 : 0; in cx_set_async_param()
745 c->aopt.cor3.flowct = ixon ? FLOWCC_NOTPASS : FLOWCC_PASS; in cx_set_async_param()
747 c->aopt.schr1 = symstart; /* XON */ in cx_set_async_param()
748 c->aopt.schr2 = symstop; /* XOFF */ in cx_set_async_param()
751 outb (CAR(c->port), c->num & 3); in cx_set_async_param()
755 c->rxbaud = c->txbaud = baud; in cx_set_async_param()
758 cx_clock (c->oscfreq, c->rxbaud, &clock, &period); in cx_set_async_param()
759 c->opt.rcor.clk = clock; in cx_set_async_param()
760 outb (RCOR(c->port), BYTE c->opt.rcor); in cx_set_async_param()
761 outb (RBPR(c->port), period); in cx_set_async_param()
764 cx_clock (c->oscfreq, c->txbaud, &clock, &period); in cx_set_async_param()
765 c->opt.tcor.clk = clock; in cx_set_async_param()
766 c->opt.tcor.ext1x = 0; in cx_set_async_param()
767 outb (TCOR(c->port), BYTE c->opt.tcor); in cx_set_async_param()
768 outb (TBPR(c->port), period); in cx_set_async_param()
770 outb (COR2(c->port), BYTE c->aopt.cor2); in cx_set_async_param()
771 outb (COR3(c->port), BYTE c->aopt.cor3); in cx_set_async_param()
772 outb (SCHR1(c->port), c->aopt.schr1); in cx_set_async_param()
773 outb (SCHR2(c->port), c->aopt.schr2); in cx_set_async_param()
775 if (BYTE c->aopt.cor1 != BYTE cor1) { in cx_set_async_param()
776 BYTE c->aopt.cor1 = BYTE cor1; in cx_set_async_param()
777 outb (COR1(c->port), BYTE c->aopt.cor1); in cx_set_async_param()
780 cx_cmd (c->port, CCR_INITCH); in cx_set_async_param()
788 int cx_set_mode (cx_chan_t *c, int mode) in cx_set_mode() argument
791 if (c->type == T_ASYNC) in cx_set_mode()
794 if (c->mode == M_HDLC) in cx_set_mode()
797 c->mode = M_HDLC; in cx_set_mode()
799 if (c->type == T_SYNC_RS232 || in cx_set_mode()
800 c->type == T_SYNC_V35 || in cx_set_mode()
801 c->type == T_SYNC_RS449) in cx_set_mode()
804 if (c->mode == M_ASYNC) in cx_set_mode()
807 c->mode = M_ASYNC; in cx_set_mode()
808 c->opt.tcor.ext1x = 0; in cx_set_mode()
809 c->opt.tcor.llm = 0; in cx_set_mode()
810 c->opt.rcor.dpll = 0; in cx_set_mode()
811 c->opt.rcor.encod = ENCOD_NRZ; in cx_set_mode()
812 if (! c->txbaud || ! c->rxbaud) in cx_set_mode()
813 c->txbaud = c->rxbaud = 9600; in cx_set_mode()
817 cx_setup_chan (c); in cx_set_mode()
818 cx_start_chan (c, 0, 0); in cx_set_mode()
819 cx_enable_receive (c, 0); in cx_set_mode()
820 cx_enable_transmit (c, 0); in cx_set_mode()
827 void cx_set_port (cx_chan_t *c, int iftype) in cx_set_port() argument
829 if (c->board->type == B_SIGMA_XXX) { in cx_set_port()
830 switch (c->num) { in cx_set_port()
832 if ((c->board->if0type != 0) == (iftype != 0)) in cx_set_port()
834 c->board->if0type = iftype; in cx_set_port()
835 c->board->bcr0 &= ~BCR0_UMASK; in cx_set_port()
836 if (c->board->if0type && in cx_set_port()
837 (c->type==T_UNIV_RS449 || c->type==T_UNIV_V35)) in cx_set_port()
838 c->board->bcr0 |= BCR0_UI_RS449; in cx_set_port()
839 outb (BCR0(c->board->port), c->board->bcr0); in cx_set_port()
842 if ((c->board->if8type != 0) == (iftype != 0)) in cx_set_port()
844 c->board->if8type = iftype; in cx_set_port()
845 c->board->bcr0b &= ~BCR0_UMASK; in cx_set_port()
846 if (c->board->if8type && in cx_set_port()
847 (c->type==T_UNIV_RS449 || c->type==T_UNIV_V35)) in cx_set_port()
848 c->board->bcr0b |= BCR0_UI_RS449; in cx_set_port()
849 outb (BCR0(c->board->port+0x10), c->board->bcr0b); in cx_set_port()
862 int cx_get_port (cx_chan_t *c) in cx_get_port() argument
866 if (c->board->type == B_SIGMA_XXX) { in cx_get_port()
867 switch (c->num) { in cx_get_port()
869 iftype = c->board->if0type; break; in cx_get_port()
871 iftype = c->board->if8type; break; in cx_get_port()
877 switch (c->type) { in cx_get_port()