source: rtems/c/src/lib/libbsp/powerpc/ep1a/console/config.c @ 00991a3

4.115
Last change on this file since 00991a3 was 00991a3, checked in by Jennifer Averett <Jennifer.Averett@…>, on 10/18/11 at 18:33:04

2011-10-18 Jennifer Averett <Jennifer.Averett@…>

PR 1917/bsps

  • Makefile.am, preinstall.am, console/config.c, console/mc68360_scc.c, console/ns16550cfg.c, console/printk_support.c: Modifications to add dynamic tables for libchip serial drivers.
  • Property mode set to 100644
File size: 20.7 KB
Line 
1/*
2 *  This file contains the TTY driver table for the EP1A
3 *
4 *  COPYRIGHT (c) 1989-2008.
5 *  On-Line Applications Research Corporation (OAR).
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.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#include <libchip/serial.h>
15#include <libchip/ns16550.h>
16#include "ns16550cfg.h"
17#include <bsp.h>
18#include <libcpu/io.h>
19#include "m68360.h"
20
21/*
22 *  Based on BSP configuration information decide whether to do polling IO
23 *  or interrupt driven IO.
24 */
25#define NS16550_FUNCTIONS &ns16550_fns_polled
26#define MC68360_SCC_FUNCTIONS &mc68360_scc_fns
27
28/*
29 * Configuration specific probe routines
30 */
31static bool config_68360_scc_base_probe_1(int minor);
32static bool config_68360_scc_base_probe_2(int minor);
33static bool config_68360_scc_base_probe_3(int minor);
34static bool config_68360_scc_base_probe_4(int minor);
35static bool config_68360_scc_base_probe_5(int minor);
36static bool config_68360_scc_base_probe_6(int minor);
37static bool config_68360_scc_base_probe_7(int minor);
38static bool config_68360_scc_base_probe_8(int minor);
39static bool config_68360_scc_base_probe_9(int minor);
40static bool config_68360_scc_base_probe_10(int minor);
41static bool config_68360_scc_base_probe_11(int minor);
42static bool config_68360_scc_base_probe_12(int minor);
43
44extern console_fns mc68360_scc_fns;
45
46/*
47 * The following table configures the console drivers used in this BSP.
48 *
49 * The first entry which, when probed, is available, will be named /dev/console,
50 * all others being given the name indicated.
51 *
52 * Each field is interpreted thus:
53 *
54 * sDeviceName  This is the name of the device.
55 * pDeviceFns   This is a pointer to the set of driver routines to use.
56 * pDeviceFlow  This is a pointer to the set of flow control routines to
57 *              use. Serial device drivers will typically supply RTSCTS
58 *              and DTRCTS handshake routines for DCE to DCE communication,
59 *              however for DCE to DTE communication, no such routines
60 *              should be necessary as RTS will be driven automatically
61 *              when the transmitter is active.
62 * ulMargin     The high water mark in the input buffer is set to the buffer
63 *              size less ulMargin. Once this level is reached, the driver's
64 *              flow control routine used to stop the remote transmitter will
65 *              be called. This figure should be greater than or equal to
66 *              the number of stages of FIFO between the transmitter and
67 *              receiver.
68 * ulHysteresis After the high water mark specified by ulMargin has been
69 *              reached, the driver's routine to re-start the remote
70 *              transmitter will be called once the level in the input
71 *              buffer has fallen by ulHysteresis bytes.
72 * pDeviceParams This contains either device specific data or a pointer to a
73 *              device specific structure containing additional information
74 *              not provided in this table.
75 * ulCtrlPort1  This is the primary control port number for the device. This
76 *              may be used to specify different instances of the same device
77 *              type.
78 * ulCtrlPort2  This is the secondary control port number, of use when a given
79 *              device has more than one available channel.
80 * ulDataPort   This is the port number for the data port of the device
81 * ulIntVector  This encodes the interrupt vector of the device.
82 *
83 */
84console_tbl     Console_Configuration_Ports[] = {
85        /*
86         *  NS16550 Chips provide first COM1 and COM2 Ports.
87         */
88        {
89                "/dev/com1",                    /* sDeviceName */
90                SERIAL_NS16550,                 /* deviceType */
91                NS16550_FUNCTIONS,              /* pDeviceFns */
92                NULL,                           /* deviceProbe */
93                &ns16550_flow_RTSCTS,           /* pDeviceFlow */
94                16,                             /* ulMargin */
95                8,                              /* ulHysteresis */
96                (void *)9600,   /* baud rate */ /* pDeviceParams */
97                UART_BASE_COM1,                 /* ulCtrlPort1 */
98                0,                              /* ulCtrlPort2 */
99                UART_BASE_COM1,                 /* ulDataPort */
100                Read_ns16550_register,          /* getRegister */
101                Write_ns16550_register,         /* setRegister */
102                NULL,                           /* getData */
103                NULL,                           /* setData */
104                7372800,                        /* ulClock */
105                0                               /* ulIntVector */
106        },
107        {
108                "/dev/com2",                    /* sDeviceName */
109                SERIAL_NS16550,                 /* deviceType */
110                NS16550_FUNCTIONS,              /* pDeviceFns */
111                NULL,                           /* deviceProbe */
112                &ns16550_flow_RTSCTS,           /* pDeviceFlow */
113                16,                             /* ulMargin */
114                8,                              /* ulHysteresis */
115                (void *)9600,   /* baud rate */ /* pDeviceParams */
116                UART_BASE_COM2,                  /* ulCtrlPort1-Filled in at runtime */
117                0,                              /* ulCtrlPort2 */
118                UART_BASE_COM2,                 /* ulDataPort-Filled in at runtime*/
119                Read_ns16550_register,          /* getRegister */
120                Write_ns16550_register,         /* setRegister */
121                NULL,                           /* getData */
122                NULL,                           /* setData */
123                7372800,                        /* ulClock */
124                0                               /* ulIntVector */
125        },
126        /*
127         * Up to 12 serial ports are provided by MC68360 SCC ports.
128         *     EP1A may have one MC68360 providing 4 ports (A,B,C,D).
129         */
130        {
131                "/dev/rs232_2",                 /* sDeviceName */
132                SERIAL_CUSTOM,                  /* deviceType */
133                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
134                config_68360_scc_base_probe_1,  /* deviceProbe */
135                NULL,                           /* pDeviceFlow */
136                16,                             /* ulMargin */
137                8,                              /* ulHysteresis */
138                (void *)9600,   /* baud rate */ /* pDeviceParams */
139                0,                              /* ulCtrlPort1 */
140                0,                              /* ulCtrlPort2 */
141                0,                              /* ulDataPort */
142                NULL,                           /* getRegister */
143                NULL,                           /* setRegister */
144                NULL,                           /* getData */
145                NULL,                           /* setData */
146                0,                              /* ulClock */
147                0                               /* ulIntVector */
148        },
149        {
150                "/dev/rs422_1",                 /* sDeviceName */
151                SERIAL_CUSTOM,                  /* deviceType */
152                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
153                config_68360_scc_base_probe_2,  /* deviceProbe */
154                NULL,                           /* pDeviceFlow */
155                16,                             /* ulMargin */
156                8,                              /* ulHysteresis */
157                (void *)9600,   /* baud rate */ /* pDeviceParams */
158                0,                              /* ulCtrlPort1 */
159                0,                              /* ulCtrlPort2 */
160                0,                              /* ulDataPort */
161                NULL,                           /* getRegister */
162                NULL,                           /* setRegister */
163                NULL,                           /* getData */
164                NULL,                           /* setData */
165                0,                              /* ulClock */
166                0                               /* ulIntVector */
167        },
168        {
169                "/dev/rs422_2",                    /* sDeviceName */
170                SERIAL_CUSTOM,                  /* deviceType */
171                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
172                config_68360_scc_base_probe_3,   /* deviceProbe */
173                NULL,                           /* pDeviceFlow */
174                16,                             /* ulMargin */
175                8,                              /* ulHysteresis */
176                (void *)9600,   /* baud rate */ /* pDeviceParams */
177                0,                              /* ulCtrlPort1 */
178                0,                              /* ulCtrlPort2 */
179                0,                              /* ulDataPort */
180                NULL,                           /* getRegister */
181                NULL,                           /* setRegister */
182                NULL,                           /* getData */
183                NULL,                           /* setData */
184                0,                              /* ulClock */
185                0                               /* ulIntVector */
186        },
187        {
188                "/dev/ep1a_d",                  /* sDeviceName */
189                SERIAL_CUSTOM,                  /* deviceType */
190                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
191                config_68360_scc_base_probe_4,  /* deviceProbe */
192                NULL,                           /* pDeviceFlow */
193                16,                             /* ulMargin */
194                8,                              /* ulHysteresis */
195                (void *)9600,   /* baud rate */ /* pDeviceParams */
196                0,                              /* ulCtrlPort1 */
197                0,                              /* ulCtrlPort2 */
198                0,                              /* ulDataPort */
199                NULL,                           /* getRegister */
200                NULL,                           /* setRegister */
201                NULL,                           /* getData */
202                NULL,                           /* setData */
203                0,                              /* ulClock */
204                0                               /* ulIntVector */
205        },
206        /*
207         * PMC1 may have one MC16550 providing 4 ports (A,B,C,D).
208         */
209        {
210                "/dev/rs422_3",                 /* sDeviceName */
211                SERIAL_CUSTOM,                  /* deviceType */
212                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
213                config_68360_scc_base_probe_5,  /* deviceProbe */
214                NULL,                           /* pDeviceFlow */
215                16,                             /* ulMargin */
216                8,                              /* ulHysteresis */
217                (void *)9600,   /* baud rate */ /* pDeviceParams */
218                0,                              /* ulCtrlPort1 */
219                0,                              /* ulCtrlPort2 */
220                0,                              /* ulDataPort */
221                NULL,                           /* getRegister */
222                NULL,                           /* setRegister */
223                NULL,                           /* getData */
224                NULL,                           /* setData */
225                0,                              /* ulClock */
226                0                               /* ulIntVector */
227        },
228        {
229                "/dev/rs422_4",                 /* sDeviceName */
230                SERIAL_CUSTOM,                  /* deviceType */
231                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
232                config_68360_scc_base_probe_6,  /* deviceProbe */
233                NULL,                           /* pDeviceFlow */
234                16,                             /* ulMargin */
235                8,                              /* ulHysteresis */
236                (void *)9600,   /* baud rate */ /* pDeviceParams */
237                0,                              /* ulCtrlPort1 */
238                0,                              /* ulCtrlPort2 */
239                0,                              /* ulDataPort */
240                NULL,                           /* getRegister */
241                NULL,                           /* setRegister */
242                NULL,                           /* getData */
243                NULL,                           /* setData */
244                0,                              /* ulClock */
245                0                               /* ulIntVector */
246        },
247        {
248                "/dev/rs422_5",                 /* sDeviceName */
249                SERIAL_CUSTOM,                  /* deviceType */
250                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
251                config_68360_scc_base_probe_7,  /* deviceProbe */
252                NULL,                           /* pDeviceFlow */
253                16,                             /* ulMargin */
254                8,                              /* ulHysteresis */
255                (void *)9600,   /* baud rate */ /* pDeviceParams */
256                0,                              /* ulCtrlPort1 */
257                0,                              /* ulCtrlPort2 */
258                0,                              /* ulDataPort */
259                NULL,                           /* getRegister */
260                NULL,                           /* setRegister */
261                NULL,                           /* getData */
262                NULL,                           /* setData */
263                0,                              /* ulClock */
264                0                               /* ulIntVector */
265        },
266        {
267                "/dev/rs422_6",                 /* sDeviceName */
268                SERIAL_CUSTOM,                  /* deviceType */
269                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
270                config_68360_scc_base_probe_8,  /* deviceProbe */
271                NULL,                           /* pDeviceFlow */
272                16,                             /* ulMargin */
273                8,                              /* ulHysteresis */
274                (void *)9600,   /* baud rate */ /* pDeviceParams */
275                0,                              /* ulCtrlPort1 */
276                0,                              /* ulCtrlPort2 */
277                0,                              /* ulDataPort */
278                NULL,                           /* getRegister */
279                NULL,                           /* setRegister */
280                NULL,                           /* getData */
281                NULL,                           /* setData */
282                0,                              /* ulClock */
283                0                               /* ulIntVector */
284        },
285        /*
286         * PMC2 may have one MC16550 providing 4 ports (A,B,C,D).
287         */
288        {
289                "/dev/rs232_3",                 /* sDeviceName */
290                SERIAL_CUSTOM,                  /* deviceType */
291                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
292                config_68360_scc_base_probe_9,  /* deviceProbe */
293                NULL,                           /* pDeviceFlow */
294                16,                             /* ulMargin */
295                8,                              /* ulHysteresis */
296                (void *)9600,   /* baud rate */ /* pDeviceParams */
297                0,                              /* ulCtrlPort1 */
298                0,                              /* ulCtrlPort2 */
299                0,                              /* ulDataPort */
300                NULL,                           /* getRegister */
301                NULL,                           /* setRegister */
302                NULL,                           /* getData */
303                NULL,                           /* setData */
304                0,                              /* ulClock */
305                0                               /* ulIntVector */
306        },
307        {
308                "/dev/rs232_4",                 /* sDeviceName */
309                SERIAL_CUSTOM,                  /* deviceType */
310                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
311                config_68360_scc_base_probe_10, /* deviceProbe */
312                NULL,                           /* pDeviceFlow */
313                16,                             /* ulMargin */
314                8,                              /* ulHysteresis */
315                (void *)9600,   /* baud rate */ /* pDeviceParams */
316                0,                              /* ulCtrlPort1 */
317                0,                              /* ulCtrlPort2 */
318                0,                              /* ulDataPort */
319                NULL,                           /* getRegister */
320                NULL,                           /* setRegister */
321                NULL,                           /* getData */
322                NULL,                           /* setData */
323                0,                              /* ulClock */
324                0                               /* ulIntVector */
325        },
326        {
327                "/dev/rs232_5",                 /* sDeviceName */
328                SERIAL_CUSTOM,                  /* deviceType */
329                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
330                config_68360_scc_base_probe_11, /* deviceProbe */
331                NULL,                           /* pDeviceFlow */
332                16,                             /* ulMargin */
333                8,                              /* ulHysteresis */
334                (void *)9600,   /* baud rate */ /* pDeviceParams */
335                0,                              /* ulCtrlPort1 */
336                0,                              /* ulCtrlPort2 */
337                0,                              /* ulDataPort */
338                NULL,                           /* getRegister */
339                NULL,                           /* setRegister */
340                NULL,                           /* getData */
341                NULL,                           /* setData */
342                0,                              /* ulClock */
343                0                               /* ulIntVector */
344        },
345        {
346                "/dev/rs232_6",                 /* sDeviceName */
347                SERIAL_CUSTOM,                  /* deviceType */
348                MC68360_SCC_FUNCTIONS,          /* pDeviceFns */
349                config_68360_scc_base_probe_12, /* deviceProbe */
350                NULL,                           /* pDeviceFlow */
351                16,                             /* ulMargin */
352                8,                              /* ulHysteresis */
353                (void *)9600,   /* baud rate */ /* pDeviceParams */
354                0,                              /* ulCtrlPort1 */
355                0,                              /* ulCtrlPort2 */
356                0,                              /* ulDataPort */
357                NULL,                           /* getRegister */
358                NULL,                           /* setRegister */
359                NULL,                           /* getData */
360                NULL,                           /* setData */
361                0,                              /* ulClock */
362                0                               /* ulIntVector */
363        }
364};
365
366/*
367 *  Define a variable that contains the number of statically configured
368 *  console devices.
369 */
370unsigned long  Console_Configuration_Count = \
371    (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
372
373static bool config_68360_scc_base_probe(int minor, unsigned long busNo, unsigned long slotNo, int channel)
374{
375  M68360_t chip = M68360_chips;
376
377  /*
378   * Find out if the chip is installed.
379   */
380  while (chip) {
381    if ((chip->board_data->slotNo == slotNo) && (chip->board_data->busNo == busNo))
382      break;
383    chip = chip->next;
384  }
385
386  if (!chip)
387    return false;
388
389  Console_Port_Tbl[minor]->pDeviceParams = &chip->port[ channel-1 ];
390  chip->port[ channel-1 ].minor         = minor;
391  return true;
392}
393
394static bool config_68360_scc_base_probe_1( int minor ) {
395  return config_68360_scc_base_probe(minor, 0, 11, 1);
396}
397
398static bool config_68360_scc_base_probe_2( int minor ) {
399  return config_68360_scc_base_probe(minor, 0, 11, 2);
400}
401
402static bool config_68360_scc_base_probe_3( int minor ) {
403  return config_68360_scc_base_probe( minor, 0, 11, 3);
404}
405
406static bool config_68360_scc_base_probe_4( int minor ) {
407  return config_68360_scc_base_probe( minor, 0, 11, 4);
408}
409
410static bool config_68360_scc_base_probe_5( int minor ) {
411  return config_68360_scc_base_probe( minor, 0, 16, 1);
412}
413
414static bool config_68360_scc_base_probe_6( int minor ) {
415  return config_68360_scc_base_probe( minor, 0, 16, 2);
416}
417
418static bool config_68360_scc_base_probe_7( int minor ) {
419  return config_68360_scc_base_probe( minor, 0, 16, 3);
420}
421
422static bool config_68360_scc_base_probe_8( int minor ) {
423  return config_68360_scc_base_probe( minor, 0, 16, 4);
424}
425
426static bool config_68360_scc_base_probe_9( int minor ) {
427  return config_68360_scc_base_probe( minor, 0, 15, 1);
428}
429
430static bool config_68360_scc_base_probe_10( int minor ) {
431  return config_68360_scc_base_probe( minor, 0, 15, 2);
432}
433
434static bool config_68360_scc_base_probe_11( int minor ) {
435  return config_68360_scc_base_probe( minor, 0, 15, 3);
436}
437
438static bool config_68360_scc_base_probe_12( int minor ) {
439  return config_68360_scc_base_probe( minor, 0, 15, 4);
440}
441
Note: See TracBrowser for help on using the repository browser.