serial.h 3.4 KB

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