cd2400Sio.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:21k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* cd2400.h - Cirrus Logic CD2400 serial chip header */
  2. /* Copyright 1991-1997 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01d,29sep98,fle  doc : made it refgen parsable
  7. 01c,04mar97,dat  SPR 7767, added #ifdef _ASMLANGUAGE
  8. 01b,15jun95,ms  updated for new driver.
  9. 01a,06mar95,myz  written (from cd2400Serial.h).
  10. */
  11. /*
  12. */
  13. #ifndef __INCcd2400Sioh
  14. #define __INCcd2400Sioh
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define N_CHANNELS    4 /* number of serial channels on chip */
  19. #ifndef _ASMLANGUAGE
  20. /* channel descriptors */
  21. typedef struct
  22.     {
  23.     /* always goes first */
  24.     SIO_DRV_FUNCS *     pDrvFuncs;      /* driver functions */
  25.     /* callbacks */
  26.     STATUS      (*getTxChar) ();
  27.     STATUS      (*putRcvChar) ();
  28.     void *      getTxArg;
  29.     void *      putRcvArg;
  30.     BOOL        created;
  31.     UINT16      int_vec;        /* channel interrupt vector base */
  32.     UINT16      chan_num;       /* the channel number of this device */
  33.     UINT16      channelMode;
  34.     void        (*intEnDisable)(int mode);
  35.     struct CD2400_QUSART * pQusart;
  36.     } CD2400_CHAN;
  37. /* cd2400 chip descriptor */
  38. typedef struct CD2400_QUSART
  39.     {
  40.     CD2400_CHAN  channel[N_CHANNELS];
  41.     UINT16      numChannels;
  42.     char * baseAdrs; /* the base address of the device */
  43.     UINT16      regSpacing;
  44.     INT16       devMode; /* only one channel in polling mode */
  45.     int baudClkFreq;
  46.     BOOL (*rxReady) (struct CD2400_QUSART *);
  47.     BOOL (*txReady) (struct CD2400_QUSART *);
  48.     } CD2400_QUSART;
  49. /* on-board access, register definitions */
  50. #undef  MPCC_ADRS
  51. #define MPCC_ADRS(reg) (pQusart->baseAdrs + (reg * pQusart->regSpacing))
  52. /* MPCC -- cd2400 serial channel chip -- register definitions
  53.  * Defined in this order which is the order of defined in
  54.  * the CIRRUS LOGIC document
  55.  */
  56. /* GLOBAL REGISTERS */
  57. #define MPCC_GFRCR MPCC_ADRS(0x81) /* Global Firmware Rev Code Register */
  58. #define MPCC_TFTC MPCC_ADRS(0x80) /* Transmit FIFO Transfer Count */
  59. #define MPCC_MEOIR MPCC_ADRS(0x86) /* Modem End of Interrupt Register */
  60. #define MPCC_TEOIR MPCC_ADRS(0x85) /* Transmit End of Interrupt Register */
  61. #define MPCC_REOIR MPCC_ADRS(0x84) /* Receive End of Interrupt Register */
  62. #define MPCC_MISR MPCC_ADRS(0x8b) /* Modem (/Timer) Interrupt Status Re */
  63. #define MPCC_TISR MPCC_ADRS(0x8a) /* Transmit Interrupt Status Register */
  64. #define MPCC_RISR MPCC_ADRS(0x88) /* Receive Interrupt Stat Reg (WORD) */
  65. #define MPCC_RISRL MPCC_ADRS(0x89) /* Receive Interrupt Stat Reg Low */
  66. #define MPCC_RISRH MPCC_ADRS(0x88) /* Receive Interrupt Stat Reg High */
  67. #define MPCC_MIR MPCC_ADRS(0xef) /* Modem Interrupt Register */
  68. #define MPCC_TIR MPCC_ADRS(0xec) /* Transmit Interrupt Register */
  69. #define MPCC_RIR MPCC_ADRS(0xed) /* Receive Interrupt Register */
  70. #define MPCC_STK MPCC_ADRS(0xe2) /* Stack Register */
  71. #define MPCC_TPR MPCC_ADRS(0xda) /* Timer Period Register */
  72. #define MPCC_PILR1 MPCC_ADRS(0xe3) /* Priority Interrupt Level Reg 1 */
  73. #define MPCC_PILR2 MPCC_ADRS(0xe0) /* Priority Interrupt Level Reg 2 */
  74. #define MPCC_PILR3 MPCC_ADRS(0xe1) /* Priority Interrupt Level Reg 3 */
  75. #define MPCC_CAR MPCC_ADRS(0xee) /* Channel Access Register */
  76. #define MPCC_RDR MPCC_ADRS(0xf8) /* Receive Data Register */
  77. #define MPCC_TDR MPCC_ADRS(0xf8) /* Transmit Data Register */
  78. #define MPCC_DMR MPCC_ADRS(0xf6) /* DMA Mode Register */
  79. /* Per-Channel Registers */
  80. #define MPCC_LICR MPCC_ADRS(0x26) /* Local Interrupting Channel Reg */
  81. #define MPCC_LIVR MPCC_ADRS(0x09) /* Local Interrupt Vector Register */
  82. #define MPCC_CCR MPCC_ADRS(0x13) /* Channel Command Register */
  83. #define MPCC_STCR MPCC_ADRS(0x12) /* Special Transmit Command Register */
  84. #define MPCC_IER MPCC_ADRS(0x11) /* Interrupt Enable Register */
  85. #define MPCC_COR1 MPCC_ADRS(0x10) /* Channel Option Register 1 */
  86. #define MPCC_COR2 MPCC_ADRS(0x17) /* Channel Option Register 2 */
  87. #define MPCC_COR3 MPCC_ADRS(0x16) /* Channel Option Register 3 */
  88. #define MPCC_COR4 MPCC_ADRS(0x15) /* Channel Option Register 4 */
  89. #define MPCC_COR5 MPCC_ADRS(0x14) /* Channel Option Register 5 */
  90. #define MPCC_COR6 MPCC_ADRS(0x18) /* Channel Option Register 6 */
  91. #define MPCC_COR7 MPCC_ADRS(0x07) /* Channel Option Register 7 */
  92. #define MPCC_CMR MPCC_ADRS(0x1b) /* Channel Mode Register */
  93. #define MPCC_CSR MPCC_ADRS(0x1a) /* Channel Status Reg (Sync Modes) */
  94. #define MPCC_DMABSTS MPCC_ADRS(0x19) /* DMA Buffer Status */
  95. #define MPCC_LNXT MPCC_ADRS(0x2e) /* LNext Character */
  96. #define MPCC_SCHR1 MPCC_ADRS(0x1f) /* Special Character Register 1 */
  97. #define MPCC_RFAR1 MPCC_ADRS(0x1f) /* Receive Frame Address Register 1 */
  98. #define MPCC_SCHR2 MPCC_ADRS(0x1e) /* Special Character Register 2 */
  99. #define MPCC_RFAR2 MPCC_ADRS(0x1e) /* Receive Frame Address Register 2 */
  100. #define MPCC_SCHR3 MPCC_ADRS(0x1d) /* Special Character Register 3 */
  101. #define MPCC_RFAR3 MPCC_ADRS(0x1d) /* Receive Frame Address Register 3 */
  102. #define MPCC_SCHR4 MPCC_ADRS(0x1c) /* Special Character Register 4 */
  103. #define MPCC_RFAR4 MPCC_ADRS(0x1c) /* Receive Frame Address Register 4 */
  104. #define MPCC_SCRL MPCC_ADRS(0x23) /* Special Character Range Low */
  105. #define MPCC_SCRH MPCC_ADRS(0x22) /* Special Character Range High */
  106. #define MPCC_RTPR MPCC_ADRS(0x24) /* Receive Timeout Period Register */
  107. #define MPCC_RTPRL MPCC_ADRS(0x25) /* Receive Timeout Period Reg Low */
  108. #define MPCC_RTPRH MPCC_ADRS(0x24) /* Receive Timeout Period Reg High */
  109. #define MPCC_GT1 MPCC_ADRS(0x2a) /* General Timer 1 */
  110. #define MPCC_GT1L MPCC_ADRS(0x2b) /* General Timer 1 Low */
  111. #define MPCC_GT1H MPCC_ADRS(0x2a) /* General Timer 1 High */
  112. #define MPCC_GT2 MPCC_ADRS(0x29) /* General Timer 2 */
  113. #define MPCC_TTR MPCC_ADRS(0x29) /* Transmit Timer Register */
  114. #define MPCC_RFOC MPCC_ADRS(0x30) /* Receive FIFO Output Count */
  115. #define MPCC_TCBADRL MPCC_ADRS(0x3a) /* Transmit Current Buffer Addr Lower */
  116. #define MPCC_TCBADRH MPCC_ADRS(0x38) /* Transmit Current Buffer Addr Upper */
  117. #define MPCC_RCBADRL MPCC_ADRS(0x3e) /* Receive Current Buffer Addr Lower */
  118. #define MPCC_RCBADRH MPCC_ADRS(0x3c) /* Receive Current Buffer Addr Upper */
  119. #define MPCC_ARBADRL MPCC_ADRS(0x42) /* A Receive Buffer Address Lower */
  120. #define MPCC_ARBADRU MPCC_ADRS(0x40) /* A Receive Buffer Address Upper */
  121. #define MPCC_BRBADRL MPCC_ADRS(0x46) /* B Receive Buffer Address Lower */
  122. #define MPCC_BRBADRU MPCC_ADRS(0x44) /* B Receive Buffer Address Upper */
  123. #define MPCC_ARBCNT MPCC_ADRS(0x4a) /* A Receive Buffer Count */
  124. #define MPCC_BRBCNT MPCC_ADRS(0x48) /* B Receive Buffer Count */
  125. #define MPCC_ARBSTS MPCC_ADRS(0x4f) /* A Receive Buffer Status */
  126. #define MPCC_BRBSTS MPCC_ADRS(0x4e) /* B Receive Buffer Status */
  127. #define MPCC_ATBADRL MPCC_ADRS(0x52) /* A Transmit Buffer Address Lower */
  128. #define MPCC_ATBADRU MPCC_ADRS(0x50) /* B Transmit Buffer Address Upper */
  129. #define MPCC_BTBADRL MPCC_ADRS(0x56) /* B Transmit Buffer Address Lower */
  130. #define MPCC_BTBADRU MPCC_ADRS(0x54) /* B Transmit Buffer Address Upper */
  131. #define MPCC_ATBCNT MPCC_ADRS(0x5a) /* A Buffer Transmit Byte Count */
  132. #define MPCC_BTBCNT MPCC_ADRS(0x58) /* B Buffer Transmit Byte Count */
  133. #define MPCC_ATBSTS MPCC_ADRS(0x5f) /* A Transmit Buffer Status */
  134. #define MPCC_BTBSTS MPCC_ADRS(0x5e) /* B Transmit Buffer Status */
  135. #define MPCC_MSVRRTS MPCC_ADRS(0xde) /* Modem Signal Value Register - RTS */
  136. #define MPCC_MSVRDTR MPCC_ADRS(0xdf) /* Modem Signal Value Register - DTR */
  137. #define MPCC_TBPR MPCC_ADRS(0xc3) /* Transmit Baud Rate Period Register */
  138. #define MPCC_TCOR MPCC_ADRS(0xc0) /* Transmit Clock Option Register */
  139. #define MPCC_RBPR MPCC_ADRS(0xcb) /* Receive Baud Rate Period Register */
  140. #define MPCC_RCOR MPCC_ADRS(0xc8) /* Receive Clock Option Register */
  141. #define MPCC_CPSR MPCC_ADRS(0xd6) /* CRC Polynomial Select Register */
  142. /* Now let's define some register bit values */
  143. /* MEOIR 0x86 Modem End of Interrupt Register    */
  144. /* TEOIR 0x85 Transmit End of Interrupt Register */
  145. /* REOIR 0x84 Receive End of Interrupt Register  */
  146. #define EOIR_SET_TIMER_2 0x20 /* load MISR to timer 2 */
  147. #define EOIR_SET_TIMER_1 0x10 /* load MISR to timer 1 */
  148. #define EOIR_TERMINATE_BUF 0x80 /* 1=Terminate buffer in DMA Mode */
  149. #define EOIR_END_OF_FRAME 0x40 /* 0 = no, 1 = yes */
  150. #define EOIR_NO_TRANSFER 0x08 /* no data transferred */
  151. #define EOIR_DIS_EXCEP_CHAR 0x40 /* 0 = no, 1 = yes */
  152. #define EOIR_TRANSFER 0x00 /* data was transferred */
  153. /* MISR 0x8b Modem (/Timer) Interrupt Status Register */
  154. #define MISR_DSR_CHANGED 0x80 /* 0 = no, 1 = yes */
  155. #define MISR_CD_CHANGED 0x40 /* 0 = no, 1 = yes */
  156. #define MISR_CTS_CHANGED 0x20 /* 0 = no, 1 = yes */
  157. #define MISR_TIMER2_TIMEOUT 0x02 /* 0 = no, 1 = yes */
  158. #define MISR_TIMER1_TIMEOUT 0x01 /* 0 = no, 1 = yes */
  159. /* TISR 0x8a Transmit Interrupt Status Register          */
  160. #define TISR_TRANS_BERR 0x80 /* 0 = no, 1 = yes (Bus error) */
  161. #define TISR_TRANS_EOF 0x40 /* 0 = no, 1 = yes (End Of Frame) */
  162. #define TISR_TRANS_EOB 0x20 /* 0 = no, 1 = yes (End Of trans Buf) */
  163. #define TISR_TRANS_UNDERRUN 0x10 /* 0 = no, 1 = yes */
  164. #define TISR_TRANS_A_OR_B 0x08 /* 0 = Buffer A, 1 = Buffer B */
  165. #define TISR_TX_EMPTY 0x02 /* 0 = no, 1 = yes (idle condition) */
  166. #define TISR_TX_DATA 0x01 /* 0 = no, 1 = yes (below threshold) */
  167. /* RISR 0x88 Receive Interrupt Status Register       */
  168. /* RISRL 0x89 Receive Interrupt Status Register Low   */
  169. /* HDLC Mode */
  170. #define RISR_REC_EOF 0x40 /* 0 = no, 1 = yes */
  171. #define RISR_REC_ABORT 0x20 /* 0 = no, 1 = yes (term frame) */
  172. #define RISR_REC_CRC 0x10 /* 0 = no, 1 = yes (CRC error frame) */
  173. #define RISR_REC_OVERRUN 0x08 /* 0 = no, 1 = yes (Overrun occured) */
  174. #define RISR_REC_RESIDUAL 0x04 /* 0 = no, 1 = yes (char was partial */
  175. #define RISR_REC_CLEAR_DCT 0x01 /* 0 = no, 1 = yes (X.21 Clr signal) */
  176. /* Asynchronous Mode */
  177. #define RISR_REC_TIMEOUT 0x80 /* 0 = no, 1 = yes (No char rec'd) */
  178. #define RISR_REC_PARITY_ERR 0x04 /* 0 = no, 1 = yes (Parity error) */
  179. #define RISR_REC_FRAME_ERR 0x02 /* 0 = no, 1 = yes (Frame error) */
  180. #define RISR_REC_BREAK 0x01 /* 0 = no, 1 = yes (Break detected) */
  181. /* RISRH 0x88 Receive Interrupt Status Register High */
  182. #define RISR_REC_BERR 0x80 /* 0 = no, 1 = yes (Bus error) */
  183. #define RISR_REC_EOB 0x20 /* 0 = no, 1 = yes (End Of Buffer) */
  184. #define RISR_REC_A_OR_B 0x08 /* 0 = Buffer A, 1 = Buffer B */
  185. /* MIR 0xef Modem Interrupt Register  */
  186. #define MIR_MODEM_ENABLE 0x80 /* 0 = no, 1 = yes (Modem inter) */
  187. #define MIR_MODEM_ACTIVE 0x40 /* 0 = no, 1 = yes (Modem Active) */
  188. #define MIR_MODEM_EOI 0x20 /* 0 = no, 1 = yes (Modem End Of Int) */
  189. /* TIR 0xec Transmit Interrupt Register  */
  190. #define TIR_TRANS_ENABLE 0x80 /* 0 = no, 1 = yes (Trans inter) */
  191. #define TIR_TRANS_ACTIVE 0x40 /* 0 = no, 1 = yes (Trans Active) */
  192. #define TIR_TRANS_EOI 0x20 /* 0 = no, 1 = yes (Trans End of Int) */
  193. /* RIR 0xed Receive Interrupt Register  */
  194. #define RIR_REC_ENABLE 0x80 /* 0 = no, 1 = yes (Rec inter) */
  195. #define RIR_REC_ACTIVE 0x40 /* 0 = no, 1 = yes (Rec Active) */
  196. #define RIR_REC_EOI 0x20 /* 0 = no, 1 = yes (Rec End of Int) */
  197. /* CAR 0xee Channel Access Register */
  198. #define CAR_CHANNEL0 0x00 /* Channel 0 1-0 */
  199. #define CAR_CHANNEL1 0x01 /* Channel 1 1-0 */
  200. #define CAR_CHANNEL2 0x02 /* Channel 2 1-0 */
  201. #define CAR_CHANNEL3 0x03 /* Channel 3 1-0 */
  202. /* DMR 0xf6 DMA Mode Register */
  203. #define DMR_BYTE_DMA 0x08 /* Do BYTE DMA always 3 */
  204. #define DMR_WORD_DMA  0x00 /* Do WORD DMA whenever poss 4 */
  205. /* CCR 0x13 Channel Command Register */
  206. #define CCR_CLEAR_CHANNEL 0x40 /* clear channel 7,6 */
  207. #define CCR_INIT_CHANNEL 0x20 /* initialize channel 7,5 */
  208. #define CCR_RESET_ALL 0x10 /* on-chip init ALL CHANNELS 7,4 */
  209. #define CCR_ENABLE_TRANS 0x08 /* enable transmitter 7,3 */
  210. #define CCR_DISABLE_TRANS 0x04 /* disable transmitter 7,2 */
  211. #define CCR_ENABLE_REC 0x02 /* enable receiver 7,1 */
  212. #define CCR_DISABLE_REC 0x01 /* disable receiver 7,0 */
  213. #define CCR_CLEAR_TIMER1 0xc0 /* clear general timer 1 7,6 */
  214. #define CCR_CLEAR_TIMER2 0xa0 /* clear general timer 2 7,5 */
  215. /* STCR 0x12 Special Transmit Command Register */
  216. #define STCR_ABORT_TX 0x40 /* abort transmiss (HDLC) 6 */
  217. #define STCR_APPD_CMP 0x20 /* append complete (async DMA) 5 */
  218. #define STCR_SND_SPC 0x08 /* send special character 3 */
  219. #define STCR_SPECIAL_CHAR1 0x01 /* send special char 1 2-0 */
  220. #define STCR_SPECIAL_CHAR2 0x02 /* send special char 2 2-0 */
  221. #define STCR_SPECIAL_CHAR3 0x03 /* send special char 3 2-0 */
  222. #define STCR_SPECIAL_CHAR4 0x04 /* send special char 4 2-0 */
  223. /* IER 0x11 Interrupt Enable Register */
  224. #define IER_MODEM 0x80 /* modem pin change detect 7 */
  225. #define IER_RET 0x20 /* Receive Exception Timeout 5 */
  226. #define IER_RXDATA 0x08 /* Receive Data Interrupt 3 */
  227. #define IER_TIMER 0x04 /* general timer timeout 2 */
  228. #define IER_TXEMPTY 0x02 /* transmitter empty 1 */
  229. #define IER_TXDATA 0x01 /* Transmit Data Interrupt 0 */
  230. /* COR1 0x10 Channel Option Register 1 */
  231. #define COR1_ODD_PARITY 0x80 /* odd parity 7 */
  232. #define COR1_EVEN_PARITY 0x00 /* even parity 7 */
  233. #define COR1_NO_PARITY 0x00 /* no parity mode 6-5 */
  234. #define COR1_FORCE_PARITY 0x20 /* force parity (odd=1/even=0) 6-5 */
  235. #define COR1_PARITY 0x40 /* normal parity 6-5 */
  236. #define COR1_IGNORE_PARITY 0x10 /* do not evaluate parity 4 */
  237. #define COR1_5BITS 0x04 /* 5 data bits 3-0 */
  238. #define COR1_6BITS 0x05 /* 6 data bits 3-0 */
  239. #define COR1_7BITS 0x06 /* 7 data bits 3-0 */
  240. #define COR1_8BITS 0x07 /* 8 data bits 3-0 */
  241. /* COR2 0x17 Channel Option Register 2 */
  242. #define COR2_IXM 0x80 /* xon with any char 7 */
  243. #define COR2_TXIBE 0x40 /* tx in-band xon/xoff control 6 */
  244. #define COR2_ETC 0x20 /* embedded tx command enable 5 */
  245. #define COR2_REMOTE_LOOP 0x08 /* enable remote loopback 3 */
  246. #define COR2_AUTO_RTS 0x04 /* RTS automatic output enable 2 */
  247. #define COR2_AUTO_CTS 0x02 /* CTS automatic enable 1 */
  248. #define COR2_AUTO_DSR 0x01 /* DSR automatic enable 0 */
  249. /* COR3 0x16 Channel Option Register 3 */
  250. #define COR3_ESCDE 0x80 /* extnd spec char det enable 7 */
  251. #define COR3_RANGE_DETECT 0x40 /* generate special char inter 6 */
  252. #define COR3_FCT 0x20 /* flow control not passed 5 */
  253. #define COR3_SCDE 0x10 /* special character detecton 4 */
  254. #define COR3_1STOP_BIT 0x02 /* 1 stop bit 2-0 */
  255. #define COR3_1_5STOP_BIT 0x03 /* 1.5 stop bits 2-0 */
  256. #define COR3_2STOP_BIT 0x04 /* 2 stop bits 2-0 */
  257. /* COR4 0x15 Channel Option Register 4 */
  258. #define COR4_DSR_ZD 0x80 /* 1->0 detect on the DSR* 7 */
  259. #define COR4_CD_ZD 0x40 /* 1->0 detect on the CD* 6 */
  260. #define COR4_CTS_ZD 0x20 /* 1->0 detect on the CTS* 5 */
  261. /* COR5 0x14 Channel Option Register 5 */
  262. #define COR5_DSR_OD 0x80 /* 0->1 detect on the DSR* 7 */
  263. #define COR5_CD_OD 0x40 /* 0->1 detect on the CD* 6 */
  264. #define COR5_CTS_OD 0x20 /* 0->1 detect on the CTS* 5 */
  265. /* COR6 0x18 Channel Option Register 6 */
  266. #define COR6_NORMAL_CR_NL 0x00 /* no special action on CR/NL 7-5 */
  267. #define COR6_NL_TO_CR 0x20 /* NL translated to CR 7-5 */
  268. #define COR6_CR_TO_NL 0x40 /* CR translated to NL 7-5 */
  269. #define COR6_SWAP_CR_NL 0x60 /* CR->NL, NL->CR 7-5 */
  270. #define COR6_NO_CR 0x80 /* CR discarded 7-5 */
  271. #define COR6_NO_CR_NL_TO_CR 0xa0 /* CR discarded, NL->CR 7-5 */
  272. #define COR6_BRK_EXCEPTION 0x00 /* on break: generate exception 3-4 */
  273. #define COR6_BRK_TO_NULL 0x08 /*      trans to NULL 3-4 */
  274. #define COR6_BRK_DISCARD 0x18 /*      discard character 3-4 */
  275. /*   On Parity/Framing Error:     */
  276. #define COR6_PARITY_EXCEPTION 0x00 /* generate exception interrupt 2-0 */
  277. #define COR6_PARITY_TO_NULL 0x01 /* translated to a NULL char 2-0 */
  278. #define COR6_PARITY_IGNORE 0x02 /* ignore error,pass as good 2-0 */
  279. #define COR6_PARTIY_DISCARD 0x03 /* discard error character 2-0 */
  280. #define COR6_PARITY_FF_NULL 0x05 /* trans to FF NULL pass as gd 2-0 */
  281. /* COR7 0x07 Channel Option Register 7 */
  282. #define COR7_ISTRIP 0x80 /* strip to 7 bits on input 7 */
  283. #define COR7_LNEXT 0x40 /* char after LNXT no spec process 6 */
  284. #define COR7_FCERROR 0x20 /* frlow control on error char 5 */
  285. #define COR7_NORMAL_CR_NL 0x00 /* on tx CR/NL: no special act 1-0 */
  286. #define COR7_CR_TO_NL 0x01 /* CR -> NL 1-0 */
  287. #define COR7_NL_TO_CR_NL 0x02 /* NL -> CR/NL 1-0 */
  288. #define COR7_CR_TO_NL_NL_TO_CR_NL 0x03 /* CR->NL,NL->CR/NL 1-0 */
  289. /* CMR 0x1b Channel Mode Register */
  290. #define CMR_RX_INTERRUPT 0x00 /* rx tran mode = interrupt 7 */
  291. #define CMR_RX_DMA 0x80 /* rx tran mode = DMA 7 */
  292. #define CMR_TX_INTERRUPT 0x00 /* tx tran mode = interrupt 6 */
  293. #define CMR_TX_DMA 0x40 /* tx tran mode = DMA 6 */
  294. #define CMR_HDLC_MODE 0x00 /* protocal: HDLC 2-0 */
  295. #define CMR_BISYNC_MODE 0x01 /* BISYNC 2-0 */
  296. #define CMR_ASYNC_MODE 0x02 /* ASYNC 2-0 */
  297. #define CMR_X_21_MODE 0x03 /* X.21 2-0 */
  298. /* CSR 0x1a Channel Status Register */
  299. #define CSR_RX_ENABLE 0x80 /* receiver is enabled 7 */
  300. #define CSR_RX_FLOFF 0x40 /* receive flow off sent 6 */
  301. #define CSR_RX_FLON 0x20 /* receive flow on sent 5 */
  302. #define CSR_TX_ENABLE 0x08 /* transmitter is enabled 3 */
  303. #define CSR_TX_FLOFF 0x04 /* trans remote stop request 2 */
  304. #define CSR_TX_FLON 0x02 /* trans remote start request 1 */
  305. /* DMABSTS 0x19 DMA Buffer Status */
  306. #define DMABSTS_RST_APD 0x40 /* reset append mode 6 */
  307. #define DMABSTS_APPEND 0x10 /* append buffer is in use 4 */
  308. #define DMABSTS_B_NTBUF 0x08 /* B is next tx buffer 3 */
  309. #define DMABSTS_TBSY 0x04 /* current tx buffer in use 2 */
  310. #define DMABSTS_B_NRBUF 0x02 /* B is next rx buffer 1 */
  311. #define DMABSTS_RBUSY 0x01 /* current rec buffer in use 0 */
  312. /* ARBSTS 0x4f A Receive Buffer Status */
  313. /* BRBSTS 0x4e B Receive Buffer Status */
  314. #define RBSTS_BUS_ERR 0x80 /* bus error occurred 7 */
  315. #define RBSTS_EOF 0x40 /* this buffer term frame 6 */
  316. #define RBSTS_EOB 0x20 /* buffer complete 5 */
  317. #define RBSTS_2400_OWN 0x01 /* buffer can be used by CD2400 0 */
  318. /* ATBSTS 0x5f A Transmit Buffer Status */
  319. /* BTBSTS 0x5E B Transmit Buffer Status */
  320. #define TBSTS_BUS_ERR 0x80 /* bus error occurred 7 */
  321. #define TBSTS_EOF 0x40 /* last in frame/block 6 */
  322. #define TBSTS_EOB 0x20 /* end of tx buffer reached 5 */
  323. #define TBSTS_APPEND 0x08 /* data may be appded during tx 3 */
  324. #define TBSTS_INTR 0x02 /* interrupt required 1 */
  325. #define TBSTS_2400_OWN 0x01 /* buffer ready to transmit 0 */
  326. /* MSVR_RTS 0xde Modem Signal Value Register DTR */
  327. /* MSVR_DTR 0xdf Modem Signal Value Register DTR */
  328. #define MSVR_DSR 0x80 /* state of the DSR input 7 */
  329. #define MSVR_CD 0x40 /* state of the CD input 6 */
  330. #define MSVR_CTS 0x20 /* state of the CTS input 5 */
  331. #define MSVR_DTR 0x02 /* state of the DTR output 1 */
  332. #define MSVR_RTS 0x01 /* state of the RTS output 0 */
  333. /* TCOR 0xc0 Transmit Clock Option Register */
  334. #define TCOR_CLK0 0x00 /* select clock 0 7-5 */
  335. #define TCOR_CLK1 0x20 /* select clock 1 7-5 */
  336. #define TCOR_CLK2 0x40 /* select clock 2 7-5 */
  337. #define TCOR_CLK3 0x60 /* select clock 3 7-5 */
  338. #define TCOR_CLK4 0x80 /* select clock 4 7-5 */
  339. #define TCOR_EXTERNAL_CLK 0xc0 /* External clock 7-5 */
  340. #define TCOR_RECEIVE_CLK 0xe0 /* Receive clock 7-5 */
  341. #define TCOR_EXT_1X 0x08 /* times 1 extern clock 3 */
  342. #define TCOR_LLM 0x02 /* enable local loopback 1 */
  343. /* TBPR 0xc3 Transmit Baud Rate Period Reg */
  344. /* RBPR 0xcb Receive Baud Rate Period Reg */
  345. #define BPR_64000 0x26 /* with clk0 */
  346. #define BPR_56000 0x2c /* with clk0 */
  347. #define BPR_38400 0x40 /* with clk0 */
  348. #define BPR_19200 0x81 /* with clk0 */
  349. #define BPR_9600 0x40 /* with clk1 */
  350. #define BPR_7200 0x56 /* with clk1 */
  351. #define BPR_4800 0x81 /* with clk1 */
  352. #define BPR_3600 0xad /* with clk1 */
  353. #define BPR_2400 0x40 /* with clk2 */
  354. #define BPR_1200 0x81 /* with clk2 */
  355. #define BPR_600 0x40 /* with clk3 */
  356. #define BPR_300 0x81 /* with clk3 */
  357. #define BPR_150 0x40 /* with clk4 */
  358. #define BPR_110 0x58 /* with clk4 */
  359. #define BPR_50 0xc2 /* with clk4 */
  360. /* RCOR 0xc8 Receive Clock Option Register */
  361. #define RCOR_TLVAL 0x80 /* transmit line value 7 */
  362. #define RCOR_DPLL_ENABLE 0x20 /* enable DPLL 5 */
  363. #define RCOR_DPLL_DISABLE 0x00 /* disable DPLL 5 */
  364. #define RCOR_DPLL_NRZ 0x00 /* data encoding: NRZ 4-3 */
  365. #define RCOR_DPLL_NRZI 0x08 /* NRZI 4-3 */
  366. #define RCOR_DPLL_MANCHESTER 0x10 /* Manches 4-3 */
  367. #define RCOR_CLK0 0x00 /* select clock 0 2-0 */
  368. #define RCOR_CLK1 0x01 /* select clock 1 2-0 */
  369. #define RCOR_CLK2 0x02 /* select clock 2 2-0 */
  370. #define RCOR_CLK3 0x03 /* select clock 3 2-0 */
  371. #define RCOR_CLK4 0x04 /* select clock 4 2-0 */
  372. /* CPSR 0xd6 CRC Polynomial Select Register */
  373. #define CPSR_CRC_16 0x01 /* CRC-16 polynomial (Bisync) 0 */
  374. #define CPSR_CRC_V41 0x00 /* CRC V.41 polynomial (HDLC) 0 */
  375. /* function prototypes */
  376. #if defined(__STDC__) || defined(__cplusplus)
  377. extern void cd2400HrdInit (CD2400_QUSART *pQusart);
  378. extern void cd2400IntRx (CD2400_CHAN *pDev);
  379. extern void cd2400IntTx (CD2400_CHAN *pDev);
  380. extern void cd2400Int (CD2400_CHAN *pDev);
  381. #else   /* __STDC__ */
  382. extern void cd2400HrdInit ();
  383. extern void cd2400IntRx ();
  384. extern void cd2400IntTx ();
  385. extern void cd2400Int ();
  386. #endif  /* __STDC__ */
  387. #endif /*__ASM_LANGUAGE*/
  388. #ifdef __cplusplus
  389. }
  390. #endif
  391. #endif /* __INCcd2400h */