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

4.104.114.84.95
Last change on this file since da2fc6c0 was da2fc6c0, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/06 at 21:43:56

2006-09-11 Joel Sherrill <joel@…>

  • console/console.c, console/sci.c, console/sci.h, spurious/spinit.c, startup/bspclean.c, startup/start_c.c: Convert C++ style comments to C style.
  • Property mode set to 100644
File size: 10.6 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
79#define SCI_BAUD_57_6K            9
80#define SCI_BAUD_38_4K           14
81#define SCI_BAUD_19_2K           27
82#define SCI_BAUD_9600            55
83#define SCI_BAUD_4800           109
84#define SCI_BAUD_2400           218
85#define SCI_BAUD_1200           437
86
87
88/*  SCI Control Register 1  (SCCR1)  $FFFC0A
89
90    8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
91    ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
92    | | | |   | | | |   | | | |   | | | |
93    | | | |   | | | |   | | | |   | | | +-----   0 send a break
94    | | | |   | | | |   | | | |   | | +-------   1 rcvr wakeup mode
95    | | | |   | | | |   | | | |   | +---------   2 rcvr enable
96    | | | |   | | | |   | | | |   +-----------   3 xmtr enable
97    | | | |   | | | |   | | | |
98    | | | |   | | | |   | | | +---------------   4 idle line intr enable
99    | | | |   | | | |   | | +-----------------   5 rcvr intr enable
100    | | | |   | | | |   | +-------------------   6 xmit complete intr enable
101    | | | |   | | | |   +---------------------   7 xmtr intr enable
102    | | | |   | | | |
103    | | | |   | | | +-------------------------   8 wakeup on address mark
104    | | | |   | | +---------------------------   9 mode 1=9 bits, 0=8 bits
105    | | | |   | +-----------------------------  10 parity enable 1=on, 0=off
106    | | | |   +-------------------------------  11 parity type 1=odd, 0=even
107    | | | |
108    | | | +-----------------------------------  12 idle line select
109    | | +-------------------------------------  13 wired-or mode
110    | +---------------------------------------  14 loop mode
111    +-----------------------------------------  15 unused
112 
113    0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 0 0 0       reset value
114*/
115
116#define SCI_SEND_BREAK          0x0001          /* 0000-0000-0000-0001 */
117#define SCI_RCVR_WAKEUP         0x0002          /* 0000-0000-0000-0010 */
118#define SCI_ENABLE_RCVR         0x0004          /* 0000-0000-0000-0100 */
119#define SCI_ENABLE_XMTR         0x0008          /* 0000-0000-0000-1000 */
120
121#define SCI_DISABLE_RCVR        0xFFFB          /* 1111-1111-1111-1011 */
122#define SCI_DISABLE_XMTR        0xFFF7          /* 1111-1111-1111-0111 */
123
124#define SCI_ENABLE_INT_IDLE     0x0010          /* 0000-0000-0001-0000 */
125#define SCI_ENABLE_INT_RX       0x0020          /* 0000-0000-0010-0000 */
126#define SCI_ENABLE_INT_TX_DONE  0x0040          /* 0000-0000-0100-0000 */
127#define SCI_ENABLE_INT_TX       0x0080          /* 0000-0000-1000-0000 */
128
129#define SCI_DISABLE_INT_ALL     0xFF00          /* 1111-1111-0000-0000 ??? */
130
131#define SCI_DISABLE_INT_RX      0xFFDF          /* 1111-1111-1101-1111 */
132#define SCI_CLEAR_RX_INT        0xFFBF          /* 1111-1111-1011-1111 */
133#define SCI_DISABLE_INT_TX      0xFF7F          /* 1111-1111-0111-1111 */
134#define SCI_CLEAR_TDRE          0xFEFF          /* 1111-1110-1111-1111 */
135
136#define SCI_RCVR_WAKE_ON_MARK   0x0100          /* 0000-0001-0000-0000 */
137#define SCI_9_DATA_BITS         0x0200          /* 0000-0010-0000-0000 */
138#define SCI_PARITY_ENABLE       0x0400          /* 0000-0100-0000-0000 */
139#define SCI_PARITY_ODD          0x0800          /* 0000-1000-0000-0000 */
140
141#define SCI_RCVR_WAKE_ON_IDLE   0xFEFF          /* 1111-1110-1111-1111 */
142#define SCI_8_DATA_BITS         0xFDFF          /* 1111-1101-1111-1111 */
143#define SCI_PARITY_DISABLE      0xFBFF          /* 1111-1011-1111-1111 */
144#define SCI_PARITY_EVEN         0xF7FF          /* 1111-0111-1111-1111 */
145
146#define SCI_PARITY_NONE         0xF3FF          /* 1111-0011-1111-1111 */
147
148#define SCI_IDLE_LINE_LONG      0x1000          /* 0001-0000-0000-0000 */
149#define SCI_TXD_OPEN_DRAIN      0x2000          /* 0010-0000-0000-0000 */
150#define SCI_LOOPBACK_MODE       0x4000          /* 0100-0000-0000-0000 */
151#define SCI_SCCR1_UNUSED        0x8000          /* 1000-0000-0000-0000 */
152
153
154/*  SCI Status Register  (SCSR)  $FFFC0C
155
156    8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
157    ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
158    | | | |   | | | |   | | | |   | | | |
159    | | | |   | | | |   | | | |   | | | +-----   0 PF - parity error
160    | | | |   | | | |   | | | |   | | +-------   1 FE - framing error
161    | | | |   | | | |   | | | |   | +---------   2 NF - noise flag
162    | | | |   | | | |   | | | |   +-----------   3 OR - overrun flag
163    | | | |   | | | |   | | | |
164    | | | |   | | | |   | | | +---------------   4 IDLE - idle line detected
165    | | | |   | | | |   | | +-----------------   5 RAF  - rcvr active flag
166    | | | |   | | | |   | +-------------------   6 RDRF - rcv data reg full
167    | | | |   | | | |   +---------------------   7 TC   - xmt complete flag
168    | | | |   | | | |
169    | | | |   | | | +-------------------------   8 TDRE - xmt data reg empty
170    | | | |   | | +---------------------------   9 always zero
171    | | | |   | +-----------------------------  10 always zero
172    | | | |   +-------------------------------  11 always zero
173    | | | |
174    | | | +-----------------------------------  12 always zero
175    | | +-------------------------------------  13 always zero
176    | +---------------------------------------  14 always zero
177    +-----------------------------------------  15 always zero
178 
179    0 0 0 0 - 0 0 0 1 - 1 0 0 0 - 0 0 0 0       reset value
180*/
181
182#define SCI_ERROR_PARITY        0x0001          /* 0000-0000-0000-0001 */
183#define SCI_ERROR_FRAMING       0x0002          /* 0000-0000-0000-0010 */
184#define SCI_ERROR_NOISE         0x0004          /* 0000-0000-0000-0100 */
185#define SCI_ERROR_OVERRUN       0x0008          /* 0000-0000-0000-1000 */
186
187#define SCI_IDLE_LINE           0x0010          /* 0000-0000-0001-0000 */
188#define SCI_RCVR_ACTIVE         0x0020          /* 0000-0000-0010-0000 */
189#define SCI_RCVR_READY          0x0040          /* 0000-0000-0100-0000 */
190#define SCI_XMTR_IDLE           0x0080          /* 0000-0000-1000-0000 */
191
192#define SCI_CLEAR_RX_INT        0xFFBF          /* 1111-1111-1011-1111 */
193
194#define SCI_XMTR_READY          0x0100          /* 0000-0001-0000-0000 */
195
196#define SCI_CLEAR_TDRE          0xFEFF          /* 1111-1110-1111-1111 */
197
198#define SCI_XMTR_AVAILABLE      0x0180          /* 0000-0001-1000-0000 */
199
200
201
202/*******************************************************************************
203  Function prototypes
204*******************************************************************************/
205
206#ifdef __cplusplus
207extern "C" {
208#endif
209
210/* look at console_open to see how this is called */
211
212const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled );
213
214/* SCI interrupt */
215
216/*rtems_isr SciIsr( rtems_vector_number vector ); */
217
218/*int32_t   SciOpenPolled    ( int32_t   major, int32_t   minor, void *arg ); */
219/*int32_t   SciOpenInterrupt ( int32_t   major, int32_t   minor, void *arg ); */
220
221/*int32_t   SciClose         ( int32_t   major, int32_t   minor, void *arg ); */
222
223/*int32_t   SciWritePolled   ( int32_t   minor, const char *buf, int32_t   len ); */
224/*int32_t   SciWriteInterrupt( int32_t   minor, const char *buf, int32_t   len ); */
225
226/*int32_t   SciReadPolled    ( int32_t   minor ); */
227
228/*int32_t   SciSetAttributes ( int32_t   minor, const struct termios *t ); */
229
230#ifdef __cplusplus
231}
232#endif
233
234#endif  /* _sci_h_ */
Note: See TracBrowser for help on using the repository browser.