source: rtems/c/src/lib/libbsp/m68k/mrm332/console/sci.h @ f05b2ac

4.104.114.84.95
Last change on this file since f05b2ac was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 10.4 KB
Line 
1/****************************************************************************
2* File:     sci.h
3*
4* Desc:     This is the include file for the serial communications interface.
5*
6* Note:     See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
7*
8* $Id$
9****************************************************************************/
10
11#ifndef _sci_h_
12#define _sci_h_
13
14/*******************************************************************************
15  IOCTL commands for the sci driver.
16  I'm still working on these...
17*******************************************************************************/
18
19#define SCI_IOCTL_PARITY_NONE           0x00    // no parity bit after the data bits
20#define SCI_IOCTL_PARITY_ODD            0x01    // parity bit added after data bits
21#define SCI_IOCTL_PARITY_EVEN           0x02    // parity bit added after data bits
22#define SCI_IOCTL_PARITY_MARK           0x03    // parity bit is lo, -12 volts, logical 1
23#define SCI_IOCTL_PARITY_SPACE          0x04    // parity bit is hi, +12 volts, logical 0
24#define SCI_IOCTL_PARITY_FORCED_ON      0x03    // parity bit is forced hi or lo
25#define SCI_IOCTL_PARITY_FORCED_OFF     0x04    // parity bit is forced hi or lo
26
27#define SCI_IOCTL_BAUD_RATE             0x20    // set the baud rate, arg is baud
28
29#define SCI_IOCTL_DATA_BITS             0x30    // set the data bits, arg is # bits
30
31#define SCI_IOCTL_STOP_BITS_1           0x40    // 1 stop bit after char frame
32#define SCI_IOCTL_STOP_BITS_2           0x41    // 2 stop bit after char frame
33
34#define SCI_IOCTL_MODE_NORMAL           0x50    // normal operating mode
35#define SCI_IOCTL_MODE_LOOP             0x51    // internal loopback mode
36
37#define SCI_IOCTL_FLOW_NONE             0x60    // no flow control
38#define SCI_IOCTL_FLOW_RTS_CTS          0x61    // hardware flow control
39
40#define SCI_IOCTL_SEND_BREAK            0x70    // send an rs-232 break
41
42#define SCI_IOCTL_MODE_1200             0x80    // 1200,n,8,1 download mode
43#define SCI_IOCTL_MODE_9600             0x81    // 9600,n,8,1 download mode
44#define SCI_IOCTL_MODE_9_BIT            0x82    // 9600,forced,8,1 command mode
45
46
47/*******************************************************************************
48  SCI Registers
49*******************************************************************************/
50
51// SCI Control Register 0  (SCCR0)  $FFFC08
52
53//  8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
54//  ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
55//  | | | |   | | | |   | | | |   | | | |
56//  | | | |   | | | |   | | | |   | | | +-----   0 baud rate divisor
57//  | | | |   | | | |   | | | |   | | +-------   1 baud rate divisor
58//  | | | |   | | | |   | | | |   | +---------   2 baud rate divisor
59//  | | | |   | | | |   | | | |   +-----------   3 baud rate divisor
60//  | | | |   | | | |   | | | |
61//  | | | |   | | | |   | | | +---------------   4 baud rate divisor
62//  | | | |   | | | |   | | +-----------------   5 baud rate divisor
63//  | | | |   | | | |   | +-------------------   6 baud rate divisor
64//  | | | |   | | | |   +---------------------   7 baud rate divisor
65//  | | | |   | | | |
66//  | | | |   | | | +-------------------------   8 baud rate divisor
67//  | | | |   | | +---------------------------   9 baud rate divisor
68//  | | | |   | +-----------------------------  10 baud rate divisor
69//  | | | |   +-------------------------------  11 baud rate divisor
70//  | | | |
71//  | | | +-----------------------------------  12 baud rate divisor
72//  | | +-------------------------------------  13 unused
73//  | +---------------------------------------  14 unused
74//  +-----------------------------------------  15 unused
75
76//  0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 1 0 0       reset value - (64k baud?)
77
78#define SCI_BAUD_57_6K            9
79#define SCI_BAUD_38_4K           14
80#define SCI_BAUD_19_2K           27
81#define SCI_BAUD_9600            55
82#define SCI_BAUD_4800           109
83#define SCI_BAUD_2400           218
84#define SCI_BAUD_1200           437
85
86
87//  SCI Control Register 1  (SCCR1)  $FFFC0A
88
89//  8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
90//  ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
91//  | | | |   | | | |   | | | |   | | | |
92//  | | | |   | | | |   | | | |   | | | +-----   0 send a break
93//  | | | |   | | | |   | | | |   | | +-------   1 rcvr wakeup mode
94//  | | | |   | | | |   | | | |   | +---------   2 rcvr enable
95//  | | | |   | | | |   | | | |   +-----------   3 xmtr enable
96//  | | | |   | | | |   | | | |
97//  | | | |   | | | |   | | | +---------------   4 idle line intr enable
98//  | | | |   | | | |   | | +-----------------   5 rcvr intr enable
99//  | | | |   | | | |   | +-------------------   6 xmit complete intr enable
100//  | | | |   | | | |   +---------------------   7 xmtr intr enable
101//  | | | |   | | | |
102//  | | | |   | | | +-------------------------   8 wakeup on address mark
103//  | | | |   | | +---------------------------   9 mode 1=9 bits, 0=8 bits
104//  | | | |   | +-----------------------------  10 parity enable 1=on, 0=off
105//  | | | |   +-------------------------------  11 parity type 1=odd, 0=even
106//  | | | |
107//  | | | +-----------------------------------  12 idle line select
108//  | | +-------------------------------------  13 wired-or mode
109//  | +---------------------------------------  14 loop mode
110//  +-----------------------------------------  15 unused
111
112//  0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 0 0 0       reset value
113
114#define SCI_SEND_BREAK          0x0001          // 0000-0000-0000-0001
115#define SCI_RCVR_WAKEUP         0x0002          // 0000-0000-0000-0010
116#define SCI_ENABLE_RCVR         0x0004          // 0000-0000-0000-0100
117#define SCI_ENABLE_XMTR         0x0008          // 0000-0000-0000-1000
118
119#define SCI_DISABLE_RCVR        0xFFFB          // 1111-1111-1111-1011
120#define SCI_DISABLE_XMTR        0xFFF7          // 1111-1111-1111-0111
121
122#define SCI_ENABLE_INT_IDLE     0x0010          // 0000-0000-0001-0000
123#define SCI_ENABLE_INT_RX       0x0020          // 0000-0000-0010-0000
124#define SCI_ENABLE_INT_TX_DONE  0x0040          // 0000-0000-0100-0000
125#define SCI_ENABLE_INT_TX       0x0080          // 0000-0000-1000-0000
126
127#define SCI_DISABLE_INT_ALL     0xFF00          // 1111-1111-0000-0000 ???
128
129#define SCI_DISABLE_INT_RX      0xFFDF          // 1111-1111-1101-1111
130#define SCI_CLEAR_RX_INT        0xFFBF          // 1111-1111-1011-1111
131#define SCI_DISABLE_INT_TX      0xFF7F          // 1111-1111-0111-1111
132#define SCI_CLEAR_TDRE          0xFEFF          // 1111-1110-1111-1111
133
134#define SCI_RCVR_WAKE_ON_MARK   0x0100          // 0000-0001-0000-0000
135#define SCI_9_DATA_BITS         0x0200          // 0000-0010-0000-0000
136#define SCI_PARITY_ENABLE       0x0400          // 0000-0100-0000-0000
137#define SCI_PARITY_ODD          0x0800          // 0000-1000-0000-0000
138
139#define SCI_RCVR_WAKE_ON_IDLE   0xFEFF          // 1111-1110-1111-1111
140#define SCI_8_DATA_BITS         0xFDFF          // 1111-1101-1111-1111
141#define SCI_PARITY_DISABLE      0xFBFF          // 1111-1011-1111-1111
142#define SCI_PARITY_EVEN         0xF7FF          // 1111-0111-1111-1111
143
144#define SCI_PARITY_NONE         0xF3FF          // 1111-0011-1111-1111
145
146#define SCI_IDLE_LINE_LONG      0x1000          // 0001-0000-0000-0000
147#define SCI_TXD_OPEN_DRAIN      0x2000          // 0010-0000-0000-0000
148#define SCI_LOOPBACK_MODE       0x4000          // 0100-0000-0000-0000
149#define SCI_SCCR1_UNUSED        0x8000          // 1000-0000-0000-0000
150
151
152//  SCI Status Register  (SCSR)  $FFFC0C
153
154//  8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
155//  ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
156//  | | | |   | | | |   | | | |   | | | |
157//  | | | |   | | | |   | | | |   | | | +-----   0 PF - parity error
158//  | | | |   | | | |   | | | |   | | +-------   1 FE - framing error
159//  | | | |   | | | |   | | | |   | +---------   2 NF - noise flag
160//  | | | |   | | | |   | | | |   +-----------   3 OR - overrun flag
161//  | | | |   | | | |   | | | |
162//  | | | |   | | | |   | | | +---------------   4 IDLE - idle line detected
163//  | | | |   | | | |   | | +-----------------   5 RAF  - rcvr active flag
164//  | | | |   | | | |   | +-------------------   6 RDRF - rcv data reg full
165//  | | | |   | | | |   +---------------------   7 TC   - xmt complete flag
166//  | | | |   | | | |
167//  | | | |   | | | +-------------------------   8 TDRE - xmt data reg empty
168//  | | | |   | | +---------------------------   9 always zero
169//  | | | |   | +-----------------------------  10 always zero
170//  | | | |   +-------------------------------  11 always zero
171//  | | | |
172//  | | | +-----------------------------------  12 always zero
173//  | | +-------------------------------------  13 always zero
174//  | +---------------------------------------  14 always zero
175//  +-----------------------------------------  15 always zero
176
177//  0 0 0 0 - 0 0 0 1 - 1 0 0 0 - 0 0 0 0       reset value
178
179#define SCI_ERROR_PARITY        0x0001          // 0000-0000-0000-0001
180#define SCI_ERROR_FRAMING       0x0002          // 0000-0000-0000-0010
181#define SCI_ERROR_NOISE         0x0004          // 0000-0000-0000-0100
182#define SCI_ERROR_OVERRUN       0x0008          // 0000-0000-0000-1000
183
184#define SCI_IDLE_LINE           0x0010          // 0000-0000-0001-0000
185#define SCI_RCVR_ACTIVE         0x0020          // 0000-0000-0010-0000
186#define SCI_RCVR_READY          0x0040          // 0000-0000-0100-0000
187#define SCI_XMTR_IDLE           0x0080          // 0000-0000-1000-0000
188
189#define SCI_CLEAR_RX_INT        0xFFBF          // 1111-1111-1011-1111
190
191#define SCI_XMTR_READY          0x0100          // 0000-0001-0000-0000
192
193#define SCI_CLEAR_TDRE          0xFEFF          // 1111-1110-1111-1111
194
195#define SCI_XMTR_AVAILABLE      0x0180          // 0000-0001-1000-0000
196
197
198
199/*******************************************************************************
200  Function prototypes
201*******************************************************************************/
202
203#ifdef __cplusplus
204extern "C" {
205#endif
206
207// look at console_open to see how this is called
208
209const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled );
210
211/* SCI interrupt */
212
213//rtems_isr SciIsr( rtems_vector_number vector );
214
215//int32_t   SciOpenPolled    ( int32_t   major, int32_t   minor, void *arg );
216//int32_t   SciOpenInterrupt ( int32_t   major, int32_t   minor, void *arg );
217
218//int32_t   SciClose         ( int32_t   major, int32_t   minor, void *arg );
219
220//int32_t   SciWritePolled   ( int32_t   minor, const char *buf, int32_t   len );
221//int32_t   SciWriteInterrupt( int32_t   minor, const char *buf, int32_t   len );
222
223//int32_t   SciReadPolled    ( int32_t   minor );
224
225//int32_t   SciSetAttributes ( int32_t   minor, const struct termios *t );
226
227#ifdef __cplusplus
228}
229#endif
230
231#endif  // _sci_h_
Note: See TracBrowser for help on using the repository browser.