synclink.h 8.4 KB

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