summaryrefslogtreecommitdiff
path: root/nuttx/include/termios.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-22 18:56:50 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-22 18:56:50 +0000
commit92ee042ea3f2cd97bcca3f1d752ec68dac919d85 (patch)
tree3031e9ab44fcd5d158aa160ee01517a0eb409a94 /nuttx/include/termios.h
parent60375dcc5d9c24b5919f66f63ac70879e653c350 (diff)
downloadnuttx-92ee042ea3f2cd97bcca3f1d752ec68dac919d85.tar.gz
nuttx-92ee042ea3f2cd97bcca3f1d752ec68dac919d85.tar.bz2
nuttx-92ee042ea3f2cd97bcca3f1d752ec68dac919d85.zip
Loosen up termios interfaces to allow more flexible baud settings; remove AIX-like interfaces of last check-in
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4969 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/termios.h')
-rw-r--r--nuttx/include/termios.h76
1 files changed, 48 insertions, 28 deletions
diff --git a/nuttx/include/termios.h b/nuttx/include/termios.h
index 705a89c0f..0a4a13b45 100644
--- a/nuttx/include/termios.h
+++ b/nuttx/include/termios.h
@@ -110,10 +110,6 @@
#define HUPCL (1 << 6) /* Hang up on last close */
#define CLOCAL (1 << 7) /* Ignore modem status lines */
-#define CBAUD (0x1f << 8) /* Baud mask (not POSIX) */
-#define CBAUDEX (0x10 << 8) /* Extra speed mask (not POSIX) */
-#define _CBAUD_SHIFT 8 /* So that we all agree where the baud code is stored */
-
/* Local Modes (c_lflag in the termios structure) */
#define ECHO (1 << 0) /* Enable echo */
@@ -142,29 +138,43 @@
#define VSUSP 8 /* SUSP character */
#define NCCS 9 /* Size of the array c_cc for control characters */
-/* Baud Rate Selection (objects of type speed_t) */
-
-#define B0 0 /* Hang up */
-#define B50 1 /* 50 baud */
-#define B75 2 /* 75 baud */
-#define B110 3 /* 110 baud */
-#define B134 4 /* 134.5 baud */
-#define B150 5 /* 150 baud */
-#define B200 6 /* 200 baud */
-#define B300 7 /* 300 baud */
-#define B600 8 /* 600 baud */
-#define B1200 9 /* 1,200 baud */
-#define B1800 10 /* 1,800 baud */
-#define B2400 11 /* 2,400 baud */
-#define B4800 12 /* 4,800 baud */
-#define B9600 13 /* 9,600 baud */
-#define B19200 14 /* 19,200 baud */
-#define B38400 15 /* 38,400 baud */
-#define B57600 16 /* 57,600 baud */
-#define B115200 17 /* 115,200 baud */
-#define B230400 18 /* 230,400 baud */
-#define B460800 19 /* 460,800 baud */
-#define B921600 20 /* 921,600 baud */
+/* Baud Rate Selection (objects of type speed_t). NOTE that as a simplification
+ * in NuttX, the value of the baud symbol is the buad rate itself; not an encoded
+ * value as you will see in most implementations of termios.h.
+ */
+
+#define B0 0 /* Hang up */
+#define B50 50 /* 50 baud */
+#define B75 75 /* 75 baud */
+#define B110 110 /* 110 baud */
+#define B134 134 /* 134.5 baud */
+#define B150 150 /* 150 baud */
+#define B200 200 /* 200 baud */
+#define B300 300 /* 300 baud */
+#define B600 600 /* 600 baud */
+#define B1200 1200 /* 1,200 baud */
+#define B1800 1800 /* 1,800 baud */
+#define B2400 2400 /* 2,400 baud */
+#define B4800 4800 /* 4,800 baud */
+#define B9600 9600 /* 9,600 baud */
+#define B19200 19200 /* 19,200 baud */
+#define B38400 38400 /* 38,400 baud */
+
+#define B57600 57600 /* 57,600 baud */
+#define B115200 115200 /* 115,200 baud */
+#define B128000 128000 /* 128,000 baud */
+#define B230400 230400 /* 230,400 baud */
+#define B256000 256000 /* 256,000 baud */
+#define B460800 460800 /* 460,800 baud */
+#define B500000 500000 /* 500,000 baud */
+#define B576000 576000 /* 576,000 baud */
+#define B921600 921600 /* 921,600 baud */
+#define B1000000 1000000 /* 1,000,000 baud */
+#define B1152000 1152000 /* 1,152,000 baud */
+#define B1500000 1500000 /* 1,500,000 baud */
+#define B2000000 2000000 /* 2,000,000 baud */
+#define B2500000 2500000 /* 2,500,000 baud */
+#define B3000000 3000000 /* 3,000,000 baud */
/* Attribute Selection (used with tcsetattr()) */
@@ -191,7 +201,7 @@
/* Baud rate selection */
-typedef uint8_t speed_t; /* Used for terminal baud rates */
+typedef uint32_t speed_t; /* Used for terminal baud rates */
/* Types used within the termios structure */
@@ -202,11 +212,21 @@ typedef int cc_t; /* Used for terminal special characters */
struct termios
{
+ /* Exposed fields defined by POSIX */
+
tcflag_t c_iflag; /* Input modes */
tcflag_t c_oflag; /* Output modes */
tcflag_t c_cflag; /* Control modes */
tcflag_t c_lflag; /* Local modes */
cc_t c_cc[NCCS]; /* Control chars */
+
+ /* Implementation specific fields. For portability reasons, these fields
+ * should not be accessed directly, but rather through only through the
+ * cf[set|get][o|i]speed() POSIX interfaces.
+ */
+
+ speed_t c_ispeed; /* Input speed */
+ speed_t c_ospeed; /* Output speed */
};
/****************************************************************************