blob: a01a75abf27a4bea9a5c7cf39da42dd86b656fed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
* Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* 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 <bsp/console-termios.h>
#include <bsp/fatal.h>
#include <rtems/console.h>
#include <unistd.h>
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;
}
|