^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Modified 1999
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * 99/01/28 Added N_IRDA and N_SMSBLOCK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _ASM_IA64_TERMIOS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _ASM_IA64_TERMIOS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <uapi/asm/termios.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* intr=^C quit=^\ erase=del kill=^U
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) eof=^D vtime=\0 vmin=\1 sxtc=\0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) start=^Q stop=^S susp=^Z eol=\0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) reprint=^R discard=^U werase=^W lnext=^V
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) eol2=\0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * Translate a "termio" structure into a "termios". Ugh.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned short __tmp; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) get_user(__tmp,&(termio)->x); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *(unsigned short *) &(termios)->x = __tmp; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define user_termio_to_kernel_termios(termios, termio) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * Translate a "termios" structure into a "termio". Ugh.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define kernel_termios_to_user_termio(termio, termios) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) put_user((termios)->c_iflag, &(termio)->c_iflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) put_user((termios)->c_oflag, &(termio)->c_oflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) put_user((termios)->c_cflag, &(termio)->c_cflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) put_user((termios)->c_lflag, &(termio)->c_lflag); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) put_user((termios)->c_line, &(termio)->c_line); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif /* _ASM_IA64_TERMIOS_H */