summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2009-12-16 10:45:01 +0000
committerThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2009-12-16 10:45:01 +0000
commitdddcb78e00075ad8882676afab4fbe86bf03d63c (patch)
treee242f7c0e3e42c21778707983faa24a00269ccc3 /doc
parentadd missing files (diff)
downloadrtems-dddcb78e00075ad8882676afab4fbe86bf03d63c.tar.bz2
adaption of calling convention to console my_driver_write function
Diffstat (limited to 'doc')
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/bsp_howto/console.t18
2 files changed, 19 insertions, 4 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index cb757ec2f0..57ded9516f 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-16 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
+
+ * bsp_howto/console.t: adaption to ssize_t return value for
+ my_driver_write() function
+
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1460/cpukit
diff --git a/doc/bsp_howto/console.t b/doc/bsp_howto/console.t
index a46bac6146..0bd8eb411a 100644
--- a/doc/bsp_howto/console.t
+++ b/doc/bsp_howto/console.t
@@ -260,9 +260,15 @@ Termios for simple character IO.
The @code{my_driver_poll_write} routine is responsible for writing @code{n}
characters from @code{buf} to the serial device specified by @code{minor}.
+On success, the number of bytes written is returned (zero indicates nothing
+was written). On error, @code{-1} is returned.
+
+NOTE: Due to the current implementation of termios, any data passed into
+ the write function will be lost.
+
@example
@group
-static int my_driver_poll_write(int minor, const char *buf, int n)
+static ssize_t my_driver_poll_write(int minor, const char *buf, size_t n)
@{
my_driver_entry *e = &my_driver_table [minor];
int i = 0;
@@ -278,7 +284,7 @@ static int my_driver_poll_write(int minor, const char *buf, int n)
my_driver_write_char(e, buf [i]);
@}
- return 0;
+ return n;
@}
@end group
@end example
@@ -380,9 +386,13 @@ to fill the output buffer. If the transmit interrupt arises before Termios was
able to fill the transmit buffer you will end up with one interrupt per
character.
+On error, the function should return @code{-1}. On success, it should return
+@code{0}, since it the interrupt handler will report the actual number of
+characters transmitted.
+
@example
@group
-static int my_driver_interrupt_write(int minor, const char *buf, int n)
+static ssize_t my_driver_interrupt_write(int minor, const char *buf, size_t n)
@{
my_driver_entry *e = &my_driver_table [minor];
@@ -394,7 +404,7 @@ static int my_driver_interrupt_write(int minor, const char *buf, int n)
/*
* Tell the device to transmit some characters from buf (less than
- * or equal to n). If the device is finished it should raise an
+ * or equal to n). When the device is finished it should raise an
* interrupt. The interrupt handler will notify Termios that these
* characters have been transmitted and this may trigger this write
* function again. You may have to store the number of outstanding