#ifndef CYGONCE_ISO_TERMIOS_H
|
#ifndef CYGONCE_ISO_TERMIOS_H
|
#define CYGONCE_ISO_TERMIOS_H
|
#define CYGONCE_ISO_TERMIOS_H
|
/* ====================================================================
|
/* ====================================================================
|
//
|
//
|
// termios.h
|
// termios.h
|
//
|
//
|
// POSIX termios
|
// POSIX termios
|
//
|
//
|
// ====================================================================
|
// ====================================================================
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
// -------------------------------------------
|
// -------------------------------------------
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
//
|
//
|
// eCos is free software; you can redistribute it and/or modify it under
|
// eCos is free software; you can redistribute it and/or modify it under
|
// the terms of the GNU General Public License as published by the Free
|
// the terms of the GNU General Public License as published by the Free
|
// Software Foundation; either version 2 or (at your option) any later version.
|
// Software Foundation; either version 2 or (at your option) any later version.
|
//
|
//
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for more details.
|
// for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along
|
// You should have received a copy of the GNU General Public License along
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
//
|
//
|
// As a special exception, if other files instantiate templates or use macros
|
// As a special exception, if other files instantiate templates or use macros
|
// or inline functions from this file, or you compile this file and link it
|
// or inline functions from this file, or you compile this file and link it
|
// with other works to produce a work based on this file, this file does not
|
// with other works to produce a work based on this file, this file does not
|
// by itself cause the resulting work to be covered by the GNU General Public
|
// by itself cause the resulting work to be covered by the GNU General Public
|
// License. However the source code for this file must still be made available
|
// License. However the source code for this file must still be made available
|
// in accordance with section (3) of the GNU General Public License.
|
// in accordance with section (3) of the GNU General Public License.
|
//
|
//
|
// This exception does not invalidate any other reasons why a work based on
|
// This exception does not invalidate any other reasons why a work based on
|
// this file might be covered by the GNU General Public License.
|
// this file might be covered by the GNU General Public License.
|
//
|
//
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
// at http://sources.redhat.com/ecos/ecos-license/
|
// at http://sources.redhat.com/ecos/ecos-license/
|
// -------------------------------------------
|
// -------------------------------------------
|
//####ECOSGPLCOPYRIGHTEND####
|
//####ECOSGPLCOPYRIGHTEND####
|
// ====================================================================
|
// ====================================================================
|
//#####DESCRIPTIONBEGIN####
|
//#####DESCRIPTIONBEGIN####
|
//
|
//
|
// Author(s): jlarmour
|
// Author(s): jlarmour
|
// Contributors:
|
// Contributors:
|
// Date: 2000-07-22
|
// Date: 2000-07-22
|
// Purpose: POSIX termios support
|
// Purpose: POSIX termios support
|
// Description:
|
// Description:
|
//
|
//
|
//####DESCRIPTIONEND####
|
//####DESCRIPTIONEND####
|
//
|
//
|
// ==================================================================*/
|
// ==================================================================*/
|
|
|
#include <pkgconf/isoinfra.h>
|
#include <pkgconf/isoinfra.h>
|
|
|
#if CYGINT_ISO_TERMIOS
|
#if CYGINT_ISO_TERMIOS
|
# ifdef CYGBLD_ISO_TERMIOS_HEADER
|
# ifdef CYGBLD_ISO_TERMIOS_HEADER
|
# include CYGBLD_ISO_TERMIOS_HEADER
|
# include CYGBLD_ISO_TERMIOS_HEADER
|
# else
|
# else
|
|
|
/* TYPES */
|
/* TYPES */
|
|
|
typedef unsigned int tcflag_t; /* terminal flags type */
|
typedef unsigned int tcflag_t; /* terminal flags type */
|
typedef unsigned char cc_t; /* control chars type */
|
typedef unsigned char cc_t; /* control chars type */
|
typedef unsigned int speed_t; /* baud rate type */
|
typedef unsigned int speed_t; /* baud rate type */
|
|
|
#define NCCS 16 /* May as well hard-code - ASCII isn't that configurable! */
|
#define NCCS 16 /* May as well hard-code - ASCII isn't that configurable! */
|
|
|
struct termios {
|
struct termios {
|
tcflag_t c_iflag; /* Input mode flags */
|
tcflag_t c_iflag; /* Input mode flags */
|
tcflag_t c_oflag; /* Output mode flags */
|
tcflag_t c_oflag; /* Output mode flags */
|
tcflag_t c_cflag; /* Control mode flags */
|
tcflag_t c_cflag; /* Control mode flags */
|
tcflag_t c_lflag; /* Local mode flags */
|
tcflag_t c_lflag; /* Local mode flags */
|
cc_t c_cc[NCCS]; /* Control characters */
|
cc_t c_cc[NCCS]; /* Control characters */
|
speed_t c_ispeed; /* input speed */
|
speed_t c_ispeed; /* input speed */
|
speed_t c_ospeed; /* output speed */
|
speed_t c_ospeed; /* output speed */
|
};
|
};
|
|
|
/* CONSTANTS */
|
/* CONSTANTS */
|
|
|
/* Input mode flags */
|
/* Input mode flags */
|
|
|
#define BRKINT (1<<0)
|
#define BRKINT (1<<0)
|
#define ICRNL (1<<1)
|
#define ICRNL (1<<1)
|
#define IGNBRK (1<<2)
|
#define IGNBRK (1<<2)
|
#define IGNCR (1<<3)
|
#define IGNCR (1<<3)
|
#define IGNPAR (1<<4)
|
#define IGNPAR (1<<4)
|
#define INLCR (1<<5)
|
#define INLCR (1<<5)
|
#define INPCK (1<<6)
|
#define INPCK (1<<6)
|
#define ISTRIP (1<<7)
|
#define ISTRIP (1<<7)
|
#define IXOFF (1<<8)
|
#define IXOFF (1<<8)
|
#define IXON (1<<9)
|
#define IXON (1<<9)
|
#define PARMRK (1<<10)
|
#define PARMRK (1<<10)
|
|
|
/* Output mode flags */
|
/* Output mode flags */
|
|
|
#define OPOST (1<<0)
|
#define OPOST (1<<0)
|
#define ONLCR (1<<1) /* Note: This isn't POSIX */
|
#define ONLCR (1<<1) /* Note: This isn't POSIX */
|
|
|
/* Control mode flags */
|
/* Control mode flags */
|
|
|
#define CLOCAL (1<<0)
|
#define CLOCAL (1<<0)
|
#define CREAD (1<<1)
|
#define CREAD (1<<1)
|
#define CS5 (0)
|
#define CS5 (0)
|
#define CS6 (1<<2)
|
#define CS6 (1<<2)
|
#define CS7 (1<<3)
|
#define CS7 (1<<3)
|
#define CS8 (CS6|CS7)
|
#define CS8 (CS6|CS7)
|
#define CSIZE (CS8)
|
#define CSIZE (CS8)
|
#define CSTOPB (1<<4)
|
#define CSTOPB (1<<4)
|
#define HUPCL (1<<5)
|
#define HUPCL (1<<5)
|
#define PARENB (1<<6)
|
#define PARENB (1<<6)
|
#define PARODD (1<<7)
|
#define PARODD (1<<7)
|
#ifndef _POSIX_SOURCE_
|
#ifndef _POSIX_SOURCE_
|
# define CRTSCTS (1<<8)
|
# define CRTSCTS (1<<8)
|
#endif
|
#endif
|
|
|
/* Local mode flags */
|
/* Local mode flags */
|
|
|
#define ECHO (1<<0)
|
#define ECHO (1<<0)
|
#define ECHOE (1<<1)
|
#define ECHOE (1<<1)
|
#define ECHOK (1<<2)
|
#define ECHOK (1<<2)
|
#define ECHONL (1<<3)
|
#define ECHONL (1<<3)
|
#define ICANON (1<<4)
|
#define ICANON (1<<4)
|
#define IEXTEN (1<<5)
|
#define IEXTEN (1<<5)
|
#define ISIG (1<<6)
|
#define ISIG (1<<6)
|
#define NOFLSH (1<<7)
|
#define NOFLSH (1<<7)
|
#define TOSTOP (1<<8)
|
#define TOSTOP (1<<8)
|
|
|
/* Special control characters */
|
/* Special control characters */
|
|
|
#define VEOF 0
|
#define VEOF 0
|
#define VEOL 1
|
#define VEOL 1
|
#define VERASE 2
|
#define VERASE 2
|
#define VINTR 3
|
#define VINTR 3
|
#define VKILL 4
|
#define VKILL 4
|
#define VMIN 5
|
#define VMIN 5
|
#define VQUIT 6
|
#define VQUIT 6
|
#define VSUSP 7
|
#define VSUSP 7
|
#define VTIME 8
|
#define VTIME 8
|
#define VSTART 9
|
#define VSTART 9
|
#define VSTOP 10
|
#define VSTOP 10
|
|
|
/* Baud rates */
|
/* Baud rates */
|
/* There may be tables in the implementation that rely on the
|
/* There may be tables in the implementation that rely on the
|
* values here, so only append to this table - do not insert values!
|
* values here, so only append to this table - do not insert values!
|
*/
|
*/
|
#define B0 0
|
#define B0 0
|
#define B50 1
|
#define B50 1
|
#define B75 2
|
#define B75 2
|
#define B110 3
|
#define B110 3
|
#define B134 4
|
#define B134 4
|
#define B150 5
|
#define B150 5
|
#define B200 6
|
#define B200 6
|
#define B300 7
|
#define B300 7
|
#define B600 8
|
#define B600 8
|
#define B1200 9
|
#define B1200 9
|
#define B1800 10
|
#define B1800 10
|
#define B2400 11
|
#define B2400 11
|
#define B3600 12
|
#define B3600 12
|
#define B4800 13
|
#define B4800 13
|
#define B7200 14
|
#define B7200 14
|
#define B9600 15
|
#define B9600 15
|
#define B14400 16
|
#define B14400 16
|
#define B19200 17
|
#define B19200 17
|
#define B38400 18
|
#define B38400 18
|
#define B57600 19
|
#define B57600 19
|
#define B115200 20
|
#define B115200 20
|
#define B230400 21
|
#define B230400 21
|
#define B460800 22
|
#define B460800 22
|
#define B500000 23
|
#define B500000 23
|
#define B576000 24
|
#define B576000 24
|
#define B921600 25
|
#define B921600 25
|
#define B1000000 26
|
#define B1000000 26
|
#define B1152000 27
|
#define B1152000 27
|
#define B1500000 28
|
#define B1500000 28
|
#define B2000000 29
|
#define B2000000 29
|
#define B2500000 30
|
#define B2500000 30
|
#define B3000000 31
|
#define B3000000 31
|
#define B3500000 32
|
#define B3500000 32
|
#define B4000000 33
|
#define B4000000 33
|
|
|
|
|
/* Optional actions to tcsetattr() */
|
/* Optional actions to tcsetattr() */
|
|
|
#define TCSANOW 0
|
#define TCSANOW 0
|
#define TCSADRAIN 1
|
#define TCSADRAIN 1
|
#define TCSAFLUSH 2
|
#define TCSAFLUSH 2
|
|
|
/* Queue selectors for tcflush() */
|
/* Queue selectors for tcflush() */
|
|
|
#define TCIFLUSH 0
|
#define TCIFLUSH 0
|
#define TCOFLUSH 1
|
#define TCOFLUSH 1
|
#define TCIOFLUSH 2
|
#define TCIOFLUSH 2
|
|
|
/* Actions for tcflow() */
|
/* Actions for tcflow() */
|
|
|
#define TCOOFF 0
|
#define TCOOFF 0
|
#define TCOON 1
|
#define TCOON 1
|
#define TCIOFF 2
|
#define TCIOFF 2
|
#define TCION 3
|
#define TCION 3
|
|
|
|
|
/* FUNCTIONS */
|
/* FUNCTIONS */
|
|
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
extern "C" {
|
extern "C" {
|
#endif
|
#endif
|
|
|
extern speed_t
|
extern speed_t
|
cfgetospeed( const struct termios *__termios_p );
|
cfgetospeed( const struct termios *__termios_p );
|
|
|
extern int
|
extern int
|
cfsetospeed( struct termios *__termios_p, speed_t __speed );
|
cfsetospeed( struct termios *__termios_p, speed_t __speed );
|
|
|
extern speed_t
|
extern speed_t
|
cfgetispeed( const struct termios *__termios_p );
|
cfgetispeed( const struct termios *__termios_p );
|
|
|
extern int
|
extern int
|
cfsetispeed( struct termios *__termios_p, speed_t __speed );
|
cfsetispeed( struct termios *__termios_p, speed_t __speed );
|
|
|
extern int
|
extern int
|
tcgetattr( int __fildes, struct termios *__termios_p );
|
tcgetattr( int __fildes, struct termios *__termios_p );
|
|
|
extern int
|
extern int
|
tcsetattr( int __fildes, int __optact, const struct termios *__termios_p );
|
tcsetattr( int __fildes, int __optact, const struct termios *__termios_p );
|
|
|
extern int
|
extern int
|
tcsendbreak( int __fildes, int __duration );
|
tcsendbreak( int __fildes, int __duration );
|
|
|
extern int
|
extern int
|
tcdrain( int __fildes );
|
tcdrain( int __fildes );
|
|
|
extern int
|
extern int
|
tcflush( int __fildes, int __queue_sel );
|
tcflush( int __fildes, int __queue_sel );
|
|
|
extern int
|
extern int
|
tcflow( int __fildes, int __action );
|
tcflow( int __fildes, int __action );
|
|
|
/* tcgetpgrp() and tcsetpgrp() not included in the absence of job control */
|
/* tcgetpgrp() and tcsetpgrp() not included in the absence of job control */
|
|
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
} /* extern "C" */
|
} /* extern "C" */
|
#endif
|
#endif
|
|
|
# endif /* ifndef CYGBLD_ISO_TERMIOS_HEADER */
|
# endif /* ifndef CYGBLD_ISO_TERMIOS_HEADER */
|
#endif /* if CYGINT_ISO_TERMIOS */
|
#endif /* if CYGINT_ISO_TERMIOS */
|
|
|
|
|
#endif /* ifndef CYGONCE_ISO_TERMIOS_H */
|
#endif /* ifndef CYGONCE_ISO_TERMIOS_H */
|
|
|
/* EOF termios.h */
|
/* EOF termios.h */
|
|
|