source: rtems/bsps/arm/csb337/console/uarts.c @ d7d66d7

5
Last change on this file since d7d66d7 was d7d66d7, checked in by Sebastian Huber <sebastian.huber@…>, on 04/19/18 at 04:28:01

bsps: Move console drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

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