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

4.115
Last change on this file since ad83ea0 was ad83ea0, checked in by Sebastian Huber <sebastian.huber@…>, on 07/07/13 at 12:43:17

mouse: Add shared bsp_get_serial_mouse_device()

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[a91dc98b]1/*
2 * Copyright (c) 2013 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.com/license/LICENSE.
13 */
14
[3b645c1]15#include <rtems/serial_mouse.h>
16
[a91dc98b]17#include <libchip/serial.h>
18
19#include <bsp.h>
20#include <bsp/irq.h>
21#include <bsp/arm-pl011.h>
[3b645c1]22#include <bsp/arm-pl050.h>
23
[a91dc98b]24console_tbl Console_Configuration_Ports[] = {
25  {
26    .sDeviceName = "/dev/ttyS0",
27    .deviceType = SERIAL_CUSTOM,
28    .pDeviceFns = &arm_pl011_fns,
29    .deviceProbe = NULL,
30    .pDeviceFlow = NULL,
31    .ulMargin = 10,
32    .ulHysteresis = 0,
33    .pDeviceParams = (void *) 115200,
34    .ulCtrlPort1 = 0x10009000,
35    .ulCtrlPort2 = 0,
36    .ulDataPort = 0,
37    .getRegister = NULL,
38    .setRegister = NULL,
39    .getData = NULL,
40    .setData = NULL,
41    .ulClock = 0,
42    .ulIntVector = RVPBXA9_IRQ_UART_0
[3b645c1]43  }, {
[ad83ea0]44    .sDeviceName = SERIAL_MOUSE_DEVICE_PS2,
[3b645c1]45    .deviceType = SERIAL_CUSTOM,
46    .pDeviceFns = &arm_pl050_fns,
47    .deviceProbe = NULL,
48    .pDeviceFlow = NULL,
49    .ulMargin = 10,
50    .ulHysteresis = 0,
51    .pDeviceParams = (void *) 115200,
52    .ulCtrlPort1 = 0x10007000,
53    .ulCtrlPort2 = 0,
54    .ulDataPort = 0,
55    .getRegister = NULL,
56    .setRegister = NULL,
57    .getData = NULL,
58    .setData = NULL,
59    .ulClock = 0,
60    .ulIntVector = RVPBXA9_IRQ_KMI1
[a91dc98b]61  }
62};
63
64unsigned long Console_Configuration_Count =
65  RTEMS_ARRAY_SIZE(Console_Configuration_Ports);
66
67static void output_char(char c)
68{
69  int minor = (int) Console_Port_Minor;
70  const console_tbl *ct = Console_Port_Tbl != NULL ?
71    Console_Port_Tbl[minor] : &Console_Configuration_Ports[minor];
72  const console_fns *cf = ct->pDeviceFns;
73
74  if (c == '\n') {
75    (*cf->deviceWritePolled)(minor, '\r');
76  }
77
78  (*cf->deviceWritePolled)(minor, c);
79}
80
81static void output_char_init(char c)
82{
83  if (Console_Port_Tbl == NULL) {
84    int minor = (int) Console_Port_Minor;
85    const console_fns *cf = Console_Configuration_Ports[minor].pDeviceFns;
86
87    (*cf->deviceInitialize)(minor);
88  }
89
90  BSP_output_char = output_char;
91  output_char(c);
92}
93
94BSP_output_char_function_type BSP_output_char = output_char_init;
95
96BSP_polling_getchar_function_type BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.