aboutsummaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-13 22:27:06 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-08-13 22:27:06 +0000
commita72ff3b651c8b4a13c4791fb1829c94ed0ce88ed (patch)
treeea1871ae9b26cb5c840c71a8ed1fb70797aaa053 /nuttx/drivers
parentd5c4c4da8d1612ef8e24f7cd99bc3200c80e002d (diff)
downloadpx4-firmware-a72ff3b651c8b4a13c4791fb1829c94ed0ce88ed.tar.gz
px4-firmware-a72ff3b651c8b4a13c4791fb1829c94ed0ce88ed.tar.bz2
px4-firmware-a72ff3b651c8b4a13c4791fb1829c94ed0ce88ed.zip
Make the lib/ subdirectory build more like other directories
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5025 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/serial/serial.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/nuttx/drivers/serial/serial.c b/nuttx/drivers/serial/serial.c
index c0ebd245a..9ffcd75dc 100644
--- a/nuttx/drivers/serial/serial.c
+++ b/nuttx/drivers/serial/serial.c
@@ -241,7 +241,7 @@ static int uart_putxmitchar(FAR uart_dev_t *dev, int ch)
* Name: uart_irqwrite
************************************************************************************/
-static ssize_t uart_irqwrite(FAR uart_dev_t *dev, FAR const char *buffer, size_t buflen)
+static inline ssize_t uart_irqwrite(FAR uart_dev_t *dev, FAR const char *buffer, size_t buflen)
{
ssize_t ret = buflen;
@@ -250,14 +250,17 @@ static ssize_t uart_irqwrite(FAR uart_dev_t *dev, FAR const char *buffer, size_t
for (; buflen; buflen--)
{
int ch = *buffer++;
- uart_putc(ch);
- /* If this is the console, then we should replace LF with LF-CR */
+ /* If this is the console, then we should replace LF with CR-LF */
if (ch == '\n')
{
uart_putc('\r');
}
+
+ /* Output the character, using the low-level direct UART interfaces */
+
+ uart_putc(ch);
}
return ret;
@@ -274,14 +277,17 @@ static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t
ssize_t nread = buflen;
int ret;
- /* We may receive console writes through this path from
- * interrupt handlers and from debug output in the IDLE task!
- * In these cases, we will need to do things a little
- * differently.
+ /* We may receive console writes through this path from interrupt handlers and
+ * from debug output in the IDLE task! In these cases, we will need to do things
+ * a little differently.
*/
if (up_interrupt_context() || getpid() == 0)
{
+ /* up_putc() will be used to generate the output in a busy-wait loop.
+ * up_putc() is only available for the console device.
+ */
+
if (dev->isconsole)
{
irqstate_t flags = irqsave();
@@ -291,7 +297,7 @@ static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t
}
else
{
- return ERROR;
+ return -EPERM;
}
}