11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _CRIS_TERMIOS_H 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _CRIS_TERMIOS_H 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4e717abac8a9f65eee6de3bb37e10c6916bced483David Howells#include <uapi/asm/termios.h> 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* intr=^C quit=^\ erase=del kill=^U 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds eof=^D vtime=\0 vmin=\1 sxtc=\0 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds start=^Q stop=^S susp=^Z eol=\0 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds reprint=^R discard=^U werase=^W lnext=^V 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds eol2=\0 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Translate a "termio" structure into a "termios". Ugh. 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned short __tmp; \ 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds get_user(__tmp,&(termio)->x); \ 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *(unsigned short *) &(termios)->x = __tmp; \ 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define user_termio_to_kernel_termios(termios, termio) \ 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds({ \ 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}) 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Translate a "termios" structure into a "termio". Ugh. 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define kernel_termios_to_user_termio(termio, termios) \ 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds({ \ 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds put_user((termios)->c_iflag, &(termio)->c_iflag); \ 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds put_user((termios)->c_oflag, &(termio)->c_oflag); \ 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds put_user((termios)->c_cflag, &(termio)->c_cflag); \ 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds put_user((termios)->c_lflag, &(termio)->c_lflag); \ 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds put_user((termios)->c_line, &(termio)->c_line); \ 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}) 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 46e30afd5119f5a3684e4e5e66bbaeb9c8d2c814beAlan Cox#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) 47e30afd5119f5a3684e4e5e66bbaeb9c8d2c814beAlan Cox#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) 48e30afd5119f5a3684e4e5e66bbaeb9c8d2c814beAlan Cox#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) 49e30afd5119f5a3684e4e5e66bbaeb9c8d2c814beAlan Cox#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _CRIS_TERMIOS_H */ 52