From e81a336112145a051b354124d4fbf5c7ee73b7f3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 24 Jul 2012 17:16:25 +0000 Subject: Ooops.. c_speed is now read-only git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4974 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/lpc43xx/lpc43_serial.c | 42 +++++++++++++++++++++++++++++++ nuttx/arch/arm/src/stm32/stm32_serial.c | 7 ++++-- 2 files changed, 47 insertions(+), 2 deletions(-) (limited to 'nuttx/arch/arm') diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c index 9d678b125..c125660e1 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c @@ -48,6 +48,10 @@ #include #include +#ifdef CONFIG_SERIAL_TERMIOS +# include +#endif + #include #include #include @@ -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 0546bb7ff..5572ee662 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; -- cgit v1.2.3