source: svn/trunk/newcon3bcm2_21bu/toolchain/mipsel-linux-uclibc/include/linux/synclink.h @ 52

Last change on this file since 52 was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 7.7 KB
Line 
1/*
2 * SyncLink Multiprotocol Serial Adapter Driver
3 *
4 *
5 * Copyright (C) 1998-2000 by Microgate Corporation
6 *
7 * Redistribution of this file is permitted under
8 * the terms of the GNU Public License (GPL)
9 */
10
11#ifndef _SYNCLINK_H_
12#define _SYNCLINK_H_
13#define SYNCLINK_H_VERSION 3.6
14
15#include <asm/types.h>
16
17#define BOOLEAN int
18#define TRUE 1
19#define FALSE 0
20
21#define BIT0    0x0001
22#define BIT1    0x0002
23#define BIT2    0x0004
24#define BIT3    0x0008
25#define BIT4    0x0010
26#define BIT5    0x0020
27#define BIT6    0x0040
28#define BIT7    0x0080
29#define BIT8    0x0100
30#define BIT9    0x0200
31#define BIT10   0x0400
32#define BIT11   0x0800
33#define BIT12   0x1000
34#define BIT13   0x2000
35#define BIT14   0x4000
36#define BIT15   0x8000
37#define BIT16   0x00010000
38#define BIT17   0x00020000
39#define BIT18   0x00040000
40#define BIT19   0x00080000
41#define BIT20   0x00100000
42#define BIT21   0x00200000
43#define BIT22   0x00400000
44#define BIT23   0x00800000
45#define BIT24   0x01000000
46#define BIT25   0x02000000
47#define BIT26   0x04000000
48#define BIT27   0x08000000
49#define BIT28   0x10000000
50#define BIT29   0x20000000
51#define BIT30   0x40000000
52#define BIT31   0x80000000
53
54
55#define HDLC_MAX_FRAME_SIZE     65535
56#define MAX_ASYNC_TRANSMIT      4096
57#define MAX_ASYNC_BUFFER_SIZE   4096
58
59#define ASYNC_PARITY_NONE               0
60#define ASYNC_PARITY_EVEN               1
61#define ASYNC_PARITY_ODD                2
62#define ASYNC_PARITY_SPACE              3
63
64#define HDLC_FLAG_UNDERRUN_ABORT7       0x0000
65#define HDLC_FLAG_UNDERRUN_ABORT15      0x0001
66#define HDLC_FLAG_UNDERRUN_FLAG         0x0002
67#define HDLC_FLAG_UNDERRUN_CRC          0x0004
68#define HDLC_FLAG_SHARE_ZERO            0x0010
69#define HDLC_FLAG_AUTO_CTS              0x0020
70#define HDLC_FLAG_AUTO_DCD              0x0040
71#define HDLC_FLAG_AUTO_RTS              0x0080
72#define HDLC_FLAG_RXC_DPLL              0x0100
73#define HDLC_FLAG_RXC_BRG               0x0200
74#define HDLC_FLAG_RXC_TXCPIN            0x8000
75#define HDLC_FLAG_RXC_RXCPIN            0x0000
76#define HDLC_FLAG_TXC_DPLL              0x0400
77#define HDLC_FLAG_TXC_BRG               0x0800
78#define HDLC_FLAG_TXC_TXCPIN            0x0000
79#define HDLC_FLAG_TXC_RXCPIN            0x0008
80#define HDLC_FLAG_DPLL_DIV8             0x1000
81#define HDLC_FLAG_DPLL_DIV16            0x2000
82#define HDLC_FLAG_DPLL_DIV32            0x0000
83#define HDLC_FLAG_HDLC_LOOPMODE         0x4000
84
85#define HDLC_CRC_NONE                   0
86#define HDLC_CRC_16_CCITT               1
87#define HDLC_CRC_32_CCITT               2
88#define HDLC_CRC_MASK                   0x00ff
89#define HDLC_CRC_RETURN_EX              0x8000
90
91#define RX_OK                           0
92#define RX_CRC_ERROR                    1
93
94#define HDLC_TXIDLE_FLAGS               0
95#define HDLC_TXIDLE_ALT_ZEROS_ONES      1
96#define HDLC_TXIDLE_ZEROS               2
97#define HDLC_TXIDLE_ONES                3
98#define HDLC_TXIDLE_ALT_MARK_SPACE      4
99#define HDLC_TXIDLE_SPACE               5
100#define HDLC_TXIDLE_MARK                6
101
102#define HDLC_ENCODING_NRZ                       0
103#define HDLC_ENCODING_NRZB                      1
104#define HDLC_ENCODING_NRZI_MARK                 2
105#define HDLC_ENCODING_NRZI_SPACE                3
106#define HDLC_ENCODING_NRZI                      HDLC_ENCODING_NRZI_SPACE
107#define HDLC_ENCODING_BIPHASE_MARK              4
108#define HDLC_ENCODING_BIPHASE_SPACE             5
109#define HDLC_ENCODING_BIPHASE_LEVEL             6
110#define HDLC_ENCODING_DIFF_BIPHASE_LEVEL        7
111
112#define HDLC_PREAMBLE_LENGTH_8BITS      0
113#define HDLC_PREAMBLE_LENGTH_16BITS     1
114#define HDLC_PREAMBLE_LENGTH_32BITS     2
115#define HDLC_PREAMBLE_LENGTH_64BITS     3
116
117#define HDLC_PREAMBLE_PATTERN_NONE      0
118#define HDLC_PREAMBLE_PATTERN_ZEROS     1
119#define HDLC_PREAMBLE_PATTERN_FLAGS     2
120#define HDLC_PREAMBLE_PATTERN_10        3
121#define HDLC_PREAMBLE_PATTERN_01        4
122#define HDLC_PREAMBLE_PATTERN_ONES      5
123
124#define MGSL_MODE_ASYNC         1
125#define MGSL_MODE_HDLC          2
126#define MGSL_MODE_RAW           6
127
128#define MGSL_BUS_TYPE_ISA       1
129#define MGSL_BUS_TYPE_EISA      2
130#define MGSL_BUS_TYPE_PCI       5
131
132#define MGSL_INTERFACE_DISABLE  0
133#define MGSL_INTERFACE_RS232    1
134#define MGSL_INTERFACE_V35      2
135#define MGSL_INTERFACE_RS422    3
136
137typedef struct _MGSL_PARAMS
138{
139        /* Common */
140
141        unsigned long   mode;           /* Asynchronous or HDLC */
142        unsigned char   loopback;       /* internal loopback mode */
143
144        /* HDLC Only */
145
146        unsigned short  flags;
147        unsigned char   encoding;       /* NRZ, NRZI, etc. */
148        unsigned long   clock_speed;    /* external clock speed in bits per second */
149        unsigned char   addr_filter;    /* receive HDLC address filter, 0xFF = disable */
150        unsigned short  crc_type;       /* None, CRC16-CCITT, or CRC32-CCITT */
151        unsigned char   preamble_length;
152        unsigned char   preamble;
153
154        /* Async Only */
155
156        unsigned long   data_rate;      /* bits per second */
157        unsigned char   data_bits;      /* 7 or 8 data bits */
158        unsigned char   stop_bits;      /* 1 or 2 stop bits */
159        unsigned char   parity;         /* none, even, or odd */
160
161} MGSL_PARAMS, *PMGSL_PARAMS;
162
163#define MICROGATE_VENDOR_ID 0x13c0
164#define SYNCLINK_DEVICE_ID 0x0010
165#define MGSCC_DEVICE_ID 0x0020
166#define SYNCLINK_SCA_DEVICE_ID 0x0030
167#define MGSL_MAX_SERIAL_NUMBER 30
168
169/*
170** device diagnostics status
171*/
172
173#define DiagStatus_OK                           0
174#define DiagStatus_AddressFailure               1
175#define DiagStatus_AddressConflict              2
176#define DiagStatus_IrqFailure                   3
177#define DiagStatus_IrqConflict                  4
178#define DiagStatus_DmaFailure                   5
179#define DiagStatus_DmaConflict                  6
180#define DiagStatus_PciAdapterNotFound           7
181#define DiagStatus_CantAssignPciResources       8
182#define DiagStatus_CantAssignPciMemAddr         9
183#define DiagStatus_CantAssignPciIoAddr          10
184#define DiagStatus_CantAssignPciIrq             11
185#define DiagStatus_MemoryError                  12
186
187#define SerialSignal_DCD            0x01     /* Data Carrier Detect */
188#define SerialSignal_TXD            0x02     /* Transmit Data */
189#define SerialSignal_RI             0x04     /* Ring Indicator */
190#define SerialSignal_RXD            0x08     /* Receive Data */
191#define SerialSignal_CTS            0x10     /* Clear to Send */
192#define SerialSignal_RTS            0x20     /* Request to Send */
193#define SerialSignal_DSR            0x40     /* Data Set Ready */
194#define SerialSignal_DTR            0x80     /* Data Terminal Ready */
195
196
197/*
198 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
199 */
200struct mgsl_icount {
201        __u32   cts, dsr, rng, dcd, tx, rx;
202        __u32   frame, parity, overrun, brk;
203        __u32   buf_overrun;
204        __u32   txok;
205        __u32   txunder;
206        __u32   txabort;
207        __u32   txtimeout;
208        __u32   rxshort;
209        __u32   rxlong;
210        __u32   rxabort;
211        __u32   rxover;
212        __u32   rxcrc;
213        __u32   rxok;
214        __u32   exithunt;
215        __u32   rxidle;
216};
217
218
219#define DEBUG_LEVEL_DATA        1
220#define DEBUG_LEVEL_ERROR       2
221#define DEBUG_LEVEL_INFO        3
222#define DEBUG_LEVEL_BH          4
223#define DEBUG_LEVEL_ISR         5
224
225/*
226** Event bit flags for use with MgslWaitEvent
227*/
228
229#define MgslEvent_DsrActive     0x0001
230#define MgslEvent_DsrInactive   0x0002
231#define MgslEvent_Dsr           0x0003
232#define MgslEvent_CtsActive     0x0004
233#define MgslEvent_CtsInactive   0x0008
234#define MgslEvent_Cts           0x000c
235#define MgslEvent_DcdActive     0x0010
236#define MgslEvent_DcdInactive   0x0020
237#define MgslEvent_Dcd           0x0030
238#define MgslEvent_RiActive      0x0040
239#define MgslEvent_RiInactive    0x0080
240#define MgslEvent_Ri            0x00c0
241#define MgslEvent_ExitHuntMode  0x0100
242#define MgslEvent_IdleReceived  0x0200
243
244/* Private IOCTL codes:
245 *
246 * MGSL_IOCSPARAMS      set MGSL_PARAMS structure values
247 * MGSL_IOCGPARAMS      get current MGSL_PARAMS structure values
248 * MGSL_IOCSTXIDLE      set current transmit idle mode
249 * MGSL_IOCGTXIDLE      get current transmit idle mode
250 * MGSL_IOCTXENABLE     enable or disable transmitter
251 * MGSL_IOCRXENABLE     enable or disable receiver
252 * MGSL_IOCTXABORT      abort transmitting frame (HDLC)
253 * MGSL_IOCGSTATS       return current statistics
254 * MGSL_IOCWAITEVENT    wait for specified event to occur
255 * MGSL_LOOPTXDONE      transmit in HDLC LoopMode done
256 * MGSL_IOCSIF          set the serial interface type
257 * MGSL_IOCGIF          get the serial interface type
258 */
259#define MGSL_MAGIC_IOC  'm'
260#define MGSL_IOCSPARAMS         _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS)
261#define MGSL_IOCGPARAMS         _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS)
262#define MGSL_IOCSTXIDLE         _IO(MGSL_MAGIC_IOC,2)
263#define MGSL_IOCGTXIDLE         _IO(MGSL_MAGIC_IOC,3)
264#define MGSL_IOCTXENABLE        _IO(MGSL_MAGIC_IOC,4)
265#define MGSL_IOCRXENABLE        _IO(MGSL_MAGIC_IOC,5)
266#define MGSL_IOCTXABORT         _IO(MGSL_MAGIC_IOC,6)
267#define MGSL_IOCGSTATS          _IO(MGSL_MAGIC_IOC,7)
268#define MGSL_IOCWAITEVENT       _IOWR(MGSL_MAGIC_IOC,8,int)
269#define MGSL_IOCCLRMODCOUNT     _IO(MGSL_MAGIC_IOC,15)
270#define MGSL_IOCLOOPTXDONE      _IO(MGSL_MAGIC_IOC,9)
271#define MGSL_IOCSIF             _IO(MGSL_MAGIC_IOC,10)
272#define MGSL_IOCGIF             _IO(MGSL_MAGIC_IOC,11)
273
274#endif /* _SYNCLINK_H_ */
Note: See TracBrowser for help on using the repository browser.