]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/stdio_dev.h
Merge tag 'u-boot-rockchip-20190819' of https://gitlab.denx.de/u-boot/custodians...
[thirdparty/u-boot.git] / include / stdio_dev.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
e831ad54
WD
2/*
3 * (C) Copyright 2000
4 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
e831ad54
WD
5 */
6
52cb4d4f
JCPV
7#ifndef _STDIO_DEV_H_
8#define _STDIO_DEV_H_
e831ad54 9
27b4225b 10#include <stdio.h>
52cb4d4f 11#include <linux/list.h>
e831ad54
WD
12
13/*
52cb4d4f 14 * STDIO DEVICES
e831ad54
WD
15 */
16
17#define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */
18#define DEV_FLAGS_OUTPUT 0x00000002 /* Device can be used as output console */
7b3c4c3a 19#define DEV_FLAGS_DM 0x00000004 /* Device priv is a struct udevice * */
e831ad54 20
47cd00fa 21/* Device information */
52cb4d4f 22struct stdio_dev {
e831ad54
WD
23 int flags; /* Device flags: input/output/system */
24 int ext; /* Supported extensions */
5294e978 25 char name[32]; /* Device name */
e831ad54
WD
26
27/* GENERAL functions */
28
709ea543
SG
29 int (*start)(struct stdio_dev *dev); /* To start the device */
30 int (*stop)(struct stdio_dev *dev); /* To stop the device */
e831ad54
WD
31
32/* OUTPUT functions */
33
709ea543
SG
34 /* To put a char */
35 void (*putc)(struct stdio_dev *dev, const char c);
36 /* To put a string (accelerator) */
37 void (*puts)(struct stdio_dev *dev, const char *s);
e831ad54
WD
38
39/* INPUT functions */
40
709ea543
SG
41 /* To test if a char is ready... */
42 int (*tstc)(struct stdio_dev *dev);
43 int (*getc)(struct stdio_dev *dev); /* To get that char */
e831ad54
WD
44
45/* Other functions */
46
47 void *priv; /* Private extensions */
c1de7a6d 48 struct list_head list;
52cb4d4f 49};
e831ad54 50
e831ad54
WD
51/*
52 * VARIABLES
53 */
52cb4d4f 54extern struct stdio_dev *stdio_devices[];
e831ad54
WD
55extern char *stdio_names[MAX_FILES];
56
57/*
58 * PROTOTYPES
59 */
52cb4d4f 60int stdio_register (struct stdio_dev * dev);
d97143a6 61int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp);
9fb02491
SG
62
63/**
64 * stdio_init_tables() - set up stdio tables ready for devices
65 *
66 * This does not add any devices, but just prepares stdio for use.
67 */
68int stdio_init_tables(void);
69
70/**
71 * stdio_add_devices() - Add stdio devices to the table
72 *
73 * This makes calls to all the various subsystems that use stdio, to make
74 * them register with stdio.
75 */
76int stdio_add_devices(void);
77
78/**
79 * stdio_init() - Sets up stdio ready for use
80 *
81 * This calls stdio_init_tables() and stdio_add_devices()
82 */
83int stdio_init(void);
84
7e3be7cf 85void stdio_print_current_devices(void);
869588de 86#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
32d01926
HG
87int stdio_deregister(const char *devname, int force);
88int stdio_deregister_dev(struct stdio_dev *dev, int force);
fea91ede 89#endif
52cb4d4f 90struct list_head* stdio_get_list(void);
d7be3056 91struct stdio_dev* stdio_get_by_name(const char* name);
52cb4d4f 92struct stdio_dev* stdio_clone(struct stdio_dev *dev);
c1de7a6d 93
e831ad54
WD
94#ifdef CONFIG_LCD
95int drv_lcd_init (void);
96#endif
a6c7ad2f 97#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
e831ad54
WD
98int drv_video_init (void);
99#endif
682011ff
WD
100#ifdef CONFIG_KEYBOARD
101int drv_keyboard_init (void);
e831ad54 102#endif
232c150a
WD
103#ifdef CONFIG_USB_TTY
104int drv_usbtty_init (void);
105#endif
68ceb29e
WD
106#ifdef CONFIG_NETCONSOLE
107int drv_nc_init (void);
108#endif
36ea8e9a
MF
109#ifdef CONFIG_JTAG_CONSOLE
110int drv_jtag_console_init (void);
111#endif
98ab435f
VB
112#ifdef CONFIG_CBMEM_CONSOLE
113int cbmemc_init(void);
114#endif
e831ad54 115
52cb4d4f 116#endif