fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/gpsoncore/ntp_tty.h
Go to the documentation of this file.
00001 /*
00002  * ntp_tty.h - header file for serial lines handling
00003  */
00004 
00005 #ifndef NTP_TTY_H
00006 #define NTP_TTY_H
00007 
00008 
00009 #define HAVE_TERMIOS_H
00010 
00011 
00012 //------ from nt_machine.h ---------
00013 
00014 /*
00015  * use only one tty model - no use in initialising
00016  * a tty in three ways
00017  * HAVE_TERMIOS is preferred over HAVE_SYSV_TTYS over HAVE_BSD_TTYS
00018  */
00019 
00020 #ifdef HAVE_TERMIOS_H
00021 # define HAVE_TERMIOS
00022 #else
00023 # ifdef HAVE_TERMIO_H
00024 #  define HAVE_SYSV_TTYS
00025 # else
00026 #  ifdef HAVE_SGTTY_H
00027 #       define HAVE_BSD_TTYS
00028 #  endif
00029 # endif
00030 #endif
00031 
00032 #ifdef HAVE_TERMIOS
00033 # undef HAVE_BSD_TTYS
00034 # undef HAVE_SYSV_TTYS
00035 #endif
00036 
00037 #ifdef HAVE_SYSV_TTYS
00038 # undef HAVE_BSD_TTYS
00039 #endif
00040 
00041 // --------------------------------
00042 
00043 
00044 
00045 
00046 #if defined(HAVE_BSD_TTYS)
00047 #include <sgtty.h>
00048 #define TTY     struct sgttyb
00049 #endif /* HAVE_BSD_TTYS */
00050 
00051 #if defined(HAVE_SYSV_TTYS)
00052 #include <termio.h>
00053 #define TTY     struct termio
00054 #ifndef tcsetattr
00055 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
00056 #endif
00057 #ifndef TCSANOW
00058 #define TCSANOW TCSETA
00059 #endif
00060 #ifndef TCIFLUSH
00061 #define TCIFLUSH 0
00062 #endif
00063 #ifndef TCOFLUSH
00064 #define TCOFLUSH 1
00065 #endif
00066 #ifndef TCIOFLUSH
00067 #define TCIOFLUSH 2
00068 #endif
00069 #ifndef tcflush
00070 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
00071 #endif
00072 #endif /* HAVE_SYSV_TTYS */
00073 
00074 #if defined(HAVE_TERMIOS)
00075 # ifdef TERMIOS_NEEDS__SVID3
00076 #  define _SVID3
00077 # endif
00078 # include <termios.h>
00079 # ifdef TERMIOS_NEEDS__SVID3
00080 #  undef _SVID3
00081 # endif
00082 #define TTY     struct termios
00083 #endif
00084 
00085 #if defined(HAVE_SYS_MODEM_H)
00086 #include <sys/modem.h>
00087 #endif
00088 
00089 #if !defined(SYSV_TTYS) && !defined(STREAM) & !defined(BSD_TTYS)
00090 #define BSD_TTYS
00091 #endif /* SYSV_TTYS STREAM BSD_TTYS */
00092 
00093 /*
00094  * Line discipline flags. These require line discipline or streams
00095  * modules to be installed/loaded in the kernel. If specified, but not
00096  * installed, the code runs as if unspecified.
00097  */
00098 #define LDISC_STD       0x0     /* standard */
00099 #define LDISC_CLK       0x1     /* tty_clk \n intercept */
00100 #define LDISC_CLKPPS    0x2     /* tty_clk \377 intercept */
00101 #define LDISC_ACTS      0x4     /* tty_clk #* intercept */
00102 #define LDISC_CHU       0x8     /* depredated */
00103 #define LDISC_PPS       0x10    /* ppsclock, ppsapi */
00104 #define LDISC_RAW       0x20    /* raw binary */
00105 
00106 #endif /* NTP_TTY_H */