summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/arm
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-07-24 17:16:25 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-07-24 17:16:25 +0000
commitb3f5f0b93e26344a05efa9107f4f0dbc38a695db (patch)
tree6a6b125c6652cae62e66ca6c93c2c3a4e5b7ed87 /nuttx/arch/arm
parent9bf65cce440ad33d17ddf7bae366b2dc2bd3064c (diff)
Ooops.. c_speed is now read-only
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4974 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r--nuttx/arch/arm/src/lpc43xx/lpc43_serial.c42
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_serial.c7
2 files changed, 47 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
index 9d678b125d..c125660e15 100644
--- a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
+++ b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
@@ -48,6 +48,10 @@
#include <errno.h>
#include <debug.h>
+#ifdef CONFIG_SERIAL_TERMIOS
+# include <termios.h>
+#endif
+
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/serial/serial.h>
@@ -1091,6 +1095,44 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
}
break;
+#ifdef CONFIG_SERIAL_TERMIOS
+ case TCGETS:
+ {
+ struct termios *termiosp = (struct termios*)arg;
+
+ if (!termiosp)
+ {
+ ret = -EINVAL;
+ break;
+ }
+
+ /* TODO: Other termios fields are not yet returned.
+ * Note that only cfsetospeed is not necessary because we have
+ * knowledge that only one speed is supported.
+ */
+
+ cfsetispeed(termiosp, priv->baud);
+ }
+ break;
+
+ case TCSETS:
+ {
+ struct termios *termiosp = (struct termios*)arg;
+
+ if (!termiosp)
+ {
+ ret = -EINVAL;
+ break;
+ }
+
+ /* TODO: Handle other termios settings. */
+
+ priv->baud = termiosp->c_speed;
+ lpc43_setbaud(priv->uartbase, priv->basefreq, priv->baud);
+ }
+ break;
+#endif
+
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
{
irqstate_t flags = irqsave();
diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c
index 0546bb7ff6..5572ee6627 100644
--- a/nuttx/arch/arm/src/stm32/stm32_serial.c
+++ b/nuttx/arch/arm/src/stm32/stm32_serial.c
@@ -1248,9 +1248,12 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
break;
}
- /* TODO: Other termios fields are not yet returned. */
+ /* TODO: Other termios fields are not yet returned.
+ * Note that only cfsetospeed is not necessary because we have
+ * knowledge that only one speed is supported.
+ */
- termiosp->c_speed = priv->baud;
+ cfsetispeed(termiosp, priv->baud);
}
break;