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

4.115
Last change on this file since a94d46c8 was a94d46c8, checked in by Sebastian Huber <sebastian.huber@…>, on May 6, 2013 at 12:34:55 PM

bsp/xilinx-zynq: New BSP

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