sdla.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * INET An implementation of the TCP/IP protocol suite for the LINUX
  3. * operating system. INET is implemented using the BSD Socket
  4. * interface as the means of communication with the user level.
  5. *
  6. * Global definitions for the Frame relay interface.
  7. *
  8. * Version: @(#)if_ifrad.h 0.20 13 Apr 96
  9. *
  10. * Author: Mike McLagan <mike.mclagan@linux.org>
  11. *
  12. * Changes:
  13. * 0.15 Mike McLagan Structure packing
  14. *
  15. * 0.20 Mike McLagan New flags for S508 buffer handling
  16. *
  17. * This program is free software; you can redistribute it and/or
  18. * modify it under the terms of the GNU General Public License
  19. * as published by the Free Software Foundation; either version
  20. * 2 of the License, or (at your option) any later version.
  21. */
  22. #ifndef SDLA_H
  23. #define SDLA_H
  24. #include <uapi/linux/sdla.h>
  25. /* important Z80 window addresses */
  26. #define SDLA_CONTROL_WND 0xE000
  27. #define SDLA_502_CMD_BUF 0xEF60
  28. #define SDLA_502_RCV_BUF 0xA900
  29. #define SDLA_502_TXN_AVAIL 0xFFF1
  30. #define SDLA_502_RCV_AVAIL 0xFFF2
  31. #define SDLA_502_EVENT_FLAGS 0xFFF3
  32. #define SDLA_502_MDM_STATUS 0xFFF4
  33. #define SDLA_502_IRQ_INTERFACE 0xFFFD
  34. #define SDLA_502_IRQ_PERMISSION 0xFFFE
  35. #define SDLA_502_DATA_OFS 0x0010
  36. #define SDLA_508_CMD_BUF 0xE000
  37. #define SDLA_508_TXBUF_INFO 0xF100
  38. #define SDLA_508_RXBUF_INFO 0xF120
  39. #define SDLA_508_EVENT_FLAGS 0xF003
  40. #define SDLA_508_MDM_STATUS 0xF004
  41. #define SDLA_508_IRQ_INTERFACE 0xF010
  42. #define SDLA_508_IRQ_PERMISSION 0xF011
  43. #define SDLA_508_TSE_OFFSET 0xF012
  44. /* Event flags */
  45. #define SDLA_EVENT_STATUS 0x01
  46. #define SDLA_EVENT_DLCI_STATUS 0x02
  47. #define SDLA_EVENT_BAD_DLCI 0x04
  48. #define SDLA_EVENT_LINK_DOWN 0x40
  49. /* IRQ Trigger flags */
  50. #define SDLA_INTR_RX 0x01
  51. #define SDLA_INTR_TX 0x02
  52. #define SDLA_INTR_MODEM 0x04
  53. #define SDLA_INTR_COMPLETE 0x08
  54. #define SDLA_INTR_STATUS 0x10
  55. #define SDLA_INTR_TIMER 0x20
  56. /* DLCI status bits */
  57. #define SDLA_DLCI_DELETED 0x01
  58. #define SDLA_DLCI_ACTIVE 0x02
  59. #define SDLA_DLCI_WAITING 0x04
  60. #define SDLA_DLCI_NEW 0x08
  61. #define SDLA_DLCI_INCLUDED 0x40
  62. /* valid command codes */
  63. #define SDLA_INFORMATION_WRITE 0x01
  64. #define SDLA_INFORMATION_READ 0x02
  65. #define SDLA_ISSUE_IN_CHANNEL_SIGNAL 0x03
  66. #define SDLA_SET_DLCI_CONFIGURATION 0x10
  67. #define SDLA_READ_DLCI_CONFIGURATION 0x11
  68. #define SDLA_DISABLE_COMMUNICATIONS 0x12
  69. #define SDLA_ENABLE_COMMUNICATIONS 0x13
  70. #define SDLA_READ_DLC_STATUS 0x14
  71. #define SDLA_READ_DLC_STATISTICS 0x15
  72. #define SDLA_FLUSH_DLC_STATISTICS 0x16
  73. #define SDLA_LIST_ACTIVE_DLCI 0x17
  74. #define SDLA_FLUSH_INFORMATION_BUFFERS 0x18
  75. #define SDLA_ADD_DLCI 0x20
  76. #define SDLA_DELETE_DLCI 0x21
  77. #define SDLA_ACTIVATE_DLCI 0x22
  78. #define SDLA_DEACTIVATE_DLCI 0x23
  79. #define SDLA_READ_MODEM_STATUS 0x30
  80. #define SDLA_SET_MODEM_STATUS 0x31
  81. #define SDLA_READ_COMMS_ERR_STATS 0x32
  82. #define SDLA_FLUSH_COMMS_ERR_STATS 0x33
  83. #define SDLA_READ_CODE_VERSION 0x40
  84. #define SDLA_SET_IRQ_TRIGGER 0x50
  85. #define SDLA_GET_IRQ_TRIGGER 0x51
  86. /* In channel signal types */
  87. #define SDLA_ICS_LINK_VERIFY 0x02
  88. #define SDLA_ICS_STATUS_ENQ 0x03
  89. /* modem status flags */
  90. #define SDLA_MODEM_DTR_HIGH 0x01
  91. #define SDLA_MODEM_RTS_HIGH 0x02
  92. #define SDLA_MODEM_DCD_HIGH 0x08
  93. #define SDLA_MODEM_CTS_HIGH 0x20
  94. /* used for RET_MODEM interpretation */
  95. #define SDLA_MODEM_DCD_LOW 0x01
  96. #define SDLA_MODEM_CTS_LOW 0x02
  97. /* return codes */
  98. #define SDLA_RET_OK 0x00
  99. #define SDLA_RET_COMMUNICATIONS 0x01
  100. #define SDLA_RET_CHANNEL_INACTIVE 0x02
  101. #define SDLA_RET_DLCI_INACTIVE 0x03
  102. #define SDLA_RET_DLCI_CONFIG 0x04
  103. #define SDLA_RET_BUF_TOO_BIG 0x05
  104. #define SDLA_RET_NO_DATA 0x05
  105. #define SDLA_RET_BUF_OVERSIZE 0x06
  106. #define SDLA_RET_CIR_OVERFLOW 0x07
  107. #define SDLA_RET_NO_BUFS 0x08
  108. #define SDLA_RET_TIMEOUT 0x0A
  109. #define SDLA_RET_MODEM 0x10
  110. #define SDLA_RET_CHANNEL_OFF 0x11
  111. #define SDLA_RET_CHANNEL_ON 0x12
  112. #define SDLA_RET_DLCI_STATUS 0x13
  113. #define SDLA_RET_DLCI_UNKNOWN 0x14
  114. #define SDLA_RET_COMMAND_INVALID 0x1F
  115. /* Configuration flags */
  116. #define SDLA_DIRECT_RECV 0x0080
  117. #define SDLA_TX_NO_EXCEPT 0x0020
  118. #define SDLA_NO_ICF_MSGS 0x1000
  119. #define SDLA_TX50_RX50 0x0000
  120. #define SDLA_TX70_RX30 0x2000
  121. #define SDLA_TX30_RX70 0x4000
  122. /* IRQ selection flags */
  123. #define SDLA_IRQ_RECEIVE 0x01
  124. #define SDLA_IRQ_TRANSMIT 0x02
  125. #define SDLA_IRQ_MODEM_STAT 0x04
  126. #define SDLA_IRQ_COMMAND 0x08
  127. #define SDLA_IRQ_CHANNEL 0x10
  128. #define SDLA_IRQ_TIMER 0x20
  129. /* definitions for PC memory mapping */
  130. #define SDLA_8K_WINDOW 0x01
  131. #define SDLA_S502_SEG_A 0x10
  132. #define SDLA_S502_SEG_C 0x20
  133. #define SDLA_S502_SEG_D 0x00
  134. #define SDLA_S502_SEG_E 0x30
  135. #define SDLA_S507_SEG_A 0x00
  136. #define SDLA_S507_SEG_B 0x40
  137. #define SDLA_S507_SEG_C 0x80
  138. #define SDLA_S507_SEG_E 0xC0
  139. #define SDLA_S508_SEG_A 0x00
  140. #define SDLA_S508_SEG_C 0x10
  141. #define SDLA_S508_SEG_D 0x08
  142. #define SDLA_S508_SEG_E 0x18
  143. /* SDLA adapter port constants */
  144. #define SDLA_IO_EXTENTS 0x04
  145. #define SDLA_REG_CONTROL 0x00
  146. #define SDLA_REG_PC_WINDOW 0x01 /* offset for PC window select latch */
  147. #define SDLA_REG_Z80_WINDOW 0x02 /* offset for Z80 window select latch */
  148. #define SDLA_REG_Z80_CONTROL 0x03 /* offset for Z80 control latch */
  149. #define SDLA_S502_STS 0x00 /* status reg for 502, 502E, 507 */
  150. #define SDLA_S508_GNRL 0x00 /* general purp. reg for 508 */
  151. #define SDLA_S508_STS 0x01 /* status reg for 508 */
  152. #define SDLA_S508_IDR 0x02 /* ID reg for 508 */
  153. /* control register flags */
  154. #define SDLA_S502A_START 0x00 /* start the CPU */
  155. #define SDLA_S502A_INTREQ 0x02
  156. #define SDLA_S502A_INTEN 0x04
  157. #define SDLA_S502A_HALT 0x08 /* halt the CPU */
  158. #define SDLA_S502A_NMI 0x10 /* issue an NMI to the CPU */
  159. #define SDLA_S502E_CPUEN 0x01
  160. #define SDLA_S502E_ENABLE 0x02
  161. #define SDLA_S502E_INTACK 0x04
  162. #define SDLA_S507_ENABLE 0x01
  163. #define SDLA_S507_IRQ3 0x00
  164. #define SDLA_S507_IRQ4 0x20
  165. #define SDLA_S507_IRQ5 0x40
  166. #define SDLA_S507_IRQ7 0x60
  167. #define SDLA_S507_IRQ10 0x80
  168. #define SDLA_S507_IRQ11 0xA0
  169. #define SDLA_S507_IRQ12 0xC0
  170. #define SDLA_S507_IRQ15 0xE0
  171. #define SDLA_HALT 0x00
  172. #define SDLA_CPUEN 0x02
  173. #define SDLA_MEMEN 0x04
  174. #define SDLA_S507_EPROMWR 0x08
  175. #define SDLA_S507_EPROMCLK 0x10
  176. #define SDLA_S508_INTRQ 0x08
  177. #define SDLA_S508_INTEN 0x10
  178. struct sdla_cmd {
  179. char opp_flag;
  180. char cmd;
  181. short length;
  182. char retval;
  183. short dlci;
  184. char flags;
  185. short rxlost_int;
  186. long rxlost_app;
  187. char reserve[2];
  188. char data[SDLA_MAX_DATA]; /* transfer data buffer */
  189. } __attribute__((packed));
  190. struct intr_info {
  191. char flags;
  192. short txlen;
  193. char irq;
  194. char flags2;
  195. short timeout;
  196. } __attribute__((packed));
  197. /* found in the 508's control window at RXBUF_INFO */
  198. struct buf_info {
  199. unsigned short rse_num;
  200. unsigned long rse_base;
  201. unsigned long rse_next;
  202. unsigned long buf_base;
  203. unsigned short reserved;
  204. unsigned long buf_top;
  205. } __attribute__((packed));
  206. /* structure pointed to by rse_base in RXBUF_INFO struct */
  207. struct buf_entry {
  208. char opp_flag;
  209. short length;
  210. short dlci;
  211. char flags;
  212. short timestamp;
  213. short reserved[2];
  214. long buf_addr;
  215. } __attribute__((packed));
  216. #endif