root/trunk/libffado/src/dice/dice_defines.h

Revision 2802, 11.5 kB (checked in by jwoithe, 2 years ago)

Cosmetic: "Firewire" becomes "FireWire?".

Officially both the "F" and "W" were capitalised in the FireWire? name, so
reflect this throughout FFADO's source tree. This mostly affects comments.

This patch originated from pander on the ffado-devel mailing list. To
maintain consistency, the committed version has been expanded to include
files not originally included in the original patch.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free FireWire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef DICEDEFINES_H
25 #define DICEDEFINES_H
26
27 // #define DICE_VER_1_0_4_0
28 #define DICE_VER_1_0_7_0
29
30 #define DICE_INVALID_OFFSET                  0xFFFFF00000000000ULL
31
32 /*
33  * This header is based upon the DICE II driver specification
34  * version 1.0.7.0 and:
35  *  dicedriverExtStatus.h,v 1.2 2006/09/27 20:35:45
36  *  dicedriverInterface.h,v 1.1.1.1 2006/08/10 20:00:57
37  *
38  */
39
40 // Register addresses & offsets
41 //  DICE_PRIVATE_SPACE registers
42 #define DICE_REGISTER_BASE                  0x0000FFFFE0000000ULL
43
44 #define DICE_REGISTER_GLOBAL_PAR_SPACE_OFF  0x0000
45 #define DICE_REGISTER_GLOBAL_PAR_SPACE_SZ   0x0004
46 #define DICE_REGISTER_TX_PAR_SPACE_OFF      0x0008
47 #define DICE_REGISTER_TX_PAR_SPACE_SZ       0x000C
48 #define DICE_REGISTER_RX_PAR_SPACE_OFF      0x0010
49 #define DICE_REGISTER_RX_PAR_SPACE_SZ       0x0014
50 #define DICE_REGISTER_UNUSED1_SPACE_OFF     0x0018
51 #define DICE_REGISTER_UNUSED1_SPACE_SZ      0x001C
52 #define DICE_REGISTER_UNUSED2_SPACE_OFF     0x0020
53 #define DICE_REGISTER_UNUSED2_SPACE_SZ      0x0024
54
55 //  GLOBAL_PAR_SPACE registers
56 #define DICE_REGISTER_GLOBAL_OWNER              0x0000
57 #define DICE_REGISTER_GLOBAL_NOTIFICATION       0x0008
58 #define DICE_REGISTER_GLOBAL_NICK_NAME          0x000C
59 #define DICE_REGISTER_GLOBAL_CLOCK_SELECT       0x004C
60 #define DICE_REGISTER_GLOBAL_ENABLE             0x0050
61 #define DICE_REGISTER_GLOBAL_STATUS             0x0054
62 #define DICE_REGISTER_GLOBAL_EXTENDED_STATUS    0x0058
63 #define DICE_REGISTER_GLOBAL_SAMPLE_RATE        0x005C
64 #define DICE_REGISTER_GLOBAL_VERSION            0x0060
65 #define DICE_REGISTER_GLOBAL_CLOCKCAPABILITIES  0x0064
66 #define DICE_REGISTER_GLOBAL_CLOCKSOURCENAMES   0x0068
67
68 //  TX_PAR_SPACE registers
69 #define DICE_REGISTER_TX_NB_TX                  0x0000
70 #define DICE_REGISTER_TX_SZ_TX                  0x0004
71
72 #define DICE_REGISTER_TX_ISOC_BASE              0x0008
73 #define DICE_REGISTER_TX_NB_AUDIO_BASE          0x000C
74 #define DICE_REGISTER_TX_MIDI_BASE              0x0010
75 #define DICE_REGISTER_TX_SPEED_BASE             0x0014
76 #define DICE_REGISTER_TX_NAMES_BASE             0x0018
77 #define DICE_REGISTER_TX_AC3_CAPABILITIES_BASE  0x0118
78 #define DICE_REGISTER_TX_AC3_ENABLE_BASE        0x011C
79
80 #define DICE_REGISTER_TX_PARAM(size, i, offset) \
81             ( ((i) * (size) ) + (offset) )
82
83 //  RX_PAR_SPACE registers
84 #define DICE_REGISTER_RX_NB_RX                  0x0000
85 #define DICE_REGISTER_RX_SZ_RX                  0x0004
86
87 #ifdef DICE_VER_1_0_4_0
88     #define DICE_REGISTER_RX_ISOC_BASE              0x0008
89     #define DICE_REGISTER_RX_SEQ_START_BASE         0x0014
90     #define DICE_REGISTER_RX_NB_AUDIO_BASE          0x000C
91     #define DICE_REGISTER_RX_MIDI_BASE              0x0010
92     #define DICE_REGISTER_RX_NAMES_BASE             0x0018
93     #define DICE_REGISTER_RX_AC3_CAPABILITIES_BASE  0x0118
94     #define DICE_REGISTER_RX_AC3_ENABLE_BASE        0x011C
95 #endif
96
97 #ifdef DICE_VER_1_0_7_0
98     #define DICE_REGISTER_RX_ISOC_BASE              0x0008
99     #define DICE_REGISTER_RX_SEQ_START_BASE         0x000C
100     #define DICE_REGISTER_RX_NB_AUDIO_BASE          0x0010
101     #define DICE_REGISTER_RX_MIDI_BASE              0x0014
102     #define DICE_REGISTER_RX_NAMES_BASE             0x0018
103     #define DICE_REGISTER_RX_AC3_CAPABILITIES_BASE  0x0118
104     #define DICE_REGISTER_RX_AC3_ENABLE_BASE        0x011C
105 #endif
106
107 #define DICE_REGISTER_RX_PARAM(size, i, offset) \
108             ( ((i) * (size) ) + (offset) )
109
110 // Register Bitfields
111 //  GLOBAL_PAR_SPACE registers
112 //   OWNER register defines
113 #define DICE_OWNER_NO_OWNER 0xFFFF000000000000LLU
114
115 //   NOTIFICATION register defines
116 #define DICE_NOTIFY_RX_CFG_CHG_BIT      (1UL << 0)
117 #define DICE_NOTIFY_TX_CFG_CHG_BIT      (1UL << 1)
118 #define DICE_NOTIFY_DUP_ISOC_BIT        (1UL << 2)
119 #define DICE_NOTIFY_BW_ERR_BIT          (1UL << 3)
120 #define DICE_NOTIFY_LOCK_CHG_BIT        (1UL << 4)
121 #define DICE_NOTIFY_CLOCK_ACCEPTED      (1UL << 5)
122
123 // bits 6..15 are RESERVED
124
125 // FIXME:
126 // diceDriverInterface.h defines the following bitfield
127 // that is undocumented by spec 1.0.7.0
128 #define DICE_INTERFACE_CHG_BIT          (1UL << 6)
129
130 // FIXME:
131 // The spec 1.0.7.0 defines these as USER notifications
132 // however diceDriverInterface.h defines these as
133 // 'reserved bits for future system wide use'.
134 #define DICE_NOTIFY_RESERVED1           (1UL << 16)
135 #define DICE_NOTIFY_RESERVED2           (1UL << 17)
136 #define DICE_NOTIFY_RESERVED3           (1UL << 18)
137 #define DICE_NOTIFY_RESERVED4           (1UL << 19)
138
139 // FIXME:
140 // The spec 1.0.7.0 does not specify anything about
141 // the format of the user messages
142 // however diceDriverInterface.h indicates:
143 // "When DD_NOTIFY_MESSAGE is set DD_NOTIFY_USER4 through
144 //  DD_NOTIFY_USER11 are defined as an 8 bit message so
145 //  you can have 256 seperate messages (like gray encoder
146 //  movements)."
147
148 #define DICE_NOTIFY_MESSAGE             (1UL << 20)
149 #define DICE_NOTIFY_USER1               (1UL << 21)
150 #define DICE_NOTIFY_USER2               (1UL << 22)
151 #define DICE_NOTIFY_USER3               (1UL << 23)
152 #define DICE_NOTIFY_USER4               (1UL << 24)
153 #define DICE_NOTIFY_USER5               (1UL << 25)
154 #define DICE_NOTIFY_USER6               (1UL << 26)
155 #define DICE_NOTIFY_USER7               (1UL << 27)
156 #define DICE_NOTIFY_USER8               (1UL << 28)
157 #define DICE_NOTIFY_USER9               (1UL << 29)
158 #define DICE_NOTIFY_USER10              (1UL << 30)
159 #define DICE_NOTIFY_USER11              (1UL << 31)
160
161 #define DICE_NOTIFY_USER_IS_MESSAGE(x) \
162                 ( ((x) & DICE_NOTIFY_MESSAGE) != 0 )
163
164 #define DICE_NOTIFY_USER_GET_MESSAGE(x) \
165                 ( ((x) >> 24 ) & 0xFF )
166
167 //   NICK_NAME register
168
169 // NOTE: in bytes
170 #define DICE_NICK_NAME_SIZE             64
171
172 //   CLOCK_SELECT register
173 // Clock sources supported
174 #define DICE_CLOCKSOURCE_AES1           0x00
175 #define DICE_CLOCKSOURCE_AES2           0x01
176 #define DICE_CLOCKSOURCE_AES3           0x02
177 #define DICE_CLOCKSOURCE_AES4           0x03
178 #define DICE_CLOCKSOURCE_AES_ANY        0x04
179 #define DICE_CLOCKSOURCE_ADAT           0x05
180 #define DICE_CLOCKSOURCE_TDIF           0x06
181 #define DICE_CLOCKSOURCE_WC             0x07
182 #define DICE_CLOCKSOURCE_ARX1           0x08
183 #define DICE_CLOCKSOURCE_ARX2           0x09
184 #define DICE_CLOCKSOURCE_ARX3           0x0A
185 #define DICE_CLOCKSOURCE_ARX4           0x0B
186 #define DICE_CLOCKSOURCE_INTERNAL       0x0C
187 #define DICE_CLOCKSOURCE_COUNT (DICE_CLOCKSOURCE_INTERNAL+1)
188
189 #define DICE_CLOCKSOURCE_MASK           0x0000FFFFLU
190 #define DICE_GET_CLOCKSOURCE(reg)       (((reg) & DICE_CLOCKSOURCE_MASK))
191 #define DICE_SET_CLOCKSOURCE(reg,clk)   (((reg) & ~DICE_CLOCKSOURCE_MASK) | ((clk) & DICE_CLOCKSOURCE_MASK))
192
193 // Supported rates
194 #define DICE_RATE_32K                   0x00
195 #define DICE_RATE_44K1                  0x01
196 #define DICE_RATE_48K                   0x02
197 #define DICE_RATE_88K2                  0x03
198 #define DICE_RATE_96K                   0x04
199 #define DICE_RATE_176K4                 0x05
200 #define DICE_RATE_192K                  0x06
201 #define DICE_RATE_ANY_LOW               0x07
202 #define DICE_RATE_ANY_MID               0x08
203 #define DICE_RATE_ANY_HIGH              0x09
204 #define DICE_RATE_NONE                  0x0A
205
206 #define DICE_RATE_MASK                  0x0000FF00LU
207 #define DICE_GET_RATE(reg)              (((reg) & DICE_RATE_MASK) >> 8)
208 #define DICE_SET_RATE(reg,rate)         (((reg) & ~DICE_RATE_MASK) | (((rate) << 8) & DICE_RATE_MASK) )
209
210 //   ENABLE register
211 #define DICE_ISOSTREAMING_ENABLE        (1UL << 0)
212 #define DICE_ISOSTREAMING_DISABLE       (0)
213
214
215 //   CLOCK_STATUS register
216 #define DICE_STATUS_SOURCE_LOCKED       (1UL << 0)
217 #define DICE_STATUS_RATE_CONFLICT       (1UL << 1)
218
219 #define DICE_STATUS_GET_NOMINAL_RATE(x) ( ((x) >> 8 ) & 0xFF )
220
221 //   EXTENDED_STATUS register
222 #define DICE_EXT_STATUS_AES0_LOCKED         (1UL << 0)
223 #define DICE_EXT_STATUS_AES1_LOCKED         (1UL << 1)
224 #define DICE_EXT_STATUS_AES2_LOCKED         (1UL << 2)
225 #define DICE_EXT_STATUS_AES3_LOCKED         (1UL << 3)
226 #define DICE_EXT_STATUS_AES_ANY_LOCKED      (    0x0F)
227 #define DICE_EXT_STATUS_ADAT_LOCKED         (1UL << 4)
228 #define DICE_EXT_STATUS_TDIF_LOCKED         (1UL << 5)
229 #define DICE_EXT_STATUS_ARX1_LOCKED         (1UL << 6)
230 #define DICE_EXT_STATUS_ARX2_LOCKED         (1UL << 7)
231 #define DICE_EXT_STATUS_ARX3_LOCKED         (1UL << 8)
232 #define DICE_EXT_STATUS_ARX4_LOCKED         (1UL << 9)
233
234 // FIXME: this one is missing in dicedriverExtStatus.h
235 #define DICE_EXT_STATUS_WC_LOCKED          (1UL << 10)
236
237 #define DICE_EXT_STATUS_AES0_SLIP           (1UL << 16)
238 #define DICE_EXT_STATUS_AES1_SLIP           (1UL << 17)
239 #define DICE_EXT_STATUS_AES2_SLIP           (1UL << 18)
240 #define DICE_EXT_STATUS_AES3_SLIP           (1UL << 19)
241 #define DICE_EXT_STATUS_ADAT_SLIP           (1UL << 20)
242 #define DICE_EXT_STATUS_TDIF_SLIP           (1UL << 21)
243 #define DICE_EXT_STATUS_ARX1_SLIP           (1UL << 22)
244 #define DICE_EXT_STATUS_ARX2_SLIP           (1UL << 23)
245 #define DICE_EXT_STATUS_ARX3_SLIP           (1UL << 24)
246 #define DICE_EXT_STATUS_ARX4_SLIP           (1UL << 25)
247
248 // FIXME: does this even exist?
249 #define DICE_EXT_STATUS_WC_SLIP             (1UL << 26)
250
251 //   SAMPLE_RATE register
252 // nothing here
253
254 //   VERSION register
255 #define DICE_DRIVER_SPEC_VERSION_NUMBER_GET(x,y) \
256             ( ( (x) >> (y)) & 0xFF )
257
258 #define DICE_DRIVER_SPEC_VERSION_NUMBER_GET_A(x) \
259             DICE_DRIVER_SPEC_VERSION_NUMBER_GET(x,24)
260
261 #define DICE_DRIVER_SPEC_VERSION_NUMBER_GET_B(x) \
262             DICE_DRIVER_SPEC_VERSION_NUMBER_GET(x,16)
263
264 #define DICE_DRIVER_SPEC_VERSION_NUMBER_GET_C(x) \
265             DICE_DRIVER_SPEC_VERSION_NUMBER_GET(x,8)
266
267 #define DICE_DRIVER_SPEC_VERSION_NUMBER_GET_D(x) \
268             DICE_DRIVER_SPEC_VERSION_NUMBER_GET(x,0)
269
270 //   CLOCKCAPABILITIES register
271 #define DICE_CLOCKCAP_RATE_32K          (1UL << 0)
272 #define DICE_CLOCKCAP_RATE_44K1         (1UL << 1)
273 #define DICE_CLOCKCAP_RATE_48K          (1UL << 2)
274 #define DICE_CLOCKCAP_RATE_88K2         (1UL << 3)
275 #define DICE_CLOCKCAP_RATE_96K          (1UL << 4)
276 #define DICE_CLOCKCAP_RATE_176K4        (1UL << 5)
277 #define DICE_CLOCKCAP_RATE_192K         (1UL << 6)
278 #define DICE_CLOCKCAP_SOURCE_AES1       (1UL << 16)
279 #define DICE_CLOCKCAP_SOURCE_AES2       (1UL << 17)
280 #define DICE_CLOCKCAP_SOURCE_AES3       (1UL << 18)
281 #define DICE_CLOCKCAP_SOURCE_AES4       (1UL << 19)
282 #define DICE_CLOCKCAP_SOURCE_AES_ANY    (1UL << 20)
283 #define DICE_CLOCKCAP_SOURCE_ADAT       (1UL << 21)
284 #define DICE_CLOCKCAP_SOURCE_TDIF       (1UL << 22)
285 #define DICE_CLOCKCAP_SOURCE_WORDCLOCK  (1UL << 23)
286 #define DICE_CLOCKCAP_SOURCE_ARX1       (1UL << 24)
287 #define DICE_CLOCKCAP_SOURCE_ARX2       (1UL << 25)
288 #define DICE_CLOCKCAP_SOURCE_ARX3       (1UL << 26)
289 #define DICE_CLOCKCAP_SOURCE_ARX4       (1UL << 27)
290 #define DICE_CLOCKCAP_SOURCE_INTERNAL   (1UL << 28)
291
292 //   CLOCKSOURCENAMES
293 // note: in bytes
294 #define DICE_CLOCKSOURCENAMES_SIZE      256
295
296 //  TX_PAR_SPACE registers
297 // note: in bytes
298 #define DICE_TX_NAMES_SIZE              256
299
300 //  RX_PAR_SPACE registers
301 // note: in bytes
302 #define DICE_RX_NAMES_SIZE              256
303
304 #endif // DICEDEFINES_H
Note: See TracBrowser for help on using the browser.