0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef _UAPI_SYNCLINK_H_
0014 #define _UAPI_SYNCLINK_H_
0015 #define SYNCLINK_H_VERSION 3.6
0016
0017 #include <linux/types.h>
0018
0019 #define BIT0 0x0001
0020 #define BIT1 0x0002
0021 #define BIT2 0x0004
0022 #define BIT3 0x0008
0023 #define BIT4 0x0010
0024 #define BIT5 0x0020
0025 #define BIT6 0x0040
0026 #define BIT7 0x0080
0027 #define BIT8 0x0100
0028 #define BIT9 0x0200
0029 #define BIT10 0x0400
0030 #define BIT11 0x0800
0031 #define BIT12 0x1000
0032 #define BIT13 0x2000
0033 #define BIT14 0x4000
0034 #define BIT15 0x8000
0035 #define BIT16 0x00010000
0036 #define BIT17 0x00020000
0037 #define BIT18 0x00040000
0038 #define BIT19 0x00080000
0039 #define BIT20 0x00100000
0040 #define BIT21 0x00200000
0041 #define BIT22 0x00400000
0042 #define BIT23 0x00800000
0043 #define BIT24 0x01000000
0044 #define BIT25 0x02000000
0045 #define BIT26 0x04000000
0046 #define BIT27 0x08000000
0047 #define BIT28 0x10000000
0048 #define BIT29 0x20000000
0049 #define BIT30 0x40000000
0050 #define BIT31 0x80000000
0051
0052
0053 #define HDLC_MAX_FRAME_SIZE 65535
0054 #define MAX_ASYNC_TRANSMIT 4096
0055 #define MAX_ASYNC_BUFFER_SIZE 4096
0056
0057 #define ASYNC_PARITY_NONE 0
0058 #define ASYNC_PARITY_EVEN 1
0059 #define ASYNC_PARITY_ODD 2
0060 #define ASYNC_PARITY_SPACE 3
0061
0062 #define HDLC_FLAG_UNDERRUN_ABORT7 0x0000
0063 #define HDLC_FLAG_UNDERRUN_ABORT15 0x0001
0064 #define HDLC_FLAG_UNDERRUN_FLAG 0x0002
0065 #define HDLC_FLAG_UNDERRUN_CRC 0x0004
0066 #define HDLC_FLAG_SHARE_ZERO 0x0010
0067 #define HDLC_FLAG_AUTO_CTS 0x0020
0068 #define HDLC_FLAG_AUTO_DCD 0x0040
0069 #define HDLC_FLAG_AUTO_RTS 0x0080
0070 #define HDLC_FLAG_RXC_DPLL 0x0100
0071 #define HDLC_FLAG_RXC_BRG 0x0200
0072 #define HDLC_FLAG_RXC_TXCPIN 0x8000
0073 #define HDLC_FLAG_RXC_RXCPIN 0x0000
0074 #define HDLC_FLAG_TXC_DPLL 0x0400
0075 #define HDLC_FLAG_TXC_BRG 0x0800
0076 #define HDLC_FLAG_TXC_TXCPIN 0x0000
0077 #define HDLC_FLAG_TXC_RXCPIN 0x0008
0078 #define HDLC_FLAG_DPLL_DIV8 0x1000
0079 #define HDLC_FLAG_DPLL_DIV16 0x2000
0080 #define HDLC_FLAG_DPLL_DIV32 0x0000
0081 #define HDLC_FLAG_HDLC_LOOPMODE 0x4000
0082
0083 #define HDLC_CRC_NONE 0
0084 #define HDLC_CRC_16_CCITT 1
0085 #define HDLC_CRC_32_CCITT 2
0086 #define HDLC_CRC_MASK 0x00ff
0087 #define HDLC_CRC_RETURN_EX 0x8000
0088
0089 #define RX_OK 0
0090 #define RX_CRC_ERROR 1
0091
0092 #define HDLC_TXIDLE_FLAGS 0
0093 #define HDLC_TXIDLE_ALT_ZEROS_ONES 1
0094 #define HDLC_TXIDLE_ZEROS 2
0095 #define HDLC_TXIDLE_ONES 3
0096 #define HDLC_TXIDLE_ALT_MARK_SPACE 4
0097 #define HDLC_TXIDLE_SPACE 5
0098 #define HDLC_TXIDLE_MARK 6
0099 #define HDLC_TXIDLE_CUSTOM_8 0x10000000
0100 #define HDLC_TXIDLE_CUSTOM_16 0x20000000
0101
0102 #define HDLC_ENCODING_NRZ 0
0103 #define HDLC_ENCODING_NRZB 1
0104 #define HDLC_ENCODING_NRZI_MARK 2
0105 #define HDLC_ENCODING_NRZI_SPACE 3
0106 #define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE
0107 #define HDLC_ENCODING_BIPHASE_MARK 4
0108 #define HDLC_ENCODING_BIPHASE_SPACE 5
0109 #define HDLC_ENCODING_BIPHASE_LEVEL 6
0110 #define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7
0111
0112 #define HDLC_PREAMBLE_LENGTH_8BITS 0
0113 #define HDLC_PREAMBLE_LENGTH_16BITS 1
0114 #define HDLC_PREAMBLE_LENGTH_32BITS 2
0115 #define HDLC_PREAMBLE_LENGTH_64BITS 3
0116
0117 #define HDLC_PREAMBLE_PATTERN_NONE 0
0118 #define HDLC_PREAMBLE_PATTERN_ZEROS 1
0119 #define HDLC_PREAMBLE_PATTERN_FLAGS 2
0120 #define HDLC_PREAMBLE_PATTERN_10 3
0121 #define HDLC_PREAMBLE_PATTERN_01 4
0122 #define HDLC_PREAMBLE_PATTERN_ONES 5
0123
0124 #define MGSL_MODE_ASYNC 1
0125 #define MGSL_MODE_HDLC 2
0126 #define MGSL_MODE_MONOSYNC 3
0127 #define MGSL_MODE_BISYNC 4
0128 #define MGSL_MODE_RAW 6
0129 #define MGSL_MODE_BASE_CLOCK 7
0130 #define MGSL_MODE_XSYNC 8
0131
0132 #define MGSL_BUS_TYPE_ISA 1
0133 #define MGSL_BUS_TYPE_EISA 2
0134 #define MGSL_BUS_TYPE_PCI 5
0135
0136 #define MGSL_INTERFACE_MASK 0xf
0137 #define MGSL_INTERFACE_DISABLE 0
0138 #define MGSL_INTERFACE_RS232 1
0139 #define MGSL_INTERFACE_V35 2
0140 #define MGSL_INTERFACE_RS422 3
0141 #define MGSL_INTERFACE_RTS_EN 0x10
0142 #define MGSL_INTERFACE_LL 0x20
0143 #define MGSL_INTERFACE_RL 0x40
0144 #define MGSL_INTERFACE_MSB_FIRST 0x80
0145
0146 typedef struct _MGSL_PARAMS
0147 {
0148
0149
0150 unsigned long mode;
0151 unsigned char loopback;
0152
0153
0154
0155 unsigned short flags;
0156 unsigned char encoding;
0157 unsigned long clock_speed;
0158 unsigned char addr_filter;
0159 unsigned short crc_type;
0160 unsigned char preamble_length;
0161 unsigned char preamble;
0162
0163
0164
0165 unsigned long data_rate;
0166 unsigned char data_bits;
0167 unsigned char stop_bits;
0168 unsigned char parity;
0169
0170 } MGSL_PARAMS, *PMGSL_PARAMS;
0171
0172 #define MICROGATE_VENDOR_ID 0x13c0
0173 #define SYNCLINK_DEVICE_ID 0x0010
0174 #define MGSCC_DEVICE_ID 0x0020
0175 #define SYNCLINK_SCA_DEVICE_ID 0x0030
0176 #define SYNCLINK_GT_DEVICE_ID 0x0070
0177 #define SYNCLINK_GT4_DEVICE_ID 0x0080
0178 #define SYNCLINK_AC_DEVICE_ID 0x0090
0179 #define SYNCLINK_GT2_DEVICE_ID 0x00A0
0180 #define MGSL_MAX_SERIAL_NUMBER 30
0181
0182
0183
0184
0185
0186 #define DiagStatus_OK 0
0187 #define DiagStatus_AddressFailure 1
0188 #define DiagStatus_AddressConflict 2
0189 #define DiagStatus_IrqFailure 3
0190 #define DiagStatus_IrqConflict 4
0191 #define DiagStatus_DmaFailure 5
0192 #define DiagStatus_DmaConflict 6
0193 #define DiagStatus_PciAdapterNotFound 7
0194 #define DiagStatus_CantAssignPciResources 8
0195 #define DiagStatus_CantAssignPciMemAddr 9
0196 #define DiagStatus_CantAssignPciIoAddr 10
0197 #define DiagStatus_CantAssignPciIrq 11
0198 #define DiagStatus_MemoryError 12
0199
0200 #define SerialSignal_DCD 0x01
0201 #define SerialSignal_TXD 0x02
0202 #define SerialSignal_RI 0x04
0203 #define SerialSignal_RXD 0x08
0204 #define SerialSignal_CTS 0x10
0205 #define SerialSignal_RTS 0x20
0206 #define SerialSignal_DSR 0x40
0207 #define SerialSignal_DTR 0x80
0208
0209
0210
0211
0212
0213 struct mgsl_icount {
0214 __u32 cts, dsr, rng, dcd, tx, rx;
0215 __u32 frame, parity, overrun, brk;
0216 __u32 buf_overrun;
0217 __u32 txok;
0218 __u32 txunder;
0219 __u32 txabort;
0220 __u32 txtimeout;
0221 __u32 rxshort;
0222 __u32 rxlong;
0223 __u32 rxabort;
0224 __u32 rxover;
0225 __u32 rxcrc;
0226 __u32 rxok;
0227 __u32 exithunt;
0228 __u32 rxidle;
0229 };
0230
0231 struct gpio_desc {
0232 __u32 state;
0233 __u32 smask;
0234 __u32 dir;
0235 __u32 dmask;
0236 };
0237
0238 #define DEBUG_LEVEL_DATA 1
0239 #define DEBUG_LEVEL_ERROR 2
0240 #define DEBUG_LEVEL_INFO 3
0241 #define DEBUG_LEVEL_BH 4
0242 #define DEBUG_LEVEL_ISR 5
0243
0244
0245
0246
0247
0248 #define MgslEvent_DsrActive 0x0001
0249 #define MgslEvent_DsrInactive 0x0002
0250 #define MgslEvent_Dsr 0x0003
0251 #define MgslEvent_CtsActive 0x0004
0252 #define MgslEvent_CtsInactive 0x0008
0253 #define MgslEvent_Cts 0x000c
0254 #define MgslEvent_DcdActive 0x0010
0255 #define MgslEvent_DcdInactive 0x0020
0256 #define MgslEvent_Dcd 0x0030
0257 #define MgslEvent_RiActive 0x0040
0258 #define MgslEvent_RiInactive 0x0080
0259 #define MgslEvent_Ri 0x00c0
0260 #define MgslEvent_ExitHuntMode 0x0100
0261 #define MgslEvent_IdleReceived 0x0200
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278 #define MGSL_MAGIC_IOC 'm'
0279 #define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS)
0280 #define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS)
0281 #define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2)
0282 #define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3)
0283 #define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4)
0284 #define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5)
0285 #define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6)
0286 #define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7)
0287 #define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int)
0288 #define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15)
0289 #define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
0290 #define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10)
0291 #define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11)
0292 #define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
0293 #define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
0294 #define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
0295 #define MGSL_IOCSXSYNC _IO(MGSL_MAGIC_IOC, 19)
0296 #define MGSL_IOCGXSYNC _IO(MGSL_MAGIC_IOC, 20)
0297 #define MGSL_IOCSXCTRL _IO(MGSL_MAGIC_IOC, 21)
0298 #define MGSL_IOCGXCTRL _IO(MGSL_MAGIC_IOC, 22)
0299
0300
0301 #endif