summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/shared
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
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')
-rw-r--r--c/src/lib/libbsp/shared/console-termios-init.c41
-rw-r--r--c/src/lib/libbsp/shared/console-termios.c20
-rw-r--r--c/src/lib/libbsp/shared/include/console-termios.h19
3 files changed, 17 insertions, 63 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;
}
diff --git a/c/src/lib/libbsp/shared/console-termios.c b/c/src/lib/libbsp/shared/console-termios.c
index f57b06ce0c..1e755d91c9 100644
--- a/c/src/lib/libbsp/shared/console-termios.c
+++ b/c/src/lib/libbsp/shared/console-termios.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
@@ -21,7 +21,11 @@ rtems_device_driver console_open(
void *arg
)
{
- return rtems_termios_device_open( major, minor, arg );
+ (void) major;
+ (void) minor;
+ (void) arg;
+
+ return RTEMS_INTERNAL_ERROR;
}
rtems_device_driver console_close(
@@ -32,8 +36,9 @@ rtems_device_driver console_close(
{
(void) major;
(void) minor;
+ (void) arg;
- return rtems_termios_device_close( arg );
+ return RTEMS_INTERNAL_ERROR;
}
rtems_device_driver console_read(
@@ -44,8 +49,9 @@ rtems_device_driver console_read(
{
(void) major;
(void) minor;
+ (void) arg;
- return rtems_termios_read( arg );
+ return RTEMS_INTERNAL_ERROR;
}
rtems_device_driver console_write(
@@ -56,8 +62,9 @@ rtems_device_driver console_write(
{
(void) major;
(void) minor;
+ (void) arg;
- return rtems_termios_write( arg );
+ return RTEMS_INTERNAL_ERROR;
}
rtems_device_driver console_control(
@@ -68,6 +75,7 @@ rtems_device_driver console_control(
{
(void) major;
(void) minor;
+ (void) arg;
- return rtems_termios_ioctl( arg );
+ return RTEMS_INTERNAL_ERROR;
}
diff --git a/c/src/lib/libbsp/shared/include/console-termios.h b/c/src/lib/libbsp/shared/include/console-termios.h
index bbb9f357df..413dde4663 100644
--- a/c/src/lib/libbsp/shared/include/console-termios.h
+++ b/c/src/lib/libbsp/shared/include/console-termios.h
@@ -87,25 +87,6 @@ typedef struct {
} console_device;
/**
- * @brief Installs a console device after console driver initialization.
- *
- * @param[in] device_file The device file path.
- * @param[in] handler The Termios device handler. It must be persistent
- * throughout the installed time of the device.
- * @param[in] flow The Termios device flow control handler. The device flow
- * control handler are optional and may be @c NULL. If present must be
- * persistent throughout the installed time of the device.
- * @param[in] context The Termios device context. It must be persistent
- * throughout the installed time of the device.
- */
-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
-);
-
-/**
* @brief Returns true and does nothing else.
*/
bool console_device_probe_default(rtems_termios_device_context *context);