stallion.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*****************************************************************************/
  2. /*
  3. * stallion.h -- stallion multiport serial driver.
  4. *
  5. * Copyright (C) 1996-1998 Stallion Technologies
  6. * Copyright (C) 1994-1996 Greg Ungerer.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. /*****************************************************************************/
  23. #ifndef _STALLION_H
  24. #define _STALLION_H
  25. /*****************************************************************************/
  26. /*
  27. * Define important driver constants here.
  28. */
  29. #define STL_MAXBRDS 4
  30. #define STL_MAXPANELS 4
  31. #define STL_MAXBANKS 8
  32. #define STL_PORTSPERPANEL 16
  33. #define STL_MAXPORTS 64
  34. #define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS)
  35. /*
  36. * Define a set of structures to hold all the board/panel/port info
  37. * for our ports. These will be dynamically allocated as required.
  38. */
  39. /*
  40. * Define a ring queue structure for each port. This will hold the
  41. * TX data waiting to be output. Characters are fed into this buffer
  42. * from the line discipline (or even direct from user space!) and
  43. * then fed into the UARTs during interrupts. Will use a classic ring
  44. * queue here for this. The good thing about this type of ring queue
  45. * is that the head and tail pointers can be updated without interrupt
  46. * protection - since "write" code only needs to change the head, and
  47. * interrupt code only needs to change the tail.
  48. */
  49. typedef struct {
  50. char *buf;
  51. char *head;
  52. char *tail;
  53. } stlrq_t;
  54. /*
  55. * Port, panel and board structures to hold status info about each.
  56. * The board structure contains pointers to structures for each panel
  57. * connected to it, and in turn each panel structure contains pointers
  58. * for each port structure for each port on that panel. Note that
  59. * the port structure also contains the board and panel number that it
  60. * is associated with, this makes it (fairly) easy to get back to the
  61. * board/panel info for a port.
  62. */
  63. typedef struct stlport {
  64. unsigned long magic;
  65. int portnr;
  66. int panelnr;
  67. int brdnr;
  68. int ioaddr;
  69. int uartaddr;
  70. int pagenr;
  71. long istate;
  72. int flags;
  73. int baud_base;
  74. int custom_divisor;
  75. int close_delay;
  76. int closing_wait;
  77. int refcount;
  78. int openwaitcnt;
  79. int brklen;
  80. unsigned int sigs;
  81. unsigned int rxignoremsk;
  82. unsigned int rxmarkmsk;
  83. unsigned int imr;
  84. unsigned int crenable;
  85. unsigned long clk;
  86. unsigned long hwid;
  87. void *uartp;
  88. struct tty_struct *tty;
  89. wait_queue_head_t open_wait;
  90. wait_queue_head_t close_wait;
  91. struct work_struct tqueue;
  92. comstats_t stats;
  93. stlrq_t tx;
  94. } stlport_t;
  95. typedef struct stlpanel {
  96. unsigned long magic;
  97. int panelnr;
  98. int brdnr;
  99. int pagenr;
  100. int nrports;
  101. int iobase;
  102. void *uartp;
  103. void (*isr)(struct stlpanel *panelp, unsigned int iobase);
  104. unsigned int hwid;
  105. unsigned int ackmask;
  106. stlport_t *ports[STL_PORTSPERPANEL];
  107. } stlpanel_t;
  108. typedef struct stlbrd {
  109. unsigned long magic;
  110. int brdnr;
  111. int brdtype;
  112. int state;
  113. int nrpanels;
  114. int nrports;
  115. int nrbnks;
  116. int irq;
  117. int irqtype;
  118. int (*isr)(struct stlbrd *brdp);
  119. unsigned int ioaddr1;
  120. unsigned int ioaddr2;
  121. unsigned int iosize1;
  122. unsigned int iosize2;
  123. unsigned int iostatus;
  124. unsigned int ioctrl;
  125. unsigned int ioctrlval;
  126. unsigned int hwid;
  127. unsigned long clk;
  128. unsigned int bnkpageaddr[STL_MAXBANKS];
  129. unsigned int bnkstataddr[STL_MAXBANKS];
  130. stlpanel_t *bnk2panel[STL_MAXBANKS];
  131. stlpanel_t *panels[STL_MAXPANELS];
  132. } stlbrd_t;
  133. /*
  134. * Define MAGIC numbers used for above structures.
  135. */
  136. #define STL_PORTMAGIC 0x5a7182c9
  137. #define STL_PANELMAGIC 0x7ef621a1
  138. #define STL_BOARDMAGIC 0xa2267f52
  139. /*****************************************************************************/
  140. #endif