source: rtems/c/src/lib/libbsp/arm/lpc32xx/console/console-config.c @ 0a91018f

4.115
Last change on this file since 0a91018f was 0a91018f, checked in by Jennifer Averett <Jennifer.Averett@…>, on Oct 18, 2011 at 6:25:15 PM

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

PR 1917/bsps

  • Makefile.am, console/console-config.c, console/hsu.c: Modifications to add dynamic tables for libchip serial drivers.
  • 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
45/* FIXME: Console selection */
46
47console_tbl Console_Configuration_Ports [] = {
48  #ifdef LPC32XX_CONFIG_U5CLK
49    {
50      .sDeviceName = "/dev/ttyS5",
51      .deviceType = SERIAL_NS16550,
52      .pDeviceFns = &ns16550_fns,
53      .deviceProbe = NULL,
54      .pDeviceFlow = NULL,
55      .ulMargin = 16,
56      .ulHysteresis = 8,
57      .pDeviceParams = (void *) 1,
58      .ulCtrlPort1 = LPC32XX_BASE_UART_5,
59      .ulCtrlPort2 = 0,
60      .ulDataPort = LPC32XX_BASE_UART_5,
61      .getRegister = lpc32xx_uart_get_register,
62      .setRegister = lpc32xx_uart_set_register,
63      .getData = NULL,
64      .setData = NULL,
65      .ulClock = 16,
66      .ulIntVector = LPC32XX_IRQ_UART_5
67    },
68  #endif
69  #ifdef LPC32XX_CONFIG_U3CLK
70    {
71      .sDeviceName = "/dev/ttyS3",
72      .deviceType = SERIAL_NS16550,
73      .pDeviceFns = &ns16550_fns,
74      .deviceProbe = NULL,
75      .pDeviceFlow = NULL,
76      .ulMargin = 16,
77      .ulHysteresis = 8,
78      .pDeviceParams = (void *) 1,
79      .ulCtrlPort1 = LPC32XX_BASE_UART_3,
80      .ulCtrlPort2 = 0,
81      .ulDataPort = LPC32XX_BASE_UART_3,
82      .getRegister = lpc32xx_uart_get_register,
83      .setRegister = lpc32xx_uart_set_register,
84      .getData = NULL,
85      .setData = NULL,
86      .ulClock = 16,
87      .ulIntVector = LPC32XX_IRQ_UART_3
88    },
89  #endif
90  #ifdef LPC32XX_CONFIG_U4CLK
91    {
92      .sDeviceName = "/dev/ttyS4",
93      .deviceType = SERIAL_NS16550,
94      .pDeviceFns = &ns16550_fns,
95      .deviceProbe = NULL,
96      .pDeviceFlow = NULL,
97      .ulMargin = 16,
98      .ulHysteresis = 8,
99      .pDeviceParams = (void *) 1,
100      .ulCtrlPort1 = LPC32XX_BASE_UART_4,
101      .ulCtrlPort2 = 0,
102      .ulDataPort = LPC32XX_BASE_UART_4,
103      .getRegister = lpc32xx_uart_get_register,
104      .setRegister = lpc32xx_uart_set_register,
105      .getData = NULL,
106      .setData = NULL,
107      .ulClock = 16,
108      .ulIntVector = LPC32XX_IRQ_UART_4
109    },
110  #endif
111  #ifdef LPC32XX_CONFIG_U6CLK
112    {
113      .sDeviceName = "/dev/ttyS6",
114      .deviceType = SERIAL_NS16550,
115      .pDeviceFns = &ns16550_fns,
116      .deviceProbe = NULL,
117      .pDeviceFlow = NULL,
118      .ulMargin = 16,
119      .ulHysteresis = 8,
120      .pDeviceParams = (void *) 1,
121      .ulCtrlPort1 = LPC32XX_BASE_UART_6,
122      .ulCtrlPort2 = 0,
123      .ulDataPort = LPC32XX_BASE_UART_6,
124      .getRegister = lpc32xx_uart_get_register,
125      .setRegister = lpc32xx_uart_set_register,
126      .getData = NULL,
127      .setData = NULL,
128      .ulClock = 16,
129      .ulIntVector = LPC32XX_IRQ_UART_6
130    },
131  #endif
132  #ifdef LPC32XX_UART_1_BAUD
133    {
134      .sDeviceName = "/dev/ttyS1",
135      .deviceType = SERIAL_CUSTOM,
136      .pDeviceFns = &lpc32xx_hsu_fns,
137      .deviceProbe = NULL,
138      .pDeviceFlow = NULL,
139      .ulMargin = 16,
140      .ulHysteresis = 8,
141      .pDeviceParams = (void *) LPC32XX_UART_1_BAUD,
142      .ulCtrlPort1 = LPC32XX_BASE_UART_1,
143      .ulCtrlPort2 = 0,
144      .ulDataPort = 0,
145      .getRegister = NULL,
146      .setRegister = NULL,
147      .getData = NULL,
148      .setData = NULL,
149      .ulClock = 16,
150      .ulIntVector = LPC32XX_IRQ_UART_1
151    },
152  #endif
153  #ifdef LPC32XX_UART_2_BAUD
154    {
155      .sDeviceName = "/dev/ttyS2",
156      .deviceType = SERIAL_CUSTOM,
157      .pDeviceFns = &lpc32xx_hsu_fns,
158      .deviceProbe = NULL,
159      .pDeviceFlow = NULL,
160      .ulMargin = 16,
161      .ulHysteresis = 8,
162      .pDeviceParams = (void *) LPC32XX_UART_2_BAUD,
163      .ulCtrlPort1 = LPC32XX_BASE_UART_2,
164      .ulCtrlPort2 = 0,
165      .ulDataPort = 0,
166      .getRegister = NULL,
167      .setRegister = NULL,
168      .getData = NULL,
169      .setData = NULL,
170      .ulClock = 16,
171      .ulIntVector = LPC32XX_IRQ_UART_2
172    },
173  #endif
174  #ifdef LPC32XX_UART_7_BAUD
175    {
176      .sDeviceName = "/dev/ttyS7",
177      .deviceType = SERIAL_CUSTOM,
178      .pDeviceFns = &lpc32xx_hsu_fns,
179      .deviceProbe = NULL,
180      .pDeviceFlow = NULL,
181      .ulMargin = 16,
182      .ulHysteresis = 8,
183      .pDeviceParams = (void *) LPC32XX_UART_7_BAUD,
184      .ulCtrlPort1 = LPC32XX_BASE_UART_7,
185      .ulCtrlPort2 = 0,
186      .ulDataPort = 0,
187      .getRegister = NULL,
188      .setRegister = NULL,
189      .getData = NULL,
190      .setData = NULL,
191      .ulClock = 16,
192      .ulIntVector = LPC32XX_IRQ_UART_7
193    },
194  #endif
195};
196
197#define LPC32XX_UART_COUNT \
198  (sizeof(Console_Configuration_Ports) / sizeof(Console_Configuration_Ports [0]))
199
200unsigned long Console_Configuration_Count = LPC32XX_UART_COUNT;
Note: See TracBrowser for help on using the repository browser.