source: rtems/bsps/arm/realview-pbx-a9/console/console-config.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: 1.8 KB
Line 
1/*
2 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <info@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#include <rtems/serial_mouse.h>
16#include <rtems/bspIo.h>
17
18#include <bsp.h>
19#include <bsp/irq.h>
20#include <bsp/arm-pl011.h>
21#include <bsp/arm-pl050.h>
22#include <bsp/console-termios.h>
23
24static arm_pl011_context pl011_context = {
25  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
26  .regs = (volatile pl011 *) 0x10009000,
27  .irq = RVPBXA9_IRQ_UART_0,
28  .initial_baud = 115200
29};
30
31static arm_pl050_context pl050_context = {
32  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL050"),
33  .regs = (volatile pl050 *) 0x10007000,
34  .irq = RVPBXA9_IRQ_KMI1,
35  .initial_baud = 115200
36};
37
38static void output_char(char c)
39{
40  arm_pl011_write_polled(&pl011_context.base, c);
41}
42
43static bool pl011_probe(rtems_termios_device_context *base)
44{
45  BSP_output_char = output_char;
46
47  return arm_pl011_probe(base);
48}
49
50static void output_char_init(char c)
51{
52  pl011_probe(&pl011_context.base);
53  output_char(c);
54}
55
56BSP_output_char_function_type BSP_output_char = output_char_init;
57
58BSP_polling_getchar_function_type BSP_poll_char = NULL;
59
60const console_device console_device_table[] = {
61  {
62    .device_file = "/dev/ttyS0",
63    .probe = pl011_probe,
64    .handler = &arm_pl011_fns,
65    .context = &pl011_context.base
66  }, {
67    .device_file = SERIAL_MOUSE_DEVICE_PS2,
68    .probe = console_device_probe_default,
69    .handler = &arm_pl050_fns,
70    .context = &pl050_context.base
71  }
72};
73
74const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
Note: See TracBrowser for help on using the repository browser.