sio.c (91986) | sio.c (92793) |
---|---|
1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/pc98/cbus/sio.c 91986 2002-03-10 07:22:42Z nyan $ | 33 * $FreeBSD: head/sys/pc98/cbus/sio.c 92793 2002-03-20 12:22:31Z kato $ |
34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 35 * from: i386/isa sio.c,v 1.234 36 */ 37 38#include "opt_comconsole.h" 39#include "opt_compat.h" 40#include "opt_ddb.h" 41#include "opt_sio.h" --- 322 unchanged lines hidden (view full) --- 364 u_char *obuf2; 365#else 366 u_char obuf1[256]; 367 u_char obuf2[256]; 368#endif 369}; 370 371#ifdef COM_ESP | 34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 35 * from: i386/isa sio.c,v 1.234 36 */ 37 38#include "opt_comconsole.h" 39#include "opt_compat.h" 40#include "opt_ddb.h" 41#include "opt_sio.h" --- 322 unchanged lines hidden (view full) --- 364 u_char *obuf2; 365#else 366 u_char obuf1[256]; 367 u_char obuf2[256]; 368#endif 369}; 370 371#ifdef COM_ESP |
372static int espattach __P((struct com_s *com, Port_t esp_port)); | 372static int espattach(struct com_s *com, Port_t esp_port); |
373#endif 374 375static timeout_t siobusycheck; | 373#endif 374 375static timeout_t siobusycheck; |
376static u_int siodivisor __P((u_long rclk, speed_t speed)); | 376static u_int siodivisor(u_long rclk, speed_t speed); |
377static timeout_t siodtrwakeup; | 377static timeout_t siodtrwakeup; |
378static void comhardclose __P((struct com_s *com)); 379static void sioinput __P((struct com_s *com)); 380static void siointr1 __P((struct com_s *com)); 381static void siointr __P((void *arg)); 382static int commctl __P((struct com_s *com, int bits, int how)); 383static int comparam __P((struct tty *tp, struct termios *t)); 384static void siopoll __P((void *)); 385static void siosettimeout __P((void)); 386static int siosetwater __P((struct com_s *com, speed_t speed)); 387static void comstart __P((struct tty *tp)); 388static void comstop __P((struct tty *tp, int rw)); | 378static void comhardclose(struct com_s *com); 379static void sioinput(struct com_s *com); 380static void siointr1(struct com_s *com); 381static void siointr(void *arg); 382static int commctl(struct com_s *com, int bits, int how); 383static int comparam(struct tty *tp, struct termios *t); 384static void siopoll(void *); 385static void siosettimeout(void); 386static int siosetwater(struct com_s *com, speed_t speed); 387static void comstart(struct tty *tp); 388static void comstop(struct tty *tp, int rw); |
389static timeout_t comwakeup; | 389static timeout_t comwakeup; |
390static void disc_optim __P((struct tty *tp, struct termios *t, 391 struct com_s *com)); | 390static void disc_optim(struct tty *tp, struct termios *t, 391 struct com_s *com); |
392 393char sio_driver_name[] = "sio"; 394static struct mtx sio_lock; 395static int sio_inited; 396 397/* table and macro for fast conversion from a unit number to its com struct */ 398devclass_t sio_devclass; 399#define com_addr(unit) ((struct com_s *) \ --- 59 unchanged lines hidden (view full) --- 459 460#define COM_CARRIER_DETECT_EMULATE 0 461#define PC98_CHECK_MODEM_INTERVAL (hz/10) 462#define DCD_OFF_TOLERANCE 2 463#define DCD_ON_RECOGNITION 2 464#define IS_8251(if_type) (!(if_type & 0x10)) 465#define COM1_EXT_CLOCK 0x40000 466 | 392 393char sio_driver_name[] = "sio"; 394static struct mtx sio_lock; 395static int sio_inited; 396 397/* table and macro for fast conversion from a unit number to its com struct */ 398devclass_t sio_devclass; 399#define com_addr(unit) ((struct com_s *) \ --- 59 unchanged lines hidden (view full) --- 459 460#define COM_CARRIER_DETECT_EMULATE 0 461#define PC98_CHECK_MODEM_INTERVAL (hz/10) 462#define DCD_OFF_TOLERANCE 2 463#define DCD_ON_RECOGNITION 2 464#define IS_8251(if_type) (!(if_type & 0x10)) 465#define COM1_EXT_CLOCK 0x40000 466 |
467static void commint __P((dev_t dev)); 468static void com_tiocm_set __P((struct com_s *com, int msr)); 469static void com_tiocm_bis __P((struct com_s *com, int msr)); 470static void com_tiocm_bic __P((struct com_s *com, int msr)); 471static int com_tiocm_get __P((struct com_s *com)); 472static int com_tiocm_get_delta __P((struct com_s *com)); 473static void pc98_msrint_start __P((dev_t dev)); 474static void com_cflag_and_speed_set __P((struct com_s *com, int cflag, int speed)); 475static int pc98_ttspeedtab __P((struct com_s *com, int speed, u_int *divisor)); 476static int pc98_get_modem_status __P((struct com_s *com)); | 467static void commint(dev_t dev); 468static void com_tiocm_set(struct com_s *com, int msr); 469static void com_tiocm_bis(struct com_s *com, int msr); 470static void com_tiocm_bic(struct com_s *com, int msr); 471static int com_tiocm_get(struct com_s *com); 472static int com_tiocm_get_delta(struct com_s *com); 473static void pc98_msrint_start(dev_t dev); 474static void com_cflag_and_speed_set(struct com_s *com, int cflag, int speed); 475static int pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor); 476static int pc98_get_modem_status(struct com_s *com); |
477static timeout_t pc98_check_msr; | 477static timeout_t pc98_check_msr; |
478static void pc98_set_baud_rate __P((struct com_s *com, u_int count)); 479static void pc98_i8251_reset __P((struct com_s *com, int mode, int command)); 480static void pc98_disable_i8251_interrupt __P((struct com_s *com, int mod)); 481static void pc98_enable_i8251_interrupt __P((struct com_s *com, int mod)); 482static int pc98_check_i8251_interrupt __P((struct com_s *com)); 483static int pc98_i8251_get_cmd __P((struct com_s *com)); 484static int pc98_i8251_get_mod __P((struct com_s *com)); 485static void pc98_i8251_set_cmd __P((struct com_s *com, int x)); 486static void pc98_i8251_or_cmd __P((struct com_s *com, int x)); 487static void pc98_i8251_clear_cmd __P((struct com_s *com, int x)); 488static void pc98_i8251_clear_or_cmd __P((struct com_s *com, int clr, int x)); 489static int pc98_check_if_type __P((device_t dev, struct siodev *iod)); 490static int pc98_check_8251vfast __P((void)); 491static int pc98_check_8251fifo __P((void)); 492static void pc98_check_sysclock __P((void)); 493static void pc98_set_ioport __P((struct com_s *com)); | 478static void pc98_set_baud_rate(struct com_s *com, u_int count); 479static void pc98_i8251_reset(struct com_s *com, int mode, int command); 480static void pc98_disable_i8251_interrupt(struct com_s *com, int mod); 481static void pc98_enable_i8251_interrupt(struct com_s *com, int mod); 482static int pc98_check_i8251_interrupt(struct com_s *com); 483static int pc98_i8251_get_cmd(struct com_s *com); 484static int pc98_i8251_get_mod(struct com_s *com); 485static void pc98_i8251_set_cmd(struct com_s *com, int x); 486static void pc98_i8251_or_cmd(struct com_s *com, int x); 487static void pc98_i8251_clear_cmd(struct com_s *com, int x); 488static void pc98_i8251_clear_or_cmd(struct com_s *com, int clr, int x); 489static int pc98_check_if_type(device_t dev, struct siodev *iod); 490static int pc98_check_8251vfast(void); 491static int pc98_check_8251fifo(void); 492static void pc98_check_sysclock(void); 493static void pc98_set_ioport(struct com_s *com); |
494 495#define com_int_Tx_disable(com) \ 496 pc98_disable_i8251_interrupt(com,IEN_Tx|IEN_TxEMP) 497#define com_int_Tx_enable(com) \ 498 pc98_enable_i8251_interrupt(com,IEN_TxFLAG) 499#define com_int_Rx_disable(com) \ 500 pc98_disable_i8251_interrupt(com,IEN_Rx) 501#define com_int_Rx_enable(com) \ --- 3422 unchanged lines hidden (view full) --- 3924 u_char dlbl; 3925 u_char dlbh; 3926 u_char ier; 3927 u_char cfcr; 3928 u_char mcr; 3929}; 3930 3931#ifndef __alpha__ | 494 495#define com_int_Tx_disable(com) \ 496 pc98_disable_i8251_interrupt(com,IEN_Tx|IEN_TxEMP) 497#define com_int_Tx_enable(com) \ 498 pc98_enable_i8251_interrupt(com,IEN_TxFLAG) 499#define com_int_Rx_disable(com) \ 500 pc98_disable_i8251_interrupt(com,IEN_Rx) 501#define com_int_Rx_enable(com) \ --- 3422 unchanged lines hidden (view full) --- 3924 u_char dlbl; 3925 u_char dlbh; 3926 u_char ier; 3927 u_char cfcr; 3928 u_char mcr; 3929}; 3930 3931#ifndef __alpha__ |
3932static speed_t siocngetspeed __P((Port_t, u_long rclk)); | 3932static speed_t siocngetspeed(Port_t, u_long rclk); |
3933#endif | 3933#endif |
3934static void siocnclose __P((struct siocnstate *sp, Port_t iobase)); 3935static void siocnopen __P((struct siocnstate *sp, Port_t iobase, int speed)); 3936static void siocntxwait __P((Port_t iobase)); | 3934static void siocnclose(struct siocnstate *sp, Port_t iobase); 3935static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed); 3936static void siocntxwait(Port_t iobase); |
3937 3938#ifdef __alpha__ | 3937 3938#ifdef __alpha__ |
3939int siocnattach __P((int port, int speed)); 3940int siogdbattach __P((int port, int speed)); 3941int siogdbgetc __P((void)); 3942void siogdbputc __P((int c)); | 3939int siocnattach(int port, int speed); 3940int siogdbattach(int port, int speed); 3941int siogdbgetc(void); 3942void siogdbputc(int c); |
3943#else 3944static cn_probe_t siocnprobe; 3945static cn_init_t siocninit; 3946static cn_term_t siocnterm; 3947#endif 3948static cn_checkc_t siocncheckc; 3949static cn_getc_t siocngetc; 3950static cn_putc_t siocnputc; --- 1075 unchanged lines hidden --- | 3943#else 3944static cn_probe_t siocnprobe; 3945static cn_init_t siocninit; 3946static cn_term_t siocnterm; 3947#endif 3948static cn_checkc_t siocncheckc; 3949static cn_getc_t siocngetc; 3950static cn_putc_t siocnputc; --- 1075 unchanged lines hidden --- |