line.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __LINE_H__
  6. #define __LINE_H__
  7. #include "linux/list.h"
  8. #include "linux/workqueue.h"
  9. #include "linux/tty.h"
  10. #include "linux/interrupt.h"
  11. #include "asm/semaphore.h"
  12. #include "chan_user.h"
  13. #include "mconsole_kern.h"
  14. struct line_driver {
  15. char *name;
  16. char *device_name;
  17. char *devfs_name;
  18. short major;
  19. short minor_start;
  20. short type;
  21. short subtype;
  22. int read_irq;
  23. char *read_irq_name;
  24. int write_irq;
  25. char *write_irq_name;
  26. char *symlink_from;
  27. char *symlink_to;
  28. struct mc_device mc;
  29. };
  30. struct line {
  31. char *init_str;
  32. int init_pri;
  33. struct list_head chan_list;
  34. int valid;
  35. int count;
  36. struct semaphore sem;
  37. char *buffer;
  38. char *head;
  39. char *tail;
  40. int sigio;
  41. struct work_struct task;
  42. struct line_driver *driver;
  43. int have_irq;
  44. };
  45. #define LINE_INIT(str, d) \
  46. { init_str : str, \
  47. init_pri : INIT_STATIC, \
  48. chan_list : { }, \
  49. valid : 1, \
  50. sem : { }, \
  51. buffer : NULL, \
  52. head : NULL, \
  53. tail : NULL, \
  54. sigio : 0, \
  55. driver : d, \
  56. have_irq : 0 }
  57. struct lines {
  58. int num;
  59. };
  60. #define LINES_INIT(n) { num : n }
  61. extern void line_close(struct tty_struct *tty, struct file * filp);
  62. extern int line_open(struct line *lines, struct tty_struct *tty,
  63. struct chan_opts *opts);
  64. extern int line_setup(struct line *lines, int num, char *init,
  65. int all_allowed);
  66. extern int line_write(struct tty_struct *tty, const unsigned char *buf, int len);
  67. extern void line_put_char(struct tty_struct *tty, unsigned char ch);
  68. extern void line_set_termios(struct tty_struct *tty, struct termios * old);
  69. extern int line_chars_in_buffer(struct tty_struct *tty);
  70. extern int line_write_room(struct tty_struct *tty);
  71. extern int line_ioctl(struct tty_struct *tty, struct file * file,
  72. unsigned int cmd, unsigned long arg);
  73. extern char *add_xterm_umid(char *base);
  74. extern int line_setup_irq(int fd, int input, int output, struct tty_struct *tty);
  75. extern void line_close_chan(struct line *line);
  76. extern void line_disable(struct tty_struct *tty, int current_irq);
  77. extern struct tty_driver * line_register_devfs(struct lines *set,
  78. struct line_driver *line_driver,
  79. struct tty_operations *driver,
  80. struct line *lines,
  81. int nlines);
  82. extern void lines_init(struct line *lines, int nlines);
  83. extern void close_lines(struct line *lines, int nlines);
  84. extern int line_config(struct line *lines, int num, char *str);
  85. extern int line_remove(struct line *lines, int num, char *str);
  86. extern int line_get_config(char *dev, struct line *lines, int num, char *str,
  87. int size, char **error_out);
  88. #endif
  89. /*
  90. * Overrides for Emacs so that we follow Linus's tabbing style.
  91. * Emacs will notice this stuff at the end of the file and automatically
  92. * adjust the settings for this buffer only. This must remain at the end
  93. * of the file.
  94. * ---------------------------------------------------------------------------
  95. * Local variables:
  96. * c-file-style: "linux"
  97. * End:
  98. */