source: rtems/bsps/shared/dev/serial/console-termios-init.c @ 9bf813c5

Last change on this file since 9bf813c5 was 9bf813c5, checked in by Joel Sherrill <joel@…>, on 03/01/22 at 21:38:43

bsps/shared/: Scripted embedded brains header file clean up

Updates #4625.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
3 *
4 * The license and distribution terms for this file may be
5 * found in the file LICENSE in this distribution or at
6 * http://www.rtems.org/license/LICENSE.
7 */
8
9#include <bsp/console-termios.h>
10#include <bsp/fatal.h>
11
12#include <rtems/console.h>
13
14#include <unistd.h>
15
16bool console_device_probe_default(rtems_termios_device_context *context)
17{
18  (void) context;
19
20  return true;
21}
22
23rtems_device_driver console_initialize(
24  rtems_device_major_number  major,
25  rtems_device_minor_number  minor,
26  void                      *arg
27)
28{
29  bool console_device_done = false;
30
31  rtems_termios_initialize();
32
33  for ( minor = 0; minor < console_device_count; ++minor ) {
34    const console_device *ctx = &console_device_table[ minor ];
35    rtems_status_code     sc;
36
37    if ( ( *ctx->probe )( ctx->context ) ) {
38      sc = rtems_termios_device_install(
39        ctx->device_file,
40        ctx->handler,
41        ctx->flow,
42        ctx->context
43      );
44      if ( sc != RTEMS_SUCCESSFUL ) {
45        bsp_fatal( BSP_FATAL_CONSOLE_INSTALL_0 );
46      }
47
48      if ( !console_device_done ) {
49        console_device_done = true;
50
51        if ( link( ctx->device_file, CONSOLE_DEVICE_NAME ) != 0 ) {
52          bsp_fatal( BSP_FATAL_CONSOLE_INSTALL_1 );
53        }
54      }
55    }
56  }
57
58  return RTEMS_SUCCESSFUL;
59}
Note: See TracBrowser for help on using the repository browser.