logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

serial.h (5245B)


  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 _LINUX_SERIAL_H
  11. #define _LINUX_SERIAL_H
  12. #include <linux/const.h>
  13. #include <linux/types.h>
  14. #include <linux/tty_flags.h>
  15. struct serial_struct {
  16. int type;
  17. int line;
  18. unsigned int port;
  19. int irq;
  20. int flags;
  21. int xmit_fifo_size;
  22. int custom_divisor;
  23. int baud_base;
  24. unsigned short close_delay;
  25. char io_type;
  26. char reserved_char[1];
  27. int hub6;
  28. unsigned short closing_wait; /* time to wait before closing */
  29. unsigned short closing_wait2; /* no longer used... */
  30. unsigned char *iomem_base;
  31. unsigned short iomem_reg_shift;
  32. unsigned int port_high;
  33. unsigned long iomap_base; /* cookie passed into ioremap */
  34. };
  35. /*
  36. * For the close wait times, 0 means wait forever for serial port to
  37. * flush its output. 65535 means don't wait at all.
  38. */
  39. #define ASYNC_CLOSING_WAIT_INF 0
  40. #define ASYNC_CLOSING_WAIT_NONE 65535
  41. /*
  42. * These are the supported serial types.
  43. */
  44. #define PORT_UNKNOWN 0
  45. #define PORT_8250 1
  46. #define PORT_16450 2
  47. #define PORT_16550 3
  48. #define PORT_16550A 4
  49. #define PORT_CIRRUS 5
  50. #define PORT_16650 6
  51. #define PORT_16650V2 7
  52. #define PORT_16750 8
  53. #define PORT_STARTECH 9
  54. #define PORT_16C950 10 /* Oxford Semiconductor */
  55. #define PORT_16654 11
  56. #define PORT_16850 12
  57. #define PORT_RSA 13 /* RSA-DV II/S card */
  58. #define PORT_MAX 13
  59. #define SERIAL_IO_PORT 0
  60. #define SERIAL_IO_HUB6 1
  61. #define SERIAL_IO_MEM 2
  62. #define SERIAL_IO_MEM32 3
  63. #define SERIAL_IO_AU 4
  64. #define SERIAL_IO_TSI 5
  65. #define SERIAL_IO_MEM32BE 6
  66. #define SERIAL_IO_MEM16 7
  67. #define UART_CLEAR_FIFO 0x01
  68. #define UART_USE_FIFO 0x02
  69. #define UART_STARTECH 0x04
  70. #define UART_NATSEMI 0x08
  71. /*
  72. * Multiport serial configuration structure --- external structure
  73. */
  74. struct serial_multiport_struct {
  75. int irq;
  76. int port1;
  77. unsigned char mask1, match1;
  78. int port2;
  79. unsigned char mask2, match2;
  80. int port3;
  81. unsigned char mask3, match3;
  82. int port4;
  83. unsigned char mask4, match4;
  84. int port_monitor;
  85. int reserved[32];
  86. };
  87. /*
  88. * Serial input interrupt line counters -- external structure
  89. * Four lines can interrupt: CTS, DSR, RI, DCD
  90. */
  91. struct serial_icounter_struct {
  92. int cts, dsr, rng, dcd;
  93. int rx, tx;
  94. int frame, overrun, parity, brk;
  95. int buf_overrun;
  96. int reserved[9];
  97. };
  98. /**
  99. * struct serial_rs485 - serial interface for controlling RS485 settings.
  100. * @flags: RS485 feature flags.
  101. * @delay_rts_before_send: Delay before send (milliseconds).
  102. * @delay_rts_after_send: Delay after send (milliseconds).
  103. * @addr_recv: Receive filter for RS485 addressing mode
  104. * (used only when %SER_RS485_ADDR_RECV is set).
  105. * @addr_dest: Destination address for RS485 addressing mode
  106. * (used only when %SER_RS485_ADDR_DEST is set).
  107. * @padding0: Padding (set to zero).
  108. * @padding1: Padding (set to zero).
  109. * @padding: Deprecated, use @padding0 and @padding1 instead.
  110. * Do not use with @addr_recv and @addr_dest (due to
  111. * overlap).
  112. *
  113. * Serial interface for controlling RS485 settings on chips with suitable
  114. * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
  115. * platform. The set function returns the new state, with any unsupported bits
  116. * reverted appropriately.
  117. *
  118. * The flag bits are:
  119. *
  120. * * %SER_RS485_ENABLED - RS485 enabled.
  121. * * %SER_RS485_RTS_ON_SEND - Logical level for RTS pin when sending.
  122. * * %SER_RS485_RTS_AFTER_SEND - Logical level for RTS pin after sent.
  123. * * %SER_RS485_RX_DURING_TX - Full-duplex RS485 line.
  124. * * %SER_RS485_TERMINATE_BUS - Enable bus termination (if supported).
  125. * * %SER_RS485_ADDRB - Enable RS485 addressing mode.
  126. * * %SER_RS485_ADDR_RECV - Receive address filter (enables @addr_recv). Requires %SER_RS485_ADDRB.
  127. * * %SER_RS485_ADDR_DEST - Destination address (enables @addr_dest). Requires %SER_RS485_ADDRB.
  128. * * %SER_RS485_MODE_RS422 - Enable RS422. Requires %SER_RS485_ENABLED.
  129. */
  130. struct serial_rs485 {
  131. __u32 flags;
  132. #define SER_RS485_ENABLED _BITUL(0)
  133. #define SER_RS485_RTS_ON_SEND _BITUL(1)
  134. #define SER_RS485_RTS_AFTER_SEND _BITUL(2)
  135. /* Placeholder for bit 3: SER_RS485_RTS_BEFORE_SEND, which isn't used anymore */
  136. #define SER_RS485_RX_DURING_TX _BITUL(4)
  137. #define SER_RS485_TERMINATE_BUS _BITUL(5)
  138. #define SER_RS485_ADDRB _BITUL(6)
  139. #define SER_RS485_ADDR_RECV _BITUL(7)
  140. #define SER_RS485_ADDR_DEST _BITUL(8)
  141. #define SER_RS485_MODE_RS422 _BITUL(9)
  142. __u32 delay_rts_before_send;
  143. __u32 delay_rts_after_send;
  144. /* The fields below are defined by flags */
  145. union {
  146. __u32 padding[5]; /* Memory is cheap, new structs are a pain */
  147. struct {
  148. __u8 addr_recv;
  149. __u8 addr_dest;
  150. __u8 padding0[2];
  151. __u32 padding1[4];
  152. };
  153. };
  154. };
  155. /*
  156. * Serial interface for controlling ISO7816 settings on chips with suitable
  157. * support. Set with TIOCSISO7816 and get with TIOCGISO7816 if supported by
  158. * your platform.
  159. */
  160. struct serial_iso7816 {
  161. __u32 flags; /* ISO7816 feature flags */
  162. #define SER_ISO7816_ENABLED (1 << 0)
  163. #define SER_ISO7816_T_PARAM (0x0f << 4)
  164. #define SER_ISO7816_T(t) (((t) & 0x0f) << 4)
  165. __u32 tg;
  166. __u32 sc_fi;
  167. __u32 sc_di;
  168. __u32 clk;
  169. __u32 reserved[5];
  170. };
  171. #endif /* _LINUX_SERIAL_H */