Changeset 2c12262 in rtems


Ignore:
Timestamp:
Nov 28, 2017, 5:30:35 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
dc158ad
Parents:
8d7f3680
git-author:
Sebastian Huber <sebastian.huber@…> (11/28/17 05:30:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/02/18 14:01:21)
Message:

termios: Use self-contained objects

Update #2840.

Files:
16 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/confdefs.h

    r8d7f3680 r2c12262  
    154154   */
    155155  const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops);
    156 #endif
    157 
    158 /*
    159  * This macro determines if termios is disabled by this application.
    160  * This only means that resources will not be reserved.  If you end
    161  * up using termios, it will fail.
    162  */
    163 #ifdef CONFIGURE_TERMIOS_DISABLED
    164   #define _CONFIGURE_TERMIOS_SEMAPHORES 0
    165 #else
    166   /**
    167    * This macro specifies the number of serial or PTY ports that will
    168    * use termios.
    169    */
    170   #ifndef CONFIGURE_NUMBER_OF_TERMIOS_PORTS
    171   #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1
    172   #endif
    173 
    174   /*
    175    * This macro reserves the number of semaphores required by termios
    176    * based upon the number of communication ports that will use it.
    177    */
    178   #define _CONFIGURE_TERMIOS_SEMAPHORES \
    179     ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1)
    180156#endif
    181157
     
    20972073  #define _CONFIGURE_SEMAPHORES \
    20982074    (CONFIGURE_MAXIMUM_SEMAPHORES + \
    2099       _CONFIGURE_TERMIOS_SEMAPHORES + \
    21002075      _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS + \
    21012076      _CONFIGURE_NETWORKING_SEMAPHORES)
     
    35123487#endif
    35133488
     3489#ifdef CONFIGURE_TERMIOS_DISABLED
     3490  #warning "The CONFIGURE_TERMIOS_DISABLED configuration option is obsolete since RTEMS 5.1"
     3491#endif
     3492
    35143493#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
    35153494  #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1"
  • cpukit/include/rtems/libio.h

    r8d7f3680 r2c12262  
    18921892} rtems_termios_callbacks;
    18931893
    1894 void rtems_termios_initialize (void);
     1894RTEMS_INLINE_ROUTINE void rtems_termios_initialize( void )
     1895{
     1896  /* Nothing to do, provided for backward compatibility */
     1897}
    18951898
    18961899/*
  • cpukit/include/rtems/termiostypes.h

    r8d7f3680 r2c12262  
    2121#include <rtems/assoc.h>
    2222#include <rtems/chain.h>
     23#include <rtems/thread.h>
    2324#include <sys/ioccom.h>
    2425#include <stdint.h>
     
    5354  volatile unsigned int  Tail;
    5455  volatile unsigned int  Size;
    55   rtems_id    Semaphore;
     56  rtems_binary_semaphore Semaphore;
    5657};
    5758
     
    7879
    7980    /* Used for TERMIOS_IRQ_SERVER_DRIVEN or TERMIOS_TASK_DRIVEN */
    80     rtems_id mutex;
     81    rtems_mutex mutex;
    8182  } lock;
    8283
     
    301302   * Mutual-exclusion semaphores
    302303   */
    303   rtems_id isem;
    304   rtems_id osem;
     304  rtems_mutex isem;
     305  rtems_mutex osem;
    305306
    306307  /*
     
    327328   */
    328329  struct rtems_termios_rawbuf rawInBuf;
    329   uint32_t                    rawInBufSemaphoreOptions;
     330  bool                        rawInBufSemaphoreWait;
    330331  rtems_interval              rawInBufSemaphoreTimeout;
    331332  rtems_interval              rawInBufSemaphoreFirstTimeout;
     
    596597#define RTEMS_TERMIOS_NUMBER_BAUD_RATES 25
    597598
     599extern rtems_mutex rtems_termios_ttyMutex;
     600
    598601#ifdef __cplusplus
    599602}
  • cpukit/libcsupport/src/termios.c

    r8d7f3680 r2c12262  
    8585       sizeof (rtems_termios_linesw) / sizeof (rtems_termios_linesw[0]);
    8686
    87 extern rtems_id rtems_termios_ttyMutex;
    88 
    8987static size_t rtems_termios_cbufsize = 256;
    9088static size_t rtems_termios_raw_input_size = 256;
     
    116114#define TERMIOS_RX_TERMINATE_EVENT RTEMS_EVENT_0
    117115
    118 static rtems_status_code
     116static void
    119117rtems_termios_obtain (void)
    120118{
    121   return rtems_semaphore_obtain (rtems_termios_ttyMutex, RTEMS_WAIT,
    122     RTEMS_NO_TIMEOUT);
     119  rtems_mutex_lock (&rtems_termios_ttyMutex);
    123120}
    124121
     
    126123rtems_termios_release (void)
    127124{
    128   rtems_status_code sc;
    129 
    130   sc = rtems_semaphore_release (rtems_termios_ttyMutex);
    131   _Assert (sc == RTEMS_SUCCESSFUL);
    132   (void) sc;
     125  rtems_mutex_unlock (&rtems_termios_ttyMutex);
    133126}
    134127
     
    259252  rtems_termios_device_context *ctx = tty->device_context;
    260253  rtems_interrupt_lock_context lock_context;
    261   rtems_status_code sc;
    262254
    263255  if (tty->handler.mode != TERMIOS_POLLED) {
     
    266258      tty->rawOutBufState = rob_wait;
    267259      rtems_termios_device_lock_release (ctx, &lock_context);
    268       sc = rtems_semaphore_obtain(
    269         tty->rawOutBuf.Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    270       if (sc != RTEMS_SUCCESSFUL)
    271         rtems_fatal_error_occurred (sc);
     260      rtems_binary_semaphore_wait (&tty->rawOutBuf.Semaphore);
    272261      rtems_termios_device_lock_acquire (ctx, &lock_context);
    273262    }
     
    286275rtems_termios_destroy_tty (rtems_termios_tty *tty, void *arg, bool last_close)
    287276{
    288   rtems_status_code sc;
    289 
    290277  if (rtems_termios_linesw[tty->t_line].l_close != NULL) {
    291278    /*
     
    297284     * default: just flush output buffer
    298285     */
    299     sc = rtems_semaphore_obtain(tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    300     if (sc != RTEMS_SUCCESSFUL) {
    301       rtems_fatal_error_occurred (sc);
    302     }
     286    rtems_mutex_lock (&tty->osem);
    303287    drainOutput (tty);
    304     rtems_semaphore_release (tty->osem);
     288    rtems_mutex_unlock (&tty->osem);
    305289  }
    306290
    307291  if (tty->handler.mode == TERMIOS_TASK_DRIVEN) {
     292    rtems_status_code sc;
     293
    308294    /*
    309295     * send "terminate" to I/O tasks
     
    322308    tty->device_node->tty = NULL;
    323309
    324   rtems_semaphore_delete (tty->isem);
    325   rtems_semaphore_delete (tty->osem);
    326   rtems_semaphore_delete (tty->rawOutBuf.Semaphore);
     310  rtems_mutex_destroy (&tty->isem);
     311  rtems_mutex_destroy (&tty->osem);
     312  rtems_binary_semaphore_destroy (&tty->rawOutBuf.Semaphore);
    327313  if ((tty->handler.poll_read == NULL) ||
    328314      (tty->handler.mode == TERMIOS_TASK_DRIVEN))
    329     rtems_semaphore_delete (tty->rawInBuf.Semaphore);
     315    rtems_binary_semaphore_destroy (&tty->rawInBuf.Semaphore);
    330316
    331317  if (needDeviceMutex (tty)) {
    332     rtems_semaphore_delete (tty->device_context->lock.mutex);
     318    rtems_mutex_destroy (&tty->device_context->lock.mutex);
    333319  } else if (tty->device_context == &tty->legacy_device_context) {
    334320    rtems_interrupt_lock_destroy (&tty->legacy_device_context.lock.interrupt);
     
    347333)
    348334{
    349   rtems_status_code sc;
    350 
    351   sc = rtems_semaphore_obtain (ctx->lock.mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    352   _Assert (sc == RTEMS_SUCCESSFUL);
    353   (void) sc;
     335  rtems_mutex_lock (&ctx->lock.mutex);
    354336}
    355337
     
    360342)
    361343{
    362   rtems_status_code sc;
    363 
    364   sc = rtems_semaphore_release (ctx->lock.mutex);
    365   _Assert (sc == RTEMS_SUCCESSFUL);
    366   (void) sc;
     344  rtems_mutex_unlock (&ctx->lock.mutex);
    367345}
    368346
     
    452430     * Set up mutex semaphores
    453431     */
    454     sc = rtems_semaphore_create (
    455       rtems_build_name ('T', 'R', 'i', c),
    456       1,
    457       RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
    458       RTEMS_NO_PRIORITY,
    459       &tty->isem);
    460     if (sc != RTEMS_SUCCESSFUL)
    461       rtems_fatal_error_occurred (sc);
    462     sc = rtems_semaphore_create (
    463       rtems_build_name ('T', 'R', 'o', c),
    464       1,
    465       RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
    466       RTEMS_NO_PRIORITY,
    467       &tty->osem);
    468     if (sc != RTEMS_SUCCESSFUL)
    469       rtems_fatal_error_occurred (sc);
    470     sc = rtems_semaphore_create (
    471       rtems_build_name ('T', 'R', 'x', c),
    472       0,
    473       RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
    474       RTEMS_NO_PRIORITY,
    475       &tty->rawOutBuf.Semaphore);
    476     if (sc != RTEMS_SUCCESSFUL)
    477       rtems_fatal_error_occurred (sc);
     432    rtems_mutex_init (&tty->isem, "termios input");
     433    rtems_mutex_init (&tty->osem, "termios output");
     434    rtems_binary_semaphore_init (&tty->rawOutBuf.Semaphore,
     435                                 "termios raw output");
    478436    tty->rawOutBufState = rob_idle;
    479437
     
    521479
    522480    if (needDeviceMutex (tty)) {
    523       sc = rtems_semaphore_create (
    524         rtems_build_name ('T', 'l', 'k', c),
    525         1,
    526         RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
    527         0,
    528         &ctx->lock.mutex);
    529       if (sc != RTEMS_SUCCESSFUL) {
    530         rtems_fatal_error_occurred (sc);
    531       }
    532 
     481      rtems_mutex_init (&ctx->lock.mutex, "termios device");
    533482      ctx->lock_acquire = deviceAcquireMutex;
    534483      ctx->lock_release = deviceReleaseMutex;
     
    566515    if ((tty->handler.poll_read == NULL) ||
    567516        (tty->handler.mode == TERMIOS_TASK_DRIVEN)){
    568       sc = rtems_semaphore_create (
    569         rtems_build_name ('T', 'R', 'r', c),
    570         0,
    571         RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_PRIORITY,
    572         RTEMS_NO_PRIORITY,
    573         &tty->rawInBuf.Semaphore);
     517      rtems_binary_semaphore_init (&tty->rawInBuf.Semaphore,
     518                                   "termios raw input");
    574519      if (sc != RTEMS_SUCCESSFUL)
    575520        rtems_fatal_error_occurred (sc);
     
    655600)
    656601{
    657   rtems_status_code sc;
    658602  struct rtems_termios_tty *tty;
    659603
     
    661605   * See if the device has already been opened
    662606   */
    663   sc = rtems_termios_obtain ();
    664   if (sc != RTEMS_SUCCESSFUL)
    665     return sc;
     607  rtems_termios_obtain ();
    666608
    667609  for (tty = rtems_termios_ttyHead ; tty != NULL ; tty = tty->forw) {
     
    731673rtems_termios_close (void *arg)
    732674{
    733   rtems_status_code sc;
    734675  rtems_libio_open_close_args_t *args = arg;
    735676  struct rtems_termios_tty *tty = args->iop->data1;
    736677
    737   sc = rtems_termios_obtain ();
    738   if (sc != RTEMS_SUCCESSFUL)
    739     rtems_fatal_error_occurred (sc);
     678  rtems_termios_obtain ();
    740679
    741680  if (tty->refcount == 1) {
     
    855794  int flags;
    856795
     796  sc = RTEMS_SUCCESSFUL;
    857797  args->ioctl_return = 0;
    858   sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    859   if (sc != RTEMS_SUCCESSFUL) {
    860     return sc;
    861   }
     798  rtems_mutex_lock (&tty->osem);
    862799  switch (args->command) {
    863800  default:
     
    892829
    893830    if (tty->termios.c_lflag & ICANON) {
    894       tty->rawInBufSemaphoreOptions = RTEMS_WAIT;
    895       tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT;
    896       tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT;
     831      tty->rawInBufSemaphoreWait = true;
     832      tty->rawInBufSemaphoreTimeout = 0;
     833      tty->rawInBufSemaphoreFirstTimeout = 0;
    897834    } else {
    898835      tty->vtimeTicks = tty->termios.c_cc[VTIME] *
    899836                    rtems_clock_get_ticks_per_second() / 10;
    900837      if (tty->termios.c_cc[VTIME]) {
    901         tty->rawInBufSemaphoreOptions = RTEMS_WAIT;
     838        tty->rawInBufSemaphoreWait = true;
    902839        tty->rawInBufSemaphoreTimeout = tty->vtimeTicks;
    903840        if (tty->termios.c_cc[VMIN])
    904           tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT;
     841          tty->rawInBufSemaphoreFirstTimeout = 0;
    905842        else
    906843          tty->rawInBufSemaphoreFirstTimeout = tty->vtimeTicks;
    907844      } else {
    908845        if (tty->termios.c_cc[VMIN]) {
    909           tty->rawInBufSemaphoreOptions = RTEMS_WAIT;
    910           tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT;
    911           tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT;
     846          tty->rawInBufSemaphoreWait = true;
     847          tty->rawInBufSemaphoreTimeout = 0;
     848          tty->rawInBufSemaphoreFirstTimeout = 0;
    912849        } else {
    913           tty->rawInBufSemaphoreOptions = RTEMS_NO_WAIT;
     850          tty->rawInBufSemaphoreWait = false;
    914851        }
    915852      }
     
    984921  }
    985922
    986   rtems_semaphore_release (tty->osem);
     923  rtems_mutex_unlock (&tty->osem);
    987924  return sc;
    988925}
     
    1041978  rtems_termios_device_context *ctx = tty->device_context;
    1042979  rtems_interrupt_lock_context lock_context;
    1043   rtems_status_code sc;
    1044980  size_t todo;
    1045981
     
    10661002          tty->rawOutBufState = rob_wait;
    10671003          rtems_termios_device_lock_release (ctx, &lock_context);
    1068           sc = rtems_semaphore_obtain(
    1069             tty->rawOutBuf.Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    1070           if (sc != RTEMS_SUCCESSFUL)
    1071             rtems_fatal_error_occurred (sc);
     1004          rtems_binary_semaphore_wait (&tty->rawOutBuf.Semaphore);
    10721005          rtems_termios_device_lock_acquire (ctx, &lock_context);
    10731006        } while (newHead == tty->rawOutBuf.Tail);
     
    12571190  rtems_libio_rw_args_t *args = arg;
    12581191  struct rtems_termios_tty *tty = args->iop->data1;
    1259   rtems_status_code sc;
    1260 
    1261   sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    1262   if (sc != RTEMS_SUCCESSFUL)
    1263     return sc;
     1192
     1193  rtems_mutex_lock (&tty->osem);
    12641194  if (rtems_termios_linesw[tty->t_line].l_write != NULL) {
     1195    rtems_status_code sc;
     1196
    12651197    sc = rtems_termios_linesw[tty->t_line].l_write(tty,args);
    1266     rtems_semaphore_release (tty->osem);
     1198    rtems_mutex_unlock (&tty->osem);
    12671199    return sc;
    12681200  }
    12691201  args->bytes_moved = rtems_termios_write_tty (args->iop, tty,
    12701202                                               args->buffer, args->count);
    1271   rtems_semaphore_release (tty->osem);
    1272   return sc;
     1203  rtems_mutex_unlock (&tty->osem);
     1204  return RTEMS_SUCCESSFUL;
    12731205}
    12741206
     
    14411373   */
    14421374  if (tty->termios.c_lflag & (ECHO|ECHOE|ECHOK|ECHONL|ECHOPRT|ECHOCTL|ECHOKE)) {
    1443     rtems_status_code sc;
    1444     sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    1445     if (sc != RTEMS_SUCCESSFUL)
    1446       rtems_fatal_error_occurred (sc);
     1375    rtems_mutex_lock (&tty->osem);
    14471376    i = iproc (c, tty);
    1448     sc = rtems_semaphore_release (tty->osem);
    1449     if (sc != RTEMS_SUCCESSFUL)
    1450       rtems_fatal_error_occurred (sc);
     1377    rtems_mutex_unlock (&tty->osem);
    14511378  }
    14521379  else {
     
    15921519    if (wait) {
    15931520      if (tty->ccount < CBUFSIZE - 1) {
    1594         rtems_status_code sc;
    1595 
    1596         sc = rtems_semaphore_obtain(
    1597           tty->rawInBuf.Semaphore, tty->rawInBufSemaphoreOptions, timeout);
    1598         if (sc != RTEMS_SUCCESSFUL)
     1521        rtems_binary_semaphore *sem;
     1522        int eno;
     1523
     1524        sem = &tty->rawInBuf.Semaphore;
     1525
     1526        if (tty->rawInBufSemaphoreWait) {
     1527          eno = rtems_binary_semaphore_wait_timed_ticks (sem, timeout);
     1528        } else {
     1529          eno = rtems_binary_semaphore_try_wait (sem);
     1530        }
     1531
     1532        if (eno != 0) {
    15991533          break;
     1534        }
    16001535      } else {
    16011536        break;
     
    16341569  rtems_libio_rw_args_t *args = arg;
    16351570  struct rtems_termios_tty *tty = args->iop->data1;
    1636   rtems_status_code sc;
    1637 
    1638   sc = rtems_semaphore_obtain (tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    1639   if (sc != RTEMS_SUCCESSFUL)
    1640     return sc;
     1571
     1572  rtems_mutex_lock (&tty->isem);
    16411573
    16421574  if (rtems_termios_linesw[tty->t_line].l_read != NULL) {
     1575    rtems_status_code sc;
     1576
    16431577    sc = rtems_termios_linesw[tty->t_line].l_read(tty,args);
    16441578    tty->tty_rcvwakeup = false;
    1645     rtems_semaphore_release (tty->isem);
     1579    rtems_mutex_unlock (&tty->isem);
    16461580    return sc;
    16471581  }
    16481582
    16491583  args->bytes_moved = rtems_termios_read_tty (tty, args->buffer, args->count);
    1650   rtems_semaphore_release (tty->isem);
    1651   return sc;
     1584  rtems_mutex_unlock (&tty->isem);
     1585  return RTEMS_SUCCESSFUL;
    16521586}
    16531587
     
    18271761
    18281762  tty->rawInBufDropped += dropped;
    1829   rtems_semaphore_release (tty->rawInBuf.Semaphore);
     1763  rtems_binary_semaphore_post (&tty->rawInBuf.Semaphore);
    18301764  return dropped;
    18311765}
     
    19241858
    19251859  if (wakeUpWriterTask) {
    1926     rtems_semaphore_release (tty->rawOutBuf.Semaphore);
     1860    rtems_binary_semaphore_post (&tty->rawOutBuf.Semaphore);
    19271861  }
    19281862
     
    20631997{
    20641998  rtems_termios_device_node *device_node;
    2065   rtems_status_code sc;
    20661999  rtems_libio_open_close_args_t args;
    20672000  struct rtems_termios_tty *tty;
     
    20742007  args.mode = mode;
    20752008
    2076   sc = rtems_termios_obtain ();
    2077   if (sc != RTEMS_SUCCESSFUL) {
    2078     rtems_set_errno_and_return_minus_one (ENXIO);
    2079   }
     2009  rtems_termios_obtain ();
    20802010
    20812011  tty = rtems_termios_open_tty (device_node->major, device_node->minor, &args,
     
    20932023rtems_termios_imfs_close (rtems_libio_t *iop)
    20942024{
    2095   rtems_status_code sc;
    20962025  rtems_libio_open_close_args_t args;
    20972026  struct rtems_termios_tty *tty;
     
    21022031  tty = iop->data1;
    21032032
    2104   sc = rtems_termios_obtain ();
    2105   _Assert (sc == RTEMS_SUCCESSFUL);
    2106   (void) sc;
    2107 
     2033  rtems_termios_obtain ();
    21082034  rtems_termios_close_tty (tty, &args);
    21092035  rtems_termios_release ();
     
    21152041{
    21162042  struct rtems_termios_tty *tty;
    2117   rtems_status_code sc;
    21182043  uint32_t bytes_moved;
    21192044
    21202045  tty = iop->data1;
    21212046
    2122   sc = rtems_semaphore_obtain (tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    2123   _Assert (sc == RTEMS_SUCCESSFUL);
     2047  rtems_mutex_lock (&tty->isem);
    21242048
    21252049  if (rtems_termios_linesw[tty->t_line].l_read != NULL) {
    21262050    rtems_libio_rw_args_t args;
     2051    rtems_status_code sc;
    21272052
    21282053    memset (&args, 0, sizeof (args));
     
    21342059    sc = rtems_termios_linesw[tty->t_line].l_read (tty, &args);
    21352060    tty->tty_rcvwakeup = false;
    2136     rtems_semaphore_release (tty->isem);
     2061    rtems_mutex_unlock (&tty->isem);
    21372062
    21382063    if (sc != RTEMS_SUCCESSFUL) {
     
    21442069
    21452070  bytes_moved = rtems_termios_read_tty (tty, buffer, count);
    2146   rtems_semaphore_release (tty->isem);
     2071  rtems_mutex_unlock (&tty->isem);
    21472072  return (ssize_t) bytes_moved;
    21482073}
     
    21522077{
    21532078  struct rtems_termios_tty *tty;
    2154   rtems_status_code sc;
    21552079  uint32_t bytes_moved;
    21562080
    21572081  tty = iop->data1;
    21582082
    2159   sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    2160   _Assert (sc == RTEMS_SUCCESSFUL);
     2083  rtems_mutex_lock (&tty->osem);
    21612084
    21622085  if (rtems_termios_linesw[tty->t_line].l_write != NULL) {
    21632086    rtems_libio_rw_args_t args;
     2087    rtems_status_code sc;
    21642088
    21652089    memset (&args, 0, sizeof (args));
     
    21702094
    21712095    sc = rtems_termios_linesw[tty->t_line].l_write (tty, &args);
    2172     rtems_semaphore_release (tty->osem);
     2096    rtems_mutex_unlock (&tty->osem);
    21732097
    21742098    if (sc != RTEMS_SUCCESSFUL) {
     
    21802104
    21812105  bytes_moved = rtems_termios_write_tty (iop, tty, buffer, count);
    2182   rtems_semaphore_release (tty->osem);
     2106  rtems_mutex_unlock (&tty->osem);
    21832107  return (ssize_t) bytes_moved;
    21842108}
  • cpukit/libcsupport/src/termiosinitialize.c

    r8d7f3680 r2c12262  
    2323#endif
    2424
    25 #include <rtems.h>
    26 #include <rtems.h>
    27 #include <rtems/libio.h>
    28 #include <ctype.h>
    29 #include <errno.h>
    30 #include <stdio.h>
    31 #include <stdlib.h>
    32 #include <termios.h>
    33 #include <unistd.h>
     25#include <rtems/termiostypes.h>
    3426
    35 rtems_id rtems_termios_ttyMutex;
    36 
    37 void
    38 rtems_termios_initialize (void)
    39 {
    40   rtems_status_code sc;
    41 
    42   /*
    43    * Create the mutex semaphore for the tty list
    44    */
    45   if (!rtems_termios_ttyMutex) {
    46     sc = rtems_semaphore_create (
    47       rtems_build_name ('T', 'R', 'm', 'i'),
    48       1,
    49       RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
    50       RTEMS_NO_PRIORITY,
    51       &rtems_termios_ttyMutex);
    52     if (sc != RTEMS_SUCCESSFUL)
    53       rtems_fatal_error_occurred (sc);
    54   }
    55 }
     27rtems_mutex rtems_termios_ttyMutex = RTEMS_MUTEX_INITIALIZER( "termios" );
  • testsuites/libtests/termios01/init.c

    r8d7f3680 r2c12262  
    636636   */
    637637  for (i = 0; i < 4; ++i) {
    638     errno = 0;
    639638    fd = open( &dev[0], O_RDWR );
    640     rtems_test_assert( fd == -1 );
    641     rtems_test_assert( errno == ENXIO );
     639    rtems_test_assert( fd == i );
     640
     641    rv = close( fd );
     642    rtems_test_assert( rv == 0 );
    642643  }
    643644
  • testsuites/sptests/Makefile.am

    r8d7f3680 r2c12262  
    1818    spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
    1919    spfatal08 spfatal09 spfatal10 spfatal11 spfatal12 spfatal13 spfatal14 \
    20     spfatal15 spfatal16 spfatal17 spfatal18 spfatal19 spfatal20 \
     20    spfatal15 spfatal16 \
    2121    spfatal24 spfatal25 spfatal27\
    2222    spfifo01 spfifo02 spfifo03 spfifo04 spfifo05 \
  • testsuites/sptests/configure.ac

    r8d7f3680 r2c12262  
    188188spfatal15/Makefile
    189189spfatal16/Makefile
    190 spfatal17/Makefile
    191 spfatal18/Makefile
    192 spfatal19/Makefile
    193 spfatal20/Makefile
    194190spfatal24/Makefile
    195191spfatal25/Makefile
  • testsuites/sptests/spfatal_support/system.h

    r8d7f3680 r2c12262  
    7272
    7373/* extra parameters may be in testcase.h */
    74 #ifdef FATAL_USE_TERMIOS_CONSOLE
    75 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
    76 #else
    7774#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
    78 #endif
    7975#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    8076
Note: See TracChangeset for help on using the changeset viewer.