summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/shared/console-termios-init.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-16 12:58:06 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-19 07:52:33 +0200
commit55e0be36069942e0343e406615a3b1744cf7d6b3 (patch)
treea260825ed4914c1e96683924bfaa04a00bc50e8b /c/src/lib/libbsp/shared/console-termios-init.c
parentlibtests/devfs: Use printk() (diff)
downloadrtems-55e0be36069942e0343e406615a3b1744cf7d6b3.tar.bz2
termios: Use IMFS nodes for new Termios devices
This makes the new Termios devices independent of device major/minor numbers. It enables BSP independent Termios device drivers which may reside in the cpukit domain. These drivers require an IMFS and do not work with the device file system. However, the device file system should go away in the future.
Diffstat (limited to 'c/src/lib/libbsp/shared/console-termios-init.c')
-rw-r--r--c/src/lib/libbsp/shared/console-termios-init.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/c/src/lib/libbsp/shared/console-termios-init.c b/c/src/lib/libbsp/shared/console-termios-init.c
index 83d14d15fa..a01a75abf2 100644
--- a/c/src/lib/libbsp/shared/console-termios-init.c
+++ b/c/src/lib/libbsp/shared/console-termios-init.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014, 2016 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -17,36 +17,7 @@
#include <rtems/console.h>
-RTEMS_INTERRUPT_LOCK_DEFINE( static, console_lock, "console" )
-
-static rtems_device_major_number console_major = UINT32_MAX;
-
-static rtems_device_minor_number console_minor;
-
-rtems_status_code console_device_install(
- const char *device_file,
- const rtems_termios_device_handler *handler,
- const rtems_termios_device_flow *flow,
- rtems_termios_device_context *context
-)
-{
- rtems_interrupt_lock_context lock_context;
- rtems_device_minor_number minor;
-
- rtems_interrupt_lock_acquire( &console_lock, &lock_context );
- minor = console_minor;
- ++console_minor;
- rtems_interrupt_lock_release( &console_lock, &lock_context );
-
- return rtems_termios_device_install(
- device_file,
- console_major,
- minor,
- handler,
- flow,
- context
- );
-}
+#include <unistd.h>
bool console_device_probe_default(rtems_termios_device_context *context)
{
@@ -72,8 +43,6 @@ rtems_device_driver console_initialize(
if ( ( *ctx->probe )( ctx->context ) ) {
sc = rtems_termios_device_install(
ctx->device_file,
- major,
- minor,
ctx->handler,
ctx->flow,
ctx->context
@@ -85,16 +54,12 @@ rtems_device_driver console_initialize(
if ( !console_device_done ) {
console_device_done = true;
- sc = rtems_io_register_name( CONSOLE_DEVICE_NAME, major, minor );
- if ( sc != RTEMS_SUCCESSFUL ) {
+ if ( link( ctx->device_file, CONSOLE_DEVICE_NAME ) != 0 ) {
bsp_fatal( BSP_FATAL_CONSOLE_INSTALL_1 );
}
}
}
}
- console_major = major;
- console_minor = minor;
-
return RTEMS_SUCCESSFUL;
}