2005-04-16 15:20:36 -07:00
|
|
|
#ifndef _LINUX_TTY_FLIP_H
|
|
|
|
|
#define _LINUX_TTY_FLIP_H
|
|
|
|
|
|
2013-11-22 12:09:55 -05:00
|
|
|
extern int tty_buffer_set_limit(struct tty_port *port, int limit);
|
2013-06-15 09:36:08 -04:00
|
|
|
extern int tty_buffer_space_avail(struct tty_port *port);
|
2013-01-03 15:53:01 +01:00
|
|
|
extern int tty_buffer_request_room(struct tty_port *port, size_t size);
|
2013-01-03 15:53:02 +01:00
|
|
|
extern int tty_insert_flip_string_flags(struct tty_port *port,
|
|
|
|
|
const unsigned char *chars, const char *flags, size_t size);
|
|
|
|
|
extern int tty_insert_flip_string_fixed_flag(struct tty_port *port,
|
|
|
|
|
const unsigned char *chars, char flag, size_t size);
|
|
|
|
|
extern int tty_prepare_flip_string(struct tty_port *port,
|
|
|
|
|
unsigned char **chars, size_t size);
|
2013-01-03 15:53:06 +01:00
|
|
|
extern void tty_flip_buffer_push(struct tty_port *port);
|
2013-01-03 15:53:07 +01:00
|
|
|
void tty_schedule_flip(struct tty_port *port);
|
2006-01-09 20:54:13 -08:00
|
|
|
|
2013-01-03 15:53:03 +01:00
|
|
|
static inline int tty_insert_flip_char(struct tty_port *port,
|
2006-04-10 22:54:05 -07:00
|
|
|
unsigned char ch, char flag)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2013-01-03 15:53:03 +01:00
|
|
|
struct tty_buffer *tb = port->buf.tail;
|
2013-12-09 09:23:52 -05:00
|
|
|
int change;
|
|
|
|
|
|
|
|
|
|
change = (tb->flags & TTYB_NORMAL) && (flag != TTY_NORMAL);
|
|
|
|
|
if (!change && tb->used < tb->size) {
|
|
|
|
|
if (~tb->flags & TTYB_NORMAL)
|
|
|
|
|
*flag_buf_ptr(tb, tb->used) = flag;
|
2013-06-15 09:36:01 -04:00
|
|
|
*char_buf_ptr(tb, tb->used++) = ch;
|
2006-01-09 20:54:13 -08:00
|
|
|
return 1;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
2013-01-03 15:53:03 +01:00
|
|
|
return tty_insert_flip_string_flags(port, &ch, &flag, 1);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
2013-01-03 15:53:04 +01:00
|
|
|
static inline int tty_insert_flip_string(struct tty_port *port,
|
|
|
|
|
const unsigned char *chars, size_t size)
|
2010-02-18 16:43:54 +00:00
|
|
|
{
|
2013-01-03 15:53:04 +01:00
|
|
|
return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
|
2010-02-18 16:43:54 +00:00
|
|
|
}
|
|
|
|
|
|
2013-06-15 09:36:15 -04:00
|
|
|
extern void tty_buffer_lock_exclusive(struct tty_port *port);
|
|
|
|
|
extern void tty_buffer_unlock_exclusive(struct tty_port *port);
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif /* _LINUX_TTY_FLIP_H */
|