diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-12 16:36:45 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-12 16:36:45 +0000 |
commit | ec5c538c2d9b423c79387a09c60457e918e22703 (patch) | |
tree | 986a5643cf00efbea8f795c17cc3466982031247 /nuttx/drivers/serial/serial.c | |
parent | e6f4d56ce41c0e258632e9525b2e62dd17fe8273 (diff) | |
download | px4-nuttx-ec5c538c2d9b423c79387a09c60457e918e22703.tar.gz px4-nuttx-ec5c538c2d9b423c79387a09c60457e918e22703.tar.bz2 px4-nuttx-ec5c538c2d9b423c79387a09c60457e918e22703.zip |
Add wchar_t type; Add LPC17xx CAN driver from Lzyy; Fix serial bug reported by Lzyy
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3775 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/serial/serial.c')
-rw-r--r-- | nuttx/drivers/serial/serial.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nuttx/drivers/serial/serial.c b/nuttx/drivers/serial/serial.c index 3df4a4e18..983d4ae16 100644 --- a/nuttx/drivers/serial/serial.c +++ b/nuttx/drivers/serial/serial.c @@ -296,6 +296,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen { FAR struct inode *inode = filep->f_inode; FAR uart_dev_t *dev = inode->i_private; + irqstate_t flags; ssize_t recvd = 0; /* Only one user can be accessing dev->recv.tail at once */ @@ -372,14 +373,17 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen else { - /* Wait for some characters to be sent from the buffer - * with the TX interrupt re-enabled. + /* Wait for some characters to be sent from the buffer with the RX interrupt + * re-enabled. Interrupts are disabled briefly to assure that the following + * operations are atomic. */ + flags = irqsave(); dev->recvwaiting = true; uart_enablerxint(dev); uart_takesem(&dev->recvsem); uart_disablerxint(dev); + irqrestore(flags); } } |