diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-23 15:37:13 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-23 15:37:13 +0000 |
commit | 6355e50a2289d7d764ac9de87ddd1528c510bd8f (patch) | |
tree | bdace79b95ff390c7c1b0ccdd005816be2c83e6c /nuttx/lib/termios/lib_cfsetospeed.c | |
parent | 92ee042ea3f2cd97bcca3f1d752ec68dac919d85 (diff) | |
download | px4-nuttx-6355e50a2289d7d764ac9de87ddd1528c510bd8f.tar.gz px4-nuttx-6355e50a2289d7d764ac9de87ddd1528c510bd8f.tar.bz2 px4-nuttx-6355e50a2289d7d764ac9de87ddd1528c510bd8f.zip |
Baud definitions (B9600 for example) are again encoded; Now supports the BOTHER settings which allows specifying the baud via c_ispeed and c_ospeed termios fields
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4970 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/termios/lib_cfsetospeed.c')
-rw-r--r-- | nuttx/lib/termios/lib_cfsetospeed.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/nuttx/lib/termios/lib_cfsetospeed.c b/nuttx/lib/termios/lib_cfsetospeed.c index 4a30699e9..cbf8e341b 100644 --- a/nuttx/lib/termios/lib_cfsetospeed.c +++ b/nuttx/lib/termios/lib_cfsetospeed.c @@ -71,26 +71,26 @@ * There is no effect on the baud rates set in the hardware until a * subsequent successful call to tcsetattr() on the same termios structure. * - * NON STANDARD BEHAVIOR. In Nuttx, the speed_t is defined to be uint32_t - * and the baud encodings of termios.h are the actual baud values - * themselves. Therefore, any baud value can be provided as the speed - * argument here. However, if you do so, your code will *NOT* be portable - * to other environments where speed_t is smaller and where the termios.h - * baud values are encoded! To avoid portability issues, use the baud - * definitions in termios.h! + * NOTE 1: NuttX does not not control input/output baud rates independently + * Hense, this function is *identical* to cfsetispeed. + * NOTE 2: If the specia value BOTHER is used, then the actual input baud + * must also be provided in the (non-standard) c_ospeed field. * * Input Parameters: * termiosp - The termiosp argument is a pointer to a termios structure. * speed - The new output speed * * Returned Value: - * Baud is not checked... OK is always returned. + * Baud is not checked... OK is always returned (this is non-standard + * behavior). * ****************************************************************************/ int cfsetospeed(struct termios *termios_p, speed_t speed) { DEBUGASSERT(termios_p); - termios_p->c_ospeed = speed; + speed &= (CBAUD | CBAUDEX); + termios_p->c_cflag &= ~(CBAUD | CBAUDEX); + termios_p->c_cflag |= speed; return OK; } |