xref: /kernel/linux/linux-5.10/arch/um/drivers/chan.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __CHAN_KERN_H__
78c2ecf20Sopenharmony_ci#define __CHAN_KERN_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/tty.h>
108c2ecf20Sopenharmony_ci#include <linux/list.h>
118c2ecf20Sopenharmony_ci#include <linux/console.h>
128c2ecf20Sopenharmony_ci#include "chan_user.h"
138c2ecf20Sopenharmony_ci#include "line.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct chan {
168c2ecf20Sopenharmony_ci	struct list_head list;
178c2ecf20Sopenharmony_ci	struct list_head free_list;
188c2ecf20Sopenharmony_ci	struct line *line;
198c2ecf20Sopenharmony_ci	char *dev;
208c2ecf20Sopenharmony_ci	unsigned int primary:1;
218c2ecf20Sopenharmony_ci	unsigned int input:1;
228c2ecf20Sopenharmony_ci	unsigned int output:1;
238c2ecf20Sopenharmony_ci	unsigned int opened:1;
248c2ecf20Sopenharmony_ci	unsigned int enabled:1;
258c2ecf20Sopenharmony_ci	int fd;
268c2ecf20Sopenharmony_ci	const struct chan_ops *ops;
278c2ecf20Sopenharmony_ci	void *data;
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciextern void chan_interrupt(struct line *line, int irq);
318c2ecf20Sopenharmony_ciextern int parse_chan_pair(char *str, struct line *line, int device,
328c2ecf20Sopenharmony_ci			   const struct chan_opts *opts, char **error_out);
338c2ecf20Sopenharmony_ciextern int write_chan(struct chan *chan, const char *buf, int len,
348c2ecf20Sopenharmony_ci			     int write_irq);
358c2ecf20Sopenharmony_ciextern int console_write_chan(struct chan *chan, const char *buf,
368c2ecf20Sopenharmony_ci			      int len);
378c2ecf20Sopenharmony_ciextern int console_open_chan(struct line *line, struct console *co);
388c2ecf20Sopenharmony_ciextern void deactivate_chan(struct chan *chan, int irq);
398c2ecf20Sopenharmony_ciextern void reactivate_chan(struct chan *chan, int irq);
408c2ecf20Sopenharmony_ciextern void chan_enable_winch(struct chan *chan, struct tty_port *port);
418c2ecf20Sopenharmony_ciextern int enable_chan(struct line *line);
428c2ecf20Sopenharmony_ciextern void close_chan(struct line *line);
438c2ecf20Sopenharmony_ciextern int chan_window_size(struct line *line,
448c2ecf20Sopenharmony_ci			     unsigned short *rows_out,
458c2ecf20Sopenharmony_ci			     unsigned short *cols_out);
468c2ecf20Sopenharmony_ciextern int chan_config_string(struct line *line, char *str, int size,
478c2ecf20Sopenharmony_ci			      char **error_out);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#endif
50