specialix_io8.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * linux/drivers/char/specialix_io8.h --
  3. * Specialix IO8+ multiport serial driver.
  4. *
  5. * Copyright (C) 1997 Roger Wolff (R.E.Wolff@BitWizard.nl)
  6. * Copyright (C) 1994-1996 Dmitry Gorodchanin (pgmdsg@ibi.com)
  7. *
  8. *
  9. * Specialix pays for the development and support of this driver.
  10. * Please DO contact io8-linux@specialix.co.uk if you require
  11. * support.
  12. *
  13. * This driver was developped in the BitWizard linux device
  14. * driver service. If you require a linux device driver for your
  15. * product, please contact devices@BitWizard.nl for a quote.
  16. *
  17. * This code is firmly based on the riscom/8 serial driver,
  18. * written by Dmitry Gorodchanin. The specialix IO8+ card
  19. * programming information was obtained from the CL-CD1865 Data
  20. * Book, and Specialix document number 6200059: IO8+ Hardware
  21. * Functional Specification.
  22. *
  23. * This program is free software; you can redistribute it and/or
  24. * modify it under the terms of the GNU General Public License as
  25. * published by the Free Software Foundation; either version 2 of
  26. * the License, or (at your option) any later version.
  27. *
  28. * This program is distributed in the hope that it will be
  29. * useful, but WITHOUT ANY WARRANTY; without even the implied
  30. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  31. * PURPOSE. See the GNU General Public License for more details.
  32. *
  33. * You should have received a copy of the GNU General Public
  34. * License along with this program; if not, write to the Free
  35. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  36. * USA.
  37. * */
  38. #ifndef __LINUX_SPECIALIX_H
  39. #define __LINUX_SPECIALIX_H
  40. #include <linux/serial.h>
  41. #ifdef __KERNEL__
  42. /* You can have max 4 ISA cards in one PC, and I recommend not much
  43. more than a few PCI versions of the card. */
  44. #define SX_NBOARD 8
  45. /* NOTE: Specialix decoder recognizes 4 addresses, but only two are used.... */
  46. #define SX_IO_SPACE 4
  47. /* The PCI version decodes 8 addresses, but still only 2 are used. */
  48. #define SX_PCI_IO_SPACE 8
  49. /* eight ports per board. */
  50. #define SX_NPORT 8
  51. #define SX_BOARD(line) ((line) / SX_NPORT)
  52. #define SX_PORT(line) ((line) & (SX_NPORT - 1))
  53. #define SX_DATA_REG 0 /* Base+0 : Data register */
  54. #define SX_ADDR_REG 1 /* base+1 : Address register. */
  55. #define MHz *1000000 /* I'm ashamed of myself. */
  56. /* On-board oscillator frequency */
  57. #define SX_OSCFREQ (25 MHz/2)
  58. /* There is a 25MHz crystal on the board, but the chip is in /2 mode */
  59. /* Ticks per sec. Used for setting receiver timeout and break length */
  60. #define SPECIALIX_TPS 4000
  61. /* Yeah, after heavy testing I decided it must be 6.
  62. * Sure, You can change it if needed.
  63. */
  64. #define SPECIALIX_RXFIFO 6 /* Max. receiver FIFO size (1-8) */
  65. #define SPECIALIX_MAGIC 0x0907
  66. #define SX_CCR_TIMEOUT 10000 /* CCR timeout. You may need to wait upto
  67. 10 milliseconds before the internal
  68. processor is available again after
  69. you give it a command */
  70. #define SX_IOBASE1 0x100
  71. #define SX_IOBASE2 0x180
  72. #define SX_IOBASE3 0x250
  73. #define SX_IOBASE4 0x260
  74. struct specialix_board {
  75. unsigned long flags;
  76. unsigned short base;
  77. unsigned char irq;
  78. //signed char count;
  79. int count;
  80. unsigned char DTR;
  81. int reg;
  82. spinlock_t lock;
  83. };
  84. #define SX_BOARD_PRESENT 0x00000001
  85. #define SX_BOARD_ACTIVE 0x00000002
  86. #define SX_BOARD_IS_PCI 0x00000004
  87. struct specialix_port {
  88. int magic;
  89. int baud_base;
  90. int flags;
  91. struct tty_struct * tty;
  92. int count;
  93. int blocked_open;
  94. ulong event;
  95. int timeout;
  96. int close_delay;
  97. unsigned char * xmit_buf;
  98. int custom_divisor;
  99. int xmit_head;
  100. int xmit_tail;
  101. int xmit_cnt;
  102. wait_queue_head_t open_wait;
  103. wait_queue_head_t close_wait;
  104. struct work_struct tqueue;
  105. struct work_struct tqueue_hangup;
  106. short wakeup_chars;
  107. short break_length;
  108. unsigned short closing_wait;
  109. unsigned char mark_mask;
  110. unsigned char IER;
  111. unsigned char MSVR;
  112. unsigned char COR2;
  113. unsigned long overrun;
  114. unsigned long hits[10];
  115. spinlock_t lock;
  116. };
  117. #endif /* __KERNEL__ */
  118. #endif /* __LINUX_SPECIALIX_H */