1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef __MUSYCCREG_H__
20 #define __MUSYCCREG_H__
21
22 #define MUSYCC_PCI_BAR 0x10
23
24
25 #define MUSYCC_GROUPBASE(x) (0x0800 * (x))
26
27 #define MUSYCC_DACB_PTR 0x0004
28
29 #define MUSYCC_SERREQ(x) (0x0008 + 0x0800 * (x))
30
31 #define MUSYCC_INTRSTATUS 0x000c
32 #define MUSYCC_INTCNT_MASK 0x00007fff
33 #define MUSYCC_INTFULL 0x00008000
34 #define MUSYCC_NEXTINT_GET(x) (((x) >> 16) & 0x7fff)
35 #define MUSYCC_NEXTINT_SET(x) (((x) & 0x7fff) << 16)
36
37
38 #define MUSYCC_GLOBALCONF 0x0600
39
40 #define MUSYCC_INTQPTR 0x0604
41 #define MUSYCC_INTQLEN 0x0608
42
43
44 struct musycc_grpdesc {
45 u_int32_t tx_headp[32];
46 u_int32_t tx_msgp[32];
47 u_int32_t rx_headp[32];
48 u_int32_t rx_msgp[32];
49 u_int8_t tx_tsmap[128];
50 u_int8_t tx_submap[256];
51 u_int32_t tx_cconf[32];
52 u_int8_t rx_tsmap[128];
53 u_int8_t rx_submap[256];
54 u_int32_t rx_cconf[32];
55 u_int32_t global_conf;
56 u_int32_t int_queuep;
57 u_int32_t int_queuelen;
58 u_int32_t group_conf;
59 u_int32_t memprot;
60 u_int32_t msglen_conf;
61 u_int32_t port_conf;
62 };
63
64
65 #define MUSYCC_CONF_PORTMAP 0x00000003
66 #define MUSYCC_CONF_INTB 0x00000004
67 #define MUSYCC_CONF_INTA 0x00000008
68 #define MUSYCC_CONF_ELAPSE_GET(x) \
69 (((x) >> 4) & 0x7)
70 #define MUSYCC_CONF_ELAPSE_SET(x) \
71 ((x & 0x7) << 4)
72 #define MUSYCC_CONF_ALAPSE_GET(x) \
73 (((x) >> 8) & 0x3)
74 #define MUSYCC_CONF_ALAPSE_SET(x) \
75 ((x & 0x3) << 8)
76 #define MUSYCC_CONF_MPUSEL 0x00000400
77 #define MUSYCC_CONF_ECKEN 0x00000800
78 #define MUSYCC_CONF_BLAPSE_GET(x) \
79 (((x) >> 12) & 0x7)
80 #define MUSYCC_CONF_BLAPSE_SET(x) \
81 ((x & 0x7) << 12)
82
83
84 #define MUSYCC_INTD_BLEN 0x00001fff
85 #define MUSYCC_INTD_ILOST 0x00008000
86 #define MUSYCC_INTD_DIR 0x80000000
87 #define MUSYCC_INTD_GRP(x) \
88 ((((x) >> 29) & 0x3) | (((x) >> 12) & 0x4))
89 #define MUSYCC_INTD_CHAN(x) \
90 (((x) >> 24) & 0x1f)
91 #define MUSYCC_INTD_EVENT(x) \
92 (((x) >> 20) & 0xf)
93 #define MUSYCC_INTD_ERROR(x) \
94 (((x) >> 16) & 0xf)
95
96
97 #define MUSYCC_INTEV_NONE 0
98 #define MUSYCC_INTEV_SACK 1
99 #define MUSYCC_INTEV_EOB 2
100 #define MUSYCC_INTEV_EOM 3
101 #define MUSYCC_INTEV_EOP 4
102 #define MUSYCC_INTEV_CHABT 5
103 #define MUSYCC_INTEV_CHIC 6
104 #define MUSYCC_INTEV_FREC 7
105 #define MUSYCC_INTEV_SINC 8
106 #define MUSYCC_INTEV_SDEC 9
107 #define MUSYCC_INTEV_SFILT 10
108
109
110 #define MUSYCC_INTERR_NONE 0
111 #define MUSYCC_INTERR_BUFF 1
112 #define MUSYCC_INTERR_COFA 2
113 #define MUSYCC_INTERR_ONR 3
114 #define MUSYCC_INTERR_PROT 4
115 #define MUSYCC_INTERR_OOF 8
116 #define MUSYCC_INTERR_FCS 9
117 #define MUSYCC_INTERR_ALIGN 10
118 #define MUSYCC_INTERR_ABT 11
119 #define MUSYCC_INTERR_LNG 12
120 #define MUSYCC_INTERR_SHT 13
121 #define MUSYCC_INTERR_SUERR 14
122 #define MUSYCC_INTERR_PERR 15
123
124
125 #define MUSYCC_SREQ_MASK 0x001f
126 #define MUSYCC_SREQ_CHSET(x) \
127 ((x) & MUSYCC_SREQ_MASK)
128 #define MUSYCC_SREQ_TXDIR 0x0020
129 #define MUSYCC_SREQ_SET(x) \
130 (((x) & MUSYCC_SREQ_MASK) << 8)
131
132 #define MUSYCC_SREQ_RX 0x1
133 #define MUSYCC_SREQ_TX 0x2
134 #define MUSYCC_SREQ_BOTH 0x3
135 #define MUSYCC_SREQ_NOWAIT 0x8
136 #define MUSYCC_SREQ_NONE 0xffffffff
137
138
139 #define MUSYCC_GRCFG_RXENBL 0x0001
140 #define MUSYCC_GRCFG_TXENBL 0x0002
141 #define MUSYCC_GRCFG_SUBDSBL 0x0004
142 #define MUSYCC_GRCFG_OOFABT 0x0008
143 #define MUSYCC_GRCFG_MSKOOF 0x0010
144 #define MUSYCC_GRCFG_MSKCOFA 0x0020
145 #define MUSYCC_GRCFG_MCENBL 0x0040
146 #define MUSYCC_GRCFG_INHRBSD 0x0100
147 #define MUSYCC_GRCFG_INHTBSD 0x0200
148 #define MUSYCC_GRCFG_POLL16 0x0400
149 #define MUSYCC_GRCFG_POLL32 0x0800
150 #define MUSYCC_GRCFG_POLL64 0x0C00
151 #define MUSYCC_GRCFG_SFALIGN 0x8000
152 #define MUSYCC_GRCFG_SUETMASK 0x3f0000
153
154
155 #define MUSYCC_PORT_MODEMASK 0x007
156 #define MUSYCC_PORT_MODE_T1 0
157 #define MUSYCC_PORT_MODE_E1 1
158 #define MUSYCC_PORT_MODE_2E1 2
159 #define MUSYCC_PORT_MODE_4E1 3
160 #define MUSYCC_PORT_MODE_N64 4
161 #define MUSYCC_PORT_TDAT_EDGE 0x010
162 #define MUSYCC_PORT_TSYNC_EDGE 0x020
163 #define MUSYCC_PORT_RDAT_EDGE 0x040
164 #define MUSYCC_PORT_RSYNC_EDGE 0x080
165 #define MUSYCC_PORT_ROOF_EDGE 0x100
166 #define MUSYCC_PORT_TRITX 0x200
167
168
169 #define MUSYCC_MAXFRM_MAX 4094
170 #define MUSYCC_MAXFRM_MASK 0x0fff
171 #define MUSYCC_MAXFRM2_SHIFT 16
172
173
174 #define MUSYCC_TSLOT_ENABLED 0x80
175 #define MUSYCC_TSLOT_56K 0x20
176 #define MUSYCC_TSLOT_SUB 0x40
177 #define MUSYCC_TSLOT_MASK 0x1f
178 #define MUSYCC_TSLOT_CHAN(x) \
179 ((x) & MUSYCC_TSLOT_MASK)
180
181
182 #define MUSYCC_CHAN_MSKBUFF 0x00000002
183 #define MUSYCC_CHAN_MSKEOM 0x00000004
184 #define MUSYCC_CHAN_MSKMSG 0x00000008
185 #define MUSYCC_CHAN_MSKIDLE 0x00000010
186 #define MUSYCC_CHAN_MSKSFILT 0x00000020
187 #define MUSYCC_CHAN_MSKSDEC 0x00000040
188 #define MUSYCC_CHAN_MSKSINC 0x00000080
189 #define MUSYCC_CHAN_MSKSUERR 0x00000100
190 #define MUSYCC_CHAN_FCS 0x00000200
191 #define MUSYCC_CHAN_MAXLEN1 0x00000400
192 #define MUSYCC_CHAN_MAXLEN2 0x00000800
193 #define MUSYCC_CHAN_EOPI 0x00008000
194 #define MUSYCC_CHAN_INV 0x00800000
195 #define MUSYCC_CHAN_PADJ 0x80000000
196
197 #define MUSYCC_CHAN_PROTO_GET(x) \
198 (((x) >> 12) & 0x7)
199 #define MUSYCC_CHAN_PROTO_SET(x) \
200 ((x & 0x7) << 12)
201 #define MUSYCC_PROTO_TRANSPARENT 0
202 #define MUSYCC_PROTO_SS7HDLC 1
203 #define MUSYCC_PROTO_HDLC16 2
204 #define MUSYCC_PROTO_HDLC32 3
205
206 #define MUSYCC_CHAN_BUFLEN_GET(x) \
207 (((x) >> 16) & 0x3f)
208 #define MUSYCC_CHAN_BUFLEN_SET(x) \
209 (((x) & 0x3F) << 16)
210 #define MUSYCC_CHAN_BUFIDX_GET(x) \
211 (((x) >> 24) & 0x3f)
212 #define MUSYCC_CHAN_BUFIDX_SET(x) \
213 (((x) & 0x3F) << 24)
214
215
216
217 #define MUSYCC_STATUS_LEN(x) \
218 ((x) & 0x3fff)
219 #define MUSYCC_STATUS_REPEAT 0x00008000
220 #define MUSYCC_STATUS_ERROR 0x000f0000
221 #define MUSYCC_STATUS_EOBI 0x10000000
222 #define MUSYCC_STATUS_EOM 0x20000000
223 #define MUSYCC_STATUS_NOPOLL 0x40000000
224 #define MUSYCC_STATUS_OWNER 0x80000000
225
226
227
228
229
230
231 struct musycc_rom {
232 u_int16_t magic;
233 #define MUSYCC_ROM_MAGIC (htons(0xacc0))
234 u_int8_t rev;
235 u_int8_t vers;
236 char product[64];
237 u_int8_t portmap;
238 u_int8_t portmode;
239 u_int8_t numframer;
240 u_int8_t ledmask;
241 u_int32_t ledbase;
242 u_int32_t rfu[2];
243 };
244
245 struct musycc_rom_framer {
246 u_int32_t type;
247 u_int32_t base;
248 u_int32_t size;
249 u_int8_t gnum;
250 u_int8_t port;
251 char slot;
252 u_int8_t flags;
253 u_int32_t rfu[2];
254 };
255 #endif