hfc_pci.h 6.0 KB

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