diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-24 15:10:21 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-24 15:10:21 +0000 |
commit | 6d2bcd43a9a90e4be63c1bc29f14882a8db536df (patch) | |
tree | d9193962a4631ab2b77486d8192377c05862ee8f /nuttx/lib | |
parent | bbae2a800dec1c8f22c3a2bf1d95affb68112746 (diff) | |
download | px4-nuttx-6d2bcd43a9a90e4be63c1bc29f14882a8db536df.tar.gz px4-nuttx-6d2bcd43a9a90e4be63c1bc29f14882a8db536df.tar.bz2 px4-nuttx-6d2bcd43a9a90e4be63c1bc29f14882a8db536df.zip |
Remove BOTHER
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4972 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib')
-rw-r--r-- | nuttx/lib/termios/lib_cfgetispeed.c | 14 | ||||
-rw-r--r-- | nuttx/lib/termios/lib_cfgetospeed.c | 14 | ||||
-rw-r--r-- | nuttx/lib/termios/lib_cfsetispeed.c | 23 | ||||
-rw-r--r-- | nuttx/lib/termios/lib_cfsetospeed.c | 23 |
4 files changed, 46 insertions, 28 deletions
diff --git a/nuttx/lib/termios/lib_cfgetispeed.c b/nuttx/lib/termios/lib_cfgetispeed.c index d52b83774..ebb52106d 100644 --- a/nuttx/lib/termios/lib_cfgetispeed.c +++ b/nuttx/lib/termios/lib_cfgetispeed.c @@ -65,15 +65,17 @@ * * Descripton: * The cfgetispeed() function shall extract the input baud rate from the - * termios structure to which the termios_p argument points. + * termios structure to which the termiosp argument points. * * This function shall return exactly the value in the termios data * structure, without interpretation. * * NOTE 1: NuttX does not not control input/output baud rates independently * Hense, this function is *identical* to cfgetospeed. - * NOTE 2: If this function returns BOTHER and the more flexible input - * speed can be obtained from the Linux-like c_ispeed field. + * NOTE 2. 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 may be returned here... not just those enumerated in + * termios.h * * Input Parameters: * termiosp - The termiosp argument is a pointer to a termios structure. @@ -83,8 +85,8 @@ * ****************************************************************************/ -speed_t cfgetispeed(const struct termios *termios_p) +speed_t cfgetispeed(FAR const struct termios *termiosp) { - DEBUGASSERT(termios_p); - return (termios_p->c_cflag & (CBAUD | CBAUDEX)); + DEBUGASSERT(termiosp); + return termiosp->c_speed; } diff --git a/nuttx/lib/termios/lib_cfgetospeed.c b/nuttx/lib/termios/lib_cfgetospeed.c index 904353332..b45c1b721 100644 --- a/nuttx/lib/termios/lib_cfgetospeed.c +++ b/nuttx/lib/termios/lib_cfgetospeed.c @@ -65,15 +65,17 @@ * * Descripton: * The cfgetospeed() function shall extract the output baud rate from the - * termios structure to which the termios_p argument points. + * termios structure to which the termiosp argument points. * * This function shall return exactly the value in the termios data * structure, without interpretation. * * NOTE 1: NuttX does not not control input/output baud rates independently * Hense, this function is *identical* to cfgetispeed. - * NOTE 2: If this function returns BOTHER and the more flexible input - * speed can be obtained from the Linux-like c_ospeed field. + * NOTE 2. 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 may be returned here... not just those enumerated in + * termios.h * * Input Parameters: * termiosp - The termiosp argument is a pointer to a termios structure. @@ -83,8 +85,8 @@ * ****************************************************************************/ -speed_t cfgetospeed(const struct termios *termios_p) +speed_t cfgetospeed(FAR const struct termios *termiosp) { - DEBUGASSERT(termios_p); - return (termios_p->c_cflag & (CBAUD | CBAUDEX)); + DEBUGASSERT(termiosp); + return termiosp->c_speed; } diff --git a/nuttx/lib/termios/lib_cfsetispeed.c b/nuttx/lib/termios/lib_cfsetispeed.c index 2aefee083..9a4dfaef1 100644 --- a/nuttx/lib/termios/lib_cfsetispeed.c +++ b/nuttx/lib/termios/lib_cfsetispeed.c @@ -66,15 +66,19 @@ * * Descripton: * The cfsetispeed() function sets the input baud rate stored in the - * structure pointed to by termios_p to speed. + * structure pointed to by termiosp to speed. * * There is no effect on the baud rates set in the hardware until a * subsequent successful call to tcsetattr() on the same termios structure. * * NOTE 1: NuttX does not not control input/output baud rates independently * Hense, this function is *identical* to cfsetospeed. - * NOTE 2: If the specia value BOTHER is used, then the actual input baud - * must also be provided in the (non-standard) c_ispeed field. + * NOTE 2. 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! * * Input Parameters: * termiosp - The termiosp argument is a pointer to a termios structure. @@ -86,11 +90,14 @@ * ****************************************************************************/ -int cfsetispeed(struct termios *termios_p, speed_t speed) +int cfsetispeed(FAR struct termios *termiosp, speed_t speed) { - DEBUGASSERT(termios_p); - speed &= (CBAUD | CBAUDEX); - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; + FAR speed_t *speedp; + + DEBUGASSERT(termiosp); + + speedp = (FAR speed_t *)&termiosp->c_speed; + *speedp = speed; + return OK; } diff --git a/nuttx/lib/termios/lib_cfsetospeed.c b/nuttx/lib/termios/lib_cfsetospeed.c index cbf8e341b..e6d8fa3ad 100644 --- a/nuttx/lib/termios/lib_cfsetospeed.c +++ b/nuttx/lib/termios/lib_cfsetospeed.c @@ -66,15 +66,19 @@ * * Descripton: * The cfsetospeed() function sets the output baud rate stored in the - * structure pointed to by termios_p to speed. + * structure pointed to by termiosp to speed. * * There is no effect on the baud rates set in the hardware until a * subsequent successful call to tcsetattr() on the same termios structure. * * 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. + * NOTE 2. 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! * * Input Parameters: * termiosp - The termiosp argument is a pointer to a termios structure. @@ -86,11 +90,14 @@ * ****************************************************************************/ -int cfsetospeed(struct termios *termios_p, speed_t speed) +int cfsetospeed(struct termios *termiosp, speed_t speed) { - DEBUGASSERT(termios_p); - speed &= (CBAUD | CBAUDEX); - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; + FAR speed_t *speedp; + + DEBUGASSERT(termiosp); + + speedp = (FAR speed_t *)&termiosp->c_speed; + *speedp = speed; + return OK; } |