162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __CHAN_KERN_H__
762306a36Sopenharmony_ci#define __CHAN_KERN_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/tty.h>
1062306a36Sopenharmony_ci#include <linux/list.h>
1162306a36Sopenharmony_ci#include <linux/console.h>
1262306a36Sopenharmony_ci#include "chan_user.h"
1362306a36Sopenharmony_ci#include "line.h"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct chan {
1662306a36Sopenharmony_ci	struct list_head list;
1762306a36Sopenharmony_ci	struct list_head free_list;
1862306a36Sopenharmony_ci	struct line *line;
1962306a36Sopenharmony_ci	char *dev;
2062306a36Sopenharmony_ci	unsigned int primary:1;
2162306a36Sopenharmony_ci	unsigned int input:1;
2262306a36Sopenharmony_ci	unsigned int output:1;
2362306a36Sopenharmony_ci	unsigned int opened:1;
2462306a36Sopenharmony_ci	unsigned int enabled:1;
2562306a36Sopenharmony_ci	int fd;
2662306a36Sopenharmony_ci	const struct chan_ops *ops;
2762306a36Sopenharmony_ci	void *data;
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciextern void chan_interrupt(struct line *line, int irq);
3162306a36Sopenharmony_ciextern int parse_chan_pair(char *str, struct line *line, int device,
3262306a36Sopenharmony_ci			   const struct chan_opts *opts, char **error_out);
3362306a36Sopenharmony_ciextern int write_chan(struct chan *chan, const char *buf, int len,
3462306a36Sopenharmony_ci			     int write_irq);
3562306a36Sopenharmony_ciextern int console_write_chan(struct chan *chan, const char *buf,
3662306a36Sopenharmony_ci			      int len);
3762306a36Sopenharmony_ciextern int console_open_chan(struct line *line, struct console *co);
3862306a36Sopenharmony_ciextern void deactivate_chan(struct chan *chan, int irq);
3962306a36Sopenharmony_ciextern void chan_enable_winch(struct chan *chan, struct tty_port *port);
4062306a36Sopenharmony_ciextern int enable_chan(struct line *line);
4162306a36Sopenharmony_ciextern void close_chan(struct line *line);
4262306a36Sopenharmony_ciextern int chan_window_size(struct line *line,
4362306a36Sopenharmony_ci			     unsigned short *rows_out,
4462306a36Sopenharmony_ci			     unsigned short *cols_out);
4562306a36Sopenharmony_ciextern int chan_config_string(struct line *line, char *str, int size,
4662306a36Sopenharmony_ci			      char **error_out);
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#endif
49