source: rtems/c/src/lib/libbsp/arm/xilinx-zynq/console/console-config.c @ c54769e7

5
Last change on this file since c54769e7 was 1c77a36, checked in by Sebastian Huber <sebastian.huber@…>, on 06/24/16 at 12:31:29

bsps: Include missing <rtems/bspIo.h>

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