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

VxWorks

开发平台:

C/C++

  1. /* m68681.h - Motorola M68681 serial chip header file */
  2. /* Copyright 1984-1992 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01h,22sep92,rrr  added support for c++
  7. 01g,14aug92,caf  added TY_CO_DEV and function declarations for 5.1 upgrade.
  8.  for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when
  9.  including this header.
  10. 01f,26may92,rrr  the tree shuffle
  11. 01e,04oct91,rrr  passed through the ansification filter
  12.   -changed ASMLANGUAGE to _ASMLANGUAGE
  13.   -changed copyright notice
  14. 01d,05oct90,shl  added copyright notice.
  15.                  made #endif ANSI style.
  16. 01c,10sep89,rld  added DUART registers.
  17. 01b,30apr88,gae  added definition INCm68681h.
  18. 01a,06jan88,miz  written for Mizar Digital Systems.
  19. */
  20. /*
  21. This file contains constants for the Motorola M68681 serial chip.
  22. The constants DUART_REG_OFFSET and SIO must defined when
  23. including this header file.
  24. */
  25. #ifndef __INCm68681h
  26. #define __INCm68681h
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #ifndef _ASMLANGUAGE
  31. #ifndef INCLUDE_TY_CO_DRV_50
  32. #include "tyLib.h"
  33. typedef struct          /* TY_CO_DEV */
  34.     {
  35.     TY_DEV tyDev;
  36.     BOOL created;       /* true if this device has really been created */
  37.     char numChannels; /* number of channels to support               */
  38.     char *dr;           /* data port                                   */
  39.     char *csr;          /* clock select register                       */
  40.     char *cr;           /* control register                            */
  41.     char *sopbc;        /* set ouput port bits register                */
  42.     char *isr;          /* interrupt status register                   */
  43.     char *mr;           /* mode register                               */
  44.     char *imr;          /* interrupt mask register                     */
  45.     char *ctlr;         /* counter timer lower register                */
  46.     char *ctur;         /* counter timer upper register                */
  47.     char *acr;          /* auxiliary control register                  */
  48.     char *ctron;        /* counter on                                  */
  49.     char *ctroff;       /* counter off                                 */
  50.     char *kimr;         /* keep current interrupt mask register value  */
  51.     char rem;           /* bit for receive-enable mask                 */
  52.     char tem;           /* bit for transmit-enable mask                */
  53.     VOIDFUNCPTR tickRtn; /* timer ISR (NULL if none)        */
  54.     } TY_CO_DEV;
  55. #endif /* INCLUDE_TY_CO_DRV_50 */
  56. #endif /* _ASMLANGUAGE */
  57. #define N_CHANNELS    2 /* number of serial channels on chip */
  58. #ifdef _ASMLANGUAGE
  59. #define SIO_ADRS(reg) (SIO + (reg * DUART_REG_OFFSET))
  60. #else
  61. #define SIO_ADRS(reg) ((char *) SIO + (reg * DUART_REG_OFFSET))
  62. #endif /* _ASMLANGUAGE */
  63. /* SIO -- m68681 serial channel chip -- register definitions */
  64. #define DUART_MRA SIO_ADRS(0x00) /* mode reg. A */
  65. #define DUART_CSRA SIO_ADRS(0x01) /* clock select reg. A */
  66. #define DUART_SRA DUART_CSRA /* status reg. A */
  67. #define DUART_CRA SIO_ADRS(0x02) /* command reg. A */
  68. #define DUART_THRA SIO_ADRS(0x03) /* transmit buffer A */
  69. #define DUART_RHRA DUART_THRA /* receive buffer A */
  70. #define DUART_ACR SIO_ADRS(0x04) /* auxiliary control reg. */
  71. #define DUART_IPCR DUART_ACR /* input port change reg. */
  72. #define DUART_IMR SIO_ADRS(0x05) /* int. mask reg. */
  73. #define DUART_ISR DUART_IMR /* int. status reg. */
  74. #define DUART_CTUR SIO_ADRS(0x06) /* counter timer upper reg. */
  75. #define DUART_CTLR SIO_ADRS(0x07) /* counter timer lower reg. */
  76. #define DUART_MRB SIO_ADRS(0x08) /* mode reg. B */
  77. #define DUART_CSRB SIO_ADRS(0x09) /* clock select reg. B */
  78. #define DUART_SRB DUART_CSRB /* status reg. B */
  79. #define DUART_CRB SIO_ADRS(0x0a) /* command reg. B */
  80. #define DUART_THRB SIO_ADRS(0x0b) /* transmit buffer B */
  81. #define DUART_RHRB DUART_THRB /* receive buffer B */
  82. #define DUART_IVR SIO_ADRS(0x0c) /* int. vector reg. */
  83. #define DUART_OPCR SIO_ADRS(0x0d) /* output port config. reg. */
  84. #define DUART_IP DUART_OPCR /* input port */
  85. #define DUART_SOPBC SIO_ADRS(0x0e) /* set output port bits */
  86. #define DUART_CTRON DUART_SOPBC /* counter on */
  87. #define DUART_ROPBC SIO_ADRS(0x0f) /* reset output port bits */
  88. #define DUART_CTROFF DUART_ROPBC /* counter off */
  89. /* equates for mode reg. A or B, mode 1 */
  90. #define RX_RTS 0x80 /* 0 = no, 1 = yes */
  91. #define RX_INT 0x40 /* 0 = RxRDY, 1 = FFULL */
  92. #define ERR_MODE 0x20 /* 0 = char, 1 = block */
  93. #define PAR_MODE_MULTI 0x18 /* multi_drop mode */
  94. #define PAR_MODE_NO 0x10 /* no parity mode */
  95. #define PAR_MODE_FORCE 0x08 /* force parity mode */
  96. #define PAR_MODE_YES 0x00 /* parity mode */
  97. #define PARITY_TYPE 0x04 /* 0 = even, 1 = odd */
  98. #define BITS_CHAR_8 0x03 /* 8 bits */
  99. #define BITS_CHAR_7 0x02 /* 7 bits */
  100. #define BITS_CHAR_6 0x01 /* 6 bits */
  101. #define BITS_CHAR_5 0x00 /* 5 bits */
  102. /* equates for mode reg. A or B, mode 2 */
  103. #define CHAN_MODE_RL 0xc0 /* remote loop */
  104. #define CHAN_MODE_LL 0x80 /* local loop */
  105. #define CHAN_MODE_AECHO 0x40 /* auto echo */
  106. #define CHAN_MODE_NORM 0x00 /* normal */
  107. #define TX_RTS 0x20 /* 0 = no, 1 = yes */
  108. #define CTS_ENABLE 0x10 /* 0 = no, 1 = yes */
  109. #define STOP_BITS_2 0x0f /* 2 */
  110. #define STOP_BITS_1 0x07 /* 1 */
  111. /* equates for clock select reg. A or B */
  112. #define RX_CLK_SEL 0xf0 /* receiver clock select */
  113. #define RX_CLK_19200 0xc0 /* 19200 */
  114. #define RX_CLK_9600 0xb0 /* 9600 */
  115. #define RX_CLK_1800 0xa0 /* 1800 */
  116. #define RX_CLK_4800 0x90 /* 4800 */
  117. #define RX_CLK_2400 0x80 /* 2400 */
  118. #define RX_CLK_2000 0x70 /* 2000 */
  119. #define RX_CLK_1200 0x60 /* 1200 */
  120. #define RX_CLK_600 0x50 /* 600 */
  121. #define RX_CLK_300 0x40 /* 300 */
  122. #define RX_CLK_150 0x30 /* 150 */
  123. #define RX_CLK_134_5 0x20 /* 134.5 */
  124. #define RX_CLK_110 0x10 /* 110 */
  125. #define RX_CLK_75 0x00 /* 75 */
  126. #define TX_CLK_SEL 0x0f /* transmitter clock select */
  127. #define TX_CLK_19200 0x0c /* 19200 */
  128. #define TX_CLK_9600 0x0b /* 9600 */
  129. #define TX_CLK_1800 0x0a /* 1800 */
  130. #define TX_CLK_4800 0x09 /* 4800 */
  131. #define TX_CLK_2400 0x08 /* 2400 */
  132. #define TX_CLK_2000 0x07 /* 2000 */
  133. #define TX_CLK_1200 0x06 /* 1200 */
  134. #define TX_CLK_600 0x05 /* 600 */
  135. #define TX_CLK_300 0x04 /* 300 */
  136. #define TX_CLK_150 0x03 /* 150 */
  137. #define TX_CLK_134_5 0x02 /* 134.5 */
  138. #define TX_CLK_110 0x01 /* 110 */
  139. #define TX_CLK_75 0x00 /* 75 */
  140. /* equates for status reg. A or B */
  141. #define RXD_BREAK 0x80 /* 0 = no, 1 = yes */
  142. #define FRAMING_ERR 0x40 /* 0 = no, 1 = yes */
  143. #define PARITY_ERR 0x20 /* 0 = no, 1 = yes */
  144. #define OVERRUN_ERR 0x10 /* 0 = no, 1 = yes */
  145. #define TXENT 0x08 /* 0 = no, 1 = yes */
  146. #define TXRDY 0x04 /* 0 = no, 1 = yes */
  147. #define FFULL 0x02 /* 0 = no, 1 = yes */
  148. #define RXRDY 0x01 /* 0 = no, 1 = yes */
  149. /* equates for command reg. A or B */
  150. /* miscellaneous commands: 0x70 */
  151. #define STP_BREAK_CMD 0x70 /* stop break command */
  152. #define STR_BREAK_CMD 0x60 /* start break command */
  153. #define RST_BRK_INT_CMD 0x50 /* reset break int. command */
  154. #define RST_ERR_STS_CMD 0x40 /* reset error status command */
  155. #define RST_TX_CMD 0x30 /* reset transmitter command */
  156. #define RST_RX_CMD 0x20 /* reset receiver command */
  157. #define RST_MR_PTR_CMD 0x10 /* reset mr pointer command */
  158. #define NO_COMMAND 0x00 /* no command */
  159. #define TX_DISABLE 0x08 /* 0 = no, 1 = yes */
  160. #define TX_ENABLE 0x04 /* 0 = no, 1 = yes */
  161. #define RX_DISABLE 0x02 /* 0 = no, 1 = yes */
  162. #define RX_ENABLE 0x01 /* 0 = no, 1 = yes */
  163. /* equates for auxiliary control reg. (timer and counter clock selects) */
  164. #define BRG_SELECT 0x80 /* baud rate generator select */
  165. /* 0 = set 1; 1 = set 2 */
  166. /* NOTE above equates are set 2 ONLY */
  167. #define TMR_EXT_CLK_16 0x70 /* external clock divided by 16 */
  168. #define TMR_EXT_CLK 0x60 /* external clock */
  169. #define TMR_IP2_16 0x50 /* ip2 divided by 16 */
  170. #define TMR_IP2 0x40 /* ip2 */
  171. #define CTR_EXT_CLK_16 0x30 /* external clock divided by 16 */
  172. #define CTR_TXCB 0x20 /* channel B transmitter clock */
  173. #define CTR_TXCA 0x10 /* channel A transmitter clock */
  174. #define CTR_IP2 0x00 /* ip2 */
  175. #define DELTA_IP3_INT 0x08 /* delta ip3 int. */
  176. #define DELTA_IP2_INT 0x04 /* delta ip2 int. */
  177. #define DELTA_IP1_INT 0x02 /* delta ip1 int. */
  178. #define DELTA_IP0_INT 0x01 /* delta ip0 int. */
  179. /* equates for input port change reg. */
  180. #define DELTA_IP3 0x80 /* 0 = no, 1 = yes */
  181. #define DELTA_IP2 0x40 /* 0 = no, 1 = yes */
  182. #define DELTA_IP1 0x20 /* 0 = no, 1 = yes */
  183. #define DELTA_IP0 0x10 /* 0 = no, 1 = yes */
  184. #define IP3 0x08 /* 0 = low, 1 = high */
  185. #define IP2 0x04 /* 0 = low, 1 = high */
  186. #define IP1 0x02 /* 0 = low, 1 = high */
  187. #define IP0 0x01 /* 0 = low, 1 = high */
  188. /* equates for int. mask reg. */
  189. #define INPUT_DELTA_INT 0x80 /* 0 = off, 1 = on */
  190. #define BREAK_B_INT 0x40 /* 0 = off, 1 = on */
  191. #define RX_RDY_B_INT 0x20 /* 0 = off, 1 = on */
  192. #define TX_RDY_B_INT 0x10 /* 0 = off, 1 = on */
  193. #define CTR_RDY_INT 0x08 /* 0 = off, 1 = on */
  194. #define BREAK_A_INT 0x04 /* 0 = off, 1 = on */
  195. #define RX_RDY_A_INT 0x02 /* 0 = off, 1 = on */
  196. #define TX_RDY_A_INT 0x01 /* 0 = off, 1 = on */
  197. /* equates for int. status reg. */
  198. #define INPUT_DELTA 0x80 /* 0 = no, 1 = yes */
  199. #define BREAK_B 0x40 /* 0 = no, 1 = yes */
  200. #define RX_RDY_B 0x20 /* 0 = no, 1 = yes */
  201. #define TX_RDY_B 0x10 /* 0 = no, 1 = yes */
  202. #define CTR_RDY 0x08 /* 0 = no, 1 = yes */
  203. #define BREAK_A 0x04 /* 0 = no, 1 = yes */
  204. #define RX_RDY_A 0x02 /* 0 = no, 1 = yes */
  205. #define TX_RDY_A 0x01 /* 0 = no, 1 = yes */
  206. /* equates for output port config. reg. */
  207. #define OP7 0x80 /* 0 = OPCR[7], 1 = TxRDYB */
  208. #define OP6 0x40 /* 0 = OPCR[6], 1 = TxRDYA */
  209. #define OP5 0x20 /* 0 = OPCR[5], 1 = RxRDYB */
  210. #define OP4 0x10 /* 0 = OPCR[4], 1 = RxRDYA */
  211. #define RXCB_1X 0x0c /* RCXB_1X */
  212. #define TXCB_1X 0x08 /* TXCB_1X */
  213. #define C_T_OUTPUT 0x04 /* C_T_OUTPUT */
  214. #define OP3 0x00 /* 0 = OPCR[3] */
  215. #define RXCA_1X 0x03 /* RXCA_1X */
  216. #define TXCA_1X 0x02 /* TXCA_1X */
  217. #define TXCA_16X 0x01 /* TXCA_16X */
  218. #define OP2 0x00 /* 0 = OPCR[2] */
  219. /* function declarations */
  220. #ifndef INCLUDE_TY_CO_DRV_50
  221. #ifndef _ASMLANGUAGE
  222. #if defined(__STDC__) || defined(__cplusplus)
  223. IMPORT  void    tyCoInt (int arg);
  224. #else /* __STDC__ */
  225. IMPORT  void    tyCoInt ();
  226. #endif /* __STDC__ */
  227. #endif /* _ASMLANGUAGE */
  228. #endif /* INCLUDE_TY_CO_DRV_50 */
  229. #ifdef __cplusplus
  230. }
  231. #endif
  232. #endif /* __INCm68681h */