hfc_pci.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * specific defines for CCD's HFC 2BDS0 PCI chips
  3. *
  4. * Author Werner Cornelius (werner@isdn4linux.de)
  5. *
  6. * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2, or (at your option)
  11. * any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. *
  22. */
  23. /*
  24. * thresholds for transparent B-channel mode
  25. * change mask and threshold simultaneously
  26. */
  27. #define HFCPCI_BTRANS_THRESHOLD 128
  28. #define HFCPCI_FILLEMPTY 64
  29. #define HFCPCI_BTRANS_THRESMASK 0x00
  30. /* defines for PCI config */
  31. #define PCI_ENA_MEMIO 0x02
  32. #define PCI_ENA_MASTER 0x04
  33. /* GCI/IOM bus monitor registers */
  34. #define HCFPCI_C_I 0x08
  35. #define HFCPCI_TRxR 0x0C
  36. #define HFCPCI_MON1_D 0x28
  37. #define HFCPCI_MON2_D 0x2C
  38. /* GCI/IOM bus timeslot registers */
  39. #define HFCPCI_B1_SSL 0x80
  40. #define HFCPCI_B2_SSL 0x84
  41. #define HFCPCI_AUX1_SSL 0x88
  42. #define HFCPCI_AUX2_SSL 0x8C
  43. #define HFCPCI_B1_RSL 0x90
  44. #define HFCPCI_B2_RSL 0x94
  45. #define HFCPCI_AUX1_RSL 0x98
  46. #define HFCPCI_AUX2_RSL 0x9C
  47. /* GCI/IOM bus data registers */
  48. #define HFCPCI_B1_D 0xA0
  49. #define HFCPCI_B2_D 0xA4
  50. #define HFCPCI_AUX1_D 0xA8
  51. #define HFCPCI_AUX2_D 0xAC
  52. /* GCI/IOM bus configuration registers */
  53. #define HFCPCI_MST_EMOD 0xB4
  54. #define HFCPCI_MST_MODE 0xB8
  55. #define HFCPCI_CONNECT 0xBC
  56. /* Interrupt and status registers */
  57. #define HFCPCI_FIFO_EN 0x44
  58. #define HFCPCI_TRM 0x48
  59. #define HFCPCI_B_MODE 0x4C
  60. #define HFCPCI_CHIP_ID 0x58
  61. #define HFCPCI_CIRM 0x60
  62. #define HFCPCI_CTMT 0x64
  63. #define HFCPCI_INT_M1 0x68
  64. #define HFCPCI_INT_M2 0x6C
  65. #define HFCPCI_INT_S1 0x78
  66. #define HFCPCI_INT_S2 0x7C
  67. #define HFCPCI_STATUS 0x70
  68. /* S/T section registers */
  69. #define HFCPCI_STATES 0xC0
  70. #define HFCPCI_SCTRL 0xC4
  71. #define HFCPCI_SCTRL_E 0xC8
  72. #define HFCPCI_SCTRL_R 0xCC
  73. #define HFCPCI_SQ 0xD0
  74. #define HFCPCI_CLKDEL 0xDC
  75. #define HFCPCI_B1_REC 0xF0
  76. #define HFCPCI_B1_SEND 0xF0
  77. #define HFCPCI_B2_REC 0xF4
  78. #define HFCPCI_B2_SEND 0xF4
  79. #define HFCPCI_D_REC 0xF8
  80. #define HFCPCI_D_SEND 0xF8
  81. #define HFCPCI_E_REC 0xFC
  82. /* bits in status register (READ) */
  83. #define HFCPCI_PCI_PROC 0x02
  84. #define HFCPCI_NBUSY 0x04
  85. #define HFCPCI_TIMER_ELAP 0x10
  86. #define HFCPCI_STATINT 0x20
  87. #define HFCPCI_FRAMEINT 0x40
  88. #define HFCPCI_ANYINT 0x80
  89. /* bits in CTMT (Write) */
  90. #define HFCPCI_CLTIMER 0x80
  91. #define HFCPCI_TIM3_125 0x04
  92. #define HFCPCI_TIM25 0x10
  93. #define HFCPCI_TIM50 0x14
  94. #define HFCPCI_TIM400 0x18
  95. #define HFCPCI_TIM800 0x1C
  96. #define HFCPCI_AUTO_TIMER 0x20
  97. #define HFCPCI_TRANSB2 0x02
  98. #define HFCPCI_TRANSB1 0x01
  99. /* bits in CIRM (Write) */
  100. #define HFCPCI_AUX_MSK 0x07
  101. #define HFCPCI_RESET 0x08
  102. #define HFCPCI_B1_REV 0x40
  103. #define HFCPCI_B2_REV 0x80
  104. /* bits in INT_M1 and INT_S1 */
  105. #define HFCPCI_INTS_B1TRANS 0x01
  106. #define HFCPCI_INTS_B2TRANS 0x02
  107. #define HFCPCI_INTS_DTRANS 0x04
  108. #define HFCPCI_INTS_B1REC 0x08
  109. #define HFCPCI_INTS_B2REC 0x10
  110. #define HFCPCI_INTS_DREC 0x20
  111. #define HFCPCI_INTS_L1STATE 0x40
  112. #define HFCPCI_INTS_TIMER 0x80
  113. /* bits in INT_M2 */
  114. #define HFCPCI_PROC_TRANS 0x01
  115. #define HFCPCI_GCI_I_CHG 0x02
  116. #define HFCPCI_GCI_MON_REC 0x04
  117. #define HFCPCI_IRQ_ENABLE 0x08
  118. #define HFCPCI_PMESEL 0x80
  119. /* bits in STATES */
  120. #define HFCPCI_STATE_MSK 0x0F
  121. #define HFCPCI_LOAD_STATE 0x10
  122. #define HFCPCI_ACTIVATE 0x20
  123. #define HFCPCI_DO_ACTION 0x40
  124. #define HFCPCI_NT_G2_G3 0x80
  125. /* bits in HFCD_MST_MODE */
  126. #define HFCPCI_MASTER 0x01
  127. #define HFCPCI_SLAVE 0x00
  128. #define HFCPCI_F0IO_POSITIV 0x02
  129. #define HFCPCI_F0_NEGATIV 0x04
  130. #define HFCPCI_F0_2C4 0x08
  131. /* remaining bits are for codecs control */
  132. /* bits in HFCD_SCTRL */
  133. #define SCTRL_B1_ENA 0x01
  134. #define SCTRL_B2_ENA 0x02
  135. #define SCTRL_MODE_TE 0x00
  136. #define SCTRL_MODE_NT 0x04
  137. #define SCTRL_LOW_PRIO 0x08
  138. #define SCTRL_SQ_ENA 0x10
  139. #define SCTRL_TEST 0x20
  140. #define SCTRL_NONE_CAP 0x40
  141. #define SCTRL_PWR_DOWN 0x80
  142. /* bits in SCTRL_E */
  143. #define HFCPCI_AUTO_AWAKE 0x01
  144. #define HFCPCI_DBIT_1 0x04
  145. #define HFCPCI_IGNORE_COL 0x08
  146. #define HFCPCI_CHG_B1_B2 0x80
  147. /* bits in FIFO_EN register */
  148. #define HFCPCI_FIFOEN_B1 0x03
  149. #define HFCPCI_FIFOEN_B2 0x0C
  150. #define HFCPCI_FIFOEN_DTX 0x10
  151. #define HFCPCI_FIFOEN_B1TX 0x01
  152. #define HFCPCI_FIFOEN_B1RX 0x02
  153. #define HFCPCI_FIFOEN_B2TX 0x04
  154. #define HFCPCI_FIFOEN_B2RX 0x08
  155. /* definitions of fifo memory area */
  156. #define MAX_D_FRAMES 15
  157. #define MAX_B_FRAMES 31
  158. #define B_SUB_VAL 0x200
  159. #define B_FIFO_SIZE (0x2000 - B_SUB_VAL)
  160. #define D_FIFO_SIZE 512
  161. #define D_FREG_MASK 0xF
  162. struct zt {
  163. __le16 z1; /* Z1 pointer 16 Bit */
  164. __le16 z2; /* Z2 pointer 16 Bit */
  165. };
  166. struct dfifo {
  167. u_char data[D_FIFO_SIZE]; /* FIFO data space */
  168. u_char fill1[0x20A0 - D_FIFO_SIZE]; /* reserved, do not use */
  169. u_char f1, f2; /* f pointers */
  170. u_char fill2[0x20C0 - 0x20A2]; /* reserved, do not use */
  171. /* mask index with D_FREG_MASK for access */
  172. struct zt za[MAX_D_FRAMES + 1];
  173. u_char fill3[0x4000 - 0x2100]; /* align 16K */
  174. };
  175. struct bzfifo {
  176. struct zt za[MAX_B_FRAMES + 1]; /* only range 0x0..0x1F allowed */
  177. u_char f1, f2; /* f pointers */
  178. u_char fill[0x2100 - 0x2082]; /* alignment */
  179. };
  180. union fifo_area {
  181. struct {
  182. struct dfifo d_tx; /* D-send channel */
  183. struct dfifo d_rx; /* D-receive channel */
  184. } d_chan;
  185. struct {
  186. u_char fill1[0x200];
  187. u_char txdat_b1[B_FIFO_SIZE];
  188. struct bzfifo txbz_b1;
  189. struct bzfifo txbz_b2;
  190. u_char txdat_b2[B_FIFO_SIZE];
  191. u_char fill2[D_FIFO_SIZE];
  192. u_char rxdat_b1[B_FIFO_SIZE];
  193. struct bzfifo rxbz_b1;
  194. struct bzfifo rxbz_b2;
  195. u_char rxdat_b2[B_FIFO_SIZE];
  196. } b_chans;
  197. u_char fill[32768];
  198. };
  199. #define Write_hfc(a, b, c) (writeb(c, (a->hw.pci_io) + b))
  200. #define Read_hfc(a, b) (readb((a->hw.pci_io) + b))