source: rtems/c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c @ 116ef2e9

4.115
Last change on this file since 116ef2e9 was 116ef2e9, checked in by Sebastian Huber <sebastian.huber@…>, on Oct 13, 2014 at 1:19:12 PM

bsps/arm: Convert PL011 and PL050 console drivers

Use Termios device API.

  • 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  if (c == '\n') {
41    arm_pl011_write_polled(&pl011_context.base, '\r');
42  }
43
44  arm_pl011_write_polled(&pl011_context.base, c);
45}
46
47static bool pl011_probe(rtems_termios_device_context *base)
48{
49  BSP_output_char = output_char;
50
51  return arm_pl011_probe(base);
52}
53
54static void output_char_init(char c)
55{
56  pl011_probe(&pl011_context.base);
57  output_char(c);
58}
59
60BSP_output_char_function_type BSP_output_char = output_char_init;
61
62BSP_polling_getchar_function_type BSP_poll_char = NULL;
63
64const console_device console_device_table[] = {
65  {
66    .device_file = "/dev/ttyS0",
67    .probe = pl011_probe,
68    .handler = &arm_pl011_fns,
69    .context = &pl011_context.base
70  }, {
71    .device_file = SERIAL_MOUSE_DEVICE_PS2,
72    .probe = console_device_probe_default,
73    .handler = &arm_pl050_fns,
74    .context = &pl050_context.base
75  }
76};
77
78const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
Note: See TracBrowser for help on using the repository browser.