1dbddf429SAlex Dewar/* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
41da177e4SLinus Torvalds */
51da177e4SLinus Torvalds
61da177e4SLinus Torvalds#ifndef __CHAN_KERN_H__
71da177e4SLinus Torvalds#define __CHAN_KERN_H__
81da177e4SLinus Torvalds
9510c72a3SAl Viro#include <linux/tty.h>
10510c72a3SAl Viro#include <linux/list.h>
11510c72a3SAl Viro#include <linux/console.h>
121da177e4SLinus Torvalds#include "chan_user.h"
131da177e4SLinus Torvalds#include "line.h"
141da177e4SLinus Torvalds
151da177e4SLinus Torvaldsstruct chan {
161da177e4SLinus Torvalds	struct list_head list;
17165dc591SJeff Dike	struct list_head free_list;
18165dc591SJeff Dike	struct line *line;
191da177e4SLinus Torvalds	char *dev;
201da177e4SLinus Torvalds	unsigned int primary:1;
211da177e4SLinus Torvalds	unsigned int input:1;
221da177e4SLinus Torvalds	unsigned int output:1;
231da177e4SLinus Torvalds	unsigned int opened:1;
24165dc591SJeff Dike	unsigned int enabled:1;
251da177e4SLinus Torvalds	int fd;
265e7672ecSJeff Dike	const struct chan_ops *ops;
271da177e4SLinus Torvalds	void *data;
281da177e4SLinus Torvalds};
291da177e4SLinus Torvalds
302e124b4aSJiri Slabyextern void chan_interrupt(struct line *line, int irq);
31165dc591SJeff Dikeextern int parse_chan_pair(char *str, struct line *line, int device,
32f28169d2SJeff Dike			   const struct chan_opts *opts, char **error_out);
33bed5e39cSAl Viroextern int write_chan(struct chan *chan, const char *buf, int len,
341da177e4SLinus Torvalds			     int write_irq);
35bed5e39cSAl Viroextern int console_write_chan(struct chan *chan, const char *buf,
361da177e4SLinus Torvalds			      int len);
37a52f362fSJeff Dikeextern int console_open_chan(struct line *line, struct console *co);
38bed5e39cSAl Viroextern void deactivate_chan(struct chan *chan, int irq);
39bed5e39cSAl Viroextern void reactivate_chan(struct chan *chan, int irq);
402116bda6SRichard Weinbergerextern void chan_enable_winch(struct chan *chan, struct tty_port *port);
41d14ad81fSJeff Dikeextern int enable_chan(struct line *line);
4210c890c0SAl Viroextern void close_chan(struct line *line);
43bed5e39cSAl Viroextern int chan_window_size(struct line *line,
441da177e4SLinus Torvalds			     unsigned short *rows_out,
451da177e4SLinus Torvalds			     unsigned short *cols_out);
46bed5e39cSAl Viroextern int chan_config_string(struct line *line, char *str, int size,
471da177e4SLinus Torvalds			      char **error_out);
481da177e4SLinus Torvalds
491da177e4SLinus Torvalds#endif
50