Changeset 0e8d2055 in rtems
- Timestamp:
- 02/23/17 09:06:52 (7 years ago)
- Branches:
- 4.11
- Children:
- a27128c5
- Parents:
- 35a3d815
- git-author:
- Sebastian Huber <sebastian.huber@…> (02/23/17 09:06:52)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (02/28/17 08:55:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libcsupport/src/termios.c
r35a3d815 r0e8d2055 1458 1458 fillBufferQueue (struct rtems_termios_tty *tty) 1459 1459 { 1460 rtems_termios_device_context *ctx = tty->device_context; 1460 1461 rtems_interval timeout = tty->rawInBufSemaphoreFirstTimeout; 1461 rtems_status_code sc; 1462 int wait = 1; 1462 bool wait = true; 1463 1463 1464 1464 while ( wait ) { 1465 rtems_interrupt_lock_context lock_context; 1466 1465 1467 /* 1466 1468 * Process characters read from raw queue 1467 1469 */ 1470 1471 rtems_termios_device_lock_acquire (ctx, &lock_context); 1472 1468 1473 while ((tty->rawInBuf.Head != tty->rawInBuf.Tail) && 1469 1474 (tty->ccount < (CBUFSIZE-1))) { … … 1474 1479 c = tty->rawInBuf.theBuf[newHead]; 1475 1480 tty->rawInBuf.Head = newHead; 1481 1476 1482 if(((tty->rawInBuf.Tail-newHead+tty->rawInBuf.Size) 1477 1483 % tty->rawInBuf.Size) … … 1495 1501 } 1496 1502 1503 rtems_termios_device_lock_release (ctx, &lock_context); 1504 1497 1505 /* continue processing new character */ 1498 1506 if (tty->termios.c_lflag & ICANON) { 1499 1507 if (siproc (c, tty)) 1500 wait = 0;1508 wait = false; 1501 1509 } else { 1502 1510 siproc (c, tty); 1503 1511 if (tty->ccount >= tty->termios.c_cc[VMIN]) 1504 wait = 0;1512 wait = false; 1505 1513 } 1506 1514 timeout = tty->rawInBufSemaphoreTimeout; 1507 } 1515 1516 rtems_termios_device_lock_acquire (ctx, &lock_context); 1517 } 1518 1519 rtems_termios_device_lock_release (ctx, &lock_context); 1508 1520 1509 1521 /* … … 1511 1523 */ 1512 1524 if ( wait ) { 1525 rtems_status_code sc; 1526 1513 1527 sc = rtems_semaphore_obtain( 1514 1528 tty->rawInBuf.Semaphore, tty->rawInBufSemaphoreOptions, timeout); … … 1580 1594 { 1581 1595 struct rtems_termios_tty *tty = ttyp; 1582 unsigned int newTail;1583 1596 char c; 1584 1597 int dropped = 0; … … 1645 1658 } 1646 1659 } else { 1647 newTail = (tty->rawInBuf.Tail + 1) % tty->rawInBuf.Size; 1660 unsigned int head; 1661 unsigned int oldTail; 1662 unsigned int newTail; 1663 1664 rtems_termios_device_lock_acquire (ctx, &lock_context); 1665 1666 head = tty->rawInBuf.Head; 1667 oldTail = tty->rawInBuf.Tail; 1668 newTail = (oldTail + 1) % tty->rawInBuf.Size; 1669 1648 1670 /* if chars_in_buffer > highwater */ 1649 rtems_termios_device_lock_acquire (ctx, &lock_context); 1650 if ((((newTail - tty->rawInBuf.Head + tty->rawInBuf.Size) 1651 % tty->rawInBuf.Size) > tty->highwater) && 1652 !(tty->flow_ctrl & FL_IREQXOF)) { 1671 if ((tty->flow_ctrl & FL_IREQXOF) != 0 && (((newTail - head 1672 + tty->rawInBuf.Size) % tty->rawInBuf.Size) > tty->highwater)) { 1653 1673 /* incoming data stream should be stopped */ 1654 1674 tty->flow_ctrl |= FL_IREQXOF; … … 1672 1692 } 1673 1693 1674 /* reenable interrupts */ 1675 rtems_termios_device_lock_release (ctx, &lock_context); 1676 1677 if (newTail == tty->rawInBuf.Head) { 1678 dropped++; 1679 } else { 1694 if (newTail != head) { 1680 1695 tty->rawInBuf.theBuf[newTail] = c; 1681 1696 tty->rawInBuf.Tail = newTail; 1697 1698 rtems_termios_device_lock_release (ctx, &lock_context); 1682 1699 1683 1700 /* … … 1688 1705 tty->tty_rcvwakeup = 1; 1689 1706 } 1707 } else { 1708 ++dropped; 1709 rtems_termios_device_lock_release (ctx, &lock_context); 1690 1710 } 1691 1711 }
Note: See TracChangeset
for help on using the changeset viewer.