source: rtems/bsps/arm/xilinx-zynq/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.4 KB
Line 
1/*
2 * Copyright (c) 2013, 2017 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/console.h>
16#include <rtems/bspIo.h>
17
18#include <bsp/irq.h>
19#include <bsp/zynq-uart.h>
20
21#include <bspopts.h>
22
23zynq_uart_context zynq_uart_instances[2] = {
24  {
25    .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 0" ),
26    .regs = (volatile struct zynq_uart *) 0xe0000000,
27    .irq = ZYNQ_IRQ_UART_0
28  }, {
29    .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 1" ),
30    .regs = (volatile struct zynq_uart *) 0xe0001000,
31    .irq = ZYNQ_IRQ_UART_1
32  }
33};
34
35rtems_status_code console_initialize(
36  rtems_device_major_number major,
37  rtems_device_minor_number minor,
38  void *arg
39)
40{
41  size_t i;
42
43  rtems_termios_initialize();
44
45  for (i = 0; i < RTEMS_ARRAY_SIZE(zynq_uart_instances); ++i) {
46    char uart[] = "/dev/ttySX";
47
48    uart[sizeof(uart) - 2] = (char) ('0' + i);
49    rtems_termios_device_install(
50      &uart[0],
51      &zynq_uart_handler,
52      NULL,
53      &zynq_uart_instances[i].base
54    );
55
56    if (i == BSP_CONSOLE_MINOR) {
57      link(&uart[0], CONSOLE_DEVICE_NAME);
58    }
59  }
60
61  return RTEMS_SUCCESSFUL;
62}
Note: See TracBrowser for help on using the repository browser.