summaryrefslogtreecommitdiff
path: root/nuttx/drivers/serial
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-13 22:27:06 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-08-13 22:27:06 +0000
commit9613efa7df49054d033f769af97bbfa3ac82cc75 (patch)
treeea1871ae9b26cb5c840c71a8ed1fb70797aaa053 /nuttx/drivers/serial
parent582c2645281ccd428bc86f858d020e4dcf02fcbe (diff)
downloadpx4-nuttx-9613efa7df49054d033f769af97bbfa3ac82cc75.tar.gz
px4-nuttx-9613efa7df49054d033f769af97bbfa3ac82cc75.tar.bz2
px4-nuttx-9613efa7df49054d033f769af97bbfa3ac82cc75.zip
Make the lib/ subdirectory build more like other directories
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5025 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/serial')
-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;
}
}