termios.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef _ASM_IA64_TERMIOS_H
  2. #define _ASM_IA64_TERMIOS_H
  3. /*
  4. * Modified 1999
  5. * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
  6. *
  7. * 99/01/28 Added N_IRDA and N_SMSBLOCK
  8. */
  9. #include <asm/termbits.h>
  10. #include <asm/ioctls.h>
  11. struct winsize {
  12. unsigned short ws_row;
  13. unsigned short ws_col;
  14. unsigned short ws_xpixel;
  15. unsigned short ws_ypixel;
  16. };
  17. #define NCC 8
  18. struct termio {
  19. unsigned short c_iflag; /* input mode flags */
  20. unsigned short c_oflag; /* output mode flags */
  21. unsigned short c_cflag; /* control mode flags */
  22. unsigned short c_lflag; /* local mode flags */
  23. unsigned char c_line; /* line discipline */
  24. unsigned char c_cc[NCC]; /* control characters */
  25. };
  26. /* modem lines */
  27. #define TIOCM_LE 0x001
  28. #define TIOCM_DTR 0x002
  29. #define TIOCM_RTS 0x004
  30. #define TIOCM_ST 0x008
  31. #define TIOCM_SR 0x010
  32. #define TIOCM_CTS 0x020
  33. #define TIOCM_CAR 0x040
  34. #define TIOCM_RNG 0x080
  35. #define TIOCM_DSR 0x100
  36. #define TIOCM_CD TIOCM_CAR
  37. #define TIOCM_RI TIOCM_RNG
  38. #define TIOCM_OUT1 0x2000
  39. #define TIOCM_OUT2 0x4000
  40. #define TIOCM_LOOP 0x8000
  41. /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
  42. # ifdef __KERNEL__
  43. /* intr=^C quit=^\ erase=del kill=^U
  44. eof=^D vtime=\0 vmin=\1 sxtc=\0
  45. start=^Q stop=^S susp=^Z eol=\0
  46. reprint=^R discard=^U werase=^W lnext=^V
  47. eol2=\0
  48. */
  49. #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
  50. /*
  51. * Translate a "termio" structure into a "termios". Ugh.
  52. */
  53. #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
  54. unsigned short __tmp; \
  55. get_user(__tmp,&(termio)->x); \
  56. *(unsigned short *) &(termios)->x = __tmp; \
  57. }
  58. #define user_termio_to_kernel_termios(termios, termio) \
  59. ({ \
  60. SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
  61. SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
  62. SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
  63. SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
  64. copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
  65. })
  66. /*
  67. * Translate a "termios" structure into a "termio". Ugh.
  68. */
  69. #define kernel_termios_to_user_termio(termio, termios) \
  70. ({ \
  71. put_user((termios)->c_iflag, &(termio)->c_iflag); \
  72. put_user((termios)->c_oflag, &(termio)->c_oflag); \
  73. put_user((termios)->c_cflag, &(termio)->c_cflag); \
  74. put_user((termios)->c_lflag, &(termio)->c_lflag); \
  75. put_user((termios)->c_line, &(termio)->c_line); \
  76. copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
  77. })
  78. #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
  79. #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
  80. #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
  81. #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
  82. # endif /* __KERNEL__ */
  83. #endif /* _ASM_IA64_TERMIOS_H */