OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libchip/] [serial/] [mc68681_p.h] - Blame information for rev 596

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.