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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [dmv177/] [console/] [conscfg.c] - Blame information for rev 846

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  This file contains the TTY driver table for the DY-4 DMV177.
3
 *
4
 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997.
5
 *  On-Line Applications Research Corporation (OAR).
6
 *  All rights assigned to U.S. Government, 1994.
7
 *
8
 *  $Id: conscfg.c,v 1.2 2001-09-27 12:00:32 chris Exp $
9
 */
10
 
11
#include <bsp.h>
12
 
13
#include <libchip/serial.h>
14
#include <libchip/mc68681.h>
15
#include <libchip/z85c30.h>
16
 
17
/*
18
 * Configuration specific probe routines
19
 *
20
 *
21
 * NOTE:  There are no DMV177 specific configuration routines.  These
22
 *        routines could be written to dynamically determine which serial
23
 *        ports are on a board.  Debugging this would require access to
24
 *        multiple board models.
25
 */
26
 
27
/* NONE CURRENTLY PROVIDED */
28
 
29
/*
30
 * The following table configures the console drivers used in this BSP.
31
 *
32
 * The first entry which, when probed, is available, will be named /dev/console,
33
 * all others being given the name indicated.
34
 */
35
 
36
mc68681_baud_t
37
  dmv177_mc68681_baud_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = {
38
  { /* ACR[7] = 0, X = 0 */
39
    MC68681_BAUD_NOT_VALID,    /* B0 */
40
    MC68681_BAUD_NOT_VALID,    /* B50 */
41
    0x01,                      /* B75 */
42
    MC68681_BAUD_NOT_VALID,    /* B110 */
43
    0x03,                      /* B134 */
44
    MC68681_BAUD_NOT_VALID,    /* B150 */
45
    0x04,                      /* B200 */
46
    MC68681_BAUD_NOT_VALID,    /* B300 */
47
    MC68681_BAUD_NOT_VALID,    /* B600 */
48
    MC68681_BAUD_NOT_VALID,    /* B1200 */
49
    MC68681_BAUD_NOT_VALID,    /* B1800 */
50
    MC68681_BAUD_NOT_VALID,    /* B2400 */
51
    0x0A,                      /* B4800 */
52
    MC68681_BAUD_NOT_VALID,    /* B9600 */
53
    MC68681_BAUD_NOT_VALID,    /* B19200 */
54
    MC68681_BAUD_NOT_VALID,    /* B38400 */
55
    MC68681_BAUD_NOT_VALID,    /* B57600 */
56
    MC68681_BAUD_NOT_VALID,    /* B115200 */
57
    MC68681_BAUD_NOT_VALID,    /* B230400 */
58
    MC68681_BAUD_NOT_VALID     /* B460800 */
59
  },
60
  { /* ACR[7] = 1, X = 0 */
61
    MC68681_BAUD_NOT_VALID,    /* B0 */
62
    0x00,                      /* B50 */
63
    0x01,                      /* B75 */
64
    MC68681_BAUD_NOT_VALID,    /* B110 */
65
    MC68681_BAUD_NOT_VALID,    /* B134 */
66
    MC68681_BAUD_NOT_VALID,    /* B150 */
67
    0x04,                      /* B200 */
68
    MC68681_BAUD_NOT_VALID,    /* B300 */
69
    MC68681_BAUD_NOT_VALID,    /* B600 */
70
    0x0A,                      /* B1200 */
71
    MC68681_BAUD_NOT_VALID,    /* B1800 */
72
    MC68681_BAUD_NOT_VALID,    /* B2400 */
73
    MC68681_BAUD_NOT_VALID,    /* B4800 */
74
    MC68681_BAUD_NOT_VALID,    /* B9600 */
75
    MC68681_BAUD_NOT_VALID,    /* B19200 */
76
    MC68681_BAUD_NOT_VALID,    /* B38400 */
77
    MC68681_BAUD_NOT_VALID,    /* B57600 */
78
    MC68681_BAUD_NOT_VALID,    /* B115200 */
79
    MC68681_BAUD_NOT_VALID,    /* B230400 */
80
    MC68681_BAUD_NOT_VALID     /* B460800 */
81
  },
82
  { /* ACR[7] = 0, X = 1 */
83
    MC68681_BAUD_NOT_VALID,    /* B0 */
84
    0x00,                      /* B50 */
85
    0x01,                      /* B75 */
86
    MC68681_BAUD_NOT_VALID,    /* B110 */
87
    MC68681_BAUD_NOT_VALID,    /* B134 */
88
    MC68681_BAUD_NOT_VALID,    /* B150 */
89
    MC68681_BAUD_NOT_VALID,    /* B200 */
90
    MC68681_BAUD_NOT_VALID,    /* B300 */
91
    MC68681_BAUD_NOT_VALID,    /* B600 */
92
    MC68681_BAUD_NOT_VALID,    /* B1200 */
93
    MC68681_BAUD_NOT_VALID,    /* B1800 */
94
    0x04,                      /* B2400 */
95
    MC68681_BAUD_NOT_VALID,    /* B4800 */
96
    0x05,                      /* B9600 */
97
    0x06,                      /* B19200 */
98
    0x07,                      /* B38400 */
99
    MC68681_BAUD_NOT_VALID,    /* B57600 */
100
    MC68681_BAUD_NOT_VALID,    /* B115200 */
101
    MC68681_BAUD_NOT_VALID,    /* B230400 */
102
    MC68681_BAUD_NOT_VALID     /* B460800 */
103
  },
104
  { /* ACR[7] = 1, X = 1 */
105
    MC68681_BAUD_NOT_VALID,    /* B0 */
106
    MC68681_BAUD_NOT_VALID,    /* B50 */
107
    0x01,                      /* B75 */
108
    MC68681_BAUD_NOT_VALID,    /* B110 */
109
    0x03,                      /* B134 */
110
    MC68681_BAUD_NOT_VALID,    /* B150 */
111
    MC68681_BAUD_NOT_VALID,    /* B200 */
112
    MC68681_BAUD_NOT_VALID,    /* B300 */
113
    MC68681_BAUD_NOT_VALID,    /* B600 */
114
    MC68681_BAUD_NOT_VALID,    /* B1200 */
115
    MC68681_BAUD_NOT_VALID,    /* B1800 */
116
    0x04,                      /* B2400 */
117
    0x0A,                      /* B4800 */
118
    0x05,                      /* B9600 */
119
    0x06,                      /* B19200 */
120
    0x07,                      /* B38400 */
121
    MC68681_BAUD_NOT_VALID,    /* B57600 */
122
    MC68681_BAUD_NOT_VALID,    /* B115200 */
123
    MC68681_BAUD_NOT_VALID,    /* B230400 */
124
    MC68681_BAUD_NOT_VALID     /* B460800 */
125
  },
126
};
127
 
128
#define MC68681_PORT_CONFIG  \
129
  (MC68681_DATA_BAUD_RATE_SET_1|MC68681_XBRG_ENABLED)
130
 
131
/*
132
 *  Based on BSP configuration information decide whether to do polling IO
133
 *  or interrupt driven IO.
134
 */
135
 
136
#if (CONSOLE_USE_INTERRUPTS)
137
#define MC68681_FUNCTIONS &mc68681_fns
138
#define Z85C30_FUNCTIONS  &z85c30_fns
139
#else
140
#define MC68681_FUNCTIONS &mc68681_fns_polled
141
#define Z85C30_FUNCTIONS  &z85c30_fns_polled
142
#endif
143
 
144
boolean dmv177_z85c30_probe(int minor);
145
boolean dmv177_mc68681_probe(int minor);
146
 
147
console_tbl     Console_Port_Tbl[] = {
148
        {
149
                "/dev/com0",                    /* sDeviceName */
150
                SERIAL_MC68681,                 /* deviceType */
151
                MC68681_FUNCTIONS,              /* pDeviceFns */
152
                dmv177_mc68681_probe,           /* deviceProbe */
153
                NULL,                           /* pDeviceFlow */
154
                16,                             /* ulMargin */
155
                8,                              /* ulHysteresis */
156
                (void *)9600,   /* baud rate */ /* pDeviceParams */
157
                MC68681_ADDR,                   /* ulCtrlPort1 */
158
                MC68681_PORT1_ADDR,             /* ulCtrlPort2 */
159
                MC68681_PORT_CONFIG,            /* ulDataPort */
160
                mc68681_get_register_8,         /* getRegister */
161
                mc68681_set_register_8,         /* setRegister */
162
                NULL, /* unused */              /* getData */
163
                NULL, /* unused */              /* setData */
164
                (unsigned32)dmv177_mc68681_baud_table, /* ulClock */
165
                DMV170_DUART_IRQ                /* ulIntVector */
166
        },
167
        {
168
                "/dev/com1",                    /* sDeviceName */
169
                SERIAL_MC68681,                 /* deviceType */
170
                MC68681_FUNCTIONS,              /* pDeviceFns */
171
                dmv177_mc68681_probe,           /* deviceProbe */
172
                NULL,                           /* pDeviceFlow */
173
                16,                             /* ulMargin */
174
                8,                              /* ulHysteresis */
175
                (void *)9600,   /* baud rate */ /* pDeviceParams */
176
                MC68681_ADDR,                   /* ulCtrlPort1 */
177
                MC68681_PORT2_ADDR,             /* ulCtrlPort2 */
178
                MC68681_PORT_CONFIG,            /* ulDataPort */
179
                mc68681_get_register_8,         /* getRegister */
180
                mc68681_set_register_8,         /* setRegister */
181
                NULL, /* unused */              /* getData */
182
                NULL, /* unused */              /* setData */
183
                (unsigned32)dmv177_mc68681_baud_table, /* ulClock */
184
                DMV170_DUART_IRQ                /* ulIntVector */
185
        },
186
        {
187
                "/dev/com3",                    /* sDeviceName */
188
                SERIAL_Z85C30,                  /* deviceType */
189
                Z85C30_FUNCTIONS,               /* pDeviceFns */
190
                dmv177_z85c30_probe,            /* deviceProbe */
191
                NULL,                           /* pDeviceFlow */
192
                16,                             /* ulMargin */
193
                8,                              /* ulHysteresis */
194
                (void *)9600,   /* baud rate */ /* pDeviceParams */
195
                Z85C30_CTRL_A,                  /* ulCtrlPort1 */
196
                Z85C30_CTRL_A,                  /* ulCtrlPort2 */
197
                0,                               /* ulDataPort */
198
                z85c30_get_register,            /* getRegister */
199
                z85c30_set_register,            /* setRegister */
200
                NULL,                           /* getData */
201
                NULL,                           /* setData */
202
                0, /* filled in by probe */     /* ulClock */
203
                DMV170_SCC_IRQ                  /* ulIntVector */
204
        },
205
        {
206
                "/dev/com4",                    /* sDeviceName */
207
                SERIAL_Z85C30,                  /* deviceType */
208
                Z85C30_FUNCTIONS,               /* pDeviceFns */
209
                dmv177_z85c30_probe,            /* deviceProbe */
210
                NULL,                           /* pDeviceFlow */
211
                16,                             /* ulMargin */
212
                8,                              /* ulHysteresis */
213
                (void *)9600,   /* baud rate */ /* pDeviceParams */
214
                Z85C30_CTRL_B,                  /* ulCtrlPort1 */
215
                Z85C30_CTRL_A,                  /* ulCtrlPort2 */
216
                0,                               /* ulDataPort */
217
                z85c30_get_register,            /* getRegister */
218
                z85c30_set_register,            /* setRegister */
219
                NULL,                           /* getData */
220
                NULL,                           /* setData */
221
                0, /* filled in by probe */     /* ulClock */
222
                DMV170_SCC_IRQ                  /* ulIntVector */
223
        }
224
};
225
 
226
/*
227
 *  Declare some information used by the console driver
228
 */
229
 
230
#define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl))
231
 
232
unsigned long  Console_Port_Count = NUM_CONSOLE_PORTS;
233
 
234
console_data  Console_Port_Data[NUM_CONSOLE_PORTS];
235
 
236
rtems_device_minor_number  Console_Port_Minor;
237
 
238
/*
239
 *  Hopefully, by checking the card resource register, this BSP
240
 *  will be able to operate on the DMV171, DMV176, or DMV177.
241
 */
242
 
243
boolean dmv177_z85c30_probe(int minor)
244
{
245
  volatile unsigned32 *dma_control_status_reg;
246
  volatile unsigned16 *card_resource_reg;
247
  unsigned16 v;
248
 
249
  card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG;
250
 
251
  v = *card_resource_reg & DMV170_SCC_INST_MASK;
252
 
253
  if ( v != DMV170_SCC_INSTALLED )
254
    return FALSE;
255
 
256
  /*
257
   *  Figure out the clock speed of the Z85C30 SCC
258
   */
259
 
260
  dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG;
261
 
262
  if ( *dma_control_status_reg & DMV170_SCC_10MHZ )
263
    Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_10;
264
  else
265
    Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_2;
266
 
267
  return TRUE;
268
}
269
 
270
boolean dmv177_mc68681_probe(int minor)
271
{
272
  volatile unsigned16 *card_resource_reg;
273
  unsigned16 v;
274
 
275
  card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG;
276
 
277
  v = *card_resource_reg & DMV170_DUART_INST_MASK;
278
 
279
  if ( v == DMV170_DUART_INSTALLED )
280
    return TRUE;
281
 
282
  return FALSE;
283
}

powered by: WebSVN 2.1.0

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