serialP.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Private header file for the (dumb) serial driver
  3. *
  4. * Copyright (C) 1997 by Theodore Ts'o.
  5. *
  6. * Redistribution of this file is permitted under the terms of the GNU
  7. * Public License (GPL)
  8. */
  9. #ifndef _LINUX_SERIALP_H
  10. #define _LINUX_SERIALP_H
  11. /*
  12. * This is our internal structure for each serial port's state.
  13. *
  14. * Many fields are paralleled by the structure used by the serial_struct
  15. * structure.
  16. *
  17. * For definitions of the flags field, see tty.h
  18. */
  19. #include <linux/termios.h>
  20. #include <linux/workqueue.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/circ_buf.h>
  23. #include <linux/wait.h>
  24. struct serial_state {
  25. int magic;
  26. int baud_base;
  27. unsigned long port;
  28. int irq;
  29. int flags;
  30. int hub6;
  31. int type;
  32. int line;
  33. int revision; /* Chip revision (950) */
  34. int xmit_fifo_size;
  35. int custom_divisor;
  36. int count;
  37. u8 *iomem_base;
  38. u16 iomem_reg_shift;
  39. unsigned short close_delay;
  40. unsigned short closing_wait; /* time to wait before closing */
  41. struct async_icount icount;
  42. int io_type;
  43. struct async_struct *info;
  44. struct pci_dev *dev;
  45. };
  46. struct async_struct {
  47. int magic;
  48. unsigned long port;
  49. int hub6;
  50. int flags;
  51. int xmit_fifo_size;
  52. struct serial_state *state;
  53. struct tty_struct *tty;
  54. int read_status_mask;
  55. int ignore_status_mask;
  56. int timeout;
  57. int quot;
  58. int x_char; /* xon/xoff character */
  59. int close_delay;
  60. unsigned short closing_wait;
  61. unsigned short closing_wait2; /* obsolete */
  62. int IER; /* Interrupt Enable Register */
  63. int MCR; /* Modem control register */
  64. int LCR; /* Line control register */
  65. int ACR; /* 16950 Additional Control Reg. */
  66. unsigned long event;
  67. unsigned long last_active;
  68. int line;
  69. int blocked_open; /* # of blocked opens */
  70. struct circ_buf xmit;
  71. spinlock_t xmit_lock;
  72. u8 *iomem_base;
  73. u16 iomem_reg_shift;
  74. int io_type;
  75. struct work_struct work;
  76. struct tasklet_struct tlet;
  77. #ifdef DECLARE_WAITQUEUE
  78. wait_queue_head_t open_wait;
  79. wait_queue_head_t close_wait;
  80. wait_queue_head_t delta_msr_wait;
  81. #else
  82. struct wait_queue *open_wait;
  83. struct wait_queue *close_wait;
  84. struct wait_queue *delta_msr_wait;
  85. #endif
  86. struct async_struct *next_port; /* For the linked list */
  87. struct async_struct *prev_port;
  88. };
  89. #define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base))
  90. #define SERIAL_MAGIC 0x5301
  91. #define SSTATE_MAGIC 0x5302
  92. /*
  93. * Events are used to schedule things to happen at timer-interrupt
  94. * time, instead of at rs interrupt time.
  95. */
  96. #define RS_EVENT_WRITE_WAKEUP 0
  97. /*
  98. * Multiport serial configuration structure --- internal structure
  99. */
  100. struct rs_multiport_struct {
  101. int port1;
  102. unsigned char mask1, match1;
  103. int port2;
  104. unsigned char mask2, match2;
  105. int port3;
  106. unsigned char mask3, match3;
  107. int port4;
  108. unsigned char mask4, match4;
  109. int port_monitor;
  110. };
  111. #if defined(__alpha__) && !defined(CONFIG_PCI)
  112. /*
  113. * Digital did something really horribly wrong with the OUT1 and OUT2
  114. * lines on at least some ALPHA's. The failure mode is that if either
  115. * is cleared, the machine locks up with endless interrupts.
  116. *
  117. * This is still used by arch/mips/au1000/common/serial.c for some weird
  118. * reason (mips != alpha!)
  119. */
  120. #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
  121. #elif defined(CONFIG_SBC8560)
  122. /*
  123. * WindRiver did something similarly broken on their SBC8560 board. The
  124. * UART tristates its IRQ output while OUT2 is clear, but they pulled
  125. * the interrupt line _up_ instead of down, so if we register the IRQ
  126. * while the UART is in that state, we die in an IRQ storm. */
  127. #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2)
  128. #else
  129. #define ALPHA_KLUDGE_MCR 0
  130. #endif
  131. #endif /* _LINUX_SERIAL_H */