hfc_multi.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. /*
  2. * see notice in hfc_multi.c
  3. */
  4. #define DEBUG_HFCMULTI_FIFO 0x00010000
  5. #define DEBUG_HFCMULTI_CRC 0x00020000
  6. #define DEBUG_HFCMULTI_INIT 0x00040000
  7. #define DEBUG_HFCMULTI_PLXSD 0x00080000
  8. #define DEBUG_HFCMULTI_MODE 0x00100000
  9. #define DEBUG_HFCMULTI_MSG 0x00200000
  10. #define DEBUG_HFCMULTI_STATE 0x00400000
  11. #define DEBUG_HFCMULTI_FILL 0x00800000
  12. #define DEBUG_HFCMULTI_SYNC 0x01000000
  13. #define DEBUG_HFCMULTI_DTMF 0x02000000
  14. #define DEBUG_HFCMULTI_LOCK 0x80000000
  15. #define PCI_ENA_REGIO 0x01
  16. #define PCI_ENA_MEMIO 0x02
  17. /*
  18. * NOTE: some registers are assigned multiple times due to different modes
  19. * also registers are assigned differen for HFC-4s/8s and HFC-E1
  20. */
  21. /*
  22. #define MAX_FRAME_SIZE 2048
  23. */
  24. struct hfc_chan {
  25. struct dchannel *dch; /* link if channel is a D-channel */
  26. struct bchannel *bch; /* link if channel is a B-channel */
  27. int port; /* the interface port this */
  28. /* channel is associated with */
  29. int nt_timer; /* -1 if off, 0 if elapsed, >0 if running */
  30. int los, ais, slip_tx, slip_rx, rdi; /* current alarms */
  31. int jitter;
  32. u_long cfg; /* port configuration */
  33. int sync; /* sync state (used by E1) */
  34. u_int protocol; /* current protocol */
  35. int slot_tx; /* current pcm slot */
  36. int bank_tx; /* current pcm bank */
  37. int slot_rx;
  38. int bank_rx;
  39. int conf; /* conference setting of TX slot */
  40. int txpending; /* if there is currently data in */
  41. /* the FIFO 0=no, 1=yes, 2=splloop */
  42. int rx_off; /* set to turn fifo receive off */
  43. int coeff_count; /* curren coeff block */
  44. s32 *coeff; /* memory pointer to 8 coeff blocks */
  45. };
  46. struct hfcm_hw {
  47. u_char r_ctrl;
  48. u_char r_irq_ctrl;
  49. u_char r_cirm;
  50. u_char r_ram_sz;
  51. u_char r_pcm_md0;
  52. u_char r_irqmsk_misc;
  53. u_char r_dtmf;
  54. u_char r_st_sync;
  55. u_char r_sci_msk;
  56. u_char r_tx0, r_tx1;
  57. u_char a_st_ctrl0[8];
  58. timer_t timer;
  59. };
  60. /* for each stack these flags are used (cfg) */
  61. #define HFC_CFG_NONCAP_TX 1 /* S/T TX interface has less capacity */
  62. #define HFC_CFG_DIS_ECHANNEL 2 /* disable E-channel processing */
  63. #define HFC_CFG_REG_ECHANNEL 3 /* register E-channel */
  64. #define HFC_CFG_OPTICAL 4 /* the E1 interface is optical */
  65. #define HFC_CFG_REPORT_LOS 5 /* the card should report loss of signal */
  66. #define HFC_CFG_REPORT_AIS 6 /* the card should report alarm ind. sign. */
  67. #define HFC_CFG_REPORT_SLIP 7 /* the card should report bit slips */
  68. #define HFC_CFG_REPORT_RDI 8 /* the card should report remote alarm */
  69. #define HFC_CFG_DTMF 9 /* enable DTMF-detection */
  70. #define HFC_CFG_CRC4 10 /* disable CRC-4 Multiframe mode, */
  71. /* use double frame instead. */
  72. #define HFC_CHIP_EXRAM_128 0 /* external ram 128k */
  73. #define HFC_CHIP_EXRAM_512 1 /* external ram 256k */
  74. #define HFC_CHIP_REVISION0 2 /* old fifo handling */
  75. #define HFC_CHIP_PCM_SLAVE 3 /* PCM is slave */
  76. #define HFC_CHIP_PCM_MASTER 4 /* PCM is master */
  77. #define HFC_CHIP_RX_SYNC 5 /* disable pll sync for pcm */
  78. #define HFC_CHIP_DTMF 6 /* DTMF decoding is enabled */
  79. #define HFC_CHIP_ULAW 7 /* ULAW mode */
  80. #define HFC_CHIP_CLOCK2 8 /* double clock mode */
  81. #define HFC_CHIP_E1CLOCK_GET 9 /* always get clock from E1 interface */
  82. #define HFC_CHIP_E1CLOCK_PUT 10 /* always put clock from E1 interface */
  83. #define HFC_CHIP_WATCHDOG 11 /* whether we should send signals */
  84. /* to the watchdog */
  85. #define HFC_CHIP_B410P 12 /* whether we have a b410p with echocan in */
  86. /* hw */
  87. #define HFC_CHIP_PLXSD 13 /* whether we have a Speech-Design PLX */
  88. #define HFC_IO_MODE_PCIMEM 0x00 /* normal memory mapped IO */
  89. #define HFC_IO_MODE_REGIO 0x01 /* PCI io access */
  90. #define HFC_IO_MODE_PLXSD 0x02 /* access HFC via PLX9030 */
  91. /* table entry in the PCI devices list */
  92. struct hm_map {
  93. char *vendor_name;
  94. char *card_name;
  95. int type;
  96. int ports;
  97. int clock2;
  98. int leds;
  99. int opticalsupport;
  100. int dip_type;
  101. int io_mode;
  102. };
  103. struct hfc_multi {
  104. struct list_head list;
  105. struct hm_map *mtyp;
  106. int id;
  107. int pcm; /* id of pcm bus */
  108. int type;
  109. int ports;
  110. u_int irq; /* irq used by card */
  111. u_int irqcnt;
  112. struct pci_dev *pci_dev;
  113. int io_mode; /* selects mode */
  114. #ifdef HFC_REGISTER_DEBUG
  115. void (*HFC_outb)(struct hfc_multi *hc, u_char reg,
  116. u_char val, const char *function, int line);
  117. void (*HFC_outb_nodebug)(struct hfc_multi *hc, u_char reg,
  118. u_char val, const char *function, int line);
  119. u_char (*HFC_inb)(struct hfc_multi *hc, u_char reg,
  120. const char *function, int line);
  121. u_char (*HFC_inb_nodebug)(struct hfc_multi *hc, u_char reg,
  122. const char *function, int line);
  123. u_short (*HFC_inw)(struct hfc_multi *hc, u_char reg,
  124. const char *function, int line);
  125. u_short (*HFC_inw_nodebug)(struct hfc_multi *hc, u_char reg,
  126. const char *function, int line);
  127. void (*HFC_wait)(struct hfc_multi *hc,
  128. const char *function, int line);
  129. void (*HFC_wait_nodebug)(struct hfc_multi *hc,
  130. const char *function, int line);
  131. #else
  132. void (*HFC_outb)(struct hfc_multi *hc, u_char reg,
  133. u_char val);
  134. void (*HFC_outb_nodebug)(struct hfc_multi *hc, u_char reg,
  135. u_char val);
  136. u_char (*HFC_inb)(struct hfc_multi *hc, u_char reg);
  137. u_char (*HFC_inb_nodebug)(struct hfc_multi *hc, u_char reg);
  138. u_short (*HFC_inw)(struct hfc_multi *hc, u_char reg);
  139. u_short (*HFC_inw_nodebug)(struct hfc_multi *hc, u_char reg);
  140. void (*HFC_wait)(struct hfc_multi *hc);
  141. void (*HFC_wait_nodebug)(struct hfc_multi *hc);
  142. #endif
  143. void (*read_fifo)(struct hfc_multi *hc, u_char *data,
  144. int len);
  145. void (*write_fifo)(struct hfc_multi *hc, u_char *data,
  146. int len);
  147. u_long pci_origmembase, plx_origmembase, dsp_origmembase;
  148. void __iomem *pci_membase; /* PCI memory */
  149. void __iomem *plx_membase; /* PLX memory */
  150. u_char *dsp_membase; /* DSP on PLX */
  151. u_long pci_iobase; /* PCI IO */
  152. struct hfcm_hw hw; /* remember data of write-only-registers */
  153. u_long chip; /* chip configuration */
  154. int masterclk; /* port that provides master clock -1=off */
  155. unsigned char silence;/* silence byte */
  156. unsigned char silence_data[128];/* silence block */
  157. int dtmf; /* flag that dtmf is currently in process */
  158. int Flen; /* F-buffer size */
  159. int Zlen; /* Z-buffer size (must be int for calculation)*/
  160. int max_trans; /* maximum transparent fifo fill */
  161. int Zmin; /* Z-buffer offset */
  162. int DTMFbase; /* base address of DTMF coefficients */
  163. u_int slots; /* number of PCM slots */
  164. u_int leds; /* type of leds */
  165. u_int ledcount; /* used to animate leds */
  166. u_long ledstate; /* save last state of leds */
  167. int opticalsupport; /* has the e1 board */
  168. /* an optical Interface */
  169. int dslot; /* channel # of d-channel (E1) default 16 */
  170. u_long wdcount; /* every 500 ms we need to */
  171. /* send the watchdog a signal */
  172. u_char wdbyte; /* watchdog toggle byte */
  173. u_int activity[8]; /* if there is any action on this */
  174. /* port (will be cleared after */
  175. /* showing led-states) */
  176. int e1_state; /* keep track of last state */
  177. int e1_getclock; /* if sync is retrieved from interface */
  178. int syncronized; /* keep track of existing sync interface */
  179. int e1_resync; /* resync jobs */
  180. spinlock_t lock; /* the lock */
  181. struct mISDNclock *iclock; /* isdn clock support */
  182. int iclock_on;
  183. /*
  184. * the channel index is counted from 0, regardless where the channel
  185. * is located on the hfc-channel.
  186. * the bch->channel is equvalent to the hfc-channel
  187. */
  188. struct hfc_chan chan[32];
  189. u_char created[8]; /* what port is created */
  190. signed char slot_owner[256]; /* owner channel of slot */
  191. };
  192. /* PLX GPIOs */
  193. #define PLX_GPIO4_DIR_BIT 13
  194. #define PLX_GPIO4_BIT 14
  195. #define PLX_GPIO5_DIR_BIT 16
  196. #define PLX_GPIO5_BIT 17
  197. #define PLX_GPIO6_DIR_BIT 19
  198. #define PLX_GPIO6_BIT 20
  199. #define PLX_GPIO7_DIR_BIT 22
  200. #define PLX_GPIO7_BIT 23
  201. #define PLX_GPIO8_DIR_BIT 25
  202. #define PLX_GPIO8_BIT 26
  203. #define PLX_GPIO4 (1 << PLX_GPIO4_BIT)
  204. #define PLX_GPIO5 (1 << PLX_GPIO5_BIT)
  205. #define PLX_GPIO6 (1 << PLX_GPIO6_BIT)
  206. #define PLX_GPIO7 (1 << PLX_GPIO7_BIT)
  207. #define PLX_GPIO8 (1 << PLX_GPIO8_BIT)
  208. #define PLX_GPIO4_DIR (1 << PLX_GPIO4_DIR_BIT)
  209. #define PLX_GPIO5_DIR (1 << PLX_GPIO5_DIR_BIT)
  210. #define PLX_GPIO6_DIR (1 << PLX_GPIO6_DIR_BIT)
  211. #define PLX_GPIO7_DIR (1 << PLX_GPIO7_DIR_BIT)
  212. #define PLX_GPIO8_DIR (1 << PLX_GPIO8_DIR_BIT)
  213. #define PLX_TERM_ON PLX_GPIO7
  214. #define PLX_SLAVE_EN_N PLX_GPIO5
  215. #define PLX_MASTER_EN PLX_GPIO6
  216. #define PLX_SYNC_O_EN PLX_GPIO4
  217. #define PLX_DSP_RES_N PLX_GPIO8
  218. /* GPIO4..8 Enable & Set to OUT, SLAVE_EN_N = 1 */
  219. #define PLX_GPIOC_INIT (PLX_GPIO4_DIR | PLX_GPIO5_DIR | PLX_GPIO6_DIR \
  220. | PLX_GPIO7_DIR | PLX_GPIO8_DIR | PLX_SLAVE_EN_N)
  221. /* PLX Interrupt Control/STATUS */
  222. #define PLX_INTCSR_LINTI1_ENABLE 0x01
  223. #define PLX_INTCSR_LINTI1_STATUS 0x04
  224. #define PLX_INTCSR_LINTI2_ENABLE 0x08
  225. #define PLX_INTCSR_LINTI2_STATUS 0x20
  226. #define PLX_INTCSR_PCIINT_ENABLE 0x40
  227. /* PLX Registers */
  228. #define PLX_INTCSR 0x4c
  229. #define PLX_CNTRL 0x50
  230. #define PLX_GPIOC 0x54
  231. /*
  232. * REGISTER SETTING FOR HFC-4S/8S AND HFC-E1
  233. */
  234. /* write only registers */
  235. #define R_CIRM 0x00
  236. #define R_CTRL 0x01
  237. #define R_BRG_PCM_CFG 0x02
  238. #define R_RAM_ADDR0 0x08
  239. #define R_RAM_ADDR1 0x09
  240. #define R_RAM_ADDR2 0x0A
  241. #define R_FIRST_FIFO 0x0B
  242. #define R_RAM_SZ 0x0C
  243. #define R_FIFO_MD 0x0D
  244. #define R_INC_RES_FIFO 0x0E
  245. #define R_FSM_IDX 0x0F
  246. #define R_FIFO 0x0F
  247. #define R_SLOT 0x10
  248. #define R_IRQMSK_MISC 0x11
  249. #define R_SCI_MSK 0x12
  250. #define R_IRQ_CTRL 0x13
  251. #define R_PCM_MD0 0x14
  252. #define R_PCM_MD1 0x15
  253. #define R_PCM_MD2 0x15
  254. #define R_SH0H 0x15
  255. #define R_SH1H 0x15
  256. #define R_SH0L 0x15
  257. #define R_SH1L 0x15
  258. #define R_SL_SEL0 0x15
  259. #define R_SL_SEL1 0x15
  260. #define R_SL_SEL2 0x15
  261. #define R_SL_SEL3 0x15
  262. #define R_SL_SEL4 0x15
  263. #define R_SL_SEL5 0x15
  264. #define R_SL_SEL6 0x15
  265. #define R_SL_SEL7 0x15
  266. #define R_ST_SEL 0x16
  267. #define R_ST_SYNC 0x17
  268. #define R_CONF_EN 0x18
  269. #define R_TI_WD 0x1A
  270. #define R_BERT_WD_MD 0x1B
  271. #define R_DTMF 0x1C
  272. #define R_DTMF_N 0x1D
  273. #define R_E1_WR_STA 0x20
  274. #define R_E1_RD_STA 0x20
  275. #define R_LOS0 0x22
  276. #define R_LOS1 0x23
  277. #define R_RX0 0x24
  278. #define R_RX_FR0 0x25
  279. #define R_RX_FR1 0x26
  280. #define R_TX0 0x28
  281. #define R_TX1 0x29
  282. #define R_TX_FR0 0x2C
  283. #define R_TX_FR1 0x2D
  284. #define R_TX_FR2 0x2E
  285. #define R_JATT_ATT 0x2F /* undocumented */
  286. #define A_ST_RD_STATE 0x30
  287. #define A_ST_WR_STATE 0x30
  288. #define R_RX_OFF 0x30
  289. #define A_ST_CTRL0 0x31
  290. #define R_SYNC_OUT 0x31
  291. #define A_ST_CTRL1 0x32
  292. #define A_ST_CTRL2 0x33
  293. #define A_ST_SQ_WR 0x34
  294. #define R_TX_OFF 0x34
  295. #define R_SYNC_CTRL 0x35
  296. #define A_ST_CLK_DLY 0x37
  297. #define R_PWM0 0x38
  298. #define R_PWM1 0x39
  299. #define A_ST_B1_TX 0x3C
  300. #define A_ST_B2_TX 0x3D
  301. #define A_ST_D_TX 0x3E
  302. #define R_GPIO_OUT0 0x40
  303. #define R_GPIO_OUT1 0x41
  304. #define R_GPIO_EN0 0x42
  305. #define R_GPIO_EN1 0x43
  306. #define R_GPIO_SEL 0x44
  307. #define R_BRG_CTRL 0x45
  308. #define R_PWM_MD 0x46
  309. #define R_BRG_MD 0x47
  310. #define R_BRG_TIM0 0x48
  311. #define R_BRG_TIM1 0x49
  312. #define R_BRG_TIM2 0x4A
  313. #define R_BRG_TIM3 0x4B
  314. #define R_BRG_TIM_SEL01 0x4C
  315. #define R_BRG_TIM_SEL23 0x4D
  316. #define R_BRG_TIM_SEL45 0x4E
  317. #define R_BRG_TIM_SEL67 0x4F
  318. #define A_SL_CFG 0xD0
  319. #define A_CONF 0xD1
  320. #define A_CH_MSK 0xF4
  321. #define A_CON_HDLC 0xFA
  322. #define A_SUBCH_CFG 0xFB
  323. #define A_CHANNEL 0xFC
  324. #define A_FIFO_SEQ 0xFD
  325. #define A_IRQ_MSK 0xFF
  326. /* read only registers */
  327. #define A_Z12 0x04
  328. #define A_Z1L 0x04
  329. #define A_Z1 0x04
  330. #define A_Z1H 0x05
  331. #define A_Z2L 0x06
  332. #define A_Z2 0x06
  333. #define A_Z2H 0x07
  334. #define A_F1 0x0C
  335. #define A_F12 0x0C
  336. #define A_F2 0x0D
  337. #define R_IRQ_OVIEW 0x10
  338. #define R_IRQ_MISC 0x11
  339. #define R_IRQ_STATECH 0x12
  340. #define R_CONF_OFLOW 0x14
  341. #define R_RAM_USE 0x15
  342. #define R_CHIP_ID 0x16
  343. #define R_BERT_STA 0x17
  344. #define R_F0_CNTL 0x18
  345. #define R_F0_CNTH 0x19
  346. #define R_BERT_EC 0x1A
  347. #define R_BERT_ECL 0x1A
  348. #define R_BERT_ECH 0x1B
  349. #define R_STATUS 0x1C
  350. #define R_CHIP_RV 0x1F
  351. #define R_STATE 0x20
  352. #define R_SYNC_STA 0x24
  353. #define R_RX_SL0_0 0x25
  354. #define R_RX_SL0_1 0x26
  355. #define R_RX_SL0_2 0x27
  356. #define R_JATT_DIR 0x2b /* undocumented */
  357. #define R_SLIP 0x2c
  358. #define A_ST_RD_STA 0x30
  359. #define R_FAS_EC 0x30
  360. #define R_FAS_ECL 0x30
  361. #define R_FAS_ECH 0x31
  362. #define R_VIO_EC 0x32
  363. #define R_VIO_ECL 0x32
  364. #define R_VIO_ECH 0x33
  365. #define A_ST_SQ_RD 0x34
  366. #define R_CRC_EC 0x34
  367. #define R_CRC_ECL 0x34
  368. #define R_CRC_ECH 0x35
  369. #define R_E_EC 0x36
  370. #define R_E_ECL 0x36
  371. #define R_E_ECH 0x37
  372. #define R_SA6_SA13_EC 0x38
  373. #define R_SA6_SA13_ECL 0x38
  374. #define R_SA6_SA13_ECH 0x39
  375. #define R_SA6_SA23_EC 0x3A
  376. #define R_SA6_SA23_ECL 0x3A
  377. #define R_SA6_SA23_ECH 0x3B
  378. #define A_ST_B1_RX 0x3C
  379. #define A_ST_B2_RX 0x3D
  380. #define A_ST_D_RX 0x3E
  381. #define A_ST_E_RX 0x3F
  382. #define R_GPIO_IN0 0x40
  383. #define R_GPIO_IN1 0x41
  384. #define R_GPI_IN0 0x44
  385. #define R_GPI_IN1 0x45
  386. #define R_GPI_IN2 0x46
  387. #define R_GPI_IN3 0x47
  388. #define R_INT_DATA 0x88
  389. #define R_IRQ_FIFO_BL0 0xC8
  390. #define R_IRQ_FIFO_BL1 0xC9
  391. #define R_IRQ_FIFO_BL2 0xCA
  392. #define R_IRQ_FIFO_BL3 0xCB
  393. #define R_IRQ_FIFO_BL4 0xCC
  394. #define R_IRQ_FIFO_BL5 0xCD
  395. #define R_IRQ_FIFO_BL6 0xCE
  396. #define R_IRQ_FIFO_BL7 0xCF
  397. /* read and write registers */
  398. #define A_FIFO_DATA0 0x80
  399. #define A_FIFO_DATA1 0x80
  400. #define A_FIFO_DATA2 0x80
  401. #define A_FIFO_DATA0_NOINC 0x84
  402. #define A_FIFO_DATA1_NOINC 0x84
  403. #define A_FIFO_DATA2_NOINC 0x84
  404. #define R_RAM_DATA 0xC0
  405. /*
  406. * BIT SETTING FOR HFC-4S/8S AND HFC-E1
  407. */
  408. /* chapter 2: universal bus interface */
  409. /* R_CIRM */
  410. #define V_IRQ_SEL 0x01
  411. #define V_SRES 0x08
  412. #define V_HFCRES 0x10
  413. #define V_PCMRES 0x20
  414. #define V_STRES 0x40
  415. #define V_ETRES 0x40
  416. #define V_RLD_EPR 0x80
  417. /* R_CTRL */
  418. #define V_FIFO_LPRIO 0x02
  419. #define V_SLOW_RD 0x04
  420. #define V_EXT_RAM 0x08
  421. #define V_CLK_OFF 0x20
  422. #define V_ST_CLK 0x40
  423. /* R_RAM_ADDR0 */
  424. #define V_RAM_ADDR2 0x01
  425. #define V_ADDR_RES 0x40
  426. #define V_ADDR_INC 0x80
  427. /* R_RAM_SZ */
  428. #define V_RAM_SZ 0x01
  429. #define V_PWM0_16KHZ 0x10
  430. #define V_PWM1_16KHZ 0x20
  431. #define V_FZ_MD 0x80
  432. /* R_CHIP_ID */
  433. #define V_PNP_IRQ 0x01
  434. #define V_CHIP_ID 0x10
  435. /* chapter 3: data flow */
  436. /* R_FIRST_FIFO */
  437. #define V_FIRST_FIRO_DIR 0x01
  438. #define V_FIRST_FIFO_NUM 0x02
  439. /* R_FIFO_MD */
  440. #define V_FIFO_MD 0x01
  441. #define V_CSM_MD 0x04
  442. #define V_FSM_MD 0x08
  443. #define V_FIFO_SZ 0x10
  444. /* R_FIFO */
  445. #define V_FIFO_DIR 0x01
  446. #define V_FIFO_NUM 0x02
  447. #define V_REV 0x80
  448. /* R_SLOT */
  449. #define V_SL_DIR 0x01
  450. #define V_SL_NUM 0x02
  451. /* A_SL_CFG */
  452. #define V_CH_DIR 0x01
  453. #define V_CH_SEL 0x02
  454. #define V_ROUTING 0x40
  455. /* A_CON_HDLC */
  456. #define V_IFF 0x01
  457. #define V_HDLC_TRP 0x02
  458. #define V_TRP_IRQ 0x04
  459. #define V_DATA_FLOW 0x20
  460. /* A_SUBCH_CFG */
  461. #define V_BIT_CNT 0x01
  462. #define V_START_BIT 0x08
  463. #define V_LOOP_FIFO 0x40
  464. #define V_INV_DATA 0x80
  465. /* A_CHANNEL */
  466. #define V_CH_DIR0 0x01
  467. #define V_CH_NUM0 0x02
  468. /* A_FIFO_SEQ */
  469. #define V_NEXT_FIFO_DIR 0x01
  470. #define V_NEXT_FIFO_NUM 0x02
  471. #define V_SEQ_END 0x40
  472. /* chapter 4: FIFO handling and HDLC controller */
  473. /* R_INC_RES_FIFO */
  474. #define V_INC_F 0x01
  475. #define V_RES_F 0x02
  476. #define V_RES_LOST 0x04
  477. /* chapter 5: S/T interface */
  478. /* R_SCI_MSK */
  479. #define V_SCI_MSK_ST0 0x01
  480. #define V_SCI_MSK_ST1 0x02
  481. #define V_SCI_MSK_ST2 0x04
  482. #define V_SCI_MSK_ST3 0x08
  483. #define V_SCI_MSK_ST4 0x10
  484. #define V_SCI_MSK_ST5 0x20
  485. #define V_SCI_MSK_ST6 0x40
  486. #define V_SCI_MSK_ST7 0x80
  487. /* R_ST_SEL */
  488. #define V_ST_SEL 0x01
  489. #define V_MULT_ST 0x08
  490. /* R_ST_SYNC */
  491. #define V_SYNC_SEL 0x01
  492. #define V_AUTO_SYNC 0x08
  493. /* A_ST_WR_STA */
  494. #define V_ST_SET_STA 0x01
  495. #define V_ST_LD_STA 0x10
  496. #define V_ST_ACT 0x20
  497. #define V_SET_G2_G3 0x80
  498. /* A_ST_CTRL0 */
  499. #define V_B1_EN 0x01
  500. #define V_B2_EN 0x02
  501. #define V_ST_MD 0x04
  502. #define V_D_PRIO 0x08
  503. #define V_SQ_EN 0x10
  504. #define V_96KHZ 0x20
  505. #define V_TX_LI 0x40
  506. #define V_ST_STOP 0x80
  507. /* A_ST_CTRL1 */
  508. #define V_G2_G3_EN 0x01
  509. #define V_D_HI 0x04
  510. #define V_E_IGNO 0x08
  511. #define V_E_LO 0x10
  512. #define V_B12_SWAP 0x80
  513. /* A_ST_CTRL2 */
  514. #define V_B1_RX_EN 0x01
  515. #define V_B2_RX_EN 0x02
  516. #define V_ST_TRIS 0x40
  517. /* A_ST_CLK_DLY */
  518. #define V_ST_CK_DLY 0x01
  519. #define V_ST_SMPL 0x10
  520. /* A_ST_D_TX */
  521. #define V_ST_D_TX 0x40
  522. /* R_IRQ_STATECH */
  523. #define V_SCI_ST0 0x01
  524. #define V_SCI_ST1 0x02
  525. #define V_SCI_ST2 0x04
  526. #define V_SCI_ST3 0x08
  527. #define V_SCI_ST4 0x10
  528. #define V_SCI_ST5 0x20
  529. #define V_SCI_ST6 0x40
  530. #define V_SCI_ST7 0x80
  531. /* A_ST_RD_STA */
  532. #define V_ST_STA 0x01
  533. #define V_FR_SYNC_ST 0x10
  534. #define V_TI2_EXP 0x20
  535. #define V_INFO0 0x40
  536. #define V_G2_G3 0x80
  537. /* A_ST_SQ_RD */
  538. #define V_ST_SQ 0x01
  539. #define V_MF_RX_RDY 0x10
  540. #define V_MF_TX_RDY 0x80
  541. /* A_ST_D_RX */
  542. #define V_ST_D_RX 0x40
  543. /* A_ST_E_RX */
  544. #define V_ST_E_RX 0x40
  545. /* chapter 5: E1 interface */
  546. /* R_E1_WR_STA */
  547. /* R_E1_RD_STA */
  548. #define V_E1_SET_STA 0x01
  549. #define V_E1_LD_STA 0x10
  550. /* R_RX0 */
  551. #define V_RX_CODE 0x01
  552. #define V_RX_FBAUD 0x04
  553. #define V_RX_CMI 0x08
  554. #define V_RX_INV_CMI 0x10
  555. #define V_RX_INV_CLK 0x20
  556. #define V_RX_INV_DATA 0x40
  557. #define V_AIS_ITU 0x80
  558. /* R_RX_FR0 */
  559. #define V_NO_INSYNC 0x01
  560. #define V_AUTO_RESYNC 0x02
  561. #define V_AUTO_RECO 0x04
  562. #define V_SWORD_COND 0x08
  563. #define V_SYNC_LOSS 0x10
  564. #define V_XCRC_SYNC 0x20
  565. #define V_MF_RESYNC 0x40
  566. #define V_RESYNC 0x80
  567. /* R_RX_FR1 */
  568. #define V_RX_MF 0x01
  569. #define V_RX_MF_SYNC 0x02
  570. #define V_RX_SL0_RAM 0x04
  571. #define V_ERR_SIM 0x20
  572. #define V_RES_NMF 0x40
  573. /* R_TX0 */
  574. #define V_TX_CODE 0x01
  575. #define V_TX_FBAUD 0x04
  576. #define V_TX_CMI_CODE 0x08
  577. #define V_TX_INV_CMI_CODE 0x10
  578. #define V_TX_INV_CLK 0x20
  579. #define V_TX_INV_DATA 0x40
  580. #define V_OUT_EN 0x80
  581. /* R_TX1 */
  582. #define V_INV_CLK 0x01
  583. #define V_EXCHG_DATA_LI 0x02
  584. #define V_AIS_OUT 0x04
  585. #define V_ATX 0x20
  586. #define V_NTRI 0x40
  587. #define V_AUTO_ERR_RES 0x80
  588. /* R_TX_FR0 */
  589. #define V_TRP_FAS 0x01
  590. #define V_TRP_NFAS 0x02
  591. #define V_TRP_RAL 0x04
  592. #define V_TRP_SA 0x08
  593. /* R_TX_FR1 */
  594. #define V_TX_FAS 0x01
  595. #define V_TX_NFAS 0x02
  596. #define V_TX_RAL 0x04
  597. #define V_TX_SA 0x08
  598. /* R_TX_FR2 */
  599. #define V_TX_MF 0x01
  600. #define V_TRP_SL0 0x02
  601. #define V_TX_SL0_RAM 0x04
  602. #define V_TX_E 0x10
  603. #define V_NEG_E 0x20
  604. #define V_XS12_ON 0x40
  605. #define V_XS15_ON 0x80
  606. /* R_RX_OFF */
  607. #define V_RX_SZ 0x01
  608. #define V_RX_INIT 0x04
  609. /* R_SYNC_OUT */
  610. #define V_SYNC_E1_RX 0x01
  611. #define V_IPATS0 0x20
  612. #define V_IPATS1 0x40
  613. #define V_IPATS2 0x80
  614. /* R_TX_OFF */
  615. #define V_TX_SZ 0x01
  616. #define V_TX_INIT 0x04
  617. /* R_SYNC_CTRL */
  618. #define V_EXT_CLK_SYNC 0x01
  619. #define V_SYNC_OFFS 0x02
  620. #define V_PCM_SYNC 0x04
  621. #define V_NEG_CLK 0x08
  622. #define V_HCLK 0x10
  623. /*
  624. #define V_JATT_AUTO_DEL 0x20
  625. #define V_JATT_AUTO 0x40
  626. */
  627. #define V_JATT_OFF 0x80
  628. /* R_STATE */
  629. #define V_E1_STA 0x01
  630. #define V_ALT_FR_RX 0x40
  631. #define V_ALT_FR_TX 0x80
  632. /* R_SYNC_STA */
  633. #define V_RX_STA 0x01
  634. #define V_FR_SYNC_E1 0x04
  635. #define V_SIG_LOS 0x08
  636. #define V_MFA_STA 0x10
  637. #define V_AIS 0x40
  638. #define V_NO_MF_SYNC 0x80
  639. /* R_RX_SL0_0 */
  640. #define V_SI_FAS 0x01
  641. #define V_SI_NFAS 0x02
  642. #define V_A 0x04
  643. #define V_CRC_OK 0x08
  644. #define V_TX_E1 0x10
  645. #define V_TX_E2 0x20
  646. #define V_RX_E1 0x40
  647. #define V_RX_E2 0x80
  648. /* R_SLIP */
  649. #define V_SLIP_RX 0x01
  650. #define V_FOSLIP_RX 0x08
  651. #define V_SLIP_TX 0x10
  652. #define V_FOSLIP_TX 0x80
  653. /* chapter 6: PCM interface */
  654. /* R_PCM_MD0 */
  655. #define V_PCM_MD 0x01
  656. #define V_C4_POL 0x02
  657. #define V_F0_NEG 0x04
  658. #define V_F0_LEN 0x08
  659. #define V_PCM_ADDR 0x10
  660. /* R_SL_SEL0 */
  661. #define V_SL_SEL0 0x01
  662. #define V_SH_SEL0 0x80
  663. /* R_SL_SEL1 */
  664. #define V_SL_SEL1 0x01
  665. #define V_SH_SEL1 0x80
  666. /* R_SL_SEL2 */
  667. #define V_SL_SEL2 0x01
  668. #define V_SH_SEL2 0x80
  669. /* R_SL_SEL3 */
  670. #define V_SL_SEL3 0x01
  671. #define V_SH_SEL3 0x80
  672. /* R_SL_SEL4 */
  673. #define V_SL_SEL4 0x01
  674. #define V_SH_SEL4 0x80
  675. /* R_SL_SEL5 */
  676. #define V_SL_SEL5 0x01
  677. #define V_SH_SEL5 0x80
  678. /* R_SL_SEL6 */
  679. #define V_SL_SEL6 0x01
  680. #define V_SH_SEL6 0x80
  681. /* R_SL_SEL7 */
  682. #define V_SL_SEL7 0x01
  683. #define V_SH_SEL7 0x80
  684. /* R_PCM_MD1 */
  685. #define V_ODEC_CON 0x01
  686. #define V_PLL_ADJ 0x04
  687. #define V_PCM_DR 0x10
  688. #define V_PCM_LOOP 0x40
  689. /* R_PCM_MD2 */
  690. #define V_SYNC_PLL 0x02
  691. #define V_SYNC_SRC 0x04
  692. #define V_SYNC_OUT 0x08
  693. #define V_ICR_FR_TIME 0x40
  694. #define V_EN_PLL 0x80
  695. /* chapter 7: pulse width modulation */
  696. /* R_PWM_MD */
  697. #define V_EXT_IRQ_EN 0x08
  698. #define V_PWM0_MD 0x10
  699. #define V_PWM1_MD 0x40
  700. /* chapter 8: multiparty audio conferences */
  701. /* R_CONF_EN */
  702. #define V_CONF_EN 0x01
  703. #define V_ULAW 0x80
  704. /* A_CONF */
  705. #define V_CONF_NUM 0x01
  706. #define V_NOISE_SUPPR 0x08
  707. #define V_ATT_LEV 0x20
  708. #define V_CONF_SL 0x80
  709. /* R_CONF_OFLOW */
  710. #define V_CONF_OFLOW0 0x01
  711. #define V_CONF_OFLOW1 0x02
  712. #define V_CONF_OFLOW2 0x04
  713. #define V_CONF_OFLOW3 0x08
  714. #define V_CONF_OFLOW4 0x10
  715. #define V_CONF_OFLOW5 0x20
  716. #define V_CONF_OFLOW6 0x40
  717. #define V_CONF_OFLOW7 0x80
  718. /* chapter 9: DTMF contoller */
  719. /* R_DTMF0 */
  720. #define V_DTMF_EN 0x01
  721. #define V_HARM_SEL 0x02
  722. #define V_DTMF_RX_CH 0x04
  723. #define V_DTMF_STOP 0x08
  724. #define V_CHBL_SEL 0x10
  725. #define V_RST_DTMF 0x40
  726. #define V_ULAW_SEL 0x80
  727. /* chapter 10: BERT */
  728. /* R_BERT_WD_MD */
  729. #define V_PAT_SEQ 0x01
  730. #define V_BERT_ERR 0x08
  731. #define V_AUTO_WD_RES 0x20
  732. #define V_WD_RES 0x80
  733. /* R_BERT_STA */
  734. #define V_BERT_SYNC_SRC 0x01
  735. #define V_BERT_SYNC 0x10
  736. #define V_BERT_INV_DATA 0x20
  737. /* chapter 11: auxiliary interface */
  738. /* R_BRG_PCM_CFG */
  739. #define V_BRG_EN 0x01
  740. #define V_BRG_MD 0x02
  741. #define V_PCM_CLK 0x20
  742. #define V_ADDR_WRDLY 0x40
  743. /* R_BRG_CTRL */
  744. #define V_BRG_CS 0x01
  745. #define V_BRG_ADDR 0x08
  746. #define V_BRG_CS_SRC 0x80
  747. /* R_BRG_MD */
  748. #define V_BRG_MD0 0x01
  749. #define V_BRG_MD1 0x02
  750. #define V_BRG_MD2 0x04
  751. #define V_BRG_MD3 0x08
  752. #define V_BRG_MD4 0x10
  753. #define V_BRG_MD5 0x20
  754. #define V_BRG_MD6 0x40
  755. #define V_BRG_MD7 0x80
  756. /* R_BRG_TIM0 */
  757. #define V_BRG_TIM0_IDLE 0x01
  758. #define V_BRG_TIM0_CLK 0x10
  759. /* R_BRG_TIM1 */
  760. #define V_BRG_TIM1_IDLE 0x01
  761. #define V_BRG_TIM1_CLK 0x10
  762. /* R_BRG_TIM2 */
  763. #define V_BRG_TIM2_IDLE 0x01
  764. #define V_BRG_TIM2_CLK 0x10
  765. /* R_BRG_TIM3 */
  766. #define V_BRG_TIM3_IDLE 0x01
  767. #define V_BRG_TIM3_CLK 0x10
  768. /* R_BRG_TIM_SEL01 */
  769. #define V_BRG_WR_SEL0 0x01
  770. #define V_BRG_RD_SEL0 0x04
  771. #define V_BRG_WR_SEL1 0x10
  772. #define V_BRG_RD_SEL1 0x40
  773. /* R_BRG_TIM_SEL23 */
  774. #define V_BRG_WR_SEL2 0x01
  775. #define V_BRG_RD_SEL2 0x04
  776. #define V_BRG_WR_SEL3 0x10
  777. #define V_BRG_RD_SEL3 0x40
  778. /* R_BRG_TIM_SEL45 */
  779. #define V_BRG_WR_SEL4 0x01
  780. #define V_BRG_RD_SEL4 0x04
  781. #define V_BRG_WR_SEL5 0x10
  782. #define V_BRG_RD_SEL5 0x40
  783. /* R_BRG_TIM_SEL67 */
  784. #define V_BRG_WR_SEL6 0x01
  785. #define V_BRG_RD_SEL6 0x04
  786. #define V_BRG_WR_SEL7 0x10
  787. #define V_BRG_RD_SEL7 0x40
  788. /* chapter 12: clock, reset, interrupt, timer and watchdog */
  789. /* R_IRQMSK_MISC */
  790. #define V_STA_IRQMSK 0x01
  791. #define V_TI_IRQMSK 0x02
  792. #define V_PROC_IRQMSK 0x04
  793. #define V_DTMF_IRQMSK 0x08
  794. #define V_IRQ1S_MSK 0x10
  795. #define V_SA6_IRQMSK 0x20
  796. #define V_RX_EOMF_MSK 0x40
  797. #define V_TX_EOMF_MSK 0x80
  798. /* R_IRQ_CTRL */
  799. #define V_FIFO_IRQ 0x01
  800. #define V_GLOB_IRQ_EN 0x08
  801. #define V_IRQ_POL 0x10
  802. /* R_TI_WD */
  803. #define V_EV_TS 0x01
  804. #define V_WD_TS 0x10
  805. /* A_IRQ_MSK */
  806. #define V_IRQ 0x01
  807. #define V_BERT_EN 0x02
  808. #define V_MIX_IRQ 0x04
  809. /* R_IRQ_OVIEW */
  810. #define V_IRQ_FIFO_BL0 0x01
  811. #define V_IRQ_FIFO_BL1 0x02
  812. #define V_IRQ_FIFO_BL2 0x04
  813. #define V_IRQ_FIFO_BL3 0x08
  814. #define V_IRQ_FIFO_BL4 0x10
  815. #define V_IRQ_FIFO_BL5 0x20
  816. #define V_IRQ_FIFO_BL6 0x40
  817. #define V_IRQ_FIFO_BL7 0x80
  818. /* R_IRQ_MISC */
  819. #define V_STA_IRQ 0x01
  820. #define V_TI_IRQ 0x02
  821. #define V_IRQ_PROC 0x04
  822. #define V_DTMF_IRQ 0x08
  823. #define V_IRQ1S 0x10
  824. #define V_SA6_IRQ 0x20
  825. #define V_RX_EOMF 0x40
  826. #define V_TX_EOMF 0x80
  827. /* R_STATUS */
  828. #define V_BUSY 0x01
  829. #define V_PROC 0x02
  830. #define V_DTMF_STA 0x04
  831. #define V_LOST_STA 0x08
  832. #define V_SYNC_IN 0x10
  833. #define V_EXT_IRQSTA 0x20
  834. #define V_MISC_IRQSTA 0x40
  835. #define V_FR_IRQSTA 0x80
  836. /* R_IRQ_FIFO_BL0 */
  837. #define V_IRQ_FIFO0_TX 0x01
  838. #define V_IRQ_FIFO0_RX 0x02
  839. #define V_IRQ_FIFO1_TX 0x04
  840. #define V_IRQ_FIFO1_RX 0x08
  841. #define V_IRQ_FIFO2_TX 0x10
  842. #define V_IRQ_FIFO2_RX 0x20
  843. #define V_IRQ_FIFO3_TX 0x40
  844. #define V_IRQ_FIFO3_RX 0x80
  845. /* R_IRQ_FIFO_BL1 */
  846. #define V_IRQ_FIFO4_TX 0x01
  847. #define V_IRQ_FIFO4_RX 0x02
  848. #define V_IRQ_FIFO5_TX 0x04
  849. #define V_IRQ_FIFO5_RX 0x08
  850. #define V_IRQ_FIFO6_TX 0x10
  851. #define V_IRQ_FIFO6_RX 0x20
  852. #define V_IRQ_FIFO7_TX 0x40
  853. #define V_IRQ_FIFO7_RX 0x80
  854. /* R_IRQ_FIFO_BL2 */
  855. #define V_IRQ_FIFO8_TX 0x01
  856. #define V_IRQ_FIFO8_RX 0x02
  857. #define V_IRQ_FIFO9_TX 0x04
  858. #define V_IRQ_FIFO9_RX 0x08
  859. #define V_IRQ_FIFO10_TX 0x10
  860. #define V_IRQ_FIFO10_RX 0x20
  861. #define V_IRQ_FIFO11_TX 0x40
  862. #define V_IRQ_FIFO11_RX 0x80
  863. /* R_IRQ_FIFO_BL3 */
  864. #define V_IRQ_FIFO12_TX 0x01
  865. #define V_IRQ_FIFO12_RX 0x02
  866. #define V_IRQ_FIFO13_TX 0x04
  867. #define V_IRQ_FIFO13_RX 0x08
  868. #define V_IRQ_FIFO14_TX 0x10
  869. #define V_IRQ_FIFO14_RX 0x20
  870. #define V_IRQ_FIFO15_TX 0x40
  871. #define V_IRQ_FIFO15_RX 0x80
  872. /* R_IRQ_FIFO_BL4 */
  873. #define V_IRQ_FIFO16_TX 0x01
  874. #define V_IRQ_FIFO16_RX 0x02
  875. #define V_IRQ_FIFO17_TX 0x04
  876. #define V_IRQ_FIFO17_RX 0x08
  877. #define V_IRQ_FIFO18_TX 0x10
  878. #define V_IRQ_FIFO18_RX 0x20
  879. #define V_IRQ_FIFO19_TX 0x40
  880. #define V_IRQ_FIFO19_RX 0x80
  881. /* R_IRQ_FIFO_BL5 */
  882. #define V_IRQ_FIFO20_TX 0x01
  883. #define V_IRQ_FIFO20_RX 0x02
  884. #define V_IRQ_FIFO21_TX 0x04
  885. #define V_IRQ_FIFO21_RX 0x08
  886. #define V_IRQ_FIFO22_TX 0x10
  887. #define V_IRQ_FIFO22_RX 0x20
  888. #define V_IRQ_FIFO23_TX 0x40
  889. #define V_IRQ_FIFO23_RX 0x80
  890. /* R_IRQ_FIFO_BL6 */
  891. #define V_IRQ_FIFO24_TX 0x01
  892. #define V_IRQ_FIFO24_RX 0x02
  893. #define V_IRQ_FIFO25_TX 0x04
  894. #define V_IRQ_FIFO25_RX 0x08
  895. #define V_IRQ_FIFO26_TX 0x10
  896. #define V_IRQ_FIFO26_RX 0x20
  897. #define V_IRQ_FIFO27_TX 0x40
  898. #define V_IRQ_FIFO27_RX 0x80
  899. /* R_IRQ_FIFO_BL7 */
  900. #define V_IRQ_FIFO28_TX 0x01
  901. #define V_IRQ_FIFO28_RX 0x02
  902. #define V_IRQ_FIFO29_TX 0x04
  903. #define V_IRQ_FIFO29_RX 0x08
  904. #define V_IRQ_FIFO30_TX 0x10
  905. #define V_IRQ_FIFO30_RX 0x20
  906. #define V_IRQ_FIFO31_TX 0x40
  907. #define V_IRQ_FIFO31_RX 0x80
  908. /* chapter 13: general purpose I/O pins (GPIO) and input pins (GPI) */
  909. /* R_GPIO_OUT0 */
  910. #define V_GPIO_OUT0 0x01
  911. #define V_GPIO_OUT1 0x02
  912. #define V_GPIO_OUT2 0x04
  913. #define V_GPIO_OUT3 0x08
  914. #define V_GPIO_OUT4 0x10
  915. #define V_GPIO_OUT5 0x20
  916. #define V_GPIO_OUT6 0x40
  917. #define V_GPIO_OUT7 0x80
  918. /* R_GPIO_OUT1 */
  919. #define V_GPIO_OUT8 0x01
  920. #define V_GPIO_OUT9 0x02
  921. #define V_GPIO_OUT10 0x04
  922. #define V_GPIO_OUT11 0x08
  923. #define V_GPIO_OUT12 0x10
  924. #define V_GPIO_OUT13 0x20
  925. #define V_GPIO_OUT14 0x40
  926. #define V_GPIO_OUT15 0x80
  927. /* R_GPIO_EN0 */
  928. #define V_GPIO_EN0 0x01
  929. #define V_GPIO_EN1 0x02
  930. #define V_GPIO_EN2 0x04
  931. #define V_GPIO_EN3 0x08
  932. #define V_GPIO_EN4 0x10
  933. #define V_GPIO_EN5 0x20
  934. #define V_GPIO_EN6 0x40
  935. #define V_GPIO_EN7 0x80
  936. /* R_GPIO_EN1 */
  937. #define V_GPIO_EN8 0x01
  938. #define V_GPIO_EN9 0x02
  939. #define V_GPIO_EN10 0x04
  940. #define V_GPIO_EN11 0x08
  941. #define V_GPIO_EN12 0x10
  942. #define V_GPIO_EN13 0x20
  943. #define V_GPIO_EN14 0x40
  944. #define V_GPIO_EN15 0x80
  945. /* R_GPIO_SEL */
  946. #define V_GPIO_SEL0 0x01
  947. #define V_GPIO_SEL1 0x02
  948. #define V_GPIO_SEL2 0x04
  949. #define V_GPIO_SEL3 0x08
  950. #define V_GPIO_SEL4 0x10
  951. #define V_GPIO_SEL5 0x20
  952. #define V_GPIO_SEL6 0x40
  953. #define V_GPIO_SEL7 0x80
  954. /* R_GPIO_IN0 */
  955. #define V_GPIO_IN0 0x01
  956. #define V_GPIO_IN1 0x02
  957. #define V_GPIO_IN2 0x04
  958. #define V_GPIO_IN3 0x08
  959. #define V_GPIO_IN4 0x10
  960. #define V_GPIO_IN5 0x20
  961. #define V_GPIO_IN6 0x40
  962. #define V_GPIO_IN7 0x80
  963. /* R_GPIO_IN1 */
  964. #define V_GPIO_IN8 0x01
  965. #define V_GPIO_IN9 0x02
  966. #define V_GPIO_IN10 0x04
  967. #define V_GPIO_IN11 0x08
  968. #define V_GPIO_IN12 0x10
  969. #define V_GPIO_IN13 0x20
  970. #define V_GPIO_IN14 0x40
  971. #define V_GPIO_IN15 0x80
  972. /* R_GPI_IN0 */
  973. #define V_GPI_IN0 0x01
  974. #define V_GPI_IN1 0x02
  975. #define V_GPI_IN2 0x04
  976. #define V_GPI_IN3 0x08
  977. #define V_GPI_IN4 0x10
  978. #define V_GPI_IN5 0x20
  979. #define V_GPI_IN6 0x40
  980. #define V_GPI_IN7 0x80
  981. /* R_GPI_IN1 */
  982. #define V_GPI_IN8 0x01
  983. #define V_GPI_IN9 0x02
  984. #define V_GPI_IN10 0x04
  985. #define V_GPI_IN11 0x08
  986. #define V_GPI_IN12 0x10
  987. #define V_GPI_IN13 0x20
  988. #define V_GPI_IN14 0x40
  989. #define V_GPI_IN15 0x80
  990. /* R_GPI_IN2 */
  991. #define V_GPI_IN16 0x01
  992. #define V_GPI_IN17 0x02
  993. #define V_GPI_IN18 0x04
  994. #define V_GPI_IN19 0x08
  995. #define V_GPI_IN20 0x10
  996. #define V_GPI_IN21 0x20
  997. #define V_GPI_IN22 0x40
  998. #define V_GPI_IN23 0x80
  999. /* R_GPI_IN3 */
  1000. #define V_GPI_IN24 0x01
  1001. #define V_GPI_IN25 0x02
  1002. #define V_GPI_IN26 0x04
  1003. #define V_GPI_IN27 0x08
  1004. #define V_GPI_IN28 0x10
  1005. #define V_GPI_IN29 0x20
  1006. #define V_GPI_IN30 0x40
  1007. #define V_GPI_IN31 0x80
  1008. /* map of all registers, used for debugging */
  1009. #ifdef HFC_REGISTER_DEBUG
  1010. struct hfc_register_names {
  1011. char *name;
  1012. u_char reg;
  1013. } hfc_register_names[] = {
  1014. /* write registers */
  1015. {"R_CIRM", 0x00},
  1016. {"R_CTRL", 0x01},
  1017. {"R_BRG_PCM_CFG ", 0x02},
  1018. {"R_RAM_ADDR0", 0x08},
  1019. {"R_RAM_ADDR1", 0x09},
  1020. {"R_RAM_ADDR2", 0x0A},
  1021. {"R_FIRST_FIFO", 0x0B},
  1022. {"R_RAM_SZ", 0x0C},
  1023. {"R_FIFO_MD", 0x0D},
  1024. {"R_INC_RES_FIFO", 0x0E},
  1025. {"R_FIFO / R_FSM_IDX", 0x0F},
  1026. {"R_SLOT", 0x10},
  1027. {"R_IRQMSK_MISC", 0x11},
  1028. {"R_SCI_MSK", 0x12},
  1029. {"R_IRQ_CTRL", 0x13},
  1030. {"R_PCM_MD0", 0x14},
  1031. {"R_0x15", 0x15},
  1032. {"R_ST_SEL", 0x16},
  1033. {"R_ST_SYNC", 0x17},
  1034. {"R_CONF_EN", 0x18},
  1035. {"R_TI_WD", 0x1A},
  1036. {"R_BERT_WD_MD", 0x1B},
  1037. {"R_DTMF", 0x1C},
  1038. {"R_DTMF_N", 0x1D},
  1039. {"R_E1_XX_STA", 0x20},
  1040. {"R_LOS0", 0x22},
  1041. {"R_LOS1", 0x23},
  1042. {"R_RX0", 0x24},
  1043. {"R_RX_FR0", 0x25},
  1044. {"R_RX_FR1", 0x26},
  1045. {"R_TX0", 0x28},
  1046. {"R_TX1", 0x29},
  1047. {"R_TX_FR0", 0x2C},
  1048. {"R_TX_FR1", 0x2D},
  1049. {"R_TX_FR2", 0x2E},
  1050. {"R_JATT_ATT", 0x2F},
  1051. {"A_ST_xx_STA/R_RX_OFF", 0x30},
  1052. {"A_ST_CTRL0/R_SYNC_OUT", 0x31},
  1053. {"A_ST_CTRL1", 0x32},
  1054. {"A_ST_CTRL2", 0x33},
  1055. {"A_ST_SQ_WR", 0x34},
  1056. {"R_TX_OFF", 0x34},
  1057. {"R_SYNC_CTRL", 0x35},
  1058. {"A_ST_CLK_DLY", 0x37},
  1059. {"R_PWM0", 0x38},
  1060. {"R_PWM1", 0x39},
  1061. {"A_ST_B1_TX", 0x3C},
  1062. {"A_ST_B2_TX", 0x3D},
  1063. {"A_ST_D_TX", 0x3E},
  1064. {"R_GPIO_OUT0", 0x40},
  1065. {"R_GPIO_OUT1", 0x41},
  1066. {"R_GPIO_EN0", 0x42},
  1067. {"R_GPIO_EN1", 0x43},
  1068. {"R_GPIO_SEL", 0x44},
  1069. {"R_BRG_CTRL", 0x45},
  1070. {"R_PWM_MD", 0x46},
  1071. {"R_BRG_MD", 0x47},
  1072. {"R_BRG_TIM0", 0x48},
  1073. {"R_BRG_TIM1", 0x49},
  1074. {"R_BRG_TIM2", 0x4A},
  1075. {"R_BRG_TIM3", 0x4B},
  1076. {"R_BRG_TIM_SEL01", 0x4C},
  1077. {"R_BRG_TIM_SEL23", 0x4D},
  1078. {"R_BRG_TIM_SEL45", 0x4E},
  1079. {"R_BRG_TIM_SEL67", 0x4F},
  1080. {"A_FIFO_DATA0-2", 0x80},
  1081. {"A_FIFO_DATA0-2_NOINC", 0x84},
  1082. {"R_RAM_DATA", 0xC0},
  1083. {"A_SL_CFG", 0xD0},
  1084. {"A_CONF", 0xD1},
  1085. {"A_CH_MSK", 0xF4},
  1086. {"A_CON_HDLC", 0xFA},
  1087. {"A_SUBCH_CFG", 0xFB},
  1088. {"A_CHANNEL", 0xFC},
  1089. {"A_FIFO_SEQ", 0xFD},
  1090. {"A_IRQ_MSK", 0xFF},
  1091. {NULL, 0},
  1092. /* read registers */
  1093. {"A_Z1", 0x04},
  1094. {"A_Z1H", 0x05},
  1095. {"A_Z2", 0x06},
  1096. {"A_Z2H", 0x07},
  1097. {"A_F1", 0x0C},
  1098. {"A_F2", 0x0D},
  1099. {"R_IRQ_OVIEW", 0x10},
  1100. {"R_IRQ_MISC", 0x11},
  1101. {"R_IRQ_STATECH", 0x12},
  1102. {"R_CONF_OFLOW", 0x14},
  1103. {"R_RAM_USE", 0x15},
  1104. {"R_CHIP_ID", 0x16},
  1105. {"R_BERT_STA", 0x17},
  1106. {"R_F0_CNTL", 0x18},
  1107. {"R_F0_CNTH", 0x19},
  1108. {"R_BERT_ECL", 0x1A},
  1109. {"R_BERT_ECH", 0x1B},
  1110. {"R_STATUS", 0x1C},
  1111. {"R_CHIP_RV", 0x1F},
  1112. {"R_STATE", 0x20},
  1113. {"R_SYNC_STA", 0x24},
  1114. {"R_RX_SL0_0", 0x25},
  1115. {"R_RX_SL0_1", 0x26},
  1116. {"R_RX_SL0_2", 0x27},
  1117. {"R_JATT_DIR", 0x2b},
  1118. {"R_SLIP", 0x2c},
  1119. {"A_ST_RD_STA", 0x30},
  1120. {"R_FAS_ECL", 0x30},
  1121. {"R_FAS_ECH", 0x31},
  1122. {"R_VIO_ECL", 0x32},
  1123. {"R_VIO_ECH", 0x33},
  1124. {"R_CRC_ECL / A_ST_SQ_RD", 0x34},
  1125. {"R_CRC_ECH", 0x35},
  1126. {"R_E_ECL", 0x36},
  1127. {"R_E_ECH", 0x37},
  1128. {"R_SA6_SA13_ECL", 0x38},
  1129. {"R_SA6_SA13_ECH", 0x39},
  1130. {"R_SA6_SA23_ECL", 0x3A},
  1131. {"R_SA6_SA23_ECH", 0x3B},
  1132. {"A_ST_B1_RX", 0x3C},
  1133. {"A_ST_B2_RX", 0x3D},
  1134. {"A_ST_D_RX", 0x3E},
  1135. {"A_ST_E_RX", 0x3F},
  1136. {"R_GPIO_IN0", 0x40},
  1137. {"R_GPIO_IN1", 0x41},
  1138. {"R_GPI_IN0", 0x44},
  1139. {"R_GPI_IN1", 0x45},
  1140. {"R_GPI_IN2", 0x46},
  1141. {"R_GPI_IN3", 0x47},
  1142. {"A_FIFO_DATA0-2", 0x80},
  1143. {"A_FIFO_DATA0-2_NOINC", 0x84},
  1144. {"R_INT_DATA", 0x88},
  1145. {"R_RAM_DATA", 0xC0},
  1146. {"R_IRQ_FIFO_BL0", 0xC8},
  1147. {"R_IRQ_FIFO_BL1", 0xC9},
  1148. {"R_IRQ_FIFO_BL2", 0xCA},
  1149. {"R_IRQ_FIFO_BL3", 0xCB},
  1150. {"R_IRQ_FIFO_BL4", 0xCC},
  1151. {"R_IRQ_FIFO_BL5", 0xCD},
  1152. {"R_IRQ_FIFO_BL6", 0xCE},
  1153. {"R_IRQ_FIFO_BL7", 0xCF},
  1154. };
  1155. #endif /* HFC_REGISTER_DEBUG */