Changeset 65483f8 in rtems


Ignore:
Timestamp:
Jun 10, 2013, 12:22:28 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
6896ca2
Parents:
fed92f5f
git-author:
Sebastian Huber <sebastian.huber@…> (06/10/13 12:22:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/12/13 14:12:50)
Message:

termios: SMP support

Location:
cpukit/libcsupport
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/include/rtems/termiostypes.h

    rfed92f5f r65483f8  
    141141  struct ttywakeup tty_rcv;
    142142  int              tty_rcvwakeup;
     143
     144  rtems_interrupt_lock interrupt_lock;
    143145};
    144146
     
    232234);
    233235
     236#define rtems_termios_interrupt_lock_acquire(tty, level) \
     237  rtems_interrupt_lock_acquire(&tty->interrupt_lock, level)
     238
     239#define rtems_termios_interrupt_lock_release(tty, level) \
     240  rtems_interrupt_lock_release(&tty->interrupt_lock, level)
     241
    234242#ifdef __cplusplus
    235243}
  • cpukit/libcsupport/src/termios.c

    rfed92f5f r65483f8  
    231231    tty->device = *callbacks;
    232232
     233    rtems_interrupt_lock_initialize (&tty->interrupt_lock);
     234
    233235    /*
    234236     * Create I/O tasks
     
    341343
    342344  if (tty->device.outputUsesInterrupts != TERMIOS_POLLED) {
    343     rtems_interrupt_disable (level);
     345    rtems_termios_interrupt_lock_acquire (tty, level);
    344346    while (tty->rawOutBuf.Tail != tty->rawOutBuf.Head) {
    345347      tty->rawOutBufState = rob_wait;
    346       rtems_interrupt_enable (level);
     348      rtems_termios_interrupt_lock_release (tty, level);
    347349      sc = rtems_semaphore_obtain(
    348350        tty->rawOutBuf.Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    349351      if (sc != RTEMS_SUCCESSFUL)
    350352        rtems_fatal_error_occurred (sc);
    351       rtems_interrupt_disable (level);
    352     }
    353     rtems_interrupt_enable (level);
     353      rtems_termios_interrupt_lock_acquire (tty, level);
     354    }
     355    rtems_termios_interrupt_lock_release (tty, level);
    354356  }
    355357}
     
    360362  rtems_interrupt_level level;
    361363
    362   rtems_interrupt_disable (level);
     364  rtems_termios_interrupt_lock_acquire (tty, level);
    363365  tty->rawOutBuf.Tail = 0;
    364366  tty->rawOutBuf.Head = 0;
    365367  tty->rawOutBufState = rob_idle;
    366   rtems_interrupt_enable (level);
     368  rtems_termios_interrupt_lock_release (tty, level);
    367369}
    368370
     
    372374  rtems_interrupt_level level;
    373375
    374   rtems_interrupt_disable (level);
     376  rtems_termios_interrupt_lock_acquire (tty, level);
    375377  tty->rawInBuf.Tail = 0;
    376378  tty->rawInBuf.Head = 0;
    377   rtems_interrupt_enable (level);
     379  rtems_termios_interrupt_lock_release (tty, level);
    378380}
    379381
     
    482484    if (tty->flow_ctrl & FL_OSTOP) {
    483485      /* disable interrupts    */
    484       rtems_interrupt_disable(level);
     486      rtems_termios_interrupt_lock_acquire (tty, level);
    485487      tty->flow_ctrl &= ~FL_OSTOP;
    486488      /* check for chars in output buffer (or rob_state?) */
     
    491493      }
    492494      /* reenable interrupts */
    493       rtems_interrupt_enable(level);
     495      rtems_termios_interrupt_lock_release (tty, level);
    494496    }
    495497  }
     
    692694     */
    693695    newHead = (newHead + 1) % tty->rawOutBuf.Size;
    694     rtems_interrupt_disable (level);
     696    rtems_termios_interrupt_lock_acquire (tty, level);
    695697    while (newHead == tty->rawOutBuf.Tail) {
    696698      tty->rawOutBufState = rob_wait;
    697       rtems_interrupt_enable (level);
     699      rtems_termios_interrupt_lock_release (tty, level);
    698700      sc = rtems_semaphore_obtain(
    699701        tty->rawOutBuf.Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
    700702      if (sc != RTEMS_SUCCESSFUL)
    701703        rtems_fatal_error_occurred (sc);
    702       rtems_interrupt_disable (level);
     704      rtems_termios_interrupt_lock_acquire (tty, level);
    703705    }
    704706    tty->rawOutBuf.theBuf[tty->rawOutBuf.Head] = *buf++;
     
    715717      tty->rawOutBufState = rob_busy;
    716718    }
    717     rtems_interrupt_enable (level);
     719    rtems_termios_interrupt_lock_release (tty, level);
    718720    len--;
    719721  }
     
    12171219      if ((tty->flow_ctrl & (FL_ORCVXOF | FL_OSTOP)) == FL_OSTOP) {
    12181220        /* disable interrupts    */
    1219         rtems_interrupt_disable(level);
     1221        rtems_termios_interrupt_lock_acquire (tty, level);
    12201222        tty->flow_ctrl &= ~FL_OSTOP;
    12211223        /* check for chars in output buffer (or rob_state?) */
     
    12261228        }
    12271229        /* reenable interrupts */
    1228         rtems_interrupt_enable(level);
     1230        rtems_termios_interrupt_lock_release (tty, level);
    12291231      }
    12301232    } else {
    12311233      newTail = (tty->rawInBuf.Tail + 1) % tty->rawInBuf.Size;
    12321234      /* if chars_in_buffer > highwater                */
    1233       rtems_interrupt_disable(level);
     1235      rtems_termios_interrupt_lock_acquire (tty, level);
    12341236      if ((((newTail - tty->rawInBuf.Head + tty->rawInBuf.Size)
    12351237            % tty->rawInBuf.Size) > tty->highwater) &&
     
    12571259
    12581260      /* reenable interrupts */
    1259       rtems_interrupt_enable(level);
     1261      rtems_termios_interrupt_lock_release (tty, level);
    12601262
    12611263      if (newTail == tty->rawInBuf.Head) {
     
    12941296  int len;
    12951297
    1296   rtems_interrupt_disable(level);
     1298  rtems_termios_interrupt_lock_acquire (tty, level);
    12971299
    12981300  /* check for XOF/XON to send */
     
    13931395  }
    13941396
    1395   rtems_interrupt_enable(level);
     1397  rtems_termios_interrupt_lock_release (tty, level);
    13961398
    13971399  if (wakeUpWriterTask) {
Note: See TracChangeset for help on using the changeset viewer.