generic_serial.h 3.0 KB

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