source: rtems/c/src/libchip/serial/mc68681_p.h @ 9eef52b

4.104.114.84.95
Last change on this file since 9eef52b was 9eef52b, checked in by Joel Sherrill <joel.sherrill@…>, on 06/23/98 at 14:54:30

Added set attributes prototype.

  • Property mode set to 100644
File size: 9.4 KB
Line 
1/*
2 *
3 *  COPYRIGHT (c) 1989-1998.
4 *  On-Line Applications Research Corporation (OAR).
5 *  Copyright assigned to U.S. Government, 1994.
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#ifndef _MC68681_P_H_
15#define _MC68681_P_H_
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22 * mc68681 register offsets Read/Write Addresses
23 */
24
25#define MC68681_MODE_REG_1A  0  /* MR1A-MR Prior to Read */
26#define MC68681_MODE_REG_2A  0  /* MR2A-MR After Read    */
27
28#define MC68681_COUNT_MODE_CURRENT_MSB       6  /* CTU   */
29#define MC68681_COUNTER_TIMER_UPPER_REG      6  /* CTU   */
30#define MC68681_COUNT_MODE_CURRENT_LSB       7  /* CTL   */
31#define MC68681_COUNTER_TIMER_LOWER_REG      7  /* CTL   */
32#define MC68681_INTERRUPT_VECTOR_REG        12  /* IVR   */
33
34#define MC68681_MODE_REG_1B  8  /* MR1B-MR Prior to Read */
35#define MC68681_MODE_REG_2B  8  /* MR2BA-MR After Read   */
36
37/*
38 * mc68681 register offsets Read Only  Addresses
39 */
40
41#define MC68681_STATUS_REG_A                 1  /* SRA   */
42#define MC68681_MASK_ISR_REG                 2  /* MISR  */
43#define MC68681_RECEIVE_BUFFER_A             3  /* RHRA  */
44#define MC68681_INPUT_PORT_CHANGE_REG        4  /* IPCR  */
45#define MC68681_INTERRUPT_STATUS_REG         5  /* ISR   */
46#define MC68681_STATUS_REG_B                 9  /* SRB   */
47#define MC68681_RECEIVE_BUFFER_B            11  /* RHRB  */
48#define MC68681_INPUT_PORT                  13  /* IP    */
49#define MC68681_START_COUNT_CMD             14  /* SCC   */
50#define MC68681_STOP_COUNT_CMD              15  /* STC   */
51
52/*
53 * mc68681 register offsets Write Only  Addresses
54 */
55
56#define MC68681_CLOCK_SELECT_REG_A           1  /* CSRA  */
57#define MC68681_COMMAND_REG_A                2  /* CRA   */
58#define MC68681_TRANSMIT_BUFFER_A            3  /* THRA  */
59#define MC68681_AUX_CTRL_REG                 4  /* ACR   */
60#define MC68681_INTERRUPT_MASK_REG           5  /* IMR   */
61#define MC68681_CLOCK_SELECT_REG_B           9  /* CSRB  */
62#define MC68681_COMMAND_REG_B               10  /* CRB   */
63#define MC68681_TRANSMIT_BUFFER_B           11  /* THRB  */
64#define MC68681_OUTPUT_PORT_CONFIG_REG      13  /* OPCR  */
65#define MC68681_OUTPUT_PORT_SET_REG         14  /* SOPBC */
66#define MC68681_OUTPUT_PORT_RESET_BITS      15  /* COPBC */
67
68/*
69 *  DUART Command Register Definitions:
70 *
71 *  MC68681_COMMAND_REG_A,MC68681_COMMAND_REG_B
72 */
73
74#define MC68681_MODE_REG_ENABLE_RX                          0x01
75#define MC68681_MODE_REG_DISABLE_RX                         0x02
76#define MC68681_MODE_REG_ENABLE_TX                          0x04
77#define MC68681_MODE_REG_DISABLE_TX                         0x08
78#define MC68681_MODE_REG_RESET_MR_PTR                       0x10
79#define MC68681_MODE_REG_RESET_RX                           0x20
80#define MC68681_MODE_REG_RESET_TX                           0x30
81#define MC68681_MODE_REG_RESET_ERROR                        0x40
82#define MC68681_MODE_REG_RESET_BREAK                        0x50
83#define MC68681_MODE_REG_START_BREAK                        0x60
84#define MC68681_MODE_REG_STOP_BREAK                         0x70
85#define MC68681_MODE_REG_SET_RX_BRG                         0x80
86#define MC68681_MODE_REG_CLEAR_RX_BRG                       0x90
87#define MC68681_MODE_REG_SET_TX_BRG                         0xa0
88#define MC68681_MODE_REG_CLEAR_TX_BRG                       0xb0
89#define MC68681_MODE_REG_SET_STANDBY                        0xc0
90#define MC68681_MODE_REG_SET_ACTIVE                         0xd0
91
92/*
93 * Mode Register Definitions
94 *
95 *  MC68681_MODE_REG_1A
96 *  MC68681_MODE_REG_1B
97 */
98
99#define MC68681_5BIT_CHARS                                  0x00
100#define MC68681_6BIT_CHARS                                  0x01
101#define MC68681_7BIT_CHARS                                  0x02
102#define MC68681_8BIT_CHARS                                  0x03
103
104#define MC68681_ODD_PARITY                                  0x00
105#define MC68681_EVEN_PARITY                                 0x04
106
107#define MC68681_WITH_PARITY                                 0x00
108#define MC68681_FORCE_PARITY                                0x08
109#define MC68681_NO_PARITY                                   0x10
110#define MC68681_MULTI_DROP                                  0x18
111
112#define MC68681_ERR_MODE_CHAR                               0x00
113#define MC68681_ERR_MODE_BLOCK                              0x20
114
115#define MC68681_RX_INTR_RX_READY                            0x00
116#define MC68681_RX_INTR_FFULL                               0x40
117
118#define MC68681_NO_RX_RTS_CTL                               0x00
119#define MC68681_RX_RTS_CTRL                                 0x80
120
121/*
122 * Mode Register Definitions
123 *
124 *  MC68681_MODE_REG_2A
125 *  MC68681_MODE_REG_2B
126 */
127
128#define MC68681_STOP_BIT_LENGTH__563                        0x00
129#define MC68681_STOP_BIT_LENGTH__625                        0x01
130#define MC68681_STOP_BIT_LENGTH__688                        0x02
131#define MC68681_STOP_BIT_LENGTH__75                         0x03
132#define MC68681_STOP_BIT_LENGTH__813                        0x04
133#define MC68681_STOP_BIT_LENGTH__875                        0x05
134#define MC68681_STOP_BIT_LENGTH__938                        0x06
135#define MC68681_STOP_BIT_LENGTH_1                           0x07
136#define MC68681_STOP_BIT_LENGTH_1_563                       0x08
137#define MC68681_STOP_BIT_LENGTH_1_625                       0x09
138#define MC68681_STOP_BIT_LENGTH_1_688                       0x0a
139#define MC68681_STOP_BIT_LENGTH_1_75                        0x0b
140#define MC68681_STOP_BIT_LENGTH_1_813                       0x0c
141#define MC68681_STOP_BIT_LENGTH_1_875                       0x0d
142#define MC68681_STOP_BIT_LENGTH_1_938                       0x0e
143#define MC68681_STOP_BIT_LENGTH_2                           0x0f
144
145#define MC68681_CTS_ENABLE_TX                               0x10
146#define MC68681_TX_RTS_CTRL                                 0x20
147
148#define MC68681_CHANNEL_MODE_NORMAL                         0x00
149#define MC68681_CHANNEL_MODE_ECHO                           0x40
150#define MC68681_CHANNEL_MODE_LOCAL_LOOP                     0x80
151#define MC68681_CHANNEL_MODE_REMOTE_LOOP                    0xc0
152
153/*
154 * Status Register Definitions
155 *
156 *    MC68681_STATUS_REG_A,  MC68681_STATUS_REG_B
157 */
158
159#define MC68681_RX_READY                                    0x01
160#define MC68681_FFULL                                       0x02
161#define MC68681_TX_READY                                    0x04
162#define MC68681_TX_EMPTY                                    0x08
163#define MC68681_OVERRUN_ERROR                               0x10
164#define MC68681_PARITY_ERROR                                0x20
165#define MC68681_FRAMING_ERROR                               0x40
166#define MC68681_RECEIVED_BREAK                              0x80
167
168/*
169 * Interupt Status Register Definitions.
170 *
171 * MC68681_INTERRUPT_STATUS_REG
172 */
173
174/*
175 *  Interupt Mask Register Definitions
176 *
177 *  MC68681_INTERRUPT_MASK_REG
178 */
179
180#define MC68681_IR_TX_READY_A                               0x01
181#define MC68681_IR_RX_READY_A                               0x02
182#define MC68681_IR_BREAK_A                                  0x04
183#define MC68681_IR_COUNTER_READY                            0x08
184#define MC68681_IR_TX_READY_B                               0x10
185#define MC68681_IR_RX_READY_B                               0x20
186#define MC68681_IR_BREAK_B                                  0x40
187#define MC68681_IR_INPUT_PORT_CHANGE                        0x80
188
189/*
190 * Status Register Definitions.
191 *
192 * MC68681_STATUS_REG_A,MC68681_STATUS_REG_B
193 */
194
195#define MC68681_STATUS_RXRDY                                0x01
196#define MC68681_STATUS_FFULL                                0x02
197#define MC68681_STATUS_TXRDY                                0x04
198#define MC68681_STATUS_TXEMT                                0x08
199#define MC68681_STATUS_OVERRUN_ERROR                        0x10
200#define MC68681_STATUS_PARITY_ERROR                         0x20
201#define MC68681_STATUS_FRAMING_ERROR                        0x40
202#define MC68681_STATUS_RECEIVED_BREAK                       0x80
203
204/*
205 * Definitions for the Interrupt Vector Register:
206 *
207 * MC68681_INTERRUPT_VECTOR_REG
208 */
209
210#define  MC68681_INTERRUPT_VECTOR_INIT                      0x0f
211
212/*
213 * Definitions for the Auxiliary Control Register
214 *
215 * MC68681_AUX_CTRL_REG
216 */
217
218#define MC68681_AUX_BRG_SET1                                0x00
219#define MC68681_AUX_BRG_SET2                                0x80
220
221/*
222 *  Per chip context control
223 */
224
225typedef struct _mc68681_context
226{
227        unsigned8       ucModemCtrl;
228} mc68681_context;
229
230/*
231 * Driver functions
232 */
233static boolean mc68681_probe(int minor);
234
235static int mc68681_set_attributes(
236  int minor,
237  const struct termios *t
238);
239
240static void mc68681_init(int minor);
241
242static int mc68681_open(
243  int major,
244  int minor,
245  void  * arg
246);
247
248static int mc68681_close(
249  int major,
250  int minor,
251  void  * arg
252);
253
254static void mc68681_write_polled(
255  int   minor,
256  char  cChar
257);
258
259static int mc68681_assert_RTS(
260  int minor
261);
262
263static int mc68681_negate_RTS(
264  int minor
265);
266
267static int mc68681_assert_DTR(
268  int minor
269);
270
271static int mc68681_negate_DTR(
272  int minor
273);
274
275static void mc68681_initialize_interrupts(int minor);
276
277static int mc68681_flush(int major, int minor, void *arg);
278
279static int mc68681_write_support_int(
280  int   minor,
281  const char *buf,
282  int   len
283);
284
285static int mc68681_write_support_polled(
286  int   minor,
287  const char *buf,
288  int   len
289  );
290
291static int mc68681_inbyte_nonblocking_polled(
292  int minor
293);
294
295#ifdef __cplusplus
296}
297#endif
298
299#endif /* _MC68681_P_H_ */
Note: See TracBrowser for help on using the repository browser.