Remove BOTHER

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4972 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-07-24 15:10:21 +00:00
parent 9dee8a084d
commit 272a475b52
8 changed files with 105 additions and 104 deletions
+8 -6
View File
@@ -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;
}
+8 -6
View File
@@ -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;
}
+15 -8
View File
@@ -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;
}
+15 -8
View File
@@ -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;
}