stdio_dev.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * (C) Copyright 2000
  3. * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef _STDIO_DEV_H_
  8. #define _STDIO_DEV_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_SYSTEM 0x80000000 /* Device is a system device */
  16. #define DEV_EXT_VIDEO 0x00000001 /* Video extensions supported */
  17. /* Device information */
  18. struct stdio_dev {
  19. int flags; /* Device flags: input/output/system */
  20. int ext; /* Supported extensions */
  21. char name[16]; /* Device name */
  22. /* GENERAL functions */
  23. int (*start) (void); /* To start the device */
  24. int (*stop) (void); /* To stop the device */
  25. /* OUTPUT functions */
  26. void (*putc) (const char c); /* To put a char */
  27. void (*puts) (const char *s); /* To put a string (accelerator) */
  28. /* INPUT functions */
  29. int (*tstc) (void); /* To test if a char is ready... */
  30. int (*getc) (void); /* To get that char */
  31. /* Other functions */
  32. void *priv; /* Private extensions */
  33. struct list_head list;
  34. };
  35. /*
  36. * VIDEO EXTENSIONS
  37. */
  38. #define VIDEO_FORMAT_RGB_INDEXED 0x0000
  39. #define VIDEO_FORMAT_RGB_DIRECTCOLOR 0x0001
  40. #define VIDEO_FORMAT_YUYV_4_4_4 0x0010
  41. #define VIDEO_FORMAT_YUYV_4_2_2 0x0011
  42. typedef struct {
  43. void *address; /* Address of framebuffer */
  44. ushort width; /* Horizontal resolution */
  45. ushort height; /* Vertical resolution */
  46. uchar format; /* Format */
  47. uchar colors; /* Colors number or color depth */
  48. void (*setcolreg) (int, int, int, int);
  49. void (*getcolreg) (int, void *);
  50. } video_ext_t;
  51. /*
  52. * VARIABLES
  53. */
  54. extern struct stdio_dev *stdio_devices[];
  55. extern char *stdio_names[MAX_FILES];
  56. /*
  57. * PROTOTYPES
  58. */
  59. int stdio_register (struct stdio_dev * dev);
  60. int stdio_init (void);
  61. void stdio_print_current_devices(void);
  62. #ifdef CONFIG_SYS_STDIO_DEREGISTER
  63. int stdio_deregister(const char *devname);
  64. #endif
  65. struct list_head* stdio_get_list(void);
  66. struct stdio_dev* stdio_get_by_name(const char* name);
  67. struct stdio_dev* stdio_clone(struct stdio_dev *dev);
  68. #ifdef CONFIG_LCD
  69. int drv_lcd_init (void);
  70. #endif
  71. #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
  72. int drv_video_init (void);
  73. #endif
  74. #ifdef CONFIG_KEYBOARD
  75. int drv_keyboard_init (void);
  76. #endif
  77. #ifdef CONFIG_USB_TTY
  78. int drv_usbtty_init (void);
  79. #endif
  80. #ifdef CONFIG_NETCONSOLE
  81. int drv_nc_init (void);
  82. #endif
  83. #ifdef CONFIG_JTAG_CONSOLE
  84. int drv_jtag_console_init (void);
  85. #endif
  86. #ifdef CONFIG_CBMEM_CONSOLE
  87. int cbmemc_init(void);
  88. #endif
  89. #endif