summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-11-28 06:30:35 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-02-02 15:01:21 +0100
commit2c12262f9a8fe7975556729f0574fab8d5a792f5 (patch)
tree0a4a0bea0900fd682d40fb1d628c5e922aab85b8 /cpukit/include/rtems
parentlibblock: Use self-contained mutex and cond var (diff)
downloadrtems-2c12262f9a8fe7975556729f0574fab8d5a792f5.tar.bz2
termios: Use self-contained objects
Update #2840.
Diffstat (limited to 'cpukit/include/rtems')
-rwxr-xr-xcpukit/include/rtems/confdefs.h29
-rw-r--r--cpukit/include/rtems/libio.h5
-rw-r--r--cpukit/include/rtems/termiostypes.h13
3 files changed, 16 insertions, 31 deletions
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 2169213c25..022026b327 100755
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -155,30 +155,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops);
#endif
-/*
- * This macro determines if termios is disabled by this application.
- * This only means that resources will not be reserved. If you end
- * up using termios, it will fail.
- */
-#ifdef CONFIGURE_TERMIOS_DISABLED
- #define _CONFIGURE_TERMIOS_SEMAPHORES 0
-#else
- /**
- * This macro specifies the number of serial or PTY ports that will
- * use termios.
- */
- #ifndef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
- #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1
- #endif
-
- /*
- * This macro reserves the number of semaphores required by termios
- * based upon the number of communication ports that will use it.
- */
- #define _CONFIGURE_TERMIOS_SEMAPHORES \
- ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1)
-#endif
-
/**
* This macro specifies the number of PTYs that can be concurrently
* active.
@@ -2096,7 +2072,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
*/
#define _CONFIGURE_SEMAPHORES \
(CONFIGURE_MAXIMUM_SEMAPHORES + \
- _CONFIGURE_TERMIOS_SEMAPHORES + \
_CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS + \
_CONFIGURE_NETWORKING_SEMAPHORES)
@@ -3511,6 +3486,10 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#error "Maximum priority configured higher than supported by target."
#endif
+#ifdef CONFIGURE_TERMIOS_DISABLED
+ #warning "The CONFIGURE_TERMIOS_DISABLED configuration option is obsolete since RTEMS 5.1"
+#endif
+
#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
#warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
#endif
diff --git a/cpukit/include/rtems/libio.h b/cpukit/include/rtems/libio.h
index 9d30dafddf..f3b0f2cbf9 100644
--- a/cpukit/include/rtems/libio.h
+++ b/cpukit/include/rtems/libio.h
@@ -1891,7 +1891,10 @@ typedef struct rtems_termios_callbacks {
int outputUsesInterrupts;
} rtems_termios_callbacks;
-void rtems_termios_initialize (void);
+RTEMS_INLINE_ROUTINE void rtems_termios_initialize( void )
+{
+ /* Nothing to do, provided for backward compatibility */
+}
/*
* CCJ: Change before opening a tty. Newer code from Eric is coming
diff --git a/cpukit/include/rtems/termiostypes.h b/cpukit/include/rtems/termiostypes.h
index b3cac66e92..db88cada8b 100644
--- a/cpukit/include/rtems/termiostypes.h
+++ b/cpukit/include/rtems/termiostypes.h
@@ -20,6 +20,7 @@
#include <rtems/libio.h>
#include <rtems/assoc.h>
#include <rtems/chain.h>
+#include <rtems/thread.h>
#include <sys/ioccom.h>
#include <stdint.h>
#include <termios.h>
@@ -52,7 +53,7 @@ struct rtems_termios_rawbuf {
volatile unsigned int Head;
volatile unsigned int Tail;
volatile unsigned int Size;
- rtems_id Semaphore;
+ rtems_binary_semaphore Semaphore;
};
typedef enum {
@@ -77,7 +78,7 @@ typedef struct rtems_termios_device_context {
rtems_interrupt_lock interrupt;
/* Used for TERMIOS_IRQ_SERVER_DRIVEN or TERMIOS_TASK_DRIVEN */
- rtems_id mutex;
+ rtems_mutex mutex;
} lock;
void ( *lock_acquire )(
@@ -300,8 +301,8 @@ typedef struct rtems_termios_tty {
/*
* Mutual-exclusion semaphores
*/
- rtems_id isem;
- rtems_id osem;
+ rtems_mutex isem;
+ rtems_mutex osem;
/*
* The canonical (cooked) character buffer
@@ -326,7 +327,7 @@ typedef struct rtems_termios_tty {
* Raw input character buffer
*/
struct rtems_termios_rawbuf rawInBuf;
- uint32_t rawInBufSemaphoreOptions;
+ bool rawInBufSemaphoreWait;
rtems_interval rawInBufSemaphoreTimeout;
rtems_interval rawInBufSemaphoreFirstTimeout;
unsigned int rawInBufDropped; /* Statistics */
@@ -595,6 +596,8 @@ int rtems_termios_poll(
#define RTEMS_TERMIOS_NUMBER_BAUD_RATES 25
+extern rtems_mutex rtems_termios_ttyMutex;
+
#ifdef __cplusplus
}
#endif