lmc_ioctl.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #ifndef _LMC_IOCTL_H_
  2. #define _LMC_IOCTL_H_
  3. /* $Id: lmc_ioctl.h,v 1.15 2000/04/06 12:16:43 asj Exp $ */
  4. /*
  5. * Copyright (c) 1997-2000 LAN Media Corporation (LMC)
  6. * All rights reserved. www.lanmedia.com
  7. *
  8. * This code is written by:
  9. * Andrew Stanley-Jones (asj@cban.com)
  10. * Rob Braun (bbraun@vix.com),
  11. * Michael Graff (explorer@vix.com) and
  12. * Matt Thomas (matt@3am-software.com).
  13. *
  14. * This software may be used and distributed according to the terms
  15. * of the GNU General Public License version 2, incorporated herein by reference.
  16. */
  17. #define LMCIOCGINFO SIOCDEVPRIVATE+3 /* get current state */
  18. #define LMCIOCSINFO SIOCDEVPRIVATE+4 /* set state to user values */
  19. #define LMCIOCGETLMCSTATS SIOCDEVPRIVATE+5
  20. #define LMCIOCCLEARLMCSTATS SIOCDEVPRIVATE+6
  21. #define LMCIOCDUMPEVENTLOG SIOCDEVPRIVATE+7
  22. #define LMCIOCGETXINFO SIOCDEVPRIVATE+8
  23. #define LMCIOCSETCIRCUIT SIOCDEVPRIVATE+9
  24. #define LMCIOCUNUSEDATM SIOCDEVPRIVATE+10
  25. #define LMCIOCRESET SIOCDEVPRIVATE+11
  26. #define LMCIOCT1CONTROL SIOCDEVPRIVATE+12
  27. #define LMCIOCIFTYPE SIOCDEVPRIVATE+13
  28. #define LMCIOCXILINX SIOCDEVPRIVATE+14
  29. #define LMC_CARDTYPE_UNKNOWN -1
  30. #define LMC_CARDTYPE_HSSI 1 /* probed card is a HSSI card */
  31. #define LMC_CARDTYPE_DS3 2 /* probed card is a DS3 card */
  32. #define LMC_CARDTYPE_SSI 3 /* probed card is a SSI card */
  33. #define LMC_CARDTYPE_T1 4 /* probed card is a T1 card */
  34. #define LMC_CTL_CARDTYPE_LMC5200 0 /* HSSI */
  35. #define LMC_CTL_CARDTYPE_LMC5245 1 /* DS3 */
  36. #define LMC_CTL_CARDTYPE_LMC1000 2 /* SSI, V.35 */
  37. #define LMC_CTL_CARDTYPE_LMC1200 3 /* DS1 */
  38. #define LMC_CTL_OFF 0 /* generic OFF value */
  39. #define LMC_CTL_ON 1 /* generic ON value */
  40. #define LMC_CTL_CLOCK_SOURCE_EXT 0 /* clock off line */
  41. #define LMC_CTL_CLOCK_SOURCE_INT 1 /* internal clock */
  42. #define LMC_CTL_CRC_LENGTH_16 16
  43. #define LMC_CTL_CRC_LENGTH_32 32
  44. #define LMC_CTL_CRC_BYTESIZE_2 2
  45. #define LMC_CTL_CRC_BYTESIZE_4 4
  46. #define LMC_CTL_CABLE_LENGTH_LT_100FT 0 /* DS3 cable < 100 feet */
  47. #define LMC_CTL_CABLE_LENGTH_GT_100FT 1 /* DS3 cable >= 100 feet */
  48. #define LMC_CTL_CIRCUIT_TYPE_E1 0
  49. #define LMC_CTL_CIRCUIT_TYPE_T1 1
  50. /*
  51. * IFTYPE defines
  52. */
  53. #define LMC_PPP 1 /* use generic HDLC interface */
  54. #define LMC_NET 2 /* use direct net interface */
  55. #define LMC_RAW 3 /* use direct net interface */
  56. /*
  57. * These are not in the least IOCTL related, but I want them common.
  58. */
  59. /*
  60. * assignments for the GPIO register on the DEC chip (common)
  61. */
  62. #define LMC_GEP_INIT 0x01 /* 0: */
  63. #define LMC_GEP_RESET 0x02 /* 1: */
  64. #define LMC_GEP_MODE 0x10 /* 4: */
  65. #define LMC_GEP_DP 0x20 /* 5: */
  66. #define LMC_GEP_DATA 0x40 /* 6: serial out */
  67. #define LMC_GEP_CLK 0x80 /* 7: serial clock */
  68. /*
  69. * HSSI GPIO assignments
  70. */
  71. #define LMC_GEP_HSSI_ST 0x04 /* 2: receive timing sense (deprecated) */
  72. #define LMC_GEP_HSSI_CLOCK 0x08 /* 3: clock source */
  73. /*
  74. * T1 GPIO assignments
  75. */
  76. #define LMC_GEP_SSI_GENERATOR 0x04 /* 2: enable prog freq gen serial i/f */
  77. #define LMC_GEP_SSI_TXCLOCK 0x08 /* 3: provide clock on TXCLOCK output */
  78. /*
  79. * Common MII16 bits
  80. */
  81. #define LMC_MII16_LED0 0x0080
  82. #define LMC_MII16_LED1 0x0100
  83. #define LMC_MII16_LED2 0x0200
  84. #define LMC_MII16_LED3 0x0400 /* Error, and the red one */
  85. #define LMC_MII16_LED_ALL 0x0780 /* LED bit mask */
  86. #define LMC_MII16_FIFO_RESET 0x0800
  87. /*
  88. * definitions for HSSI
  89. */
  90. #define LMC_MII16_HSSI_TA 0x0001
  91. #define LMC_MII16_HSSI_CA 0x0002
  92. #define LMC_MII16_HSSI_LA 0x0004
  93. #define LMC_MII16_HSSI_LB 0x0008
  94. #define LMC_MII16_HSSI_LC 0x0010
  95. #define LMC_MII16_HSSI_TM 0x0020
  96. #define LMC_MII16_HSSI_CRC 0x0040
  97. /*
  98. * assignments for the MII register 16 (DS3)
  99. */
  100. #define LMC_MII16_DS3_ZERO 0x0001
  101. #define LMC_MII16_DS3_TRLBK 0x0002
  102. #define LMC_MII16_DS3_LNLBK 0x0004
  103. #define LMC_MII16_DS3_RAIS 0x0008
  104. #define LMC_MII16_DS3_TAIS 0x0010
  105. #define LMC_MII16_DS3_BIST 0x0020
  106. #define LMC_MII16_DS3_DLOS 0x0040
  107. #define LMC_MII16_DS3_CRC 0x1000
  108. #define LMC_MII16_DS3_SCRAM 0x2000
  109. #define LMC_MII16_DS3_SCRAM_LARS 0x4000
  110. /* Note: 2 pairs of LEDs where swapped by mistake
  111. * in Xilinx code for DS3 & DS1 adapters */
  112. #define LMC_DS3_LED0 0x0100 /* bit 08 yellow */
  113. #define LMC_DS3_LED1 0x0080 /* bit 07 blue */
  114. #define LMC_DS3_LED2 0x0400 /* bit 10 green */
  115. #define LMC_DS3_LED3 0x0200 /* bit 09 red */
  116. /*
  117. * framer register 0 and 7 (7 is latched and reset on read)
  118. */
  119. #define LMC_FRAMER_REG0_DLOS 0x80 /* digital loss of service */
  120. #define LMC_FRAMER_REG0_OOFS 0x40 /* out of frame sync */
  121. #define LMC_FRAMER_REG0_AIS 0x20 /* alarm indication signal */
  122. #define LMC_FRAMER_REG0_CIS 0x10 /* channel idle */
  123. #define LMC_FRAMER_REG0_LOC 0x08 /* loss of clock */
  124. /*
  125. * Framer register 9 contains the blue alarm signal
  126. */
  127. #define LMC_FRAMER_REG9_RBLUE 0x02 /* Blue alarm failure */
  128. /*
  129. * Framer register 0x10 contains xbit error
  130. */
  131. #define LMC_FRAMER_REG10_XBIT 0x01 /* X bit error alarm failure */
  132. /*
  133. * And SSI, LMC1000
  134. */
  135. #define LMC_MII16_SSI_DTR 0x0001 /* DTR output RW */
  136. #define LMC_MII16_SSI_DSR 0x0002 /* DSR input RO */
  137. #define LMC_MII16_SSI_RTS 0x0004 /* RTS output RW */
  138. #define LMC_MII16_SSI_CTS 0x0008 /* CTS input RO */
  139. #define LMC_MII16_SSI_DCD 0x0010 /* DCD input RO */
  140. #define LMC_MII16_SSI_RI 0x0020 /* RI input RO */
  141. #define LMC_MII16_SSI_CRC 0x1000 /* CRC select - RW */
  142. /*
  143. * bits 0x0080 through 0x0800 are generic, and described
  144. * above with LMC_MII16_LED[0123] _LED_ALL, and _FIFO_RESET
  145. */
  146. #define LMC_MII16_SSI_LL 0x1000 /* LL output RW */
  147. #define LMC_MII16_SSI_RL 0x2000 /* RL output RW */
  148. #define LMC_MII16_SSI_TM 0x4000 /* TM input RO */
  149. #define LMC_MII16_SSI_LOOP 0x8000 /* loopback enable RW */
  150. /*
  151. * Some of the MII16 bits are mirrored in the MII17 register as well,
  152. * but let's keep thing separate for now, and get only the cable from
  153. * the MII17.
  154. */
  155. #define LMC_MII17_SSI_CABLE_MASK 0x0038 /* mask to extract the cable type */
  156. #define LMC_MII17_SSI_CABLE_SHIFT 3 /* shift to extract the cable type */
  157. /*
  158. * And T1, LMC1200
  159. */
  160. #define LMC_MII16_T1_UNUSED1 0x0003
  161. #define LMC_MII16_T1_XOE 0x0004
  162. #define LMC_MII16_T1_RST 0x0008 /* T1 chip reset - RW */
  163. #define LMC_MII16_T1_Z 0x0010 /* output impedance T1=1, E1=0 output - RW */
  164. #define LMC_MII16_T1_INTR 0x0020 /* interrupt from 8370 - RO */
  165. #define LMC_MII16_T1_ONESEC 0x0040 /* one second square wave - ro */
  166. #define LMC_MII16_T1_LED0 0x0100
  167. #define LMC_MII16_T1_LED1 0x0080
  168. #define LMC_MII16_T1_LED2 0x0400
  169. #define LMC_MII16_T1_LED3 0x0200
  170. #define LMC_MII16_T1_FIFO_RESET 0x0800
  171. #define LMC_MII16_T1_CRC 0x1000 /* CRC select - RW */
  172. #define LMC_MII16_T1_UNUSED2 0xe000
  173. /* 8370 framer registers */
  174. #define T1FRAMER_ALARM1_STATUS 0x47
  175. #define T1FRAMER_ALARM2_STATUS 0x48
  176. #define T1FRAMER_FERR_LSB 0x50
  177. #define T1FRAMER_FERR_MSB 0x51 /* framing bit error counter */
  178. #define T1FRAMER_LCV_LSB 0x54
  179. #define T1FRAMER_LCV_MSB 0x55 /* line code violation counter */
  180. #define T1FRAMER_AERR 0x5A
  181. /* mask for the above AERR register */
  182. #define T1FRAMER_LOF_MASK (0x0f0) /* receive loss of frame */
  183. #define T1FRAMER_COFA_MASK (0x0c0) /* change of frame alignment */
  184. #define T1FRAMER_SEF_MASK (0x03) /* severely errored frame */
  185. /* 8370 framer register ALM1 (0x47) values
  186. * used to determine link status
  187. */
  188. #define T1F_SIGFRZ 0x01 /* signaling freeze */
  189. #define T1F_RLOF 0x02 /* receive loss of frame alignment */
  190. #define T1F_RLOS 0x04 /* receive loss of signal */
  191. #define T1F_RALOS 0x08 /* receive analog loss of signal or RCKI loss of clock */
  192. #define T1F_RAIS 0x10 /* receive alarm indication signal */
  193. #define T1F_UNUSED 0x20
  194. #define T1F_RYEL 0x40 /* receive yellow alarm */
  195. #define T1F_RMYEL 0x80 /* receive multiframe yellow alarm */
  196. #define LMC_T1F_WRITE 0
  197. #define LMC_T1F_READ 1
  198. typedef struct lmc_st1f_control {
  199. int command;
  200. int address;
  201. int value;
  202. char __user *data;
  203. } lmc_t1f_control;
  204. enum lmc_xilinx_c {
  205. lmc_xilinx_reset = 1,
  206. lmc_xilinx_load_prom = 2,
  207. lmc_xilinx_load = 3
  208. };
  209. struct lmc_xilinx_control {
  210. enum lmc_xilinx_c command;
  211. int len;
  212. char __user *data;
  213. };
  214. /* ------------------ end T1 defs ------------------- */
  215. #define LMC_MII_LedMask 0x0780
  216. #define LMC_MII_LedBitPos 7
  217. #endif