summaryrefslogtreecommitdiff
path: root/nuttx/include/termios.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-24 22:56:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-24 22:56:36 +0000
commit79a649dfb7f8673a4150bfdabcf32826619de326 (patch)
treef9293a2385b426204e0e8b9125660c6b22885755 /nuttx/include/termios.h
parente81a336112145a051b354124d4fbf5c7ee73b7f3 (diff)
downloadnuttx-79a649dfb7f8673a4150bfdabcf32826619de326.tar.gz
nuttx-79a649dfb7f8673a4150bfdabcf32826619de326.tar.bz2
nuttx-79a649dfb7f8673a4150bfdabcf32826619de326.zip
Combine cfset[o|i]speed to cfsetspeed; combine cfget[o|i]speed for cfgetspeed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4975 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/termios.h')
-rw-r--r--nuttx/include/termios.h70
1 files changed, 58 insertions, 12 deletions
diff --git a/nuttx/include/termios.h b/nuttx/include/termios.h
index d082cef81..4398b6449 100644
--- a/nuttx/include/termios.h
+++ b/nuttx/include/termios.h
@@ -138,7 +138,15 @@
#define VSUSP 8 /* Bit 8: SUSP character */
#define NCCS 9 /* Bit 9: Size of the array c_cc for control characters */
-/* Baud Rate Selection. */
+/* Baud Rate Selection. These are instances of type speed_t. Values of 38400
+ * and below are specified by POSIX; values above 38400 are sometimes referred
+ * to as extended values and most values appear in most termios.h implementations.
+ *
+ * NOTE that is NuttX that the encoding of the speed_t values is simply the
+ * value of the baud itself. So this opens a window for non-portable abuse
+ * of the speed-related interfaces: The defined values should be used where-
+ * ever possible for reasons of portability.
+ */
#define B0 0 /* Hang up */
#define B50 50 /* 50 baud */
@@ -236,17 +244,55 @@ extern "C" {
#define EXTERN extern
#endif
-EXTERN speed_t cfgetispeed(FAR const struct termios *);
-EXTERN speed_t cfgetospeed(FAR const struct termios *);
-EXTERN int cfsetispeed(FAR struct termios *, speed_t);
-EXTERN int cfsetospeed(FAR struct termios *, speed_t);
-EXTERN int tcdrain(int);
-EXTERN int tcflow(int, int);
-EXTERN int tcflush(int, int);
-EXTERN int tcgetattr(int, FAR struct termios *);
-EXTERN pid_t tcgetsid(int);
-EXTERN int tcsendbreak(int, int);
-EXTERN int tcsetattr(int, int, FAR const struct termios *);
+/* The cfgetspeed() function is a non-POSIX function will extract the baud
+ * from the termios structure to which the termiosp argument points. NuttX
+ * does not control input/output baud independently. Both must be the same.
+ * The POSIX standard interfaces, cfisetispeed() and cfisetospeed() are
+ * supported by simply defining them to be cfsetspeed().
+ */
+
+EXTERN speed_t cfgetspeed(FAR const struct termios *termiosp);
+#define cfgetispeed(termiosp) cfgetspeed(termiosp)
+#define cfgetospeed(termiosp) cfgetspeed(termiosp)
+
+/* The cfsetspeed() function is a non-POSIX function that sets the baud
+ * stored in the structure pointed to by termiosp to speed. NuttX does
+ * not control input/output baud independently. Both must be the same.
+ * The POSIX standard interfaces, cfigetispeed() and cfigetospeed() are
+ * supported by simply defining them to be cfsetspeed().
+ */
+
+EXTERN int cfsetspeed(FAR struct termios *termiosp, speed_t speed);
+#define cfsetispeed(termiosp,speed) cfsetspeed(termiosp,speed)
+#define cfsetospeed(termiosp,speed) cfsetspeed(termiosp,speed)
+
+/* Wait for transmission of output */
+
+EXTERN int tcdrain(int fd);
+
+/* Suspend or restart the transmission or reception of data */
+
+EXTERN int tcflow(int fd, int action);
+
+/* Flush non-transmitted output data, non-read input data or both */
+
+EXTERN int tcflush(int fd, int cmd);
+
+/* Get the parameters associated with the terminal */
+
+EXTERN int tcgetattr(int fd, FAR struct termios *termiosp);
+
+/* Get process group ID for session leader for controlling terminal */
+
+EXTERN pid_t tcgetsid(int fd);
+
+/* Send a "break" for a specific duration */
+
+EXTERN int tcsendbreak(int fd, int duration);
+
+/* Set the parameters associated with the terminal */
+
+EXTERN int tcsetattr(int fd, int options, FAR const struct termios *termiosp);
#undef EXTERN
#ifdef __cplusplus