serial.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 UART_CLEAR_FIFO 0x01
  61. #define UART_USE_FIFO 0x02
  62. #define UART_STARTECH 0x04
  63. #define UART_NATSEMI 0x08
  64. /*
  65. * Multiport serial configuration structure --- external structure
  66. */
  67. struct serial_multiport_struct {
  68. int irq;
  69. int port1;
  70. unsigned char mask1, match1;
  71. int port2;
  72. unsigned char mask2, match2;
  73. int port3;
  74. unsigned char mask3, match3;
  75. int port4;
  76. unsigned char mask4, match4;
  77. int port_monitor;
  78. int reserved[32];
  79. };
  80. /*
  81. * Serial input interrupt line counters -- external structure
  82. * Four lines can interrupt: CTS, DSR, RI, DCD
  83. */
  84. struct serial_icounter_struct {
  85. int cts, dsr, rng, dcd;
  86. int rx, tx;
  87. int frame, overrun, parity, brk;
  88. int buf_overrun;
  89. int reserved[9];
  90. };
  91. /*
  92. * Serial interface for controlling RS485 settings on chips with suitable
  93. * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
  94. * platform. The set function returns the new state, with any unsupported bits
  95. * reverted appropriately.
  96. */
  97. struct serial_rs485 {
  98. __u32 flags; /* RS485 feature flags */
  99. #define SER_RS485_ENABLED (1 << 0) /* If enabled */
  100. #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
  101. RTS pin when
  102. sending */
  103. #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
  104. RTS pin after sent*/
  105. #define SER_RS485_RX_DURING_TX (1 << 4)
  106. __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
  107. __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
  108. __u32 padding[5]; /* Memory is cheap, new structs
  109. are a royal PITA .. */
  110. };
  111. #endif /* _UAPI_LINUX_SERIAL_H */