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

5
Last change on this file since 6b2fcc4 was 6b2fcc4, checked in by Sebastian Huber <sebastian.huber@…>, on 02/21/17 at 09:30:30

bsp/xilinx-zynq: Use new Termios device driver

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[a94d46c8]1/*
[6b2fcc4]2 * Copyright (c) 2013, 2017 embedded brains GmbH.  All rights reserved.
[a94d46c8]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
[c499856]12 * http://www.rtems.org/license/LICENSE.
[a94d46c8]13 */
14
[6b2fcc4]15#include <rtems/console.h>
[1c77a36]16#include <rtems/bspIo.h>
17
[a94d46c8]18#include <bsp/irq.h>
19#include <bsp/zynq-uart.h>
20
[6b2fcc4]21#include <bspopts.h>
22
23zynq_uart_context zynq_uart_instances[2] = {
[a94d46c8]24  {
[6b2fcc4]25    .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 0" ),
26    .regs = (volatile struct zynq_uart *) 0xe0000000,
27    .irq = ZYNQ_IRQ_UART_0
[a94d46c8]28  }, {
[6b2fcc4]29    .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 1" ),
30    .regs = (volatile struct zynq_uart *) 0xe0001000,
31    .irq = ZYNQ_IRQ_UART_1
[a94d46c8]32  }
33};
34
[6b2fcc4]35rtems_status_code console_initialize(
36  rtems_device_major_number major,
37  rtems_device_minor_number minor,
38  void *arg
39)
[a94d46c8]40{
[6b2fcc4]41  size_t i;
[a94d46c8]42
[6b2fcc4]43  rtems_termios_initialize();
[51a58e0]44
[6b2fcc4]45  for (i = 0; i < RTEMS_ARRAY_SIZE(zynq_uart_instances); ++i) {
46    char uart[] = "/dev/ttySX";
[51a58e0]47
[6b2fcc4]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    );
[a94d46c8]55
[6b2fcc4]56    if (i == BSP_CONSOLE_MINOR) {
57      link(&uart[0], CONSOLE_DEVICE_NAME);
58    }
[a94d46c8]59  }
60
[6b2fcc4]61  return RTEMS_SUCCESSFUL;
[a94d46c8]62}
Note: See TracBrowser for help on using the repository browser.