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