source: rtems/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c @ 7a752161

4.115
Last change on this file since 7a752161 was 7a752161, checked in by Sebastian Huber <sebastian.huber@…>, on 09/26/11 at 10:08:29

2011-09-27 Sebastian Huber <sebastian.huber@…>

  • make/custom/mpc8309som.cfg, startup/linkcmds.mpc8309som: New file.
  • Makefile.am, preinstall.am: Reflect changes above.
  • configure.ac, console/console-config.c, include/bsp.h, include/hwreg_vals.h, include/irq.h, network/network.c, spi/spi_init.c, startup/cpuinit.c: Renamed various BSP options.
  • make/custom/gen83xx.inc, make/custom/hsc_cm01.cfg, make/custom/mpc8313erdb.cfg, make/custom/mpc8349eamds.cfg: Avoid special linkcmds.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/**
2 * @file
3 *
4 * @brief Console configuration.
5 */
6
7/*
8 * Copyright (c) 2008, 2010 embedded brains GmbH.  All rights reserved.
9 *
10 *  embedded brains GmbH
11 *  Obere Lagerstr. 30
12 *  82178 Puchheim
13 *  Germany
14 *  <rtems@embedded-brains.de>
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.com/license/LICENSE.
19 *
20 *  $Id$
21 */
22
23#include <rtems/bspIo.h>
24
25#include <libchip/serial.h>
26#include <libchip/ns16550.h>
27
28#include <mpc83xx/mpc83xx.h>
29
30#include <bspopts.h>
31#include <bsp/irq.h>
32
33#ifdef BSP_USE_UART2
34  #define PORT_COUNT 2
35#else
36  #define PORT_COUNT 1
37#endif
38
39#ifdef BSP_USE_UART_INTERRUPTS
40  #define DEVICE_FNS &ns16550_fns
41#else
42  #define DEVICE_FNS &ns16550_fns_polled
43#endif
44
45static uint8_t gen83xx_console_get_register(uint32_t addr, uint8_t i)
46{
47  volatile uint8_t *reg = (volatile uint8_t *) addr;
48
49  return reg [i];
50}
51
52static void gen83xx_console_set_register(uint32_t addr, uint8_t i, uint8_t val)
53{
54  volatile uint8_t *reg = (volatile uint8_t *) addr;
55
56  reg [i] = val;
57}
58
59unsigned long Console_Port_Count = PORT_COUNT;
60
61rtems_device_minor_number Console_Port_Minor = 0;
62
63console_data Console_Port_Data [PORT_COUNT];
64
65console_tbl Console_Port_Tbl [PORT_COUNT] = {
66  {
67    .sDeviceName = "/dev/ttyS0",
68    .deviceType = SERIAL_NS16550,
69    .pDeviceFns = DEVICE_FNS,
70    .deviceProbe = NULL,
71    .pDeviceFlow = NULL,
72    .ulMargin = 16,
73    .ulHysteresis = 8,
74    .pDeviceParams = (void *) BSP_CONSOLE_BAUD,
75    .ulCtrlPort1 = (uint32_t) &mpc83xx.duart [0],
76    .ulCtrlPort2 = 0,
77    .ulDataPort =  (uint32_t) &mpc83xx.duart [0],
78    .getRegister = gen83xx_console_get_register,
79    .setRegister = gen83xx_console_set_register,
80    .getData = NULL,
81    .setData = NULL,
82    .ulClock = 0,
83#if MPC83XX_CHIP_TYPE / 10 == 830
84    .ulIntVector = BSP_IPIC_IRQ_UART
85#else
86    .ulIntVector = BSP_IPIC_IRQ_UART1
87#endif
88  }
89#ifdef BSP_USE_UART2
90  , {
91    .sDeviceName = "/dev/ttyS1",
92    .deviceType = SERIAL_NS16550,
93    .pDeviceFns = DEVICE_FNS,
94    .deviceProbe = NULL,
95    .pDeviceFlow = NULL,
96    .ulMargin = 16,
97    .ulHysteresis = 8,
98    .pDeviceParams = (void *) BSP_CONSOLE_BAUD,
99    .ulCtrlPort1 = (uint32_t) &mpc83xx.duart [1],
100    .ulCtrlPort2 = 0,
101    .ulDataPort =  (uint32_t) &mpc83xx.duart [1],
102    .getRegister = gen83xx_console_get_register,
103    .setRegister = gen83xx_console_set_register,
104    .getData = NULL,
105    .setData = NULL,
106    .ulClock = 0,
107#if MPC83XX_CHIP_TYPE / 10 == 830
108    .ulIntVector = BSP_IPIC_IRQ_UART
109#else
110    .ulIntVector = BSP_IPIC_IRQ_UART2
111#endif
112  }
113#endif
114};
115
116static void gen83xx_output_char(char c)
117{
118  const console_fns *console = Console_Port_Tbl [Console_Port_Minor].pDeviceFns;
119 
120  if (c == '\n') {
121    console->deviceWritePolled((int) Console_Port_Minor, '\r');
122  }
123  console->deviceWritePolled((int) Console_Port_Minor, c);
124}
125
126BSP_output_char_function_type  BSP_output_char = gen83xx_output_char;
127
128BSP_polling_getchar_function_type BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.