stdio_dev.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000
  4. * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
  5. */
  6. #ifndef _STDIO_DEV_H_
  7. #define _STDIO_DEV_H_
  8. #include <stdio.h>
  9. #include <linux/list.h>
  10. /*
  11. * STDIO DEVICES
  12. */
  13. #define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */
  14. #define DEV_FLAGS_OUTPUT 0x00000002 /* Device can be used as output console */
  15. #define DEV_FLAGS_DM 0x00000004 /* Device priv is a struct udevice * */
  16. /* Device information */
  17. struct stdio_dev {
  18. int flags; /* Device flags: input/output/system */
  19. int ext; /* Supported extensions */
  20. char name[32]; /* Device name */
  21. /* GENERAL functions */
  22. int (*start)(struct stdio_dev *dev); /* To start the device */
  23. int (*stop)(struct stdio_dev *dev); /* To stop the device */
  24. /* OUTPUT functions */
  25. /* To put a char */
  26. void (*putc)(struct stdio_dev *dev, const char c);
  27. /* To put a string (accelerator) */
  28. void (*puts)(struct stdio_dev *dev, const char *s);
  29. /* INPUT functions */
  30. /* To test if a char is ready... */
  31. int (*tstc)(struct stdio_dev *dev);
  32. int (*getc)(struct stdio_dev *dev); /* To get that char */
  33. /* Other functions */
  34. void *priv; /* Private extensions */
  35. struct list_head list;
  36. };
  37. /*
  38. * VARIABLES
  39. */
  40. extern struct stdio_dev *stdio_devices[];
  41. extern char *stdio_names[MAX_FILES];
  42. /*
  43. * PROTOTYPES
  44. */
  45. int stdio_register (struct stdio_dev * dev);
  46. int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp);
  47. /**
  48. * stdio_init_tables() - set up stdio tables ready for devices
  49. *
  50. * This does not add any devices, but just prepares stdio for use.
  51. */
  52. int stdio_init_tables(void);
  53. /**
  54. * stdio_add_devices() - Add stdio devices to the table
  55. *
  56. * This makes calls to all the various subsystems that use stdio, to make
  57. * them register with stdio.
  58. */
  59. int stdio_add_devices(void);
  60. /**
  61. * stdio_init() - Sets up stdio ready for use
  62. *
  63. * This calls stdio_init_tables() and stdio_add_devices()
  64. */
  65. int stdio_init(void);
  66. void stdio_print_current_devices(void);
  67. #if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
  68. int stdio_deregister(const char *devname, int force);
  69. int stdio_deregister_dev(struct stdio_dev *dev, int force);
  70. #endif
  71. struct list_head* stdio_get_list(void);
  72. struct stdio_dev* stdio_get_by_name(const char* name);
  73. struct stdio_dev* stdio_clone(struct stdio_dev *dev);
  74. #ifdef CONFIG_LCD
  75. int drv_lcd_init (void);
  76. #endif
  77. #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
  78. int drv_video_init (void);
  79. #endif
  80. #ifdef CONFIG_KEYBOARD
  81. int drv_keyboard_init (void);
  82. #endif
  83. #ifdef CONFIG_USB_TTY
  84. int drv_usbtty_init (void);
  85. #endif
  86. #ifdef CONFIG_NETCONSOLE
  87. int drv_nc_init (void);
  88. #endif
  89. #ifdef CONFIG_JTAG_CONSOLE
  90. int drv_jtag_console_init (void);
  91. #endif
  92. #ifdef CONFIG_CBMEM_CONSOLE
  93. int cbmemc_init(void);
  94. #endif
  95. #endif