From d7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 19 Apr 2018 06:28:01 +0200 Subject: bsps: Move console drivers to bsps This patch is a part of the BSP source reorganization. Update #3285. --- bsps/shared/dev/serial/console-termios-init.c | 65 +++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 bsps/shared/dev/serial/console-termios-init.c (limited to 'bsps/shared/dev/serial/console-termios-init.c') diff --git a/bsps/shared/dev/serial/console-termios-init.c b/bsps/shared/dev/serial/console-termios-init.c new file mode 100644 index 0000000000..a01a75abf2 --- /dev/null +++ b/bsps/shared/dev/serial/console-termios-init.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include +#include + +#include + +#include + +bool console_device_probe_default(rtems_termios_device_context *context) +{ + (void) context; + + return true; +} + +rtems_device_driver console_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg +) +{ + bool console_device_done = false; + + rtems_termios_initialize(); + + for ( minor = 0; minor < console_device_count; ++minor ) { + const console_device *ctx = &console_device_table[ minor ]; + rtems_status_code sc; + + if ( ( *ctx->probe )( ctx->context ) ) { + sc = rtems_termios_device_install( + ctx->device_file, + ctx->handler, + ctx->flow, + ctx->context + ); + if ( sc != RTEMS_SUCCESSFUL ) { + bsp_fatal( BSP_FATAL_CONSOLE_INSTALL_0 ); + } + + if ( !console_device_done ) { + console_device_done = true; + + if ( link( ctx->device_file, CONSOLE_DEVICE_NAME ) != 0 ) { + bsp_fatal( BSP_FATAL_CONSOLE_INSTALL_1 ); + } + } + } + } + + return RTEMS_SUCCESSFUL; +} -- cgit v1.2.3