[PATCH] bsps/console: Support device file system
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Apr 2 10:02:06 UTC 2020
Update #3926.
---
bsps/include/bsp/fatal.h | 2 --
bsps/shared/dev/serial/console-termios-init.c | 28 +++++++++++++++------------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/bsps/include/bsp/fatal.h b/bsps/include/bsp/fatal.h
index 3f8e1eb591..cd3c42aec0 100644
--- a/bsps/include/bsp/fatal.h
+++ b/bsps/include/bsp/fatal.h
@@ -38,8 +38,6 @@ typedef enum {
BSP_FATAL_CONSOLE_REGISTER_DEV_0,
BSP_FATAL_CONSOLE_REGISTER_DEV_1,
BSP_FATAL_CONSOLE_NO_DEV,
- BSP_FATAL_CONSOLE_INSTALL_0,
- BSP_FATAL_CONSOLE_INSTALL_1,
BSP_FATAL_CONSOLE_REGISTER_DEV_2,
/* ARM fatal codes */
diff --git a/bsps/shared/dev/serial/console-termios-init.c b/bsps/shared/dev/serial/console-termios-init.c
index a01a75abf2..87806cc39d 100644
--- a/bsps/shared/dev/serial/console-termios-init.c
+++ b/bsps/shared/dev/serial/console-termios-init.c
@@ -32,31 +32,35 @@ rtems_device_driver console_initialize(
void *arg
)
{
- bool console_device_done = false;
+ bool console_device_done;
rtems_termios_initialize();
+ console_device_done = false;
for ( minor = 0; minor < console_device_count; ++minor ) {
- const console_device *ctx = &console_device_table[ minor ];
- rtems_status_code sc;
+ const console_device *ctx;
+
+ ctx = &console_device_table[ minor ];
if ( ( *ctx->probe )( ctx->context ) ) {
- sc = rtems_termios_device_install(
- ctx->device_file,
+ const char *device_file;
+
+ if ( console_device_done ) {
+ device_file = ctx->device_file;
+ } else {
+ device_file = CONSOLE_DEVICE_NAME;
+ }
+
+ (void) rtems_termios_device_install(
+ 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 );
- }
+ (void) link( CONSOLE_DEVICE_NAME, ctx->device_file );
}
}
}
--
2.16.4
More information about the devel
mailing list