FreeBSD/Linux Kernel Cross Reference
sys/i386/isa/b004.h
1 /*
2 * b004.h
3 *
4 * Based on the Linux driver, by
5 * Christoph Niemann (niemann@swt.ruhr-uni-bochum.de)
6 *
7 * Ported to FreeBSD by Luigi Rizzo (luigi@iet.unipi.it)
8 * and Lorenzo Vicisano (l.vicisano@iet.unipi.it)
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by Christoph Niemann,
21 * Luigi Rizzo and Lorenzo Vicisano - Dipartimento di Ingegneria
22 * dell'Informazione
23 * 4. The names of these contributors may not be used to endorse or promote
24 * products derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
28 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * Works for FreeBSD 1.1.5
39 */
40
41 #ifndef _I386_ISA_B004_H_
42 #define _I386_ISA_B004_H_
43
44 #include <sys/ioccom.h>
45
46 /*
47 * device status FLAGS
48 */
49 #define B004_EXIST 0x0001 /* Is a B004-Board with at least one
50 Transputer present ? */
51 #define B004_BUSY 0x0002 /* Is the B004-board in use ? */
52
53 /*
54 * IOCTL numbers
55 */
56 #define B004RESET _IO ('Q', 0)
57 /* Reset transputer(s) */
58 #define B004WRITEABLE _IOR ('Q', 1, int)
59 /* Return C012 Output Ready */
60 #define B004READABLE _IOR ('Q', 2, int)
61 /* Return C012 Data Present */
62 #define B004ANALYSE _IO ('Q', 3)
63 /* Switch transputer(s) to ANALYSE mode */
64 #define B004ERROR _IOR ('Q', 4, int)
65 /* Return 1 on ERROR set */
66 #define B004TIMEOUT _IOW ('Q', 5, int)
67 /* Set TIMEOUT for subsequent writing or
68 reading call, value in ticks, initial
69 0 = no timeout (read/write blocking)
70 "open" sets timeout to 0 */
71
72
73 #define B004_INIT_TIMEOUT 0 /* No timeout yet */
74
75 /*
76 * Registers DISPLACEMENT
77 */
78 #define B004_IDR_OFFSET 0 /* Input Data Register */
79 #define B004_ODR_OFFSET 1 /* Output Data Register */
80 #define B004_ISR_OFFSET 2 /* Input Status Register */
81 #define B004_OSR_OFFSET 3 /* Output Status Register */
82 #define B004_RESET_OFFSET 16 /* Reset/Error Register */
83 #define B004_ERROR_OFFSET B004_RESET_OFFSET
84 #define B004_ANALYSE_OFFSET 17 /* Analyse Register */
85 #define B008_DMA_OFFSET 18 /* B008: DMA request register */
86 #define B008_INT_OFFSET 19 /* B008: Interrupt control reg */
87
88 struct b004_struct {
89 int flags; /* various flags */
90 int idr; /* address of the input data register */
91 int odr; /* address if the output data register */
92 int isr; /* address of the input status register */
93 int osr; /* address of the output status register */
94 unsigned int timeout; /* timeout for writing/reading the link */
95 int boardtype; /* what kind of board is installed */
96 void *devfs_token[8][4]; /* tokens for 4 types for 8 ports */
97 };
98
99 /*
100 * Id's for the supported boards
101 */
102 #define B004 1
103 #define B008 2
104
105 /*
106 * Defines for easier access to the b004_table.
107 */
108 #define B004_F(minor) b004_table[minor].flags
109 #define B004_TIMEOUT(minor) b004_table[minor].timeout
110 #define B004_BASE(minor) B004_IDR(minor)
111 #define B004_IDR(minor) b004_table[minor].idr
112 #define B004_ODR(minor) b004_table[minor].odr
113 #define B004_ISR(minor) b004_table[minor].isr
114 #define B004_OSR(minor) b004_table[minor].osr
115 #define B004_WAIT(minor) b004_table[minor].wait
116 #define B004_BOARDTYPE(minor) b004_table[minor].boardtype
117
118 /*
119 * Additional defines for B008-boards
120 */
121 #define B008_DMA(minor) b004_table[minor].int
122 #define B008_INT(minor) b004_table[minor].dma
123
124 /*
125 * Number of tries to access isr or osr before reading or writing sleeps
126 */
127 #define B004_MAXTRY 200
128
129 /*
130 * Maximum number of bytes to transfer at once
131 */
132 #define B004_MAX_BYTES 2048
133
134 /*
135 * bit defines for C012 status ports at base + 2/3
136 * accessed with B004_IS, B004_OS, which gets the byte...
137 */
138 #define B004_READBYTE 1
139 #define B004_WRITEBYTE 1
140
141 /*
142 * bit defines for C012 reset/error port at base + 16
143 */
144 #define B004_ASSERT_RESET 0x01 /* resetting the transputer */
145 #define B004_DEASSERT_RESET 0x00
146 #define B004_TEST_ERROR 0x01 /* for testing the transputer's error flag */
147
148 /*
149 * bit defines for C012 analyse port at base + 17
150 */
151 #define B004_ASSERT_ANALYSE 0x01 /* switch transputer to analyse-mode */
152 #define B004_DEASSERT_ANALYSE 0x00
153
154 #endif /* !_I386_ISA_B004_H_ */
Cache object: 36fa5cd1c2ef7237c52c30ad29ab5de7
|