2000-11-12 23:38:42 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000
|
|
|
|
* Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CONSOLE_H_
|
|
|
|
#define _CONSOLE_H_
|
|
|
|
|
2007-07-05 16:01:59 +00:00
|
|
|
#include <param.h>
|
2009-11-02 13:31:18 +00:00
|
|
|
#include <linux/list.h>
|
2009-06-11 13:33:49 +00:00
|
|
|
#include <driver.h>
|
2007-07-05 16:01:59 +00:00
|
|
|
|
2007-07-05 16:01:48 +00:00
|
|
|
#define CONSOLE_STDIN (1 << 0)
|
|
|
|
#define CONSOLE_STDOUT (1 << 1)
|
|
|
|
#define CONSOLE_STDERR (1 << 2)
|
2000-11-12 23:38:42 +00:00
|
|
|
|
2013-09-19 13:20:24 +00:00
|
|
|
enum console_mode {
|
|
|
|
CONSOLE_MODE_NORMAL,
|
|
|
|
CONSOLE_MODE_RS485,
|
|
|
|
};
|
|
|
|
|
2007-07-05 16:01:48 +00:00
|
|
|
struct console_device {
|
|
|
|
struct device_d *dev;
|
2009-06-11 13:33:49 +00:00
|
|
|
struct device_d class_dev;
|
2007-07-05 16:01:59 +00:00
|
|
|
|
2007-07-05 16:01:48 +00:00
|
|
|
int (*tstc)(struct console_device *cdev);
|
|
|
|
void (*putc)(struct console_device *cdev, char c);
|
|
|
|
int (*getc)(struct console_device *cdev);
|
2007-07-05 16:02:17 +00:00
|
|
|
int (*setbrg)(struct console_device *cdev, int baudrate);
|
2009-02-21 00:22:48 +00:00
|
|
|
void (*flush)(struct console_device *cdev);
|
2013-09-19 13:20:24 +00:00
|
|
|
int (*set_mode)(struct console_device *cdev, enum console_mode mode);
|
2007-07-05 16:02:17 +00:00
|
|
|
|
2007-10-11 18:36:57 +00:00
|
|
|
struct list_head list;
|
2007-07-05 16:01:59 +00:00
|
|
|
|
|
|
|
unsigned char f_active;
|
2013-04-06 09:25:28 +00:00
|
|
|
|
|
|
|
unsigned int baudrate;
|
2013-11-26 12:08:28 +00:00
|
|
|
|
|
|
|
const char *linux_console_name;
|
2007-07-05 16:01:48 +00:00
|
|
|
};
|
2000-11-12 23:38:42 +00:00
|
|
|
|
2007-07-05 16:01:48 +00:00
|
|
|
int console_register(struct console_device *cdev);
|
2011-11-24 03:01:26 +00:00
|
|
|
int console_unregister(struct console_device *cdev);
|
2000-11-12 23:38:42 +00:00
|
|
|
|
2013-09-19 13:20:23 +00:00
|
|
|
struct console_device *console_get_by_dev(struct device_d *dev);
|
|
|
|
|
2007-10-11 18:36:57 +00:00
|
|
|
extern struct list_head console_list;
|
|
|
|
#define for_each_console(console) list_for_each_entry(console, &console_list, list)
|
|
|
|
|
2007-07-05 16:02:02 +00:00
|
|
|
#define CFG_PBSIZE (CONFIG_CBSIZE+sizeof(CONFIG_PROMPT)+16)
|
|
|
|
|
2013-09-16 17:49:58 +00:00
|
|
|
bool console_is_input_allow(void);
|
|
|
|
void console_allow_input(bool val);
|
|
|
|
|
2013-02-07 12:47:26 +00:00
|
|
|
extern int barebox_loglevel;
|
|
|
|
|
2013-10-03 07:21:53 +00:00
|
|
|
struct console_device *console_get_first_active(void);
|
|
|
|
|
2000-11-12 23:38:42 +00:00
|
|
|
#endif
|