Blame view

include/stdio_dev.h 2.74 KB
83d290c56   Tom Rini   SPDX: Convert all...
1
  /* SPDX-License-Identifier: GPL-2.0+ */
e831ad54a   wdenk   Initial revision
2
3
4
  /*
   * (C) Copyright 2000
   * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
e831ad54a   wdenk   Initial revision
5
   */
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
6
7
  #ifndef _STDIO_DEV_H_
  #define _STDIO_DEV_H_
e831ad54a   wdenk   Initial revision
8

27b4225b3   Tom Rini   stdio_names: Ensu...
9
  #include <stdio.h>
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
10
  #include <linux/list.h>
e831ad54a   wdenk   Initial revision
11
12
  
  /*
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
13
   * STDIO DEVICES
e831ad54a   wdenk   Initial revision
14
15
16
17
   */
  
  #define DEV_FLAGS_INPUT	 0x00000001	/* Device can be used as input	console */
  #define DEV_FLAGS_OUTPUT 0x00000002	/* Device can be used as output console */
7b3c4c3a5   Simon Glass   dm: console: Chec...
18
  #define DEV_FLAGS_DM     0x00000004	/* Device priv is a struct udevice * */
e831ad54a   wdenk   Initial revision
19

47cd00fa7   wdenk   * Patches by Robe...
20
  /* Device information */
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
21
  struct stdio_dev {
e831ad54a   wdenk   Initial revision
22
23
  	int	flags;			/* Device flags: input/output/system	*/
  	int	ext;			/* Supported extensions			*/
5294e9783   Alexey Brodkin   stdio: extend "na...
24
  	char	name[32];		/* Device name				*/
e831ad54a   wdenk   Initial revision
25
26
  
  /* GENERAL functions */
709ea543b   Simon Glass   stdio: Pass devic...
27
28
  	int (*start)(struct stdio_dev *dev);	/* To start the device */
  	int (*stop)(struct stdio_dev *dev);	/* To stop the device */
e831ad54a   wdenk   Initial revision
29
30
  
  /* OUTPUT functions */
709ea543b   Simon Glass   stdio: Pass devic...
31
32
33
34
  	/* To put a char */
  	void (*putc)(struct stdio_dev *dev, const char c);
  	/* To put a string (accelerator) */
  	void (*puts)(struct stdio_dev *dev, const char *s);
e831ad54a   wdenk   Initial revision
35
36
  
  /* INPUT functions */
709ea543b   Simon Glass   stdio: Pass devic...
37
38
39
  	/* To test if a char is ready... */
  	int (*tstc)(struct stdio_dev *dev);
  	int (*getc)(struct stdio_dev *dev);	/* To get that char */
e831ad54a   wdenk   Initial revision
40
41
42
43
  
  /* Other functions */
  
  	void *priv;			/* Private extensions			*/
c1de7a6da   Jean-Christophe PLAGNIOL-VILLARD   devices: merge to...
44
  	struct list_head list;
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
45
  };
e831ad54a   wdenk   Initial revision
46
47
  
  /*
e831ad54a   wdenk   Initial revision
48
49
   * VARIABLES
   */
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
50
  extern struct stdio_dev *stdio_devices[];
e831ad54a   wdenk   Initial revision
51
52
53
54
55
  extern char *stdio_names[MAX_FILES];
  
  /*
   * PROTOTYPES
   */
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
56
  int	stdio_register (struct stdio_dev * dev);
d97143a67   Simon Glass   stdio: Provide fu...
57
  int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp);
9fb02491f   Simon Glass   dm: Make driver m...
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  
  /**
   * stdio_init_tables() - set up stdio tables ready for devices
   *
   * This does not add any devices, but just prepares stdio for use.
   */
  int stdio_init_tables(void);
  
  /**
   * stdio_add_devices() - Add stdio devices to the table
   *
   * This makes calls to all the various subsystems that use stdio, to make
   * them register with stdio.
   */
  int stdio_add_devices(void);
  
  /**
   * stdio_init() - Sets up stdio ready for use
   *
   * This calls stdio_init_tables() and stdio_add_devices()
   */
  int stdio_init(void);
7e3be7cf3   Jean-Christophe PLAGNIOL-VILLARD   console: unify pr...
80
  void	stdio_print_current_devices(void);
869588dec   Simon Glass   Convert CONFIG_SY...
81
  #if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
32d019265   Hans de Goede   stdio: Add force ...
82
83
  int stdio_deregister(const char *devname, int force);
  int stdio_deregister_dev(struct stdio_dev *dev, int force);
fea91edee   Jean-Christophe PLAGNIOL-VILLARD   usb_kbd: fix usb_...
84
  #endif
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
85
  struct list_head* stdio_get_list(void);
d7be3056d   Mike Frysinger   stdio: constify "...
86
  struct stdio_dev* stdio_get_by_name(const char* name);
52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
87
  struct stdio_dev* stdio_clone(struct stdio_dev *dev);
c1de7a6da   Jean-Christophe PLAGNIOL-VILLARD   devices: merge to...
88

e831ad54a   wdenk   Initial revision
89
90
91
  #ifdef CONFIG_LCD
  int	drv_lcd_init (void);
  #endif
a6c7ad2f6   wdenk   * Fix startup pro...
92
  #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
e831ad54a   wdenk   Initial revision
93
94
  int	drv_video_init (void);
  #endif
682011ff6   wdenk   * Patches by Udi ...
95
96
  #ifdef CONFIG_KEYBOARD
  int	drv_keyboard_init (void);
e831ad54a   wdenk   Initial revision
97
  #endif
232c150a2   wdenk   Add support for S...
98
99
100
  #ifdef CONFIG_USB_TTY
  int	drv_usbtty_init (void);
  #endif
68ceb29e7   wdenk   Add support for c...
101
102
103
  #ifdef CONFIG_NETCONSOLE
  int	drv_nc_init (void);
  #endif
36ea8e9ad   Mike Frysinger   Blackfin: support...
104
105
106
  #ifdef CONFIG_JTAG_CONSOLE
  int drv_jtag_console_init (void);
  #endif
98ab435f7   Vadim Bendebury   x86: Add CBMEM co...
107
108
109
  #ifdef CONFIG_CBMEM_CONSOLE
  int cbmemc_init(void);
  #endif
e831ad54a   wdenk   Initial revision
110

52cb4d4fb   Jean-Christophe PLAGNIOL-VILLARD   stdio/device: rew...
111
  #endif