Changeset e6890ba in rtems


Ignore:
Timestamp:
08/01/00 15:23:59 (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
4f8473e
Parents:
16112442
Message:

Patch from Eric Norum <eric@…> to avoid lockup under
the correct circumstances of DMA buffer size, serial
line interrupts, and ethernet interrupts the termios osend routine would
lock up waiting for the raw output buffer semaphore.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/termios.c

    r16112442 re6890ba  
    127127        volatile unsigned int   rawOutBufTail;
    128128        rtems_id                rawOutBufSemaphore;
    129         enum {rob_idle, rob_busy, rob_wait }    rawOutBufState;
     129        volatile enum {rob_idle, rob_busy, rob_wait }   rawOutBufState;
    130130
    131131        /*
     
    220220                        rtems_build_name ('T', 'R', 'x', c),
    221221                        0,
    222                         RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
     222                        RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
    223223                        RTEMS_NO_PRIORITY,
    224224                        &tty->rawOutBufSemaphore);
     
    532532                  /* check, whether XOFF has been received */
    533533                  if (!(tty->flow_ctrl & FL_ORCVXOF)) {
    534                         (*tty->device.write)(tty->minor,
     534                    (*tty->device.write)(tty->minor,
    535535                                (char *)&tty->rawOutBuf[tty->rawOutBufTail],1);
    536536                  }
     
    11021102          if (tty->rawOutBufState == rob_wait)
    11031103            rtems_semaphore_release (tty->rawOutBufSemaphore);
    1104           if ( tty->rawOutBufHead == tty->rawOutBufTail )
     1104          if ( tty->rawOutBufHead == tty->rawOutBufTail ) {
     1105            tty->rawOutBufState = rob_idle;
    11051106            return 0;   
     1107          }
    11061108          newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
    11071109          if (newTail == tty->rawOutBufHead) {
     
    11181120            /* set flag, that output has been stopped */
    11191121            tty->flow_ctrl |= FL_OSTOP;
     1122            tty->rawOutBufState = rob_busy;
    11201123            nToSend = 0;
    11211124          }
     
    11311134            /* to allow fast reaction on incoming flow ctrl and low latency*/
    11321135            /* for outgoing flow control                                   */
    1133             if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF)) {
     1136            if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF))
    11341137              nToSend = 1;
    1135             }
     1138            tty->rawOutBufState = rob_busy;
    11361139            (*tty->device.write)(tty->minor, (char *)&tty->rawOutBuf[newTail], nToSend);
    1137             tty->rawOutBufState = rob_busy;
    11381140          }
    11391141          tty->rawOutBufTail = newTail;
     
    11411143        return nToSend;
    11421144}
    1143 
    1144 
  • c/src/lib/libc/termios.c

    r16112442 re6890ba  
    127127        volatile unsigned int   rawOutBufTail;
    128128        rtems_id                rawOutBufSemaphore;
    129         enum {rob_idle, rob_busy, rob_wait }    rawOutBufState;
     129        volatile enum {rob_idle, rob_busy, rob_wait }   rawOutBufState;
    130130
    131131        /*
     
    220220                        rtems_build_name ('T', 'R', 'x', c),
    221221                        0,
    222                         RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
     222                        RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
    223223                        RTEMS_NO_PRIORITY,
    224224                        &tty->rawOutBufSemaphore);
     
    532532                  /* check, whether XOFF has been received */
    533533                  if (!(tty->flow_ctrl & FL_ORCVXOF)) {
    534                         (*tty->device.write)(tty->minor,
     534                    (*tty->device.write)(tty->minor,
    535535                                (char *)&tty->rawOutBuf[tty->rawOutBufTail],1);
    536536                  }
     
    11021102          if (tty->rawOutBufState == rob_wait)
    11031103            rtems_semaphore_release (tty->rawOutBufSemaphore);
    1104           if ( tty->rawOutBufHead == tty->rawOutBufTail )
     1104          if ( tty->rawOutBufHead == tty->rawOutBufTail ) {
     1105            tty->rawOutBufState = rob_idle;
    11051106            return 0;   
     1107          }
    11061108          newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
    11071109          if (newTail == tty->rawOutBufHead) {
     
    11181120            /* set flag, that output has been stopped */
    11191121            tty->flow_ctrl |= FL_OSTOP;
     1122            tty->rawOutBufState = rob_busy;
    11201123            nToSend = 0;
    11211124          }
     
    11311134            /* to allow fast reaction on incoming flow ctrl and low latency*/
    11321135            /* for outgoing flow control                                   */
    1133             if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF)) {
     1136            if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF))
    11341137              nToSend = 1;
    1135             }
     1138            tty->rawOutBufState = rob_busy;
    11361139            (*tty->device.write)(tty->minor, (char *)&tty->rawOutBuf[newTail], nToSend);
    1137             tty->rawOutBufState = rob_busy;
    11381140          }
    11391141          tty->rawOutBufTail = newTail;
     
    11411143        return nToSend;
    11421144}
    1143 
    1144 
  • cpukit/libcsupport/src/termios.c

    r16112442 re6890ba  
    127127        volatile unsigned int   rawOutBufTail;
    128128        rtems_id                rawOutBufSemaphore;
    129         enum {rob_idle, rob_busy, rob_wait }    rawOutBufState;
     129        volatile enum {rob_idle, rob_busy, rob_wait }   rawOutBufState;
    130130
    131131        /*
     
    220220                        rtems_build_name ('T', 'R', 'x', c),
    221221                        0,
    222                         RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
     222                        RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
    223223                        RTEMS_NO_PRIORITY,
    224224                        &tty->rawOutBufSemaphore);
     
    532532                  /* check, whether XOFF has been received */
    533533                  if (!(tty->flow_ctrl & FL_ORCVXOF)) {
    534                         (*tty->device.write)(tty->minor,
     534                    (*tty->device.write)(tty->minor,
    535535                                (char *)&tty->rawOutBuf[tty->rawOutBufTail],1);
    536536                  }
     
    11021102          if (tty->rawOutBufState == rob_wait)
    11031103            rtems_semaphore_release (tty->rawOutBufSemaphore);
    1104           if ( tty->rawOutBufHead == tty->rawOutBufTail )
     1104          if ( tty->rawOutBufHead == tty->rawOutBufTail ) {
     1105            tty->rawOutBufState = rob_idle;
    11051106            return 0;   
     1107          }
    11061108          newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
    11071109          if (newTail == tty->rawOutBufHead) {
     
    11181120            /* set flag, that output has been stopped */
    11191121            tty->flow_ctrl |= FL_OSTOP;
     1122            tty->rawOutBufState = rob_busy;
    11201123            nToSend = 0;
    11211124          }
     
    11311134            /* to allow fast reaction on incoming flow ctrl and low latency*/
    11321135            /* for outgoing flow control                                   */
    1133             if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF)) {
     1136            if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF))
    11341137              nToSend = 1;
    1135             }
     1138            tty->rawOutBufState = rob_busy;
    11361139            (*tty->device.write)(tty->minor, (char *)&tty->rawOutBuf[newTail], nToSend);
    1137             tty->rawOutBufState = rob_busy;
    11381140          }
    11391141          tty->rawOutBufTail = newTail;
     
    11411143        return nToSend;
    11421144}
    1143 
    1144 
Note: See TracChangeset for help on using the changeset viewer.