source: rtems/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c @ 4a6cc2a

4.115
Last change on this file since 4a6cc2a was 4a6cc2a, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 8, 2011 at 10:39:46 AM

2011-11-08 Sebastian Huber <sebastian.huber@…>

  • include/lpc17xx.h: New file.
  • Makefile.am, preinstall.am: Reflect change above. Update due to API changes.
  • configure.ac, console/console-config.c, include/bsp.h, include/io.h, include/irq.h, include/lcd.h, include/lpc-clock-config.h, include/lpc24xx.h, include/start-config.h, irq/irq-dispatch.c, irq/irq.c, misc/bspidle.c, misc/io.c, misc/lcd.c, misc/restart.c, misc/system-clocks.c, ssp/ssp.c, startup/bspreset.c, startup/bspstart.c, startup/bspstarthooks.c, startup/start-config-emc-dynamic.c, startup/start-config-emc-static.c, startup/start-config-pinsel.c: Basic support for LPC17XX. New memory configurations for W9825G2JB75I, IS42S32800B, and SST39VF3201.
  • Property mode set to 100644
File size: 4.7 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup lpc24xx
5 *
6 * @brief Console configuration.
7 */
8
9/*
10 * Copyright (c) 2008-2011 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be found in the file
19 * LICENSE in this distribution or at 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/lpc24xx.h>
27#include <bsp/irq.h>
28#include <bsp/io.h>
29
30static uint8_t lpc24xx_uart_get_register(uint32_t addr, uint8_t i)
31{
32  volatile uint32_t *reg = (volatile uint32_t *) addr;
33
34  return (uint8_t) reg [i];
35}
36
37static void lpc24xx_uart_set_register(uint32_t addr, uint8_t i, uint8_t val)
38{
39  volatile uint32_t *reg = (volatile uint32_t *) addr;
40
41  reg [i] = val;
42}
43
44#ifdef LPC24XX_CONFIG_UART_1
45  static bool lpc24xx_uart_probe_1(int minor)
46  {
47    static const lpc24xx_pin_range pins [] = {
48      LPC24XX_PIN_UART_1_TXD_P0_15,
49      LPC24XX_PIN_UART_1_RXD_P0_16,
50      LPC24XX_PIN_TERMINAL
51    };
52
53    lpc24xx_module_enable(LPC24XX_MODULE_UART_1, LPC24XX_MODULE_PCLK_DEFAULT);
54    lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
55
56    return true;
57  }
58#endif
59
60#ifdef LPC24XX_CONFIG_UART_2
61  static bool lpc24xx_uart_probe_2(int minor)
62  {
63    static const lpc24xx_pin_range pins [] = {
64      LPC24XX_PIN_UART_2_TXD_P0_10,
65      LPC24XX_PIN_UART_2_RXD_P0_11,
66      LPC24XX_PIN_TERMINAL
67    };
68
69    lpc24xx_module_enable(LPC24XX_MODULE_UART_2, LPC24XX_MODULE_PCLK_DEFAULT);
70    lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
71
72    return true;
73  }
74#endif
75
76#ifdef LPC24XX_CONFIG_UART_3
77  static bool lpc24xx_uart_probe_3(int minor)
78  {
79    static const lpc24xx_pin_range pins [] = {
80      LPC24XX_PIN_UART_3_TXD_P0_0,
81      LPC24XX_PIN_UART_3_RXD_P0_1,
82      LPC24XX_PIN_TERMINAL
83    };
84
85    lpc24xx_module_enable(LPC24XX_MODULE_UART_3, LPC24XX_MODULE_PCLK_DEFAULT);
86    lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
87
88    return true;
89  }
90#endif
91
92console_tbl Console_Configuration_Ports [] = {
93  #ifdef LPC24XX_CONFIG_CONSOLE
94    {
95      .sDeviceName = "/dev/ttyS0",
96      .deviceType = SERIAL_NS16550,
97      .pDeviceFns = &ns16550_fns,
98      .deviceProbe = NULL,
99      .pDeviceFlow = NULL,
100      .ulMargin = 16,
101      .ulHysteresis = 8,
102      .pDeviceParams = (void *) LPC24XX_UART_BAUD,
103      .ulCtrlPort1 = UART0_BASE_ADDR,
104      .ulCtrlPort2 = 0,
105      .ulDataPort = UART0_BASE_ADDR,
106      .getRegister = lpc24xx_uart_get_register,
107      .setRegister = lpc24xx_uart_set_register,
108      .getData = NULL,
109      .setData = NULL,
110      .ulClock = LPC24XX_PCLK,
111      .ulIntVector = LPC24XX_IRQ_UART_0
112    },
113  #endif
114  #ifdef LPC24XX_CONFIG_UART_1
115    {
116      .sDeviceName = "/dev/ttyS1",
117      .deviceType = SERIAL_NS16550,
118      .pDeviceFns = &ns16550_fns,
119      .deviceProbe = lpc24xx_uart_probe_1,
120      .pDeviceFlow = NULL,
121      .ulMargin = 16,
122      .ulHysteresis = 8,
123      .pDeviceParams = (void *) LPC24XX_UART_BAUD,
124      .ulCtrlPort1 = UART1_BASE_ADDR,
125      .ulCtrlPort2 = 0,
126      .ulDataPort = UART1_BASE_ADDR,
127      .getRegister = lpc24xx_uart_get_register,
128      .setRegister = lpc24xx_uart_set_register,
129      .getData = NULL,
130      .setData = NULL,
131      .ulClock = LPC24XX_PCLK,
132      .ulIntVector = LPC24XX_IRQ_UART_1
133    },
134  #endif
135  #ifdef LPC24XX_CONFIG_UART_2
136    {
137      .sDeviceName = "/dev/ttyS2",
138      .deviceType = SERIAL_NS16550,
139      .pDeviceFns = &ns16550_fns,
140      .deviceProbe = lpc24xx_uart_probe_2,
141      .pDeviceFlow = NULL,
142      .ulMargin = 16,
143      .ulHysteresis = 8,
144      .pDeviceParams = (void *) LPC24XX_UART_BAUD,
145      .ulCtrlPort1 = UART2_BASE_ADDR,
146      .ulCtrlPort2 = 0,
147      .ulDataPort = UART2_BASE_ADDR,
148      .getRegister = lpc24xx_uart_get_register,
149      .setRegister = lpc24xx_uart_set_register,
150      .getData = NULL,
151      .setData = NULL,
152      .ulClock = LPC24XX_PCLK,
153      .ulIntVector = LPC24XX_IRQ_UART_2
154    },
155  #endif
156  #ifdef LPC24XX_CONFIG_UART_3
157    {
158      .sDeviceName = "/dev/ttyS3",
159      .deviceType = SERIAL_NS16550,
160      .pDeviceFns = &ns16550_fns,
161      .deviceProbe = lpc24xx_uart_probe_3,
162      .pDeviceFlow = NULL,
163      .ulMargin = 16,
164      .ulHysteresis = 8,
165      .pDeviceParams = (void *) LPC24XX_UART_BAUD,
166      .ulCtrlPort1 = UART3_BASE_ADDR,
167      .ulCtrlPort2 = 0,
168      .ulDataPort = UART3_BASE_ADDR,
169      .getRegister = lpc24xx_uart_get_register,
170      .setRegister = lpc24xx_uart_set_register,
171      .getData = NULL,
172      .setData = NULL,
173      .ulClock = LPC24XX_PCLK,
174      .ulIntVector = LPC24XX_IRQ_UART_3
175    },
176  #endif
177};
178
179#define LPC24XX_UART_COUNT \
180  (sizeof(Console_Configuration_Ports) \
181    / sizeof(Console_Configuration_Ports [0]))
182unsigned long Console_Configuration_Count = LPC24XX_UART_COUNT;
Note: See TracBrowser for help on using the repository browser.