serial.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 _LINUX_SERIAL_H
  10. #define _LINUX_SERIAL_H
  11. #ifdef __KERNEL__
  12. #include <linux/types.h>
  13. #include <asm/page.h>
  14. /*
  15. * Counters of the input lines (CTS, DSR, RI, CD) interrupts
  16. */
  17. struct async_icount {
  18. __u32 cts, dsr, rng, dcd, tx, rx;
  19. __u32 frame, parity, overrun, brk;
  20. __u32 buf_overrun;
  21. };
  22. /*
  23. * The size of the serial xmit buffer is 1 page, or 4096 bytes
  24. */
  25. #define SERIAL_XMIT_SIZE PAGE_SIZE
  26. #endif
  27. struct serial_struct {
  28. int type;
  29. int line;
  30. unsigned int port;
  31. int irq;
  32. int flags;
  33. int xmit_fifo_size;
  34. int custom_divisor;
  35. int baud_base;
  36. unsigned short close_delay;
  37. char io_type;
  38. char reserved_char[1];
  39. int hub6;
  40. unsigned short closing_wait; /* time to wait before closing */
  41. unsigned short closing_wait2; /* no longer used... */
  42. unsigned char *iomem_base;
  43. unsigned short iomem_reg_shift;
  44. unsigned int port_high;
  45. unsigned long iomap_base; /* cookie passed into ioremap */
  46. };
  47. /*
  48. * For the close wait times, 0 means wait forever for serial port to
  49. * flush its output. 65535 means don't wait at all.
  50. */
  51. #define ASYNC_CLOSING_WAIT_INF 0
  52. #define ASYNC_CLOSING_WAIT_NONE 65535
  53. /*
  54. * These are the supported serial types.
  55. */
  56. #define PORT_UNKNOWN 0
  57. #define PORT_8250 1
  58. #define PORT_16450 2
  59. #define PORT_16550 3
  60. #define PORT_16550A 4
  61. #define PORT_CIRRUS 5 /* usurped by cyclades.c */
  62. #define PORT_16650 6
  63. #define PORT_16650V2 7
  64. #define PORT_16750 8
  65. #define PORT_STARTECH 9 /* usurped by cyclades.c */
  66. #define PORT_16C950 10 /* Oxford Semiconductor */
  67. #define PORT_16654 11
  68. #define PORT_16850 12
  69. #define PORT_RSA 13 /* RSA-DV II/S card */
  70. #define PORT_MAX 13
  71. #define SERIAL_IO_PORT 0
  72. #define SERIAL_IO_HUB6 1
  73. #define SERIAL_IO_MEM 2
  74. struct serial_uart_config {
  75. char *name;
  76. int dfl_xmit_fifo_size;
  77. int flags;
  78. };
  79. #define UART_CLEAR_FIFO 0x01
  80. #define UART_USE_FIFO 0x02
  81. #define UART_STARTECH 0x04
  82. #define UART_NATSEMI 0x08
  83. /*
  84. * Definitions for async_struct (and serial_struct) flags field
  85. */
  86. #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
  87. on the callout port */
  88. #define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
  89. #define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */
  90. #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
  91. #define ASYNC_SPD_MASK 0x1030
  92. #define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
  93. #define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
  94. #define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */
  95. #define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
  96. #define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
  97. #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
  98. #define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
  99. #define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
  100. #define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */
  101. #define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */
  102. #define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */
  103. #define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */
  104. #define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety
  105. * checks. Note: can be dangerous! */
  106. #define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */
  107. #define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */
  108. #define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged
  109. * users can set or reset */
  110. /* Internal flags used only by kernel/chr_drv/serial.c */
  111. #define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */
  112. #define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
  113. #define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
  114. #define ASYNC_CLOSING 0x08000000 /* Serial port is closing */
  115. #define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
  116. #define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
  117. #define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards
  118. --- no longer used */
  119. #define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */
  120. #define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */
  121. #define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */
  122. /*
  123. * Multiport serial configuration structure --- external structure
  124. */
  125. struct serial_multiport_struct {
  126. int irq;
  127. int port1;
  128. unsigned char mask1, match1;
  129. int port2;
  130. unsigned char mask2, match2;
  131. int port3;
  132. unsigned char mask3, match3;
  133. int port4;
  134. unsigned char mask4, match4;
  135. int port_monitor;
  136. int reserved[32];
  137. };
  138. /*
  139. * Serial input interrupt line counters -- external structure
  140. * Four lines can interrupt: CTS, DSR, RI, DCD
  141. */
  142. struct serial_icounter_struct {
  143. int cts, dsr, rng, dcd;
  144. int rx, tx;
  145. int frame, overrun, parity, brk;
  146. int buf_overrun;
  147. int reserved[9];
  148. };
  149. #ifdef __KERNEL__
  150. #include <linux/compiler.h>
  151. /* Allow architectures to override entries in serial8250_ports[] at run time: */
  152. struct uart_port; /* forward declaration */
  153. extern int early_serial_setup(struct uart_port *port);
  154. extern int early_serial_console_init(char *options);
  155. extern int serial8250_start_console(struct uart_port *port, char *options);
  156. #endif /* __KERNEL__ */
  157. #endif /* _LINUX_SERIAL_H */