A spurious checkin... I just want to improve some code structure
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5597 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
11aa231cf0
commit
cf411bec51
@ -220,19 +220,23 @@ static int uart_putxmitchar(FAR uart_dev_t *dev, int ch)
|
||||
|
||||
if (dev->disconnected)
|
||||
{
|
||||
irqrestore(flags);
|
||||
return -ENOTCONN;
|
||||
ret = -ENOTCONN;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* Wait for some characters to be sent from the buffer with the TX
|
||||
* interrupt enabled. When the TX interrupt is enabled, uart_xmitchars
|
||||
* should execute and remove some of the data from the TX buffer.
|
||||
*/
|
||||
{
|
||||
/* Wait for some characters to be sent from the buffer with
|
||||
* the TX interrupt enabled. When the TX interrupt is
|
||||
* enabled, uart_xmitchars should execute and remove some
|
||||
* of the data from the TX buffer.
|
||||
*/
|
||||
|
||||
dev->xmitwaiting = true;
|
||||
uart_enabletxint(dev);
|
||||
ret = uart_takesem(&dev->xmitsem, true);
|
||||
uart_disabletxint(dev);
|
||||
}
|
||||
|
||||
dev->xmitwaiting = true;
|
||||
uart_enabletxint(dev);
|
||||
ret = uart_takesem(&dev->xmitsem, true);
|
||||
uart_disabletxint(dev);
|
||||
irqrestore(flags);
|
||||
|
||||
#ifdef CONFIG_SERIAL_REMOVABLE
|
||||
@ -397,7 +401,7 @@ static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t
|
||||
* interrupted by a signal (ret should be -EINTR), or (2) if
|
||||
* CONFIG_SERIAL_REMOVABLE is defined, then uart_putxmitchar()
|
||||
* might also return if the serial device was disconnected
|
||||
* (wtih -ENOTCONN).
|
||||
* (with -ENOTCONN).
|
||||
*/
|
||||
|
||||
if (ret < 0)
|
||||
@ -409,16 +413,16 @@ static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t
|
||||
|
||||
if (buflen < nread)
|
||||
{
|
||||
/* Some data was transferred. Return the number of bytes that were
|
||||
* successfully transferred.
|
||||
/* Some data was transferred. Return the number of bytes that
|
||||
* were successfully transferred.
|
||||
*/
|
||||
|
||||
nread -= buflen;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No data was transferred. Return -EINTR. The VFS layer will
|
||||
* set the errno value appropriately).
|
||||
/* No data was transferred. Return the negated errno value.
|
||||
* The VFS layer will set the errno value appropriately).
|
||||
*/
|
||||
|
||||
nread = ret;
|
||||
@ -586,29 +590,30 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
uart_enablerxint(dev);
|
||||
|
||||
#ifdef CONFIG_SERIAL_REMOVABLE
|
||||
/* Check if the removable device is no longer connected while
|
||||
* we have interrupts off. We do not want the transition to
|
||||
* occur as a race condition before we begin the wait.
|
||||
/* Check again if the removable device is still connected
|
||||
* while we have interrupts off. We do not want the transition
|
||||
* to occur as a race condition before we begin the wait.
|
||||
*/
|
||||
|
||||
if (dev->disconnected)
|
||||
{
|
||||
uart_enablerxint(dev);
|
||||
irqrestore(flags);
|
||||
{
|
||||
ret = -ENOTCONN;
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* Now wait with the Rx interrupt re-enabled. NuttX will
|
||||
* automatically re-enable global interrupts when this thread
|
||||
* goes to sleep.
|
||||
*/
|
||||
{
|
||||
/* Now wait with the Rx interrupt re-enabled. NuttX will
|
||||
* automatically re-enable global interrupts when this
|
||||
* thread goes to sleep.
|
||||
*/
|
||||
|
||||
dev->recvwaiting = true;
|
||||
ret = uart_takesem(&dev->recvsem, true);
|
||||
}
|
||||
|
||||
dev->recvwaiting = true;
|
||||
uart_enablerxint(dev);
|
||||
ret = uart_takesem(&dev->recvsem, true);
|
||||
irqrestore(flags);
|
||||
|
||||
/* Was a signal received while waiting for data to be
|
||||
|
Loading…
Reference in New Issue
Block a user