hfc_multi.h 31 KB

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