[rtems commit] termios: Fix static device initalization

Sebastian Huber sebh at rtems.org
Fri Feb 3 09:58:19 UTC 2017


Module:    rtems
Branch:    master
Commit:    85ed95ec4808d021be50a1ab1f476476a09c5a22
Changeset: http://git.rtems.org/rtems/commit/?id=85ed95ec4808d021be50a1ab1f476476a09c5a22

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Feb  3 10:49:13 2017 +0100

termios: Fix static device initalization

This enables early printk() support.

Update #2838.

---

 cpukit/libcsupport/include/rtems/termiostypes.h | 18 +++++++++++++++++-
 cpukit/libcsupport/src/termios.c                | 12 ++++++------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
index ffe172c..3cf6beb 100644
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ b/cpukit/libcsupport/include/rtems/termiostypes.h
@@ -90,6 +90,16 @@ typedef struct rtems_termios_device_context {
   );
 } rtems_termios_device_context;
 
+void rtems_termios_device_lock_acquire_default(
+  rtems_termios_device_context *ctx,
+  rtems_interrupt_lock_context *lock_context
+);
+
+void rtems_termios_device_lock_release_default(
+  rtems_termios_device_context *ctx,
+  rtems_interrupt_lock_context *lock_context
+);
+
 /**
  * @brief Initializes a device context.
  *
@@ -104,6 +114,8 @@ RTEMS_INLINE_ROUTINE void rtems_termios_device_context_initialize(
 )
 {
   rtems_interrupt_lock_initialize( &context->lock.interrupt, name );
+  context->lock_acquire = rtems_termios_device_lock_acquire_default;
+  context->lock_release = rtems_termios_device_lock_release_default;
 }
 
 /**
@@ -113,7 +125,11 @@ RTEMS_INLINE_ROUTINE void rtems_termios_device_context_initialize(
  *   is only used if profiling is enabled.
  */
 #define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( name ) \
-  { { RTEMS_INTERRUPT_LOCK_INITIALIZER( name ) } }
+  { \
+    { RTEMS_INTERRUPT_LOCK_INITIALIZER( name ) }, \
+    rtems_termios_device_lock_acquire_default, \
+    rtems_termios_device_lock_release_default \
+  }
 
 /**
  * @brief Termios device handler.
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index d3757df..c44abbe 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -363,8 +363,8 @@ deviceReleaseMutex(
   (void) sc;
 }
 
-static void
-deviceAcquireInterrupt(
+void
+rtems_termios_device_lock_acquire_default(
   rtems_termios_device_context *ctx,
   rtems_interrupt_lock_context *lock_context
 )
@@ -372,8 +372,8 @@ deviceAcquireInterrupt(
   rtems_interrupt_lock_acquire (&ctx->lock.interrupt, lock_context);
 }
 
-static void
-deviceReleaseInterrupt(
+void
+rtems_termios_device_lock_release_default(
   rtems_termios_device_context *ctx,
   rtems_interrupt_lock_context *lock_context
 )
@@ -530,8 +530,8 @@ rtems_termios_open_tty(
       ctx->lock_acquire = deviceAcquireMutex;
       ctx->lock_release = deviceReleaseMutex;
     } else {
-      ctx->lock_acquire = deviceAcquireInterrupt;
-      ctx->lock_release = deviceReleaseInterrupt;
+      ctx->lock_acquire = rtems_termios_device_lock_acquire_default;
+      ctx->lock_release = rtems_termios_device_lock_release_default;
     }
 
     /*



More information about the vc mailing list