2 * SyncLink Multiprotocol Serial Adapter Driver
4 * ==FILEDATE 19990810==
6 * Copyright (C) 1998 by Microgate Corporation
8 * Redistribution of this file is permitted under
9 * the terms of the GNU Public License (GPL)
35 #define BIT16 0x00010000
36 #define BIT17 0x00020000
37 #define BIT18 0x00040000
38 #define BIT19 0x00080000
39 #define BIT20 0x00100000
40 #define BIT21 0x00200000
41 #define BIT22 0x00400000
42 #define BIT23 0x00800000
43 #define BIT24 0x01000000
44 #define BIT25 0x02000000
45 #define BIT26 0x04000000
46 #define BIT27 0x08000000
47 #define BIT28 0x10000000
48 #define BIT29 0x20000000
49 #define BIT30 0x40000000
50 #define BIT31 0x80000000
53 #define HDLC_MAX_FRAME_SIZE 65535
54 #define MAX_ASYNC_TRANSMIT 4096
55 #define MAX_ASYNC_BUFFER_SIZE 4096
57 #define ASYNC_PARITY_NONE 0
58 #define ASYNC_PARITY_EVEN 1
59 #define ASYNC_PARITY_ODD 2
60 #define ASYNC_PARITY_SPACE 3
62 #define HDLC_FLAG_UNDERRUN_ABORT7 0x0000
63 #define HDLC_FLAG_UNDERRUN_ABORT15 0x0001
64 #define HDLC_FLAG_UNDERRUN_FLAG 0x0002
65 #define HDLC_FLAG_UNDERRUN_CRC 0x0004
66 #define HDLC_FLAG_SHARE_ZERO 0x0010
67 #define HDLC_FLAG_AUTO_CTS 0x0020
68 #define HDLC_FLAG_AUTO_DCD 0x0040
69 #define HDLC_FLAG_AUTO_RTS 0x0080
70 #define HDLC_FLAG_RXC_DPLL 0x0100
71 #define HDLC_FLAG_RXC_BRG 0x0200
72 #define HDLC_FLAG_RXC_TXCPIN 0x8000
73 #define HDLC_FLAG_RXC_RXCPIN 0x0000
74 #define HDLC_FLAG_TXC_DPLL 0x0400
75 #define HDLC_FLAG_TXC_BRG 0x0800
76 #define HDLC_FLAG_TXC_TXCPIN 0x0000
77 #define HDLC_FLAG_TXC_RXCPIN 0x0008
78 #define HDLC_FLAG_DPLL_DIV8 0x1000
79 #define HDLC_FLAG_DPLL_DIV16 0x2000
80 #define HDLC_FLAG_DPLL_DIV32 0x0000
81 #define HDLC_FLAG_HDLC_LOOPMODE 0x4000
83 #define HDLC_CRC_NONE 0
84 #define HDLC_CRC_16_CCITT 1
85 #define HDLC_CRC_32_CCITT 2
87 #define HDLC_TXIDLE_FLAGS 0
88 #define HDLC_TXIDLE_ALT_ZEROS_ONES 1
89 #define HDLC_TXIDLE_ZEROS 2
90 #define HDLC_TXIDLE_ONES 3
91 #define HDLC_TXIDLE_ALT_MARK_SPACE 4
92 #define HDLC_TXIDLE_SPACE 5
93 #define HDLC_TXIDLE_MARK 6
95 #define HDLC_ENCODING_NRZ 0
96 #define HDLC_ENCODING_NRZB 1
97 #define HDLC_ENCODING_NRZI_MARK 2
98 #define HDLC_ENCODING_NRZI_SPACE 3
99 #define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE
100 #define HDLC_ENCODING_BIPHASE_MARK 4
101 #define HDLC_ENCODING_BIPHASE_SPACE 5
102 #define HDLC_ENCODING_BIPHASE_LEVEL 6
103 #define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7
105 #define HDLC_PREAMBLE_LENGTH_8BITS 0
106 #define HDLC_PREAMBLE_LENGTH_16BITS 1
107 #define HDLC_PREAMBLE_LENGTH_32BITS 2
108 #define HDLC_PREAMBLE_LENGTH_64BITS 3
110 #define HDLC_PREAMBLE_PATTERN_NONE 0
111 #define HDLC_PREAMBLE_PATTERN_ZEROS 1
112 #define HDLC_PREAMBLE_PATTERN_FLAGS 2
113 #define HDLC_PREAMBLE_PATTERN_10 3
114 #define HDLC_PREAMBLE_PATTERN_01 4
115 #define HDLC_PREAMBLE_PATTERN_ONES 5
117 #define MGSL_MODE_ASYNC 1
118 #define MGSL_MODE_HDLC 2
120 #define MGSL_BUS_TYPE_ISA 1
121 #define MGSL_BUS_TYPE_EISA 2
122 #define MGSL_BUS_TYPE_PCI 5
124 typedef struct _MGSL_PARAMS
128 unsigned long mode
; /* Asynchronous or HDLC */
129 unsigned char loopback
; /* internal loopback mode */
133 unsigned short flags
;
134 unsigned char encoding
; /* NRZ, NRZI, etc. */
135 unsigned long clock_speed
; /* external clock speed in bits per second */
136 unsigned char addr_filter
; /* receive HDLC address filter, 0xFF = disable */
137 unsigned short crc_type
; /* None, CRC16-CCITT, or CRC32-CCITT */
138 unsigned char preamble_length
;
139 unsigned char preamble
;
143 unsigned long data_rate
; /* bits per second */
144 unsigned char data_bits
; /* 7 or 8 data bits */
145 unsigned char stop_bits
; /* 1 or 2 stop bits */
146 unsigned char parity
; /* none, even, or odd */
148 } MGSL_PARAMS
, *PMGSL_PARAMS
;
150 #define MICROGATE_VENDOR_ID 0x13c0
151 #define SYNCLINK_DEVICE_ID 0x0010
152 #define MGSL_MAX_SERIAL_NUMBER 30
155 ** device diagnostics status
158 #define DiagStatus_OK 0
159 #define DiagStatus_AddressFailure 1
160 #define DiagStatus_AddressConflict 2
161 #define DiagStatus_IrqFailure 3
162 #define DiagStatus_IrqConflict 4
163 #define DiagStatus_DmaFailure 5
164 #define DiagStatus_DmaConflict 6
165 #define DiagStatus_PciAdapterNotFound 7
166 #define DiagStatus_CantAssignPciResources 8
167 #define DiagStatus_CantAssignPciMemAddr 9
168 #define DiagStatus_CantAssignPciIoAddr 10
169 #define DiagStatus_CantAssignPciIrq 11
170 #define DiagStatus_MemoryError 12
172 #define SerialSignal_DCD 0x01 /* Data Carrier Detect */
173 #define SerialSignal_TXD 0x02 /* Transmit Data */
174 #define SerialSignal_RI 0x04 /* Ring Indicator */
175 #define SerialSignal_RXD 0x08 /* Receive Data */
176 #define SerialSignal_CTS 0x10 /* Clear to Send */
177 #define SerialSignal_RTS 0x20 /* Request to Send */
178 #define SerialSignal_DSR 0x40 /* Data Set Ready */
179 #define SerialSignal_DTR 0x80 /* Data Terminal Ready */
183 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
186 __u32 cts
, dsr
, rng
, dcd
, tx
, rx
;
187 __u32 frame
, parity
, overrun
, brk
;
204 #define DEBUG_LEVEL_DATA 1
205 #define DEBUG_LEVEL_ERROR 2
206 #define DEBUG_LEVEL_INFO 3
207 #define DEBUG_LEVEL_BH 4
208 #define DEBUG_LEVEL_ISR 5
211 ** Event bit flags for use with MgslWaitEvent
214 #define MgslEvent_DsrActive 0x0001
215 #define MgslEvent_DsrInactive 0x0002
216 #define MgslEvent_Dsr 0x0003
217 #define MgslEvent_CtsActive 0x0004
218 #define MgslEvent_CtsInactive 0x0008
219 #define MgslEvent_Cts 0x000c
220 #define MgslEvent_DcdActive 0x0010
221 #define MgslEvent_DcdInactive 0x0020
222 #define MgslEvent_Dcd 0x0030
223 #define MgslEvent_RiActive 0x0040
224 #define MgslEvent_RiInactive 0x0080
225 #define MgslEvent_Ri 0x00c0
226 #define MgslEvent_ExitHuntMode 0x0100
227 #define MgslEvent_IdleReceived 0x0200
229 /* Private IOCTL codes:
231 * MGSL_IOCSPARAMS set MGSL_PARAMS structure values
232 * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values
233 * MGSL_IOCSTXIDLE set current transmit idle mode
234 * MGSL_IOCGTXIDLE get current transmit idle mode
235 * MGSL_IOCTXENABLE enable or disable transmitter
236 * MGSL_IOCRXENABLE enable or disable receiver
237 * MGSL_IOCTXABORT abort transmitting frame (HDLC)
238 * MGSL_IOCGSTATS return current statistics
239 * MGSL_IOCWAITEVENT wait for specified event to occur
240 * MGSL_LOOPTXDONE transmit in HDLC LoopMode done
242 #define MGSL_MAGIC_IOC 'm'
243 #define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS)
244 #define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS)
245 #define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2)
246 #define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3)
247 #define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4)
248 #define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5)
249 #define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6)
250 #define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7)
251 #define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int)
252 #define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15)
253 #define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
255 #endif /* _SYNCLINK_H_ */