Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:15

0001 /*  @file
0002  *
0003  *  @brief Baud Rate Functions
0004  *  @ingroup Termios
0005  */
0006 
0007 /*
0008  * Copyright (c) 1989, 1993
0009  *  The Regents of the University of California.  All rights reserved.
0010  *
0011  * Redistribution and use in source and binary forms, with or without
0012  * modification, are permitted provided that the following conditions
0013  * are met:
0014  * 1. Redistributions of source code must retain the above copyright
0015  *    notice, this list of conditions and the following disclaimer.
0016  * 2. Redistributions in binary form must reproduce the above copyright
0017  *    notice, this list of conditions and the following disclaimer in the
0018  *    documentation and/or other materials provided with the distribution.
0019  * 3. Neither the name of the University nor the names of its contributors
0020  *    may be used to endorse or promote products derived from this software
0021  *    without specific prior written permission.
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0027  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0028  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0029  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0030  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0031  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0032  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0033  * SUCH DAMAGE.
0034  */
0035 
0036 #ifdef HAVE_CONFIG_H
0037 #include "config.h"
0038 #endif
0039 
0040 #include <rtems.h>
0041 #if defined(RTEMS_NEWLIB)
0042 
0043 #include <sys/types.h>
0044 #include <sys/stat.h>
0045 #include <errno.h>
0046 #include <termios.h>
0047 
0048 /*
0049  * Make a pre-existing termios structure into "raw" mode: character-at-a-time
0050  * mode with no characters interpreted, 8-bit data path.
0051  */
0052 void
0053 cfmakeraw(
0054   struct termios *tp
0055 )
0056 {
0057   tp->c_iflag &= ~(IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR);
0058   tp->c_iflag |= IGNBRK;
0059   tp->c_oflag &= ~OPOST;
0060   tp->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP|PENDIN);
0061   tp->c_cflag &= ~(CSIZE|PARENB);
0062   tp->c_cflag |= CS8|CREAD;
0063   tp->c_cc[VMIN] = 1;
0064   tp->c_cc[VTIME] = 0;
0065 }
0066 #endif