Ignore:
Timestamp:
Oct 13, 2014, 1:19:12 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
6db0f56
Parents:
393e8ea
git-author:
Sebastian Huber <sebastian.huber@…> (10/13/14 13:19:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/14/14 06:02:39)
Message:

bsps/arm: Convert PL011 and PL050 console drivers

Use Termios device API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c

    r393e8ea r116ef2e9  
    11/*
    2  * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    1414
    1515#include <rtems/serial_mouse.h>
    16 
    17 #include <libchip/serial.h>
     16#include <rtems/bspIo.h>
    1817
    1918#include <bsp.h>
     
    2120#include <bsp/arm-pl011.h>
    2221#include <bsp/arm-pl050.h>
     22#include <bsp/console-termios.h>
    2323
    24 console_tbl Console_Configuration_Ports[] = {
     24static arm_pl011_context pl011_context = {
     25  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
     26  .regs = (volatile pl011 *) 0x10009000,
     27  .irq = RVPBXA9_IRQ_UART_0,
     28  .initial_baud = 115200
     29};
     30
     31static arm_pl050_context pl050_context = {
     32  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL050"),
     33  .regs = (volatile pl050 *) 0x10007000,
     34  .irq = RVPBXA9_IRQ_KMI1,
     35  .initial_baud = 115200
     36};
     37
     38static void output_char(char c)
     39{
     40  if (c == '\n') {
     41    arm_pl011_write_polled(&pl011_context.base, '\r');
     42  }
     43
     44  arm_pl011_write_polled(&pl011_context.base, c);
     45}
     46
     47static bool pl011_probe(rtems_termios_device_context *base)
     48{
     49  BSP_output_char = output_char;
     50
     51  return arm_pl011_probe(base);
     52}
     53
     54static void output_char_init(char c)
     55{
     56  pl011_probe(&pl011_context.base);
     57  output_char(c);
     58}
     59
     60BSP_output_char_function_type BSP_output_char = output_char_init;
     61
     62BSP_polling_getchar_function_type BSP_poll_char = NULL;
     63
     64const console_device console_device_table[] = {
    2565  {
    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
     66    .device_file = "/dev/ttyS0",
     67    .probe = pl011_probe,
     68    .handler = &arm_pl011_fns,
     69    .context = &pl011_context.base
    4370  }, {
    44     .sDeviceName = SERIAL_MOUSE_DEVICE_PS2,
    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
     71    .device_file = SERIAL_MOUSE_DEVICE_PS2,
     72    .probe = console_device_probe_default,
     73    .handler = &arm_pl050_fns,
     74    .context = &pl050_context.base
    6175  }
    6276};
    6377
    64 unsigned long Console_Configuration_Count =
    65   RTEMS_ARRAY_SIZE(Console_Configuration_Ports);
     78const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
Note: See TracChangeset for help on using the changeset viewer.