moxa.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. #ifndef MOXA_H_FILE
  2. #define MOXA_H_FILE
  3. #define MOXA 0x400
  4. #define MOXA_GET_IQUEUE (MOXA + 1) /* get input buffered count */
  5. #define MOXA_GET_OQUEUE (MOXA + 2) /* get output buffered count */
  6. #define MOXA_GETDATACOUNT (MOXA + 23)
  7. #define MOXA_GET_IOQUEUE (MOXA + 27)
  8. #define MOXA_FLUSH_QUEUE (MOXA + 28)
  9. #define MOXA_GETMSTATUS (MOXA + 65)
  10. /*
  11. * System Configuration
  12. */
  13. #define Magic_code 0x404
  14. /*
  15. * for C218 BIOS initialization
  16. */
  17. #define C218_ConfBase 0x800
  18. #define C218_status (C218_ConfBase + 0) /* BIOS running status */
  19. #define C218_diag (C218_ConfBase + 2) /* diagnostic status */
  20. #define C218_key (C218_ConfBase + 4) /* WORD (0x218 for C218) */
  21. #define C218DLoad_len (C218_ConfBase + 6) /* WORD */
  22. #define C218check_sum (C218_ConfBase + 8) /* BYTE */
  23. #define C218chksum_ok (C218_ConfBase + 0x0a) /* BYTE (1:ok) */
  24. #define C218_TestRx (C218_ConfBase + 0x10) /* 8 bytes for 8 ports */
  25. #define C218_TestTx (C218_ConfBase + 0x18) /* 8 bytes for 8 ports */
  26. #define C218_RXerr (C218_ConfBase + 0x20) /* 8 bytes for 8 ports */
  27. #define C218_ErrFlag (C218_ConfBase + 0x28) /* 8 bytes for 8 ports */
  28. #define C218_LoadBuf 0x0F00
  29. #define C218_KeyCode 0x218
  30. #define CP204J_KeyCode 0x204
  31. /*
  32. * for C320 BIOS initialization
  33. */
  34. #define C320_ConfBase 0x800
  35. #define C320_LoadBuf 0x0f00
  36. #define STS_init 0x05 /* for C320_status */
  37. #define C320_status C320_ConfBase + 0 /* BIOS running status */
  38. #define C320_diag C320_ConfBase + 2 /* diagnostic status */
  39. #define C320_key C320_ConfBase + 4 /* WORD (0320H for C320) */
  40. #define C320DLoad_len C320_ConfBase + 6 /* WORD */
  41. #define C320check_sum C320_ConfBase + 8 /* WORD */
  42. #define C320chksum_ok C320_ConfBase + 0x0a /* WORD (1:ok) */
  43. #define C320bapi_len C320_ConfBase + 0x0c /* WORD */
  44. #define C320UART_no C320_ConfBase + 0x0e /* WORD */
  45. #define C320_KeyCode 0x320
  46. #define FixPage_addr 0x0000 /* starting addr of static page */
  47. #define DynPage_addr 0x2000 /* starting addr of dynamic page */
  48. #define C218_start 0x3000 /* starting addr of C218 BIOS prg */
  49. #define Control_reg 0x1ff0 /* select page and reset control */
  50. #define HW_reset 0x80
  51. /*
  52. * Function Codes
  53. */
  54. #define FC_CardReset 0x80
  55. #define FC_ChannelReset 1 /* C320 firmware not supported */
  56. #define FC_EnableCH 2
  57. #define FC_DisableCH 3
  58. #define FC_SetParam 4
  59. #define FC_SetMode 5
  60. #define FC_SetRate 6
  61. #define FC_LineControl 7
  62. #define FC_LineStatus 8
  63. #define FC_XmitControl 9
  64. #define FC_FlushQueue 10
  65. #define FC_SendBreak 11
  66. #define FC_StopBreak 12
  67. #define FC_LoopbackON 13
  68. #define FC_LoopbackOFF 14
  69. #define FC_ClrIrqTable 15
  70. #define FC_SendXon 16
  71. #define FC_SetTermIrq 17 /* C320 firmware not supported */
  72. #define FC_SetCntIrq 18 /* C320 firmware not supported */
  73. #define FC_SetBreakIrq 19
  74. #define FC_SetLineIrq 20
  75. #define FC_SetFlowCtl 21
  76. #define FC_GenIrq 22
  77. #define FC_InCD180 23
  78. #define FC_OutCD180 24
  79. #define FC_InUARTreg 23
  80. #define FC_OutUARTreg 24
  81. #define FC_SetXonXoff 25
  82. #define FC_OutCD180CCR 26
  83. #define FC_ExtIQueue 27
  84. #define FC_ExtOQueue 28
  85. #define FC_ClrLineIrq 29
  86. #define FC_HWFlowCtl 30
  87. #define FC_GetClockRate 35
  88. #define FC_SetBaud 36
  89. #define FC_SetDataMode 41
  90. #define FC_GetCCSR 43
  91. #define FC_GetDataError 45
  92. #define FC_RxControl 50
  93. #define FC_ImmSend 51
  94. #define FC_SetXonState 52
  95. #define FC_SetXoffState 53
  96. #define FC_SetRxFIFOTrig 54
  97. #define FC_SetTxFIFOCnt 55
  98. #define FC_UnixRate 56
  99. #define FC_UnixResetTimer 57
  100. #define RxFIFOTrig1 0
  101. #define RxFIFOTrig4 1
  102. #define RxFIFOTrig8 2
  103. #define RxFIFOTrig14 3
  104. /*
  105. * Dual-Ported RAM
  106. */
  107. #define DRAM_global 0
  108. #define INT_data (DRAM_global + 0)
  109. #define Config_base (DRAM_global + 0x108)
  110. #define IRQindex (INT_data + 0)
  111. #define IRQpending (INT_data + 4)
  112. #define IRQtable (INT_data + 8)
  113. /*
  114. * Interrupt Status
  115. */
  116. #define IntrRx 0x01 /* receiver data O.K. */
  117. #define IntrTx 0x02 /* transmit buffer empty */
  118. #define IntrFunc 0x04 /* function complete */
  119. #define IntrBreak 0x08 /* received break */
  120. #define IntrLine 0x10 /* line status change
  121. for transmitter */
  122. #define IntrIntr 0x20 /* received INTR code */
  123. #define IntrQuit 0x40 /* received QUIT code */
  124. #define IntrEOF 0x80 /* received EOF code */
  125. #define IntrRxTrigger 0x100 /* rx data count reach tigger value */
  126. #define IntrTxTrigger 0x200 /* tx data count below trigger value */
  127. #define Magic_no (Config_base + 0)
  128. #define Card_model_no (Config_base + 2)
  129. #define Total_ports (Config_base + 4)
  130. #define Module_cnt (Config_base + 8)
  131. #define Module_no (Config_base + 10)
  132. #define Timer_10ms (Config_base + 14)
  133. #define Disable_IRQ (Config_base + 20)
  134. #define TMS320_PORT1 (Config_base + 22)
  135. #define TMS320_PORT2 (Config_base + 24)
  136. #define TMS320_CLOCK (Config_base + 26)
  137. /*
  138. * DATA BUFFER in DRAM
  139. */
  140. #define Extern_table 0x400 /* Base address of the external table
  141. (24 words * 64) total 3K bytes
  142. (24 words * 128) total 6K bytes */
  143. #define Extern_size 0x60 /* 96 bytes */
  144. #define RXrptr 0x00 /* read pointer for RX buffer */
  145. #define RXwptr 0x02 /* write pointer for RX buffer */
  146. #define TXrptr 0x04 /* read pointer for TX buffer */
  147. #define TXwptr 0x06 /* write pointer for TX buffer */
  148. #define HostStat 0x08 /* IRQ flag and general flag */
  149. #define FlagStat 0x0A
  150. #define FlowControl 0x0C /* B7 B6 B5 B4 B3 B2 B1 B0 */
  151. /* x x x x | | | | */
  152. /* | | | + CTS flow */
  153. /* | | +--- RTS flow */
  154. /* | +------ TX Xon/Xoff */
  155. /* +--------- RX Xon/Xoff */
  156. #define Break_cnt 0x0E /* received break count */
  157. #define CD180TXirq 0x10 /* if non-0: enable TX irq */
  158. #define RX_mask 0x12
  159. #define TX_mask 0x14
  160. #define Ofs_rxb 0x16
  161. #define Ofs_txb 0x18
  162. #define Page_rxb 0x1A
  163. #define Page_txb 0x1C
  164. #define EndPage_rxb 0x1E
  165. #define EndPage_txb 0x20
  166. #define Data_error 0x22
  167. #define RxTrigger 0x28
  168. #define TxTrigger 0x2a
  169. #define rRXwptr 0x34
  170. #define Low_water 0x36
  171. #define FuncCode 0x40
  172. #define FuncArg 0x42
  173. #define FuncArg1 0x44
  174. #define C218rx_size 0x2000 /* 8K bytes */
  175. #define C218tx_size 0x8000 /* 32K bytes */
  176. #define C218rx_mask (C218rx_size - 1)
  177. #define C218tx_mask (C218tx_size - 1)
  178. #define C320p8rx_size 0x2000
  179. #define C320p8tx_size 0x8000
  180. #define C320p8rx_mask (C320p8rx_size - 1)
  181. #define C320p8tx_mask (C320p8tx_size - 1)
  182. #define C320p16rx_size 0x2000
  183. #define C320p16tx_size 0x4000
  184. #define C320p16rx_mask (C320p16rx_size - 1)
  185. #define C320p16tx_mask (C320p16tx_size - 1)
  186. #define C320p24rx_size 0x2000
  187. #define C320p24tx_size 0x2000
  188. #define C320p24rx_mask (C320p24rx_size - 1)
  189. #define C320p24tx_mask (C320p24tx_size - 1)
  190. #define C320p32rx_size 0x1000
  191. #define C320p32tx_size 0x1000
  192. #define C320p32rx_mask (C320p32rx_size - 1)
  193. #define C320p32tx_mask (C320p32tx_size - 1)
  194. #define Page_size 0x2000U
  195. #define Page_mask (Page_size - 1)
  196. #define C218rx_spage 3
  197. #define C218tx_spage 4
  198. #define C218rx_pageno 1
  199. #define C218tx_pageno 4
  200. #define C218buf_pageno 5
  201. #define C320p8rx_spage 3
  202. #define C320p8tx_spage 4
  203. #define C320p8rx_pgno 1
  204. #define C320p8tx_pgno 4
  205. #define C320p8buf_pgno 5
  206. #define C320p16rx_spage 3
  207. #define C320p16tx_spage 4
  208. #define C320p16rx_pgno 1
  209. #define C320p16tx_pgno 2
  210. #define C320p16buf_pgno 3
  211. #define C320p24rx_spage 3
  212. #define C320p24tx_spage 4
  213. #define C320p24rx_pgno 1
  214. #define C320p24tx_pgno 1
  215. #define C320p24buf_pgno 2
  216. #define C320p32rx_spage 3
  217. #define C320p32tx_ofs C320p32rx_size
  218. #define C320p32tx_spage 3
  219. #define C320p32buf_pgno 1
  220. /*
  221. * Host Status
  222. */
  223. #define WakeupRx 0x01
  224. #define WakeupTx 0x02
  225. #define WakeupBreak 0x08
  226. #define WakeupLine 0x10
  227. #define WakeupIntr 0x20
  228. #define WakeupQuit 0x40
  229. #define WakeupEOF 0x80 /* used in VTIME control */
  230. #define WakeupRxTrigger 0x100
  231. #define WakeupTxTrigger 0x200
  232. /*
  233. * Flag status
  234. */
  235. #define Rx_over 0x01
  236. #define Xoff_state 0x02
  237. #define Tx_flowOff 0x04
  238. #define Tx_enable 0x08
  239. #define CTS_state 0x10
  240. #define DSR_state 0x20
  241. #define DCD_state 0x80
  242. /*
  243. * FlowControl
  244. */
  245. #define CTS_FlowCtl 1
  246. #define RTS_FlowCtl 2
  247. #define Tx_FlowCtl 4
  248. #define Rx_FlowCtl 8
  249. #define IXM_IXANY 0x10
  250. #define LowWater 128
  251. #define DTR_ON 1
  252. #define RTS_ON 2
  253. #define CTS_ON 1
  254. #define DSR_ON 2
  255. #define DCD_ON 8
  256. /* mode definition */
  257. #define MX_CS8 0x03
  258. #define MX_CS7 0x02
  259. #define MX_CS6 0x01
  260. #define MX_CS5 0x00
  261. #define MX_STOP1 0x00
  262. #define MX_STOP15 0x04
  263. #define MX_STOP2 0x08
  264. #define MX_PARNONE 0x00
  265. #define MX_PAREVEN 0x40
  266. #define MX_PARODD 0xC0
  267. #endif