![]() |
|
|||
File indexing completed on 2025-05-11 08:23:47
0001 /**************************************************************************** 0002 * File: sci.h 0003 * 0004 * Desc: This is the include file for the serial communications interface. 0005 * 0006 * Note: See bsp.h,confdefs.h,system.h for installing drivers into RTEMS. 0007 * 0008 ****************************************************************************/ 0009 0010 #ifndef _sci_h_ 0011 #define _sci_h_ 0012 0013 /******************************************************************************* 0014 IOCTL commands for the sci driver. 0015 I'm still working on these... 0016 *******************************************************************************/ 0017 0018 #define SCI_IOCTL_PARITY_NONE 0x00 /* no parity bit after the data bits */ 0019 #define SCI_IOCTL_PARITY_ODD 0x01 /* parity bit added after data bits */ 0020 #define SCI_IOCTL_PARITY_EVEN 0x02 /* parity bit added after data bits */ 0021 #define SCI_IOCTL_PARITY_MARK 0x03 /* parity bit is lo, -12 volts, logical 1 */ 0022 #define SCI_IOCTL_PARITY_SPACE 0x04 /* parity bit is hi, +12 volts, logical 0 */ 0023 #define SCI_IOCTL_PARITY_FORCED_ON 0x03 /* parity bit is forced hi or lo */ 0024 #define SCI_IOCTL_PARITY_FORCED_OFF 0x04 /* parity bit is forced hi or lo */ 0025 0026 #define SCI_IOCTL_BAUD_RATE 0x20 /* set the baud rate, arg is baud */ 0027 0028 #define SCI_IOCTL_DATA_BITS 0x30 /* set the data bits, arg is # bits */ 0029 0030 #define SCI_IOCTL_STOP_BITS_1 0x40 /* 1 stop bit after char frame */ 0031 #define SCI_IOCTL_STOP_BITS_2 0x41 /* 2 stop bit after char frame */ 0032 0033 #define SCI_IOCTL_MODE_NORMAL 0x50 /* normal operating mode */ 0034 #define SCI_IOCTL_MODE_LOOP 0x51 /* internal loopback mode */ 0035 0036 #define SCI_IOCTL_FLOW_NONE 0x60 /* no flow control */ 0037 #define SCI_IOCTL_FLOW_RTS_CTS 0x61 /* hardware flow control */ 0038 0039 #define SCI_IOCTL_SEND_BREAK 0x70 /* send an rs-232 break */ 0040 0041 #define SCI_IOCTL_MODE_1200 0x80 /* 1200,n,8,1 download mode */ 0042 #define SCI_IOCTL_MODE_9600 0x81 /* 9600,n,8,1 download mode */ 0043 #define SCI_IOCTL_MODE_9_BIT 0x82 /* 9600,forced,8,1 command mode */ 0044 0045 0046 /******************************************************************************* 0047 SCI Registers 0048 *******************************************************************************/ 0049 0050 /* SCI Control Register 0 (SCCR0) $FFFC08 0051 0052 8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1 0053 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 0054 | | | | | | | | | | | | | | | | 0055 | | | | | | | | | | | | | | | +----- 0 baud rate divisor 0056 | | | | | | | | | | | | | | +------- 1 baud rate divisor 0057 | | | | | | | | | | | | | +--------- 2 baud rate divisor 0058 | | | | | | | | | | | | +----------- 3 baud rate divisor 0059 | | | | | | | | | | | | 0060 | | | | | | | | | | | +--------------- 4 baud rate divisor 0061 | | | | | | | | | | +----------------- 5 baud rate divisor 0062 | | | | | | | | | +------------------- 6 baud rate divisor 0063 | | | | | | | | +--------------------- 7 baud rate divisor 0064 | | | | | | | | 0065 | | | | | | | +------------------------- 8 baud rate divisor 0066 | | | | | | +--------------------------- 9 baud rate divisor 0067 | | | | | +----------------------------- 10 baud rate divisor 0068 | | | | +------------------------------- 11 baud rate divisor 0069 | | | | 0070 | | | +----------------------------------- 12 baud rate divisor 0071 | | +------------------------------------- 13 unused 0072 | +--------------------------------------- 14 unused 0073 +----------------------------------------- 15 unused 0074 0075 0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 1 0 0 reset value - (64k baud?) 0076 */ 0077 0078 #define SCI_BAUD_57_6K 9 0079 #define SCI_BAUD_38_4K 14 0080 #define SCI_BAUD_19_2K 27 0081 #define SCI_BAUD_9600 55 0082 #define SCI_BAUD_4800 109 0083 #define SCI_BAUD_2400 218 0084 #define SCI_BAUD_1200 437 0085 0086 0087 /* SCI Control Register 1 (SCCR1) $FFFC0A 0088 0089 8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1 0090 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 0091 | | | | | | | | | | | | | | | | 0092 | | | | | | | | | | | | | | | +----- 0 send a break 0093 | | | | | | | | | | | | | | +------- 1 rcvr wakeup mode 0094 | | | | | | | | | | | | | +--------- 2 rcvr enable 0095 | | | | | | | | | | | | +----------- 3 xmtr enable 0096 | | | | | | | | | | | | 0097 | | | | | | | | | | | +--------------- 4 idle line intr enable 0098 | | | | | | | | | | +----------------- 5 rcvr intr enable 0099 | | | | | | | | | +------------------- 6 xmit complete intr enable 0100 | | | | | | | | +--------------------- 7 xmtr intr enable 0101 | | | | | | | | 0102 | | | | | | | +------------------------- 8 wakeup on address mark 0103 | | | | | | +--------------------------- 9 mode 1=9 bits, 0=8 bits 0104 | | | | | +----------------------------- 10 parity enable 1=on, 0=off 0105 | | | | +------------------------------- 11 parity type 1=odd, 0=even 0106 | | | | 0107 | | | +----------------------------------- 12 idle line select 0108 | | +------------------------------------- 13 wired-or mode 0109 | +--------------------------------------- 14 loop mode 0110 +----------------------------------------- 15 unused 0111 0112 0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 0 0 0 reset value 0113 */ 0114 0115 #define SCI_SEND_BREAK 0x0001 /* 0000-0000-0000-0001 */ 0116 #define SCI_RCVR_WAKEUP 0x0002 /* 0000-0000-0000-0010 */ 0117 #define SCI_ENABLE_RCVR 0x0004 /* 0000-0000-0000-0100 */ 0118 #define SCI_ENABLE_XMTR 0x0008 /* 0000-0000-0000-1000 */ 0119 0120 #define SCI_DISABLE_RCVR 0xFFFB /* 1111-1111-1111-1011 */ 0121 #define SCI_DISABLE_XMTR 0xFFF7 /* 1111-1111-1111-0111 */ 0122 0123 #define SCI_ENABLE_INT_IDLE 0x0010 /* 0000-0000-0001-0000 */ 0124 #define SCI_ENABLE_INT_RX 0x0020 /* 0000-0000-0010-0000 */ 0125 #define SCI_ENABLE_INT_TX_DONE 0x0040 /* 0000-0000-0100-0000 */ 0126 #define SCI_ENABLE_INT_TX 0x0080 /* 0000-0000-1000-0000 */ 0127 0128 #define SCI_DISABLE_INT_ALL 0xFF00 /* 1111-1111-0000-0000 ??? */ 0129 0130 #define SCI_DISABLE_INT_RX 0xFFDF /* 1111-1111-1101-1111 */ 0131 #define SCI_CLEAR_RX_INT 0xFFBF /* 1111-1111-1011-1111 */ 0132 #define SCI_DISABLE_INT_TX 0xFF7F /* 1111-1111-0111-1111 */ 0133 #define SCI_CLEAR_TDRE 0xFEFF /* 1111-1110-1111-1111 */ 0134 0135 #define SCI_RCVR_WAKE_ON_MARK 0x0100 /* 0000-0001-0000-0000 */ 0136 #define SCI_9_DATA_BITS 0x0200 /* 0000-0010-0000-0000 */ 0137 #define SCI_PARITY_ENABLE 0x0400 /* 0000-0100-0000-0000 */ 0138 #define SCI_PARITY_ODD 0x0800 /* 0000-1000-0000-0000 */ 0139 0140 #define SCI_RCVR_WAKE_ON_IDLE 0xFEFF /* 1111-1110-1111-1111 */ 0141 #define SCI_8_DATA_BITS 0xFDFF /* 1111-1101-1111-1111 */ 0142 #define SCI_PARITY_DISABLE 0xFBFF /* 1111-1011-1111-1111 */ 0143 #define SCI_PARITY_EVEN 0xF7FF /* 1111-0111-1111-1111 */ 0144 0145 #define SCI_PARITY_NONE 0xF3FF /* 1111-0011-1111-1111 */ 0146 0147 #define SCI_IDLE_LINE_LONG 0x1000 /* 0001-0000-0000-0000 */ 0148 #define SCI_TXD_OPEN_DRAIN 0x2000 /* 0010-0000-0000-0000 */ 0149 #define SCI_LOOPBACK_MODE 0x4000 /* 0100-0000-0000-0000 */ 0150 #define SCI_SCCR1_UNUSED 0x8000 /* 1000-0000-0000-0000 */ 0151 0152 0153 /* SCI Status Register (SCSR) $FFFC0C 0154 0155 8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1 0156 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 0157 | | | | | | | | | | | | | | | | 0158 | | | | | | | | | | | | | | | +----- 0 PF - parity error 0159 | | | | | | | | | | | | | | +------- 1 FE - framing error 0160 | | | | | | | | | | | | | +--------- 2 NF - noise flag 0161 | | | | | | | | | | | | +----------- 3 OR - overrun flag 0162 | | | | | | | | | | | | 0163 | | | | | | | | | | | +--------------- 4 IDLE - idle line detected 0164 | | | | | | | | | | +----------------- 5 RAF - rcvr active flag 0165 | | | | | | | | | +------------------- 6 RDRF - rcv data reg full 0166 | | | | | | | | +--------------------- 7 TC - xmt complete flag 0167 | | | | | | | | 0168 | | | | | | | +------------------------- 8 TDRE - xmt data reg empty 0169 | | | | | | +--------------------------- 9 always zero 0170 | | | | | +----------------------------- 10 always zero 0171 | | | | +------------------------------- 11 always zero 0172 | | | | 0173 | | | +----------------------------------- 12 always zero 0174 | | +------------------------------------- 13 always zero 0175 | +--------------------------------------- 14 always zero 0176 +----------------------------------------- 15 always zero 0177 0178 0 0 0 0 - 0 0 0 1 - 1 0 0 0 - 0 0 0 0 reset value 0179 */ 0180 0181 #define SCI_ERROR_PARITY 0x0001 /* 0000-0000-0000-0001 */ 0182 #define SCI_ERROR_FRAMING 0x0002 /* 0000-0000-0000-0010 */ 0183 #define SCI_ERROR_NOISE 0x0004 /* 0000-0000-0000-0100 */ 0184 #define SCI_ERROR_OVERRUN 0x0008 /* 0000-0000-0000-1000 */ 0185 0186 #define SCI_IDLE_LINE 0x0010 /* 0000-0000-0001-0000 */ 0187 #define SCI_RCVR_ACTIVE 0x0020 /* 0000-0000-0010-0000 */ 0188 #define SCI_RCVR_READY 0x0040 /* 0000-0000-0100-0000 */ 0189 #define SCI_XMTR_IDLE 0x0080 /* 0000-0000-1000-0000 */ 0190 0191 #define SCI_CLEAR_RX_INT 0xFFBF /* 1111-1111-1011-1111 */ 0192 0193 #define SCI_XMTR_READY 0x0100 /* 0000-0001-0000-0000 */ 0194 0195 #define SCI_CLEAR_TDRE 0xFEFF /* 1111-1110-1111-1111 */ 0196 0197 #define SCI_XMTR_AVAILABLE 0x0180 /* 0000-0001-1000-0000 */ 0198 0199 0200 0201 /******************************************************************************* 0202 Function prototypes 0203 *******************************************************************************/ 0204 0205 #ifdef __cplusplus 0206 extern "C" { 0207 #endif 0208 0209 /* look at console_open to see how this is called */ 0210 0211 const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled ); 0212 0213 /* SCI interrupt */ 0214 0215 /*rtems_isr SciIsr( rtems_vector_number vector ); */ 0216 0217 /*int32_t SciOpenPolled ( int32_t major, int32_t minor, void *arg ); */ 0218 /*int32_t SciOpenInterrupt ( int32_t major, int32_t minor, void *arg ); */ 0219 0220 /*int32_t SciClose ( int32_t major, int32_t minor, void *arg ); */ 0221 0222 /*int32_t SciWritePolled ( int32_t minor, const char *buf, int32_t len ); */ 0223 /*int32_t SciWriteInterrupt( int32_t minor, const char *buf, int32_t len ); */ 0224 0225 /*int32_t SciReadPolled ( int32_t minor ); */ 0226 0227 /*int32_t SciSetAttributes ( int32_t minor, const struct termios *t ); */ 0228 0229 #ifdef __cplusplus 0230 } 0231 #endif 0232 0233 #endif /* _sci_h_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |