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

VxWorks

开发平台:

C/C++

  1. /* m5206Sio.h - Motorola MCF5206 internal UART header file */
  2. /* Copyright 1984-1997 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01a,21jan96,kab  written
  7. */
  8. /*
  9. This file contains constants for the UART contained in the Motorola MCF5206.
  10. The constant SIO must defined when
  11. including this header file.
  12. */
  13. #ifndef __INCm5206Sioh
  14. #define __INCm5206Sioh
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #ifndef _ASMLANGUAGE
  19. #include "sioLib.h"
  20. typedef struct
  21.     {
  22.     SIO_DRV_FUNCS  * pDrvFuncs; /* Driver functions */
  23. /* CallBacks */
  24.     STATUS   (*getTxChar)();
  25.     STATUS   (*putRcvChar)();
  26.     void *   getTxArg;
  27.     void *   putRcvArg;
  28.     
  29.     UINT clkRate; /* system clock rate */
  30.     UINT16 mode; /* SIO_MODE */
  31.     unsigned char intVec;
  32.     int options;
  33.     int intEnable;
  34.     UINT baudRate;
  35.     UCHAR oprCopy;
  36.     UCHAR acrCopy;
  37.     UCHAR imrCopy;
  38.     volatile UCHAR *mr; /* UART mode register */
  39.     volatile UCHAR *sr; /* UART status register */
  40.     volatile UCHAR *csr; /* UART clock select register */
  41.     volatile UCHAR *cr; /* UART command register */
  42.     volatile UCHAR *rb; /* UART receive buffer register */
  43.     volatile UCHAR *tb; /* UART transmit buffer register */
  44.     volatile UCHAR *ipcr; /* UART input port change register */
  45.     volatile UCHAR *acr; /* UART auxiliary control register */
  46.     volatile UCHAR *isr; /* UART interrupt status register */
  47.     volatile UCHAR *imr; /* UART interrupt mask register */
  48.     volatile UCHAR *bg1; /* UART baud generator prescale register 1 */
  49.     volatile UCHAR *bg2; /* UART baud generator prescale register 2 */
  50.     volatile UCHAR *ivr; /* UART interrupt vector register */
  51.     volatile UCHAR *ip; /* UART input port register */
  52.     volatile UCHAR *op1; /* UART output port set cmd */
  53.     volatile UCHAR *op2; /* UART output port reset cmd */
  54.     } M5206_CHAN;
  55. #endif /* _ASMLANGUAGE */
  56. /* register bit definitions */
  57. /* MR1 - mode register 1 */
  58. #define M5206_UART_MR1_BC0 (1 << 0) /* bits per char 0 */
  59. #define M5206_UART_MR1_BC1 (1 << 1) /* bits per char 1 */
  60. #define M5206_UART_MR1_PT (1 << 2) /* parity type */
  61. #define M5206_UART_MR1_PM0 (1 << 3) /* parity mode 0 */
  62. #define M5206_UART_MR1_PM1 (1 << 4) /* parity mode 1 */
  63. #define M5206_UART_MR1_ERR (1 << 5) /* error mode */
  64. #define M5206_UART_MR1_RX_IRQ (1 << 6) /* receiver interrupt select */
  65. #define M5206_UART_MR1_RX_RTS (1 << 7) /* Rx RTS control */
  66. /* Some common modes */
  67. #define M5206_UART_MR1_BITS_CHAR_5 0
  68. #define M5206_UART_MR1_BITS_CHAR_6 M5206_UART_MR1_BC0
  69. #define M5206_UART_MR1_BITS_CHAR_7 M5206_UART_MR1_BC1
  70. #define M5206_UART_MR1_BITS_CHAR_8 (M5206_UART_MR1_BC0 
  71.  | M5206_UART_MR1_BC1)
  72. #define M5206_UART_MR1_NO_PARITY (M5206_UART_MR1_PM1)
  73. #define M5206_UART_MR1_PAR_MODE_MULTI (M5206_UART_MR1_PM0 
  74.  | M5206_UART_MR1_PM1)
  75. #define M5206_UART_MR1_EVEN_PARITY 0
  76. #define M5206_UART_MR1_ODD_PARITY M5206_UART_MR1_PT
  77. /* MR2 - mode register 2 */
  78. #define M5206_UART_MR2_SB0 (1 << 0) /* stop bit control 0 */
  79. #define M5206_UART_MR2_SB1 (1 << 1) /* stop bit control 1 */
  80. #define M5206_UART_MR2_SB2 (1 << 2) /* stop bit control 2 */
  81. #define M5206_UART_MR2_SB3 (1 << 3) /* stop bit control 3 */
  82. #define M5206_UART_MR2_TX_CTS (1 << 4) /* Tx CTS control */
  83. #define M5206_UART_MR2_TX_RTS (1 << 5) /* Tx RTS control */
  84. #define M5206_UART_MR2_CM0 (1 << 6) /* channel mode 0 */
  85. #define M5206_UART_MR2_CM1 (1 << 7) /* channel mode 1 */
  86. /* Some common bit lengths */
  87. #define M5206_UART_MR2_STOP_BITS_1 (M5206_UART_MR2_SB0 
  88.  | M5206_UART_MR2_SB1 
  89.  | M5206_UART_MR2_SB2)
  90. #define M5206_UART_MR2_STOP_BITS_2 (M5206_UART_MR2_SB0 
  91.  | M5206_UART_MR2_SB1 
  92.  | M5206_UART_MR2_SB2 
  93.  | M5206_UART_MR2_SB3)
  94. /* SR - status register */
  95. #define M5206_UART_SR_RXRDY (1 << 0) /* Rx ready */
  96. #define M5206_UART_SR_FFULL (1 << 1) /* FIFO full */
  97. #define M5206_UART_SR_TXRDY (1 << 2) /* Tx ready */
  98. #define M5206_UART_SR_TXEMP (1 << 3) /* Tx empty */
  99. #define M5206_UART_SR_OE (1 << 4) /* overrun error */
  100. #define M5206_UART_SR_PE (1 << 5) /* parity error */
  101. #define M5206_UART_SR_FE (1 << 6) /* framing error */
  102. #define M5206_UART_SR_RB (1 << 7) /* received break */
  103. /* CSR - clock select register */
  104. #define M5206_UART_CSR_TCS0 (1 << 0) /* Tx clock select 0 */
  105. #define M5206_UART_CSR_TCS1 (1 << 1) /* Tx clock select 1 */
  106. #define M5206_UART_CSR_TCS2 (1 << 2) /* Tx clock select 2 */
  107. #define M5206_UART_CSR_TCS3 (1 << 3) /* Tx clock select 3 */
  108. #define M5206_UART_CSR_RCS0 (1 << 4) /* Rx clock select 0 */
  109. #define M5206_UART_CSR_RCS1 (1 << 5) /* Rx clock select 1 */
  110. #define M5206_UART_CSR_RCS2 (1 << 6) /* Rx clock select 2 */
  111. #define M5206_UART_CSR_RCS3 (1 << 7) /* Rx clock select 3 */
  112. #define M5206_UART_CSR_TIMER_TX (M5206_UART_CSR_TCS0 
  113.  | M5206_UART_CSR_TCS2 
  114.  | M5206_UART_CSR_TCS3)
  115. #define M5206_UART_CSR_TIMER_RX (M5206_UART_CSR_RCS0 
  116.  | M5206_UART_CSR_RCS2 
  117.  | M5206_UART_CSR_RCS3)
  118. /* CR - command register */
  119. #define M5206_UART_CR_RC0 (1 << 0) /* receiver control bit 0 */
  120. #define M5206_UART_CR_RC1 (1 << 1) /* receiver control bit 1 */
  121. #define M5206_UART_CR_TC0 (1 << 2) /* transmitter control bit 0 */
  122. #define M5206_UART_CR_TC1 (1 << 3) /* transmitter control bit 1 */
  123. #define M5206_UART_CR_MISC0 (1 << 4) /* misc control bit 0 */
  124. #define M5206_UART_CR_MISC1 (1 << 5) /* misc control bit 1 */
  125. #define M5206_UART_CR_MISC2 (1 << 6) /* misc control bit 2 */
  126. /* Some common commands */
  127. #define M5206_UART_CR_TX_ENABLE (M5206_UART_CR_TC0)
  128. #define M5206_UART_CR_TX_DISABLE (M5206_UART_CR_TC1)
  129. #define M5206_UART_CR_RX_ENABLE (M5206_UART_CR_RC0)
  130. #define M5206_UART_CR_RX_DISABLE (M5206_UART_CR_RC1)
  131. #define M5206_UART_CR_RESET_MODE_PTR (M5206_UART_CR_MISC0)
  132. #define M5206_UART_CR_RESET_RX (M5206_UART_CR_MISC1)
  133. #define M5206_UART_CR_RESET_TX (M5206_UART_CR_MISC0 
  134.  | M5206_UART_CR_MISC1)
  135. #define M5206_UART_CR_RESET_ERR (M5206_UART_CR_MISC2)
  136. /* ACR - auxiliary control register */
  137. #define M5206_UART_ACR_IEC (1 << 0) /* input enable control */
  138. /* IMR - interrupt mask register */
  139. #define M5206_UART_IMR_TXRDY (1 << 0) /* transmitter ready */
  140. #define M5206_UART_IMR_RXRDY (1 << 1) /* receiver ready */
  141. #define M5206_UART_IMR_DB (1 << 2) /* delta break */
  142. #define M5206_UART_IMR_COS (1 << 7) /* change of CTS state */
  143. /* ISR - interrupt status register */
  144. #define M5206_UART_ISR_TXRDY (1 << 0) /* transmitter ready */
  145. #define M5206_UART_ISR_RXRDY (1 << 1) /* receiver ready */
  146. #define M5206_UART_ISR_DB (1 << 2) /* delta break */
  147. #define M5206_UART_ISR_COS (1 << 7) /* change of CTS state */
  148. /* IP - input port register */
  149. #define M5206_UART_IP_CTS (1 << 0) /* current CTS state */
  150. /* OP1 - output set register */
  151. #define M5206_UART_OP1_RTS (1 << 0) /* set RTS */
  152. /* OP2 - output reset register */
  153. #define M5206_UART_OP2_RTS (1 << 0) /* clear RTS */
  154. /* function declarations */
  155. #if defined(__STDC__) || defined(__cplusplus)
  156. IMPORT void m5206DevInit (M5206_CHAN *pChan);
  157. IMPORT void m5206DevInit2 (M5206_CHAN *pChan);
  158. IMPORT  void    m5206Int (M5206_CHAN *pChan);
  159. #else /* __STDC__ */
  160. IMPORT void m5206DevInit ();
  161. IMPORT void m5206DevInit2 ();
  162. IMPORT  void    m5206Int ();
  163. #endif /* __STDC__ */
  164. #ifdef __cplusplus
  165. }
  166. #endif
  167. #endif /* __INCm5206Sioh */