Changeset bb087cb0 in rtems
- Timestamp:
- 02/23/17 09:06:52 (7 years ago)
- Branches:
- 5, master
- Children:
- 9f69ac2
- Parents:
- d60c2d79
- git-author:
- Sebastian Huber <sebastian.huber@…> (02/23/17 09:06:52)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (02/28/17 07:51:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libcsupport/src/termios.c
rd60c2d79 rbb087cb0 1425 1425 fillBufferQueue (struct rtems_termios_tty *tty) 1426 1426 { 1427 rtems_termios_device_context *ctx = tty->device_context; 1427 1428 rtems_interval timeout = tty->rawInBufSemaphoreFirstTimeout; 1428 rtems_status_code sc; 1429 int wait = 1; 1429 bool wait = true; 1430 1430 1431 1431 while ( wait ) { 1432 rtems_interrupt_lock_context lock_context; 1433 1432 1434 /* 1433 1435 * Process characters read from raw queue 1434 1436 */ 1437 1438 rtems_termios_device_lock_acquire (ctx, &lock_context); 1439 1435 1440 while ((tty->rawInBuf.Head != tty->rawInBuf.Tail) && 1436 1441 (tty->ccount < (CBUFSIZE-1))) { … … 1441 1446 c = tty->rawInBuf.theBuf[newHead]; 1442 1447 tty->rawInBuf.Head = newHead; 1448 1443 1449 if(((tty->rawInBuf.Tail-newHead+tty->rawInBuf.Size) 1444 1450 % tty->rawInBuf.Size) … … 1462 1468 } 1463 1469 1470 rtems_termios_device_lock_release (ctx, &lock_context); 1471 1464 1472 /* continue processing new character */ 1465 1473 if (tty->termios.c_lflag & ICANON) { 1466 1474 if (siproc (c, tty)) 1467 wait = 0;1475 wait = false; 1468 1476 } else { 1469 1477 siproc (c, tty); 1470 1478 if (tty->ccount >= tty->termios.c_cc[VMIN]) 1471 wait = 0;1479 wait = false; 1472 1480 } 1473 1481 timeout = tty->rawInBufSemaphoreTimeout; 1474 } 1482 1483 rtems_termios_device_lock_acquire (ctx, &lock_context); 1484 } 1485 1486 rtems_termios_device_lock_release (ctx, &lock_context); 1475 1487 1476 1488 /* … … 1478 1490 */ 1479 1491 if ( wait ) { 1492 rtems_status_code sc; 1493 1480 1494 sc = rtems_semaphore_obtain( 1481 1495 tty->rawInBuf.Semaphore, tty->rawInBufSemaphoreOptions, timeout); … … 1556 1570 { 1557 1571 struct rtems_termios_tty *tty = ttyp; 1558 unsigned int newTail;1559 1572 char c; 1560 1573 int dropped = 0; … … 1621 1634 } 1622 1635 } else { 1623 newTail = (tty->rawInBuf.Tail + 1) % tty->rawInBuf.Size; 1636 unsigned int head; 1637 unsigned int oldTail; 1638 unsigned int newTail; 1639 1640 rtems_termios_device_lock_acquire (ctx, &lock_context); 1641 1642 head = tty->rawInBuf.Head; 1643 oldTail = tty->rawInBuf.Tail; 1644 newTail = (oldTail + 1) % tty->rawInBuf.Size; 1645 1624 1646 /* if chars_in_buffer > highwater */ 1625 rtems_termios_device_lock_acquire (ctx, &lock_context); 1626 if ((((newTail - tty->rawInBuf.Head + tty->rawInBuf.Size) 1627 % tty->rawInBuf.Size) > tty->highwater) && 1628 !(tty->flow_ctrl & FL_IREQXOF)) { 1647 if ((tty->flow_ctrl & FL_IREQXOF) != 0 && (((newTail - head 1648 + tty->rawInBuf.Size) % tty->rawInBuf.Size) > tty->highwater)) { 1629 1649 /* incoming data stream should be stopped */ 1630 1650 tty->flow_ctrl |= FL_IREQXOF; … … 1648 1668 } 1649 1669 1650 /* reenable interrupts */ 1651 rtems_termios_device_lock_release (ctx, &lock_context); 1652 1653 if (newTail == tty->rawInBuf.Head) { 1654 dropped++; 1655 } else { 1670 if (newTail != head) { 1656 1671 tty->rawInBuf.theBuf[newTail] = c; 1657 1672 tty->rawInBuf.Tail = newTail; 1673 1674 rtems_termios_device_lock_release (ctx, &lock_context); 1658 1675 1659 1676 /* … … 1664 1681 tty->tty_rcvwakeup = 1; 1665 1682 } 1683 } else { 1684 ++dropped; 1685 rtems_termios_device_lock_release (ctx, &lock_context); 1666 1686 } 1667 1687 }
Note: See TracChangeset
for help on using the changeset viewer.