hfc_multi.h 31 KB

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