1 /* 2 * serial167.h 3 * 4 * Richard Hirst [richard@sleepie.demon.co.uk] 5 * 6 * Based on cyclades.h 7 */ 8 9 struct cyclades_monitor { 10 unsigned long int_count; 11 unsigned long char_count; 12 unsigned long char_max; 13 unsigned long char_last; 14 }; 15 16 /* 17 * This is our internal structure for each serial port's state. 18 * 19 * Many fields are paralleled by the structure used by the serial_struct 20 * structure. 21 * 22 * For definitions of the flags field, see tty.h 23 */ 24 25 struct cyclades_port { 26 int magic; 27 int type; 28 int card; 29 int line; 30 int flags; /* defined in tty.h */ 31 struct tty_struct *tty; 32 int read_status_mask; 33 int timeout; 34 int xmit_fifo_size; 35 int cor1,cor2,cor3,cor4,cor5,cor6,cor7; 36 int tbpr,tco,rbpr,rco; 37 int ignore_status_mask; 38 int close_delay; 39 int IER; /* Interrupt Enable Register */ 40 int event; 41 unsigned long last_active; 42 int count; /* # of fd on device */ 43 int x_char; /* to be pushed out ASAP */ 44 int x_break; 45 int blocked_open; /* # of blocked opens */ 46 long session; /* Session of opening process */ 47 long pgrp; /* pgrp of opening process */ 48 unsigned char *xmit_buf; 49 int xmit_head; 50 int xmit_tail; 51 int xmit_cnt; 52 int default_threshold; 53 int default_timeout; 54 struct tq_struct tqueue; 55 struct termios normal_termios; 56 struct termios callout_termios; 57 wait_queue_head_t open_wait; 58 wait_queue_head_t close_wait; 59 struct cyclades_monitor mon; 60 }; 61 62 #define CYCLADES_MAGIC 0x4359 63 64 #define CYGETMON 0x435901 65 #define CYGETTHRESH 0x435902 66 #define CYSETTHRESH 0x435903 67 #define CYGETDEFTHRESH 0x435904 68 #define CYSETDEFTHRESH 0x435905 69 #define CYGETTIMEOUT 0x435906 70 #define CYSETTIMEOUT 0x435907 71 #define CYGETDEFTIMEOUT 0x435908 72 #define CYSETDEFTIMEOUT 0x435909 73 74 /* 75 * Events are used to schedule things to happen at timer-interrupt 76 * time, instead of at cy interrupt time. 77 */ 78 #define Cy_EVENT_READ_PROCESS 0 79 #define Cy_EVENT_WRITE_WAKEUP 1 80 #define Cy_EVENT_HANGUP 2 81 #define Cy_EVENT_BREAK 3 82 #define Cy_EVENT_OPEN_WAKEUP 4 83 84 85 86 #define CyMaxChipsPerCard 1 87 88 /**** cd2401 registers ****/ 89 90 #define CyGFRCR (0x81) 91 #define CyCCR (0x13) 92 #define CyCLR_CHAN (0x40) 93 #define CyINIT_CHAN (0x20) 94 #define CyCHIP_RESET (0x10) 95 #define CyENB_XMTR (0x08) 96 #define CyDIS_XMTR (0x04) 97 #define CyENB_RCVR (0x02) 98 #define CyDIS_RCVR (0x01) 99 #define CyCAR (0xee) 100 #define CyIER (0x11) 101 #define CyMdmCh (0x80) 102 #define CyRxExc (0x20) 103 #define CyRxData (0x08) 104 #define CyTxMpty (0x02) 105 #define CyTxRdy (0x01) 106 #define CyLICR (0x26) 107 #define CyRISR (0x89) 108 #define CyTIMEOUT (0x80) 109 #define CySPECHAR (0x70) 110 #define CyOVERRUN (0x08) 111 #define CyPARITY (0x04) 112 #define CyFRAME (0x02) 113 #define CyBREAK (0x01) 114 #define CyREOIR (0x84) 115 #define CyTEOIR (0x85) 116 #define CyMEOIR (0x86) 117 #define CyNOTRANS (0x08) 118 #define CyRFOC (0x30) 119 #define CyRDR (0xf8) 120 #define CyTDR (0xf8) 121 #define CyMISR (0x8b) 122 #define CyRISR (0x89) 123 #define CyTISR (0x8a) 124 #define CyMSVR1 (0xde) 125 #define CyMSVR2 (0xdf) 126 #define CyDSR (0x80) 127 #define CyDCD (0x40) 128 #define CyCTS (0x20) 129 #define CyDTR (0x02) 130 #define CyRTS (0x01) 131 #define CyRTPRL (0x25) 132 #define CyRTPRH (0x24) 133 #define CyCOR1 (0x10) 134 #define CyPARITY_NONE (0x00) 135 #define CyPARITY_E (0x40) 136 #define CyPARITY_O (0xC0) 137 #define Cy_5_BITS (0x04) 138 #define Cy_6_BITS (0x05) 139 #define Cy_7_BITS (0x06) 140 #define Cy_8_BITS (0x07) 141 #define CyCOR2 (0x17) 142 #define CyETC (0x20) 143 #define CyCtsAE (0x02) 144 #define CyCOR3 (0x16) 145 #define Cy_1_STOP (0x02) 146 #define Cy_2_STOP (0x04) 147 #define CyCOR4 (0x15) 148 #define CyREC_FIFO (0x0F) /* Receive FIFO threshold */ 149 #define CyCOR5 (0x14) 150 #define CyCOR6 (0x18) 151 #define CyCOR7 (0x07) 152 #define CyRBPR (0xcb) 153 #define CyRCOR (0xc8) 154 #define CyTBPR (0xc3) 155 #define CyTCOR (0xc0) 156 #define CySCHR1 (0x1f) 157 #define CySCHR2 (0x1e) 158 #define CyTPR (0xda) 159 #define CyPILR1 (0xe3) 160 #define CyPILR2 (0xe0) 161 #define CyPILR3 (0xe1) 162 #define CyCMR (0x1b) 163 #define CyASYNC (0x02) 164 #define CyLICR (0x26) 165 #define CyLIVR (0x09) 166 #define CySCRL (0x23) 167 #define CySCRH (0x22) 168 #define CyTFTC (0x80) 169 170 171 /* max number of chars in the FIFO */ 172 173 #define CyMAX_CHAR_FIFO 12 174 175 /***************************************************************************/ 176