source: rtems/c/src/lib/libbsp/arm/csb337/console/uarts.c @ 93b8c70

4.115
Last change on this file since 93b8c70 was 93b8c70, checked in by Jennifer Averett <Jennifer.Averett@…>, on 10/18/11 at 18:26:55

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

PR 1917/bsps

  • Makefile.am, console/uarts.c: Modifications to add dynamic tables for libchip serial drivers.
  • Property mode set to 100644
File size: 8.0 KB
Line 
1/*
2 *  Console driver for for KIT637_V6 (CSB637)
3 *
4 *  This driver uses the shared console driver in
5 *  ...../libbsp/shared/console.c
6 *
7 *  Copyright (c) 2003 by Cogent Computer Systems
8 *  Written by Jay Monkman <jtm@lopingdog.com>
9 *
10 * Modified by Fernando Nicodemos <fgnicodemos@terra.com.br>
11 * from NCB - Sistemas Embarcados Ltda. (Brazil)
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  Modified and FrameBuffer Console Device Support added by
18 *  Joel Sherrill, 2009.
19 *
20 *  $Id$
21 */
22
23#include <bsp.h>
24#include <rtems/libio.h>
25#include <termios.h>
26#include <rtems/bspIo.h>
27
28#include <at91rm9200.h>
29#include <at91rm9200_dbgu.h>
30#include <libchip/serial.h>
31#include <libchip/sersupp.h>
32#include <bspopts.h>
33
34extern console_fns dbgu_fns;
35
36#if ENABLE_LCD
37  extern console_fns fbcons_fns;
38  #define LCD_DEV 1
39#else
40  #define LCD_DEV 0
41#endif
42
43#if (ENABLE_UMON && ENABLE_UMON_CONSOLE)
44  extern console_fns umoncons_fns;
45  #define UMON_CONS_DEV 1
46#else
47  #define UMON_CONS_DEV 0
48#endif
49
50#if ENABLE_USART0 || ENABLE_USART1 || ENABLE_USART2 || ENABLE_USART3
51  extern console_fns usart_polling_fns;
52#endif
53
54#if ENABLE_USART0
55  #define USART0_DEV 1
56#else
57  #define USART0_DEV 0
58#endif
59
60#if ENABLE_USART1
61  #define USART1_DEV 1
62#else
63  #define USART1_DEV 0
64#endif
65
66#if ENABLE_USART2
67  #define USART2_DEV 1
68#else
69  #define USART2_DEV 0
70#endif
71
72#if ENABLE_USART3
73  #define USART3_DEV 1
74#else
75  #define USART3_DEV 0
76#endif
77
78#define NUM_DEVS \
79  (1 + LCD_DEV + UMON_CONS_DEV + \
80  USART0_DEV + USART1_DEV + USART2_DEV + USART3_DEV)
81
82/* These are used by code in console.c */
83unsigned long Console_Configuration_Count = NUM_DEVS;
84
85/*
86 * There's one item in array for each UART.
87 *
88 * Some of these fields are marked "NOT USED". They are not used
89 * by console.c, but may be used by drivers in libchip
90 *
91 * when we add other types of UARTS we will need to move this
92 * structure to a generic uart.c file with only this in it
93 */
94console_tbl Console_Configuration_Ports[] = {
95  {
96    "/dev/console",    /* sDeviceName */
97    SERIAL_CUSTOM,     /* deviceType */
98    &dbgu_fns,         /* pDeviceFns */
99    NULL,              /* deviceProbe */
100    NULL,              /* pDeviceFlow */
101    0,                 /* ulMargin - NOT USED */
102    0,                 /* ulHysteresis - NOT USED */
103    NULL,              /* pDeviceParams */
104    DBGU_BASE,         /* ulCtrlPort1  - Pointer to DBGU regs */
105    0,                 /* ulCtrlPort2  - NOT USED */
106    0,                 /* ulDataPort  - NOT USED */
107    NULL,              /* getRegister - NOT USED */
108    NULL,              /* setRegister - NOT USED */
109    NULL,              /* getData - NOT USED */
110    NULL,              /* setData - NOT USED */
111    0,                 /* ulClock - NOT USED */
112    0                  /* ulIntVector - NOT USED */
113  },
114#if ENABLE_LCD
115  {
116    "/dev/fbcons",     /* sDeviceName */
117    SERIAL_CUSTOM,     /* deviceType */
118    &fbcons_fns,       /* pDeviceFns */
119    NULL,              /* deviceProbe */
120    NULL,              /* pDeviceFlow */
121    0,                 /* ulMargin - NOT USED */
122    0,                 /* ulHysteresis - NOT USED */
123    NULL,              /* pDeviceParams */
124    0,                 /* ulCtrlPort1  - Pointer to DBGU regs */
125    0,                 /* ulCtrlPort2  - NOT USED */
126    0,                 /* ulDataPort  - NOT USED */
127    NULL,              /* getRegister - NOT USED */
128    NULL,              /* setRegister - NOT USED */
129    NULL,              /* getData - NOT USED */
130    NULL,              /* setData - NOT USED */
131    0,                 /* ulClock - NOT USED */
132    0                  /* ulIntVector - NOT USED */
133  },
134#endif
135#if (ENABLE_UMON && ENABLE_UMON_CONSOLE)
136  {
137    "/dev/umon",       /* sDeviceName */
138    SERIAL_CUSTOM,     /* deviceType */
139    &umoncons_fns,     /* pDeviceFns */
140    NULL,              /* deviceProbe */
141    NULL,              /* pDeviceFlow */
142    0,                 /* ulMargin - NOT USED */
143    0,                 /* ulHysteresis - NOT USED */
144    NULL,              /* pDeviceParams */
145    0,                 /* ulCtrlPort1  - Pointer to UMON regs */
146    0,                 /* ulCtrlPort2  - NOT USED */
147    0,                 /* ulDataPort  - NOT USED */
148    NULL,              /* getRegister - NOT USED */
149    NULL,              /* setRegister - NOT USED */
150    NULL,              /* getData - NOT USED */
151    NULL,              /* setData - NOT USED */
152    0,                 /* ulClock - NOT USED */
153    0                  /* ulIntVector - NOT USED */
154  },
155#endif
156#if ENABLE_USART0
157  {
158    "/dev/com1",       /* sDeviceName */
159    SERIAL_CUSTOM,     /* deviceType */
160    &usart_polling_fns,/* pDeviceFns */
161    NULL,              /* deviceProbe */
162    NULL,              /* pDeviceFlow */
163    0,                 /* ulMargin - NOT USED */
164    0,                 /* ulHysteresis - NOT USED */
165    NULL,              /* pDeviceParams */
166    USART0_BASE,       /* ulCtrlPort1  - Pointer to USART 0 regs */
167    0,                 /* ulCtrlPort2  - NOT USED */
168    0,                 /* ulDataPort  - NOT USED */
169    NULL,              /* getRegister - NOT USED */
170    NULL,              /* setRegister - NOT USED */
171    NULL,              /* getData - NOT USED */
172    NULL,              /* setData - NOT USED */
173    0,                 /* ulClock - NOT USED */
174    0                  /* ulIntVector - NOT USED */
175  },
176#endif
177#if ENABLE_USART1
178  {
179    "/dev/com2",       /* sDeviceName */
180    SERIAL_CUSTOM,     /* deviceType */
181    &usart_polling_fns,/* pDeviceFns */
182    NULL,              /* deviceProbe */
183    NULL,              /* pDeviceFlow */
184    0,                 /* ulMargin - NOT USED */
185    0,                 /* ulHysteresis - NOT USED */
186    NULL,              /* pDeviceParams */
187    USART1_BASE,       /* ulCtrlPort1  - Pointer to USART 1 regs */
188    0,                 /* ulCtrlPort2  - NOT USED */
189    0,                 /* ulDataPort  - NOT USED */
190    NULL,              /* getRegister - NOT USED */
191    NULL,              /* setRegister - NOT USED */
192    NULL,              /* getData - NOT USED */
193    NULL,              /* setData - NOT USED */
194    0,                 /* ulClock - NOT USED */
195    0                  /* ulIntVector - NOT USED */
196  },
197#endif
198#if ENABLE_USART2
199  {
200    "/dev/com3",       /* sDeviceName */
201    SERIAL_CUSTOM,     /* deviceType */
202    &usart_polling_fns,/* pDeviceFns */
203    NULL,              /* deviceProbe */
204    NULL,              /* pDeviceFlow */
205    0,                 /* ulMargin - NOT USED */
206    0,                 /* ulHysteresis - NOT USED */
207    NULL,              /* pDeviceParams */
208    USART2_BASE,       /* ulCtrlPort1  - Pointer to USART 2 regs */
209    0,                 /* ulCtrlPort2  - NOT USED */
210    0,                 /* ulDataPort  - NOT USED */
211    NULL,              /* getRegister - NOT USED */
212    NULL,              /* setRegister - NOT USED */
213    NULL,              /* getData - NOT USED */
214    NULL,              /* setData - NOT USED */
215    0,                 /* ulClock - NOT USED */
216    0                  /* ulIntVector - NOT USED */
217  },
218#endif
219#if ENABLE_USART3
220  {
221    "/dev/com4",       /* sDeviceName */
222    SERIAL_CUSTOM,     /* deviceType */
223    &usart_polling_fns,/* pDeviceFns */
224    NULL,              /* deviceProbe */
225    NULL,              /* pDeviceFlow */
226    0,                 /* ulMargin - NOT USED */
227    0,                 /* ulHysteresis - NOT USED */
228    NULL,              /* pDeviceParams */
229    USART3_BASE,       /* ulCtrlPort1  - Pointer to USART 3 regs */
230    0,                 /* ulCtrlPort2  - NOT USED */
231    0,                 /* ulDataPort  - NOT USED */
232    NULL,              /* getRegister - NOT USED */
233    NULL,              /* setRegister - NOT USED */
234    NULL,              /* getData - NOT USED */
235    NULL,              /* setData - NOT USED */
236    0,                 /* ulClock - NOT USED */
237    0                  /* ulIntVector - NOT USED */
238  }
239#endif
240};
241
242console_tbl *BSP_get_uart_from_minor(int minor)
243{
244    return Console_Port_Tbl[minor];
245}
Note: See TracBrowser for help on using the repository browser.