ns9750_ser.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /***********************************************************************
  2. *
  3. * Copyright (C) 2004 by FS Forth-Systeme GmbH.
  4. * All rights reserved.
  5. *
  6. * $Id: ns9750_ser.h,v 1.1 2004/02/16 10:37:20 mpietrek Exp $
  7. * @Author: Markus Pietrek
  8. * @References: [1] NS9750 Hardware Reference, December 2003
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. *
  25. ***********************************************************************/
  26. #ifndef FS_NS9750_SER_H
  27. #define FS_NS9750_SER_H
  28. #define NS9750_SER_MODULE_BASE (0x90200000)
  29. #define get_ser_reg_addr(c) \
  30. ((volatile unsigned int *)(NS9750_SER_MODULE_BASE+(unsigned int) (c)))
  31. #define get_ser_reg_addr_channel(reg,chan) \
  32. get_ser_reg_addr((reg)+(((chan)<2)?0:0x00100000)+(((chan)&1)?0x40:0))
  33. /* the register addresses */
  34. #define NS9750_SER_CTRL_A (0x00)
  35. #define NS9750_SER_CTRL_B (0x04)
  36. #define NS9750_SER_STAT_A (0x08)
  37. #define NS9750_SER_BITRATE (0x0C)
  38. #define NS9750_SER_FIFO (0x10)
  39. #define NS9750_SER_RX_BUF_TIMER (0x14)
  40. #define NS9750_SER_RX_CHAR_TIMER (0x18)
  41. #define NS9750_SER_RX_MATCH (0x1C)
  42. #define NS9750_SER_RX_MATCH_MASK (0x20)
  43. #define NS9750_SER_FLOW_CTRL (0x34)
  44. #define NS9750_SER_FLOW_CTRL_FORCE (0x38)
  45. /* register bit fields */
  46. /* control A register */
  47. #define NS9750_SER_CTRL_A_CE (0x80000000)
  48. #define NS9750_SER_CTRL_A_BRK (0x40000000)
  49. #define NS9750_SER_CTRL_A_STICKP (0x20000000)
  50. #define NS9750_SER_CTRL_A_EPS (0x10000000)
  51. #define NS9750_SER_CTRL_A_PE (0x08000000)
  52. #define NS9750_SER_CTRL_A_STOP (0x04000000)
  53. #define NS9750_SER_CTRL_A_WLS_MA (0x03000000)
  54. #define NS9750_SER_CTRL_A_WLS_5 (0x00000000)
  55. #define NS9750_SER_CTRL_A_WLS_6 (0x01000000)
  56. #define NS9750_SER_CTRL_A_WLS_7 (0x02000000)
  57. #define NS9750_SER_CTRL_A_WLS_8 (0x03000000)
  58. #define NS9750_SER_CTRL_A_CTSTX (0x00800000)
  59. #define NS9750_SER_CTRL_A_RTSRX (0x00400000)
  60. #define NS9750_SER_CTRL_A_RL (0x00200000)
  61. #define NS9750_SER_CTRL_A_LL (0x00100000)
  62. #define NS9750_SER_CTRL_A_RES (0x000CF000)
  63. #define NS9750_SER_CTRL_A_DTR (0x00020000)
  64. #define NS9750_SER_CTRL_A_RTS (0x00010000)
  65. #define NS9750_SER_CTRL_A_RIE_MA (0x00000E00)
  66. #define NS9750_SER_CTRL_A_ERXDMA (0x00000100)
  67. #define NS9750_SER_CTRL_A_RIC_MA (0x000000E0)
  68. #define NS9750_SER_CTRL_A_TIC_MA (0x0000001E)
  69. #define NS9750_SER_CTRL_A_ETXDMA (0x00000001)
  70. /* control B register */
  71. #define NS9750_SER_CTRL_B_RDM1 (0x80000000)
  72. #define NS9750_SER_CTRL_B_RDM2 (0x40000000)
  73. #define NS9750_SER_CTRL_B_RDM3 (0x20000000)
  74. #define NS9750_SER_CTRL_B_RDM4 (0x10000000)
  75. #define NS9750_SER_CTRL_B_RBGT (0x08000000)
  76. #define NS9750_SER_CTRL_B_RCGT (0x04000000)
  77. #define NS9750_SER_CTRL_B_MODE_MA (0x00300000)
  78. #define NS9750_SER_CTRL_B_MODE_UART (0x00000000)
  79. #define NS9750_SER_CTRL_B_MODE_HDLC (0x00100000)
  80. #define NS9750_SER_CTRL_B_MODE_SPI_M (0x00200000)
  81. #define NS9750_SER_CTRL_B_MODE_SPI_S (0x00300000)
  82. #define NS9750_SER_CTRL_B_BITORDR (0x00080000)
  83. #define NS9750_SER_CTRL_B_RES (0x0007703F)
  84. #define NS9750_SER_CTRL_B_RTSTX (0x00008000)
  85. #define NS9750_SER_CTRL_B_ENDEC_MA (0x00000FC0)
  86. /* status A register */
  87. #define NS9750_SER_STAT_A_MATCH1 (0x80000000)
  88. #define NS9750_SER_STAT_A_MATCH2 (0x40000000)
  89. #define NS9750_SER_STAT_A_MATCH3 (0x20000000)
  90. #define NS9750_SER_STAT_A_MATCH4 (0x10000000)
  91. #define NS9750_SER_STAT_A_BGAP (0x08000000)
  92. #define NS9750_SER_STAT_A_CGAP (0x04000000)
  93. #define NS9750_SER_STAT_A_RXFDB_MA (0x00300000)
  94. #define NS9750_SER_STAT_A_RXFDB_FULL (0x00000000)
  95. #define NS9750_SER_STAT_A_RXFDB_1 (0x00100000)
  96. #define NS9750_SER_STAT_A_RXFDB_2 (0x00200000)
  97. #define NS9750_SER_STAT_A_RXFDB_3 (0x00300000)
  98. #define NS9750_SER_STAT_A_DCD (0x00080000)
  99. #define NS9750_SER_STAT_A_RI (0x00040000)
  100. #define NS9750_SER_STAT_A_DSR (0x00020000)
  101. #define NS9750_SER_STAT_A_CTS (0x00010000)
  102. #define NS9750_SER_STAT_A_RBRK (0x00008000)
  103. #define NS9750_SER_STAT_A_RFE (0x00004000)
  104. #define NS9750_SER_STAT_A_RPE (0x00002000)
  105. #define NS9750_SER_STAT_A_ROVER (0x00001000)
  106. #define NS9750_SER_STAT_A_RRDY (0x00000800)
  107. #define NS9750_SER_STAT_A_RHALF (0x00000400)
  108. #define NS9750_SER_STAT_A_RBC (0x00000200)
  109. #define NS9750_SER_STAT_A_RFULL (0x00000100)
  110. #define NS9750_SER_STAT_A_DCDI (0x00000080)
  111. #define NS9750_SER_STAT_A_RII (0x00000040)
  112. #define NS9750_SER_STAT_A_DSRI (0x00000020)
  113. #define NS9750_SER_STAT_A_CTSI (0x00000010)
  114. #define NS9750_SER_STAT_A_TRDY (0x00000008)
  115. #define NS9750_SER_STAT_A_THALF (0x00000004)
  116. #define NS9750_SER_STAT_A_TBC (0x00000002)
  117. #define NS9750_SER_STAT_A_TEMPTY (0x00000001)
  118. #define NS9750_SER_STAT_A_RX_COND_ERR ( NS9750_SER_STAT_A_RFE | \
  119. NS9750_SER_STAT_A_ROVER | \
  120. NS9750_SER_STAT_A_RPE )
  121. #define NS9750_SER_STAT_A_RX_COND_ALL ( NS9750_SER_STAT_A_RX_COND_ERR | \
  122. NS9750_SER_STAT_A_RBRK | \
  123. NS9750_SER_STAT_A_RRDY | \
  124. NS9750_SER_STAT_A_RHALF | \
  125. NS9750_SER_STAT_A_RBC | \
  126. NS9750_SER_STAT_A_DCDI | \
  127. NS9750_SER_STAT_A_RII | \
  128. NS9750_SER_STAT_A_DSRI | \
  129. NS9750_SER_STAT_A_CTSI )
  130. #define NS9750_SER_STAT_A_TX_COND_ALL ( NS9750_SER_STAT_A_TRDY | \
  131. NS9750_SER_STAT_A_THALF | \
  132. NS9750_SER_STAT_A_TBC | \
  133. NS9750_SER_STAT_A_TEMPTY )
  134. /* bit rate register */
  135. #define NS9750_SER_BITRATE_EBIT (0x80000000)
  136. #define NS9750_SER_BITRATE_TMODE (0x40000000)
  137. #define NS9750_SER_BITRATE_RXSRC (0x20000000)
  138. #define NS9750_SER_BITRATE_TXSRC (0x10000000)
  139. #define NS9750_SER_BITRATE_RXEXT (0x08000000)
  140. #define NS9750_SER_BITRATE_TXEXT (0x04000000)
  141. #define NS9750_SER_BITRATE_CLKMUX_MA (0x03000000)
  142. #define NS9750_SER_BITRATE_CLKMUX_XTAL (0x00000000)
  143. #define NS9750_SER_BITRATE_CLKMUX_BCLK (0x01000000)
  144. #define NS9750_SER_BITRATE_CLKMUX_OUT1 (0x02000000)
  145. #define NS9750_SER_BITRATE_CLKMUX_OUT2 (0x03000000)
  146. #define NS9750_SER_BITRATE_TXCINV (0x00800000)
  147. #define NS9750_SER_BITRATE_RXCINV (0x00400000)
  148. #define NS9750_SER_BITRATE_TCDR_MA (0x00180000)
  149. #define NS9750_SER_BITRATE_TCDR_1 (0x00000000)
  150. #define NS9750_SER_BITRATE_TCDR_8 (0x00080000)
  151. #define NS9750_SER_BITRATE_TCDR_16 (0x00100000)
  152. #define NS9750_SER_BITRATE_TCDR_32 (0x00180000)
  153. #define NS9750_SER_BITRATE_RCDR_MA (0x00070000)
  154. #define NS9750_SER_BITRATE_RCDR_1 (0x00000000)
  155. #define NS9750_SER_BITRATE_RCDR_8 (0x00020000)
  156. #define NS9750_SER_BITRATE_RCDR_16 (0x00040000)
  157. #define NS9750_SER_BITRATE_RCDR_32 (0x00060000)
  158. #define NS9750_SER_BITRATE_TICS (0x00010000)
  159. #define NS9750_SER_BITRATE_RICS (0x00008000)
  160. #define NS9750_SER_BITRATE_N_MA (0x00007FFF)
  161. /* receive buffer gap timer */
  162. #define NS9750_SER_RX_BUF_TIMER_TRUN (0x80000000) /* UART and SPI */
  163. #define NS9750_SER_RX_BUF_TIMER_BT_MA (0x0000FFFF) /* UART and SPI */
  164. #define NS9750_SER_RX_BUF_TIMER_MAXLEN_MA (0x0000FFFF) /* HDLC only */
  165. /* receive character gap timer */
  166. #define NS9750_SER_RX_CHAR_TIMER_TRUN (0x80000000)
  167. #define NS9750_SER_RX_CHAR_TIMER_CT_MA (0x000FFFFF)
  168. /* receive match */
  169. #define NS9750_SER_RX_MATCH_RDMB1_MA (0xFF000000)
  170. #define NS9750_SER_RX_MATCH_RDMB2_MA (0x00FF0000)
  171. #define NS9750_SER_RX_MATCH_RDMB3_MA (0x0000FF00)
  172. #define NS9750_SER_RX_MATCH_RDMB4_MA (0x000000FF)
  173. /* receive match mask */
  174. #define NS9750_SER_RX_MATCH_MASK_RDMB1_MA (0xFF000000)
  175. #define NS9750_SER_RX_MATCH_MASK_RDMB2_MA (0x00FF0000)
  176. #define NS9750_SER_RX_MATCH_MASK_RDMB3_MA (0x0000FF00)
  177. #define NS9750_SER_RX_MATCH_MASK_RDMB4_MA (0x000000FF)
  178. #endif /* FS_NS9750_SER_H */