generic_serial.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. #include <linux/tty.h>
  16. struct real_driver {
  17. void (*disable_tx_interrupts) (void *);
  18. void (*enable_tx_interrupts) (void *);
  19. void (*disable_rx_interrupts) (void *);
  20. void (*enable_rx_interrupts) (void *);
  21. int (*get_CD) (void *);
  22. void (*shutdown_port) (void*);
  23. int (*set_real_termios) (void*);
  24. int (*chars_in_buffer) (void*);
  25. void (*close) (void*);
  26. void (*hungup) (void*);
  27. void (*getserial) (void*, struct serial_struct *sp);
  28. };
  29. struct gs_port {
  30. int magic;
  31. struct tty_port port;
  32. unsigned char *xmit_buf;
  33. int xmit_head;
  34. int xmit_tail;
  35. int xmit_cnt;
  36. struct mutex port_write_mutex;
  37. unsigned long event;
  38. unsigned short closing_wait;
  39. int close_delay;
  40. struct real_driver *rd;
  41. int wakeup_chars;
  42. int baud_base;
  43. int baud;
  44. int custom_divisor;
  45. spinlock_t driver_lock;
  46. };
  47. #endif /* __KERNEL__ */
  48. /* Flags */
  49. /* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
  50. used in serial.c, but they are also used in all other serial drivers.
  51. Make sure they don't clash with these here... */
  52. #define GS_TX_INTEN 0x00800000
  53. #define GS_RX_INTEN 0x00400000
  54. #define GS_ACTIVE 0x00200000
  55. #define GS_TYPE_NORMAL 1
  56. #define GS_DEBUG_FLUSH 0x00000001
  57. #define GS_DEBUG_BTR 0x00000002
  58. #define GS_DEBUG_TERMIOS 0x00000004
  59. #define GS_DEBUG_STUFF 0x00000008
  60. #define GS_DEBUG_CLOSE 0x00000010
  61. #define GS_DEBUG_FLOW 0x00000020
  62. #define GS_DEBUG_WRITE 0x00000040
  63. #ifdef __KERNEL__
  64. int gs_put_char(struct tty_struct *tty, unsigned char ch);
  65. int gs_write(struct tty_struct *tty,
  66. const unsigned char *buf, int count);
  67. int gs_write_room(struct tty_struct *tty);
  68. int gs_chars_in_buffer(struct tty_struct *tty);
  69. void gs_flush_buffer(struct tty_struct *tty);
  70. void gs_flush_chars(struct tty_struct *tty);
  71. void gs_stop(struct tty_struct *tty);
  72. void gs_start(struct tty_struct *tty);
  73. void gs_hangup(struct tty_struct *tty);
  74. int gs_block_til_ready(void *port, struct file *filp);
  75. void gs_close(struct tty_struct *tty, struct file *filp);
  76. void gs_set_termios (struct tty_struct * tty,
  77. struct ktermios * old_termios);
  78. int gs_init_port(struct gs_port *port);
  79. int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
  80. int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
  81. void gs_got_break(struct gs_port *port);
  82. #endif /* __KERNEL__ */
  83. #endif