[rtems commit] termios: Add TERMIOS_IRQ_SERVER_DRIVEN

Sebastian Huber sebh at rtems.org
Fri Dec 16 10:29:46 UTC 2016


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

Author:    Alexander Krutwig <alexander.krutwig at embedded-brains.de>
Date:      Mon Oct 17 14:15:34 2016 +0200

termios: Add TERMIOS_IRQ_SERVER_DRIVEN

Add a new interrupt server driven Termios mode (TERMIOS_IRQ_DRIVEN).
This mode is identical to the interrupt driven mode except that a mutex
is used for device level locking. The intended use case for this mode
are device drivers that use the interrupt server, e.g. SPI or I2C
connected devices.

Update #2839.

---

 cpukit/libcsupport/include/rtems/termiostypes.h | 10 ++++++----
 cpukit/libcsupport/src/termios.c                |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
index 81d28c2..ffe172c 100644
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ b/cpukit/libcsupport/include/rtems/termiostypes.h
@@ -57,7 +57,8 @@ struct rtems_termios_rawbuf {
 typedef enum {
   TERMIOS_POLLED,
   TERMIOS_IRQ_DRIVEN,
-  TERMIOS_TASK_DRIVEN
+  TERMIOS_TASK_DRIVEN,
+  TERMIOS_IRQ_SERVER_DRIVEN
 } rtems_termios_device_mode;
 
 struct rtems_termios_tty;
@@ -74,7 +75,7 @@ typedef struct rtems_termios_device_context {
     /* Used for TERMIOS_POLLED and TERMIOS_IRQ_DRIVEN */
     rtems_interrupt_lock interrupt;
 
-    /* Used for TERMIOS_TASK_DRIVEN */
+    /* Used for TERMIOS_IRQ_SERVER_DRIVEN or TERMIOS_TASK_DRIVEN */
     rtems_id mutex;
   } lock;
 
@@ -161,8 +162,9 @@ typedef struct {
   /**
    * @brief Polled read.
    *
-   * In case mode is TERMIOS_IRQ_DRIVEN or TERMIOS_TASK_DRIVEN, then data is
-   * received via rtems_termios_enqueue_raw_characters().
+   * In case mode is TERMIOS_IRQ_DRIVEN, TERMIOS_IRQ_SERVER_DRIVEN or
+   * TERMIOS_TASK_DRIVEN, then data is received via
+   * rtems_termios_enqueue_raw_characters().
    *
    * @param[in] context The Termios device context.
    *
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index 3bc5bb8..d3757df 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -275,7 +275,8 @@ drainOutput (struct rtems_termios_tty *tty)
 static bool
 needDeviceMutex (rtems_termios_tty *tty)
 {
-  return tty->handler.mode == TERMIOS_TASK_DRIVEN;
+  return tty->handler.mode == TERMIOS_IRQ_SERVER_DRIVEN
+    || tty->handler.mode == TERMIOS_TASK_DRIVEN;
 }
 
 static void




More information about the vc mailing list