1 1.9 matt /* $NetBSD: cyvar.h,v 1.9 2008/03/26 17:50:32 matt Exp $ */ 2 1.1 christos 3 1.1 christos /* 4 1.1 christos * cy_var.h 5 1.1 christos * 6 1.1 christos * Driver for Cyclades Cyclom-8/16/32 multiport serial cards 7 1.1 christos * (currently not tested with Cyclom-32 cards) 8 1.1 christos * 9 1.1 christos * Timo Rossi, 1996 10 1.1 christos * 11 1.1 christos * Supports both ISA and PCI Cyclom cards 12 1.1 christos */ 13 1.1 christos 14 1.1 christos /* #define CY_DEBUG */ 15 1.1 christos #define CY_DEBUG1 16 1.1 christos 17 1.1 christos /* 18 1.1 christos * Maximum number of ports per card 19 1.1 christos */ 20 1.1 christos #define CY_MAX_PORTS (CD1400_NO_OF_CHANNELS * CY_MAX_CD1400s) 21 1.1 christos 22 1.1 christos #define CY_RX_FIFO_THRESHOLD 6 23 1.1 christos 24 1.1 christos /* 25 1.1 christos * Automatic RTS (or actually DTR, the RTS and DTR lines need to be 26 1.1 christos * exchanged) handshake threshold used if CY_HW_RTS is defined 27 1.1 christos */ 28 1.1 christos #define CY_RX_DTR_THRESHOLD 9 29 1.1 christos 30 1.1 christos /* 31 1.1 christos * read/write cd1400 registers (when sc_softc-structure is available) 32 1.1 christos */ 33 1.2 thorpej #define cd_read_reg(sc,chip,reg) bus_space_read_1(sc->sc_memt, \ 34 1.2 thorpej sc->sc_bsh, sc->sc_cd1400_offs[chip] + \ 35 1.1 christos (((reg << 1)) << sc->sc_bustype)) 36 1.1 christos 37 1.2 thorpej #define cd_write_reg(sc,chip,reg,val) bus_space_write_1(sc->sc_memt, \ 38 1.2 thorpej sc->sc_bsh, sc->sc_cd1400_offs[chip] + \ 39 1.1 christos (((reg << 1))<< sc->sc_bustype), (val)) 40 1.1 christos 41 1.1 christos /* 42 1.1 christos * ibuf is a simple ring buffer. It is always used two 43 1.1 christos * bytes at a time (status and data) 44 1.1 christos */ 45 1.1 christos #define CY_IBUF_SIZE (2*512) 46 1.1 christos 47 1.1 christos /* software state for one port */ 48 1.1 christos struct cy_port { 49 1.8 thorpej struct cy_softc *cy_softc; 50 1.1 christos int cy_port_num; 51 1.1 christos int cy_chip; 52 1.5 tron int cy_clock; 53 1.1 christos struct tty *cy_tty; 54 1.1 christos int cy_openflags; 55 1.1 christos int cy_fifo_overruns; 56 1.1 christos int cy_ibuf_overruns; 57 1.1 christos u_char cy_channel_control; /* last CCR channel control 58 1.1 christos * command bits */ 59 1.1 christos u_char cy_carrier_stat; /* copied from MSVR2 */ 60 1.1 christos u_char cy_flags; 61 1.1 christos u_char *cy_ibuf, *cy_ibuf_end; 62 1.1 christos u_char *cy_ibuf_rd_ptr, *cy_ibuf_wr_ptr; 63 1.1 christos #ifdef CY_DEBUG1 64 1.1 christos int cy_rx_int_count; 65 1.1 christos int cy_tx_int_count; 66 1.1 christos int cy_modem_int_count; 67 1.1 christos int cy_start_count; 68 1.1 christos #endif /* CY_DEBUG1 */ 69 1.1 christos }; 70 1.1 christos 71 1.1 christos #define CY_F_CARRIER_CHANGED 0x01 72 1.1 christos #define CY_F_START_BREAK 0x02 73 1.1 christos #define CY_F_END_BREAK 0x04 74 1.1 christos #define CY_F_STOP 0x08 75 1.1 christos #define CY_F_SEND_NUL 0x10 76 1.1 christos #define CY_F_START 0x20 77 1.1 christos 78 1.1 christos /* software state for one card */ 79 1.1 christos struct cy_softc { 80 1.9 matt device_t sc_dev; 81 1.1 christos void *sc_ih; 82 1.2 thorpej bus_space_tag_t sc_memt; 83 1.2 thorpej bus_space_handle_t sc_bsh; 84 1.1 christos int sc_bustype; 85 1.1 christos int sc_nchips; /* Number of cd1400's on this card */ 86 1.1 christos int sc_cd1400_offs[CY_MAX_CD1400s]; 87 1.1 christos struct cy_port sc_ports[CY_MAX_PORTS]; 88 1.8 thorpej int sc_nchannels; /* total number of ports */ 89 1.1 christos #ifdef CY_DEBUG1 90 1.1 christos int sc_poll_count1; 91 1.1 christos int sc_poll_count2; 92 1.1 christos #endif 93 1.1 christos }; 94 1.1 christos 95 1.6 thorpej int cy_find(struct cy_softc *); 96 1.7 thorpej void cy_attach(struct cy_softc *); 97 1.6 thorpej int cy_intr(void *); 98