source: rtems/c/src/lib/libbsp/arm/lpc32xx/console/console-config.c @ 22f107b6

4.104.115
Last change on this file since 22f107b6 was 22f107b6, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Apr 9, 2010 at 12:25:22 PM

Changes throughout

  • Property mode set to 100644
File size: 5.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup lpc32xx
5 *
6 * @brief Console configuration.
7 */
8
9/*
10 * Copyright (c) 2009
11 * embedded brains GmbH
12 * Obere Lagerstr. 30
13 * D-82178 Puchheim
14 * Germany
15 * <rtems@embedded-brains.de>
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.com/license/LICENSE.
20 */
21
22#include <libchip/serial.h>
23#include <libchip/ns16550.h>
24
25#include <bsp.h>
26#include <bsp/lpc32xx.h>
27#include <bsp/irq.h>
28
29extern console_fns lpc32xx_hsu_fns;
30
31static uint8_t lpc32xx_uart_get_register(uint32_t addr, uint8_t i)
32{
33  volatile uint32_t *reg = (volatile uint32_t *) addr;
34
35  return (uint8_t) reg [i];
36}
37
38static void lpc32xx_uart_set_register(uint32_t addr, uint8_t i, uint8_t val)
39{
40  volatile uint32_t *reg = (volatile uint32_t *) addr;
41
42  reg [i] = val;
43}
44
45rtems_device_minor_number Console_Port_Minor = 0;
46
47/* FIXME: Console selection */
48
49console_tbl Console_Port_Tbl [] = {
50  #ifdef LPC32XX_CONFIG_U5CLK
51    {
52      .sDeviceName = "/dev/ttyS5",
53      .deviceType = SERIAL_NS16550,
54      .pDeviceFns = &ns16550_fns,
55      .deviceProbe = NULL,
56      .pDeviceFlow = NULL,
57      .ulMargin = 16,
58      .ulHysteresis = 8,
59      .pDeviceParams = (void *) 1,
60      .ulCtrlPort1 = LPC32XX_BASE_UART_5,
61      .ulCtrlPort2 = 0,
62      .ulDataPort = LPC32XX_BASE_UART_5,
63      .getRegister = lpc32xx_uart_get_register,
64      .setRegister = lpc32xx_uart_set_register,
65      .getData = NULL,
66      .setData = NULL,
67      .ulClock = 16,
68      .ulIntVector = LPC32XX_IRQ_UART_5
69    },
70  #endif
71  #ifdef LPC32XX_CONFIG_U3CLK
72    {
73      .sDeviceName = "/dev/ttyS3",
74      .deviceType = SERIAL_NS16550,
75      .pDeviceFns = &ns16550_fns,
76      .deviceProbe = NULL,
77      .pDeviceFlow = NULL,
78      .ulMargin = 16,
79      .ulHysteresis = 8,
80      .pDeviceParams = (void *) 1,
81      .ulCtrlPort1 = LPC32XX_BASE_UART_3,
82      .ulCtrlPort2 = 0,
83      .ulDataPort = LPC32XX_BASE_UART_3,
84      .getRegister = lpc32xx_uart_get_register,
85      .setRegister = lpc32xx_uart_set_register,
86      .getData = NULL,
87      .setData = NULL,
88      .ulClock = 16,
89      .ulIntVector = LPC32XX_IRQ_UART_3
90    },
91  #endif
92  #ifdef LPC32XX_CONFIG_U4CLK
93    {
94      .sDeviceName = "/dev/ttyS4",
95      .deviceType = SERIAL_NS16550,
96      .pDeviceFns = &ns16550_fns,
97      .deviceProbe = NULL,
98      .pDeviceFlow = NULL,
99      .ulMargin = 16,
100      .ulHysteresis = 8,
101      .pDeviceParams = (void *) 1,
102      .ulCtrlPort1 = LPC32XX_BASE_UART_4,
103      .ulCtrlPort2 = 0,
104      .ulDataPort = LPC32XX_BASE_UART_4,
105      .getRegister = lpc32xx_uart_get_register,
106      .setRegister = lpc32xx_uart_set_register,
107      .getData = NULL,
108      .setData = NULL,
109      .ulClock = 16,
110      .ulIntVector = LPC32XX_IRQ_UART_4
111    },
112  #endif
113  #ifdef LPC32XX_CONFIG_U6CLK
114    {
115      .sDeviceName = "/dev/ttyS6",
116      .deviceType = SERIAL_NS16550,
117      .pDeviceFns = &ns16550_fns,
118      .deviceProbe = NULL,
119      .pDeviceFlow = NULL,
120      .ulMargin = 16,
121      .ulHysteresis = 8,
122      .pDeviceParams = (void *) 1,
123      .ulCtrlPort1 = LPC32XX_BASE_UART_6,
124      .ulCtrlPort2 = 0,
125      .ulDataPort = LPC32XX_BASE_UART_6,
126      .getRegister = lpc32xx_uart_get_register,
127      .setRegister = lpc32xx_uart_set_register,
128      .getData = NULL,
129      .setData = NULL,
130      .ulClock = 16,
131      .ulIntVector = LPC32XX_IRQ_UART_6
132    },
133  #endif
134  #ifdef LPC32XX_UART_1_BAUD
135    {
136      .sDeviceName = "/dev/ttyS1",
137      .deviceType = SERIAL_CUSTOM,
138      .pDeviceFns = &lpc32xx_hsu_fns,
139      .deviceProbe = NULL,
140      .pDeviceFlow = NULL,
141      .ulMargin = 16,
142      .ulHysteresis = 8,
143      .pDeviceParams = (void *) LPC32XX_UART_1_BAUD,
144      .ulCtrlPort1 = LPC32XX_BASE_UART_1,
145      .ulCtrlPort2 = 0,
146      .ulDataPort = 0,
147      .getRegister = NULL,
148      .setRegister = NULL,
149      .getData = NULL,
150      .setData = NULL,
151      .ulClock = 16,
152      .ulIntVector = LPC32XX_IRQ_UART_1
153    },
154  #endif
155  #ifdef LPC32XX_UART_2_BAUD
156    {
157      .sDeviceName = "/dev/ttyS2",
158      .deviceType = SERIAL_CUSTOM,
159      .pDeviceFns = &lpc32xx_hsu_fns,
160      .deviceProbe = NULL,
161      .pDeviceFlow = NULL,
162      .ulMargin = 16,
163      .ulHysteresis = 8,
164      .pDeviceParams = (void *) LPC32XX_UART_2_BAUD,
165      .ulCtrlPort1 = LPC32XX_BASE_UART_2,
166      .ulCtrlPort2 = 0,
167      .ulDataPort = 0,
168      .getRegister = NULL,
169      .setRegister = NULL,
170      .getData = NULL,
171      .setData = NULL,
172      .ulClock = 16,
173      .ulIntVector = LPC32XX_IRQ_UART_2
174    },
175  #endif
176  #ifdef LPC32XX_UART_7_BAUD
177    {
178      .sDeviceName = "/dev/ttyS7",
179      .deviceType = SERIAL_CUSTOM,
180      .pDeviceFns = &lpc32xx_hsu_fns,
181      .deviceProbe = NULL,
182      .pDeviceFlow = NULL,
183      .ulMargin = 16,
184      .ulHysteresis = 8,
185      .pDeviceParams = (void *) LPC32XX_UART_7_BAUD,
186      .ulCtrlPort1 = LPC32XX_BASE_UART_7,
187      .ulCtrlPort2 = 0,
188      .ulDataPort = 0,
189      .getRegister = NULL,
190      .setRegister = NULL,
191      .getData = NULL,
192      .setData = NULL,
193      .ulClock = 16,
194      .ulIntVector = LPC32XX_IRQ_UART_7
195    },
196  #endif
197};
198
199#define LPC32XX_UART_COUNT \
200  (sizeof(Console_Port_Tbl) / sizeof(Console_Port_Tbl [0]))
201
202unsigned long Console_Port_Count = LPC32XX_UART_COUNT;
203
204console_data Console_Port_Data [LPC32XX_UART_COUNT];
Note: See TracBrowser for help on using the repository browser.