sunsab.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. /* sunsab.h: Register Definitions for the Siemens SAB82532 DUSCC
  2. *
  3. * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
  4. */
  5. #ifndef _SUNSAB_H
  6. #define _SUNSAB_H
  7. struct sab82532_async_rd_regs {
  8. u8 rfifo[0x20]; /* Receive FIFO */
  9. u8 star; /* Status Register */
  10. u8 __pad1;
  11. u8 mode; /* Mode Register */
  12. u8 timr; /* Timer Register */
  13. u8 xon; /* XON Character */
  14. u8 xoff; /* XOFF Character */
  15. u8 tcr; /* Termination Character Register */
  16. u8 dafo; /* Data Format */
  17. u8 rfc; /* RFIFO Control Register */
  18. u8 __pad2;
  19. u8 rbcl; /* Receive Byte Count Low */
  20. u8 rbch; /* Receive Byte Count High */
  21. u8 ccr0; /* Channel Configuration Register 0 */
  22. u8 ccr1; /* Channel Configuration Register 1 */
  23. u8 ccr2; /* Channel Configuration Register 2 */
  24. u8 ccr3; /* Channel Configuration Register 3 */
  25. u8 __pad3[4];
  26. u8 vstr; /* Version Status Register */
  27. u8 __pad4[3];
  28. u8 gis; /* Global Interrupt Status */
  29. u8 ipc; /* Interrupt Port Configuration */
  30. u8 isr0; /* Interrupt Status 0 */
  31. u8 isr1; /* Interrupt Status 1 */
  32. u8 pvr; /* Port Value Register */
  33. u8 pis; /* Port Interrupt Status */
  34. u8 pcr; /* Port Configuration Register */
  35. u8 ccr4; /* Channel Configuration Register 4 */
  36. };
  37. struct sab82532_async_wr_regs {
  38. u8 xfifo[0x20]; /* Transmit FIFO */
  39. u8 cmdr; /* Command Register */
  40. u8 __pad1;
  41. u8 mode;
  42. u8 timr;
  43. u8 xon;
  44. u8 xoff;
  45. u8 tcr;
  46. u8 dafo;
  47. u8 rfc;
  48. u8 __pad2;
  49. u8 xbcl; /* Transmit Byte Count Low */
  50. u8 xbch; /* Transmit Byte Count High */
  51. u8 ccr0;
  52. u8 ccr1;
  53. u8 ccr2;
  54. u8 ccr3;
  55. u8 tsax; /* Time-Slot Assignment Reg. Transmit */
  56. u8 tsar; /* Time-Slot Assignment Reg. Receive */
  57. u8 xccr; /* Transmit Channel Capacity Register */
  58. u8 rccr; /* Receive Channel Capacity Register */
  59. u8 bgr; /* Baud Rate Generator Register */
  60. u8 tic; /* Transmit Immediate Character */
  61. u8 mxn; /* Mask XON Character */
  62. u8 mxf; /* Mask XOFF Character */
  63. u8 iva; /* Interrupt Vector Address */
  64. u8 ipc;
  65. u8 imr0; /* Interrupt Mask Register 0 */
  66. u8 imr1; /* Interrupt Mask Register 1 */
  67. u8 pvr;
  68. u8 pim; /* Port Interrupt Mask */
  69. u8 pcr;
  70. u8 ccr4;
  71. };
  72. struct sab82532_async_rw_regs { /* Read/Write registers */
  73. u8 __pad1[0x20];
  74. u8 __pad2;
  75. u8 __pad3;
  76. u8 mode;
  77. u8 timr;
  78. u8 xon;
  79. u8 xoff;
  80. u8 tcr;
  81. u8 dafo;
  82. u8 rfc;
  83. u8 __pad4;
  84. u8 __pad5;
  85. u8 __pad6;
  86. u8 ccr0;
  87. u8 ccr1;
  88. u8 ccr2;
  89. u8 ccr3;
  90. u8 __pad7;
  91. u8 __pad8;
  92. u8 __pad9;
  93. u8 __pad10;
  94. u8 __pad11;
  95. u8 __pad12;
  96. u8 __pad13;
  97. u8 __pad14;
  98. u8 __pad15;
  99. u8 ipc;
  100. u8 __pad16;
  101. u8 __pad17;
  102. u8 pvr;
  103. u8 __pad18;
  104. u8 pcr;
  105. u8 ccr4;
  106. };
  107. union sab82532_async_regs {
  108. __volatile__ struct sab82532_async_rd_regs r;
  109. __volatile__ struct sab82532_async_wr_regs w;
  110. __volatile__ struct sab82532_async_rw_regs rw;
  111. };
  112. union sab82532_irq_status {
  113. unsigned short stat;
  114. struct {
  115. unsigned char isr0;
  116. unsigned char isr1;
  117. } sreg;
  118. };
  119. /* irqflags bits */
  120. #define SAB82532_ALLS 0x00000001
  121. #define SAB82532_XPR 0x00000002
  122. #define SAB82532_REGS_PENDING 0x00000004
  123. /* RFIFO Status Byte */
  124. #define SAB82532_RSTAT_PE 0x80
  125. #define SAB82532_RSTAT_FE 0x40
  126. #define SAB82532_RSTAT_PARITY 0x01
  127. /* Status Register (STAR) */
  128. #define SAB82532_STAR_XDOV 0x80
  129. #define SAB82532_STAR_XFW 0x40
  130. #define SAB82532_STAR_RFNE 0x20
  131. #define SAB82532_STAR_FCS 0x10
  132. #define SAB82532_STAR_TEC 0x08
  133. #define SAB82532_STAR_CEC 0x04
  134. #define SAB82532_STAR_CTS 0x02
  135. /* Command Register (CMDR) */
  136. #define SAB82532_CMDR_RMC 0x80
  137. #define SAB82532_CMDR_RRES 0x40
  138. #define SAB82532_CMDR_RFRD 0x20
  139. #define SAB82532_CMDR_STI 0x10
  140. #define SAB82532_CMDR_XF 0x08
  141. #define SAB82532_CMDR_XRES 0x01
  142. /* Mode Register (MODE) */
  143. #define SAB82532_MODE_FRTS 0x40
  144. #define SAB82532_MODE_FCTS 0x20
  145. #define SAB82532_MODE_FLON 0x10
  146. #define SAB82532_MODE_RAC 0x08
  147. #define SAB82532_MODE_RTS 0x04
  148. #define SAB82532_MODE_TRS 0x02
  149. #define SAB82532_MODE_TLP 0x01
  150. /* Timer Register (TIMR) */
  151. #define SAB82532_TIMR_CNT_MASK 0xe0
  152. #define SAB82532_TIMR_VALUE_MASK 0x1f
  153. /* Data Format (DAFO) */
  154. #define SAB82532_DAFO_XBRK 0x40
  155. #define SAB82532_DAFO_STOP 0x20
  156. #define SAB82532_DAFO_PAR_SPACE 0x00
  157. #define SAB82532_DAFO_PAR_ODD 0x08
  158. #define SAB82532_DAFO_PAR_EVEN 0x10
  159. #define SAB82532_DAFO_PAR_MARK 0x18
  160. #define SAB82532_DAFO_PARE 0x04
  161. #define SAB82532_DAFO_CHL8 0x00
  162. #define SAB82532_DAFO_CHL7 0x01
  163. #define SAB82532_DAFO_CHL6 0x02
  164. #define SAB82532_DAFO_CHL5 0x03
  165. /* RFIFO Control Register (RFC) */
  166. #define SAB82532_RFC_DPS 0x40
  167. #define SAB82532_RFC_DXS 0x20
  168. #define SAB82532_RFC_RFDF 0x10
  169. #define SAB82532_RFC_RFTH_1 0x00
  170. #define SAB82532_RFC_RFTH_4 0x04
  171. #define SAB82532_RFC_RFTH_16 0x08
  172. #define SAB82532_RFC_RFTH_32 0x0c
  173. #define SAB82532_RFC_TCDE 0x01
  174. /* Received Byte Count High (RBCH) */
  175. #define SAB82532_RBCH_DMA 0x80
  176. #define SAB82532_RBCH_CAS 0x20
  177. /* Transmit Byte Count High (XBCH) */
  178. #define SAB82532_XBCH_DMA 0x80
  179. #define SAB82532_XBCH_CAS 0x20
  180. #define SAB82532_XBCH_XC 0x10
  181. /* Channel Configuration Register 0 (CCR0) */
  182. #define SAB82532_CCR0_PU 0x80
  183. #define SAB82532_CCR0_MCE 0x40
  184. #define SAB82532_CCR0_SC_NRZ 0x00
  185. #define SAB82532_CCR0_SC_NRZI 0x08
  186. #define SAB82532_CCR0_SC_FM0 0x10
  187. #define SAB82532_CCR0_SC_FM1 0x14
  188. #define SAB82532_CCR0_SC_MANCH 0x18
  189. #define SAB82532_CCR0_SM_HDLC 0x00
  190. #define SAB82532_CCR0_SM_SDLC_LOOP 0x01
  191. #define SAB82532_CCR0_SM_BISYNC 0x02
  192. #define SAB82532_CCR0_SM_ASYNC 0x03
  193. /* Channel Configuration Register 1 (CCR1) */
  194. #define SAB82532_CCR1_ODS 0x10
  195. #define SAB82532_CCR1_BCR 0x08
  196. #define SAB82532_CCR1_CM_MASK 0x07
  197. /* Channel Configuration Register 2 (CCR2) */
  198. #define SAB82532_CCR2_SOC1 0x80
  199. #define SAB82532_CCR2_SOC0 0x40
  200. #define SAB82532_CCR2_BR9 0x80
  201. #define SAB82532_CCR2_BR8 0x40
  202. #define SAB82532_CCR2_BDF 0x20
  203. #define SAB82532_CCR2_SSEL 0x10
  204. #define SAB82532_CCR2_XCS0 0x20
  205. #define SAB82532_CCR2_RCS0 0x10
  206. #define SAB82532_CCR2_TOE 0x08
  207. #define SAB82532_CCR2_RWX 0x04
  208. #define SAB82532_CCR2_DIV 0x01
  209. /* Channel Configuration Register 3 (CCR3) */
  210. #define SAB82532_CCR3_PSD 0x01
  211. /* Time Slot Assignment Register Transmit (TSAX) */
  212. #define SAB82532_TSAX_TSNX_MASK 0xfc
  213. #define SAB82532_TSAX_XCS2 0x02 /* see also CCR2 */
  214. #define SAB82532_TSAX_XCS1 0x01
  215. /* Time Slot Assignment Register Receive (TSAR) */
  216. #define SAB82532_TSAR_TSNR_MASK 0xfc
  217. #define SAB82532_TSAR_RCS2 0x02 /* see also CCR2 */
  218. #define SAB82532_TSAR_RCS1 0x01
  219. /* Version Status Register (VSTR) */
  220. #define SAB82532_VSTR_CD 0x80
  221. #define SAB82532_VSTR_DPLA 0x40
  222. #define SAB82532_VSTR_VN_MASK 0x0f
  223. #define SAB82532_VSTR_VN_1 0x00
  224. #define SAB82532_VSTR_VN_2 0x01
  225. #define SAB82532_VSTR_VN_3_2 0x02
  226. /* Global Interrupt Status Register (GIS) */
  227. #define SAB82532_GIS_PI 0x80
  228. #define SAB82532_GIS_ISA1 0x08
  229. #define SAB82532_GIS_ISA0 0x04
  230. #define SAB82532_GIS_ISB1 0x02
  231. #define SAB82532_GIS_ISB0 0x01
  232. /* Interrupt Vector Address (IVA) */
  233. #define SAB82532_IVA_MASK 0xf1
  234. /* Interrupt Port Configuration (IPC) */
  235. #define SAB82532_IPC_VIS 0x80
  236. #define SAB82532_IPC_SLA1 0x10
  237. #define SAB82532_IPC_SLA0 0x08
  238. #define SAB82532_IPC_CASM 0x04
  239. #define SAB82532_IPC_IC_OPEN_DRAIN 0x00
  240. #define SAB82532_IPC_IC_ACT_LOW 0x01
  241. #define SAB82532_IPC_IC_ACT_HIGH 0x03
  242. /* Interrupt Status Register 0 (ISR0) */
  243. #define SAB82532_ISR0_TCD 0x80
  244. #define SAB82532_ISR0_TIME 0x40
  245. #define SAB82532_ISR0_PERR 0x20
  246. #define SAB82532_ISR0_FERR 0x10
  247. #define SAB82532_ISR0_PLLA 0x08
  248. #define SAB82532_ISR0_CDSC 0x04
  249. #define SAB82532_ISR0_RFO 0x02
  250. #define SAB82532_ISR0_RPF 0x01
  251. /* Interrupt Status Register 1 (ISR1) */
  252. #define SAB82532_ISR1_BRK 0x80
  253. #define SAB82532_ISR1_BRKT 0x40
  254. #define SAB82532_ISR1_ALLS 0x20
  255. #define SAB82532_ISR1_XOFF 0x10
  256. #define SAB82532_ISR1_TIN 0x08
  257. #define SAB82532_ISR1_CSC 0x04
  258. #define SAB82532_ISR1_XON 0x02
  259. #define SAB82532_ISR1_XPR 0x01
  260. /* Interrupt Mask Register 0 (IMR0) */
  261. #define SAB82532_IMR0_TCD 0x80
  262. #define SAB82532_IMR0_TIME 0x40
  263. #define SAB82532_IMR0_PERR 0x20
  264. #define SAB82532_IMR0_FERR 0x10
  265. #define SAB82532_IMR0_PLLA 0x08
  266. #define SAB82532_IMR0_CDSC 0x04
  267. #define SAB82532_IMR0_RFO 0x02
  268. #define SAB82532_IMR0_RPF 0x01
  269. /* Interrupt Mask Register 1 (IMR1) */
  270. #define SAB82532_IMR1_BRK 0x80
  271. #define SAB82532_IMR1_BRKT 0x40
  272. #define SAB82532_IMR1_ALLS 0x20
  273. #define SAB82532_IMR1_XOFF 0x10
  274. #define SAB82532_IMR1_TIN 0x08
  275. #define SAB82532_IMR1_CSC 0x04
  276. #define SAB82532_IMR1_XON 0x02
  277. #define SAB82532_IMR1_XPR 0x01
  278. /* Port Interrupt Status Register (PIS) */
  279. #define SAB82532_PIS_SYNC_B 0x08
  280. #define SAB82532_PIS_DTR_B 0x04
  281. #define SAB82532_PIS_DTR_A 0x02
  282. #define SAB82532_PIS_SYNC_A 0x01
  283. /* Channel Configuration Register 4 (CCR4) */
  284. #define SAB82532_CCR4_MCK4 0x80
  285. #define SAB82532_CCR4_EBRG 0x40
  286. #define SAB82532_CCR4_TST1 0x20
  287. #define SAB82532_CCR4_ICD 0x10
  288. #endif /* !(_SUNSAB_H) */