serial.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * include/linux/serial.h
  3. *
  4. * Copyright (C) 1992 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 _UAPI_LINUX_SERIAL_H
  10. #define _UAPI_LINUX_SERIAL_H
  11. #include <linux/types.h>
  12. #include <linux/tty_flags.h>
  13. struct serial_struct {
  14. int type;
  15. int line;
  16. unsigned int port;
  17. int irq;
  18. int flags;
  19. int xmit_fifo_size;
  20. int custom_divisor;
  21. int baud_base;
  22. unsigned short close_delay;
  23. char io_type;
  24. char reserved_char[1];
  25. int hub6;
  26. unsigned short closing_wait; /* time to wait before closing */
  27. unsigned short closing_wait2; /* no longer used... */
  28. unsigned char *iomem_base;
  29. unsigned short iomem_reg_shift;
  30. unsigned int port_high;
  31. unsigned long iomap_base; /* cookie passed into ioremap */
  32. };
  33. /*
  34. * For the close wait times, 0 means wait forever for serial port to
  35. * flush its output. 65535 means don't wait at all.
  36. */
  37. #define ASYNC_CLOSING_WAIT_INF 0
  38. #define ASYNC_CLOSING_WAIT_NONE 65535
  39. /*
  40. * These are the supported serial types.
  41. */
  42. #define PORT_UNKNOWN 0
  43. #define PORT_8250 1
  44. #define PORT_16450 2
  45. #define PORT_16550 3
  46. #define PORT_16550A 4
  47. #define PORT_CIRRUS 5 /* usurped by cyclades.c */
  48. #define PORT_16650 6
  49. #define PORT_16650V2 7
  50. #define PORT_16750 8
  51. #define PORT_STARTECH 9 /* usurped by cyclades.c */
  52. #define PORT_16C950 10 /* Oxford Semiconductor */
  53. #define PORT_16654 11
  54. #define PORT_16850 12
  55. #define PORT_RSA 13 /* RSA-DV II/S card */
  56. #define PORT_MAX 13
  57. #define SERIAL_IO_PORT 0
  58. #define SERIAL_IO_HUB6 1
  59. #define SERIAL_IO_MEM 2
  60. #define SERIAL_IO_MEM32 3
  61. #define SERIAL_IO_AU 4
  62. #define SERIAL_IO_TSI 5
  63. #define SERIAL_IO_MEM32BE 6
  64. #define UART_CLEAR_FIFO 0x01
  65. #define UART_USE_FIFO 0x02
  66. #define UART_STARTECH 0x04
  67. #define UART_NATSEMI 0x08
  68. /*
  69. * Multiport serial configuration structure --- external structure
  70. */
  71. struct serial_multiport_struct {
  72. int irq;
  73. int port1;
  74. unsigned char mask1, match1;
  75. int port2;
  76. unsigned char mask2, match2;
  77. int port3;
  78. unsigned char mask3, match3;
  79. int port4;
  80. unsigned char mask4, match4;
  81. int port_monitor;
  82. int reserved[32];
  83. };
  84. /*
  85. * Serial input interrupt line counters -- external structure
  86. * Four lines can interrupt: CTS, DSR, RI, DCD
  87. */
  88. struct serial_icounter_struct {
  89. int cts, dsr, rng, dcd;
  90. int rx, tx;
  91. int frame, overrun, parity, brk;
  92. int buf_overrun;
  93. int reserved[9];
  94. };
  95. /*
  96. * Serial interface for controlling RS485 settings on chips with suitable
  97. * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
  98. * platform. The set function returns the new state, with any unsupported bits
  99. * reverted appropriately.
  100. */
  101. struct serial_rs485 {
  102. __u32 flags; /* RS485 feature flags */
  103. #define SER_RS485_ENABLED (1 << 0) /* If enabled */
  104. #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
  105. RTS pin when
  106. sending */
  107. #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
  108. RTS pin after sent*/
  109. #define SER_RS485_RX_DURING_TX (1 << 4)
  110. __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
  111. __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
  112. __u32 padding[5]; /* Memory is cheap, new structs
  113. are a royal PITA .. */
  114. };
  115. #endif /* _UAPI_LINUX_SERIAL_H */