generic_serial.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * generic_serial.h
  3. *
  4. * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
  5. *
  6. * written for the SX serial driver.
  7. * Contains the code that should be shared over all the serial drivers.
  8. *
  9. * Version 0.1 -- December, 1998.
  10. */
  11. #ifndef GENERIC_SERIAL_H
  12. #define GENERIC_SERIAL_H
  13. #ifdef __KERNEL__
  14. #include <linux/mutex.h>
  15. struct real_driver {
  16. void (*disable_tx_interrupts) (void *);
  17. void (*enable_tx_interrupts) (void *);
  18. void (*disable_rx_interrupts) (void *);
  19. void (*enable_rx_interrupts) (void *);
  20. int (*get_CD) (void *);
  21. void (*shutdown_port) (void*);
  22. int (*set_real_termios) (void*);
  23. int (*chars_in_buffer) (void*);
  24. void (*close) (void*);
  25. void (*hungup) (void*);
  26. void (*getserial) (void*, struct serial_struct *sp);
  27. };
  28. struct gs_port {
  29. int magic;
  30. unsigned char *xmit_buf;
  31. int xmit_head;
  32. int xmit_tail;
  33. int xmit_cnt;
  34. struct mutex port_write_mutex;
  35. int flags;
  36. wait_queue_head_t open_wait;
  37. wait_queue_head_t close_wait;
  38. int count;
  39. int blocked_open;
  40. struct tty_struct *tty;
  41. unsigned long event;
  42. unsigned short closing_wait;
  43. int close_delay;
  44. struct real_driver *rd;
  45. int wakeup_chars;
  46. int baud_base;
  47. int baud;
  48. int custom_divisor;
  49. spinlock_t driver_lock;
  50. };
  51. #endif /* __KERNEL__ */
  52. /* Flags */
  53. /* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
  54. used in serial.c, but they are also used in all other serial drivers.
  55. Make sure they don't clash with these here... */
  56. #define GS_TX_INTEN 0x00800000
  57. #define GS_RX_INTEN 0x00400000
  58. #define GS_ACTIVE 0x00200000
  59. #define GS_TYPE_NORMAL 1
  60. #define GS_DEBUG_FLUSH 0x00000001
  61. #define GS_DEBUG_BTR 0x00000002
  62. #define GS_DEBUG_TERMIOS 0x00000004
  63. #define GS_DEBUG_STUFF 0x00000008
  64. #define GS_DEBUG_CLOSE 0x00000010
  65. #define GS_DEBUG_FLOW 0x00000020
  66. #define GS_DEBUG_WRITE 0x00000040
  67. #ifdef __KERNEL__
  68. void gs_put_char(struct tty_struct *tty, unsigned char ch);
  69. int gs_write(struct tty_struct *tty,
  70. const unsigned char *buf, int count);
  71. int gs_write_room(struct tty_struct *tty);
  72. int gs_chars_in_buffer(struct tty_struct *tty);
  73. void gs_flush_buffer(struct tty_struct *tty);
  74. void gs_flush_chars(struct tty_struct *tty);
  75. void gs_stop(struct tty_struct *tty);
  76. void gs_start(struct tty_struct *tty);
  77. void gs_hangup(struct tty_struct *tty);
  78. int gs_block_til_ready(void *port, struct file *filp);
  79. void gs_close(struct tty_struct *tty, struct file *filp);
  80. void gs_set_termios (struct tty_struct * tty,
  81. struct ktermios * old_termios);
  82. int gs_init_port(struct gs_port *port);
  83. int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
  84. int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
  85. void gs_got_break(struct gs_port *port);
  86. #endif /* __KERNEL__ */
  87. #endif