isar.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /*
  2. *
  3. * isar.h ISAR (Siemens PSB 7110) specific defines
  4. *
  5. * Author Karsten Keil (keil@isdn4linux.de)
  6. *
  7. * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. *
  22. */
  23. #include "iohelper.h"
  24. struct isar_hw;
  25. struct isar_ch {
  26. struct bchannel bch;
  27. struct isar_hw *is;
  28. struct timer_list ftimer;
  29. u8 nr;
  30. u8 dpath;
  31. u8 mml;
  32. u8 state;
  33. u8 cmd;
  34. u8 mod;
  35. u8 newcmd;
  36. u8 newmod;
  37. u8 try_mod;
  38. u8 conmsg[16];
  39. };
  40. struct isar_hw {
  41. struct isar_ch ch[2];
  42. void *hw;
  43. spinlock_t *hwlock; /* lock HW access */
  44. char *name;
  45. struct module *owner;
  46. read_reg_func *read_reg;
  47. write_reg_func *write_reg;
  48. fifo_func *read_fifo;
  49. fifo_func *write_fifo;
  50. int (*ctrl)(void *, u32, u_long);
  51. void (*release)(struct isar_hw *);
  52. int (*init)(struct isar_hw *);
  53. int (*open)(struct isar_hw *, struct channel_req *);
  54. int (*firmware)(struct isar_hw *, const u8 *, int);
  55. unsigned long Flags;
  56. int version;
  57. u8 bstat;
  58. u8 iis;
  59. u8 cmsb;
  60. u8 clsb;
  61. u8 buf[256];
  62. u8 log[256];
  63. };
  64. #define ISAR_IRQMSK 0x04
  65. #define ISAR_IRQSTA 0x04
  66. #define ISAR_IRQBIT 0x75
  67. #define ISAR_CTRL_H 0x61
  68. #define ISAR_CTRL_L 0x60
  69. #define ISAR_IIS 0x58
  70. #define ISAR_IIA 0x58
  71. #define ISAR_HIS 0x50
  72. #define ISAR_HIA 0x50
  73. #define ISAR_MBOX 0x4c
  74. #define ISAR_WADR 0x4a
  75. #define ISAR_RADR 0x48
  76. #define ISAR_HIS_VNR 0x14
  77. #define ISAR_HIS_DKEY 0x02
  78. #define ISAR_HIS_FIRM 0x1e
  79. #define ISAR_HIS_STDSP 0x08
  80. #define ISAR_HIS_DIAG 0x05
  81. #define ISAR_HIS_P0CFG 0x3c
  82. #define ISAR_HIS_P12CFG 0x24
  83. #define ISAR_HIS_SARTCFG 0x25
  84. #define ISAR_HIS_PUMPCFG 0x26
  85. #define ISAR_HIS_PUMPCTRL 0x2a
  86. #define ISAR_HIS_IOM2CFG 0x27
  87. #define ISAR_HIS_IOM2REQ 0x07
  88. #define ISAR_HIS_IOM2CTRL 0x2b
  89. #define ISAR_HIS_BSTREQ 0x0c
  90. #define ISAR_HIS_PSTREQ 0x0e
  91. #define ISAR_HIS_SDATA 0x20
  92. #define ISAR_HIS_DPS1 0x40
  93. #define ISAR_HIS_DPS2 0x80
  94. #define SET_DPS(x) ((x << 6) & 0xc0)
  95. #define ISAR_IIS_MSCMSD 0x3f
  96. #define ISAR_IIS_VNR 0x15
  97. #define ISAR_IIS_DKEY 0x03
  98. #define ISAR_IIS_FIRM 0x1f
  99. #define ISAR_IIS_STDSP 0x09
  100. #define ISAR_IIS_DIAG 0x25
  101. #define ISAR_IIS_GSTEV 0x00
  102. #define ISAR_IIS_BSTEV 0x28
  103. #define ISAR_IIS_BSTRSP 0x2c
  104. #define ISAR_IIS_PSTRSP 0x2e
  105. #define ISAR_IIS_PSTEV 0x2a
  106. #define ISAR_IIS_IOM2RSP 0x27
  107. #define ISAR_IIS_RDATA 0x20
  108. #define ISAR_IIS_INVMSG 0x3f
  109. #define ISAR_CTRL_SWVER 0x10
  110. #define ISAR_CTRL_STST 0x40
  111. #define ISAR_MSG_HWVER 0x20
  112. #define ISAR_DP1_USE 1
  113. #define ISAR_DP2_USE 2
  114. #define ISAR_RATE_REQ 3
  115. #define PMOD_DISABLE 0
  116. #define PMOD_FAX 1
  117. #define PMOD_DATAMODEM 2
  118. #define PMOD_HALFDUPLEX 3
  119. #define PMOD_V110 4
  120. #define PMOD_DTMF 5
  121. #define PMOD_DTMF_TRANS 6
  122. #define PMOD_BYPASS 7
  123. #define PCTRL_ORIG 0x80
  124. #define PV32P2_V23R 0x40
  125. #define PV32P2_V22A 0x20
  126. #define PV32P2_V22B 0x10
  127. #define PV32P2_V22C 0x08
  128. #define PV32P2_V21 0x02
  129. #define PV32P2_BEL 0x01
  130. /* LSB MSB in ISAR doc wrong !!! Arghhh */
  131. #define PV32P3_AMOD 0x80
  132. #define PV32P3_V32B 0x02
  133. #define PV32P3_V23B 0x01
  134. #define PV32P4_48 0x11
  135. #define PV32P5_48 0x05
  136. #define PV32P4_UT48 0x11
  137. #define PV32P5_UT48 0x0d
  138. #define PV32P4_96 0x11
  139. #define PV32P5_96 0x03
  140. #define PV32P4_UT96 0x11
  141. #define PV32P5_UT96 0x0f
  142. #define PV32P4_B96 0x91
  143. #define PV32P5_B96 0x0b
  144. #define PV32P4_UTB96 0xd1
  145. #define PV32P5_UTB96 0x0f
  146. #define PV32P4_120 0xb1
  147. #define PV32P5_120 0x09
  148. #define PV32P4_UT120 0xf1
  149. #define PV32P5_UT120 0x0f
  150. #define PV32P4_144 0x99
  151. #define PV32P5_144 0x09
  152. #define PV32P4_UT144 0xf9
  153. #define PV32P5_UT144 0x0f
  154. #define PV32P6_CTN 0x01
  155. #define PV32P6_ATN 0x02
  156. #define PFAXP2_CTN 0x01
  157. #define PFAXP2_ATN 0x04
  158. #define PSEV_10MS_TIMER 0x02
  159. #define PSEV_CON_ON 0x18
  160. #define PSEV_CON_OFF 0x19
  161. #define PSEV_V24_OFF 0x20
  162. #define PSEV_CTS_ON 0x21
  163. #define PSEV_CTS_OFF 0x22
  164. #define PSEV_DCD_ON 0x23
  165. #define PSEV_DCD_OFF 0x24
  166. #define PSEV_DSR_ON 0x25
  167. #define PSEV_DSR_OFF 0x26
  168. #define PSEV_REM_RET 0xcc
  169. #define PSEV_REM_REN 0xcd
  170. #define PSEV_GSTN_CLR 0xd4
  171. #define PSEV_RSP_READY 0xbc
  172. #define PSEV_LINE_TX_H 0xb3
  173. #define PSEV_LINE_TX_B 0xb2
  174. #define PSEV_LINE_RX_H 0xb1
  175. #define PSEV_LINE_RX_B 0xb0
  176. #define PSEV_RSP_CONN 0xb5
  177. #define PSEV_RSP_DISC 0xb7
  178. #define PSEV_RSP_FCERR 0xb9
  179. #define PSEV_RSP_SILDET 0xbe
  180. #define PSEV_RSP_SILOFF 0xab
  181. #define PSEV_FLAGS_DET 0xba
  182. #define PCTRL_CMD_TDTMF 0x5a
  183. #define PCTRL_CMD_FTH 0xa7
  184. #define PCTRL_CMD_FRH 0xa5
  185. #define PCTRL_CMD_FTM 0xa8
  186. #define PCTRL_CMD_FRM 0xa6
  187. #define PCTRL_CMD_SILON 0xac
  188. #define PCTRL_CMD_CONT 0xa2
  189. #define PCTRL_CMD_ESC 0xa4
  190. #define PCTRL_CMD_SILOFF 0xab
  191. #define PCTRL_CMD_HALT 0xa9
  192. #define PCTRL_LOC_RET 0xcf
  193. #define PCTRL_LOC_REN 0xce
  194. #define SMODE_DISABLE 0
  195. #define SMODE_V14 2
  196. #define SMODE_HDLC 3
  197. #define SMODE_BINARY 4
  198. #define SMODE_FSK_V14 5
  199. #define SCTRL_HDMC_BOTH 0x00
  200. #define SCTRL_HDMC_DTX 0x80
  201. #define SCTRL_HDMC_DRX 0x40
  202. #define S_P1_OVSP 0x40
  203. #define S_P1_SNP 0x20
  204. #define S_P1_EOP 0x10
  205. #define S_P1_EDP 0x08
  206. #define S_P1_NSB 0x04
  207. #define S_P1_CHS_8 0x03
  208. #define S_P1_CHS_7 0x02
  209. #define S_P1_CHS_6 0x01
  210. #define S_P1_CHS_5 0x00
  211. #define S_P2_BFT_DEF 0x10
  212. #define IOM_CTRL_ENA 0x80
  213. #define IOM_CTRL_NOPCM 0x00
  214. #define IOM_CTRL_ALAW 0x02
  215. #define IOM_CTRL_ULAW 0x04
  216. #define IOM_CTRL_RCV 0x01
  217. #define IOM_P1_TXD 0x10
  218. #define HDLC_FED 0x40
  219. #define HDLC_FSD 0x20
  220. #define HDLC_FST 0x20
  221. #define HDLC_ERROR 0x1c
  222. #define HDLC_ERR_FAD 0x10
  223. #define HDLC_ERR_RER 0x08
  224. #define HDLC_ERR_CER 0x04
  225. #define SART_NMD 0x01
  226. #define BSTAT_RDM0 0x1
  227. #define BSTAT_RDM1 0x2
  228. #define BSTAT_RDM2 0x4
  229. #define BSTAT_RDM3 0x8
  230. #define BSTEV_TBO 0x1f
  231. #define BSTEV_RBO 0x2f
  232. /* FAX State Machine */
  233. #define STFAX_NULL 0
  234. #define STFAX_READY 1
  235. #define STFAX_LINE 2
  236. #define STFAX_CONT 3
  237. #define STFAX_ACTIV 4
  238. #define STFAX_ESCAPE 5
  239. #define STFAX_SILDET 6
  240. extern u32 mISDNisar_init(struct isar_hw *, void *);
  241. extern void mISDNisar_irq(struct isar_hw *);