aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ymfpci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /sound/pci/ymfpci
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'sound/pci/ymfpci')
-rw-r--r--sound/pci/ymfpci/Makefile9
-rw-r--r--sound/pci/ymfpci/ymfpci.c372
-rw-r--r--sound/pci/ymfpci/ymfpci_image.h1565
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c2273
4 files changed, 4219 insertions, 0 deletions
diff --git a/sound/pci/ymfpci/Makefile b/sound/pci/ymfpci/Makefile
new file mode 100644
index 000000000000..8790c5f3ed02
--- /dev/null
+++ b/sound/pci/ymfpci/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for ALSA
3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
4#
5
6snd-ymfpci-objs := ymfpci.o ymfpci_main.o
7
8# Toplevel Module Dependency
9obj-$(CONFIG_SND_YMFPCI) += snd-ymfpci.o
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
new file mode 100644
index 000000000000..9f3ef22df08d
--- /dev/null
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -0,0 +1,372 @@
1/*
2 * The driver for the Yamaha's DS1/DS1E cards
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#include <sound/driver.h>
23#include <linux/init.h>
24#include <linux/pci.h>
25#include <linux/time.h>
26#include <linux/moduleparam.h>
27#include <sound/core.h>
28#include <sound/ymfpci.h>
29#include <sound/mpu401.h>
30#include <sound/opl3.h>
31#include <sound/initval.h>
32
33MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
34MODULE_DESCRIPTION("Yamaha DS-XG PCI");
35MODULE_LICENSE("GPL");
36MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF724},"
37 "{Yamaha,YMF724F},"
38 "{Yamaha,YMF740},"
39 "{Yamaha,YMF740C},"
40 "{Yamaha,YMF744},"
41 "{Yamaha,YMF754}}");
42
43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
45static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
46static long fm_port[SNDRV_CARDS];
47static long mpu_port[SNDRV_CARDS];
48#ifdef SUPPORT_JOYSTICK
49static long joystick_port[SNDRV_CARDS];
50#endif
51static int rear_switch[SNDRV_CARDS];
52
53module_param_array(index, int, NULL, 0444);
54MODULE_PARM_DESC(index, "Index value for the Yamaha DS-XG PCI soundcard.");
55module_param_array(id, charp, NULL, 0444);
56MODULE_PARM_DESC(id, "ID string for the Yamaha DS-XG PCI soundcard.");
57module_param_array(enable, bool, NULL, 0444);
58MODULE_PARM_DESC(enable, "Enable Yamaha DS-XG soundcard.");
59module_param_array(mpu_port, long, NULL, 0444);
60MODULE_PARM_DESC(mpu_port, "MPU-401 Port.");
61module_param_array(fm_port, long, NULL, 0444);
62MODULE_PARM_DESC(fm_port, "FM OPL-3 Port.");
63#ifdef SUPPORT_JOYSTICK
64module_param_array(joystick_port, long, NULL, 0444);
65MODULE_PARM_DESC(joystick_port, "Joystick port address");
66#endif
67module_param_array(rear_switch, bool, NULL, 0444);
68MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch");
69
70static struct pci_device_id snd_ymfpci_ids[] = {
71 { 0x1073, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724 */
72 { 0x1073, 0x000d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724F */
73 { 0x1073, 0x000a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF740 */
74 { 0x1073, 0x000c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF740C */
75 { 0x1073, 0x0010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF744 */
76 { 0x1073, 0x0012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF754 */
77 { 0, }
78};
79
80MODULE_DEVICE_TABLE(pci, snd_ymfpci_ids);
81
82#ifdef SUPPORT_JOYSTICK
83static int __devinit snd_ymfpci_create_gameport(ymfpci_t *chip, int dev,
84 int legacy_ctrl, int legacy_ctrl2)
85{
86 struct gameport *gp;
87 struct resource *r = NULL;
88 int io_port = joystick_port[dev];
89
90 if (!io_port)
91 return -ENODEV;
92
93 if (chip->pci->device >= 0x0010) { /* YMF 744/754 */
94
95 if (io_port == 1) {
96 /* auto-detect */
97 if (!(io_port = pci_resource_start(chip->pci, 2)))
98 return -ENODEV;
99 }
100 } else {
101 if (io_port == 1) {
102 /* auto-detect */
103 for (io_port = 0x201; io_port <= 0x205; io_port++) {
104 if (io_port == 0x203)
105 continue;
106 if ((r = request_region(io_port, 1, "YMFPCI gameport")) != NULL)
107 break;
108 }
109 if (!r) {
110 printk(KERN_ERR "ymfpci: no gameport ports available\n");
111 return -EBUSY;
112 }
113 }
114 switch (io_port) {
115 case 0x201: legacy_ctrl2 |= 0 << 6; break;
116 case 0x202: legacy_ctrl2 |= 1 << 6; break;
117 case 0x204: legacy_ctrl2 |= 2 << 6; break;
118 case 0x205: legacy_ctrl2 |= 3 << 6; break;
119 default:
120 printk(KERN_ERR "ymfpci: invalid joystick port %#x", io_port);
121 return -EINVAL;
122 }
123 }
124
125 if (!r && !(r = request_region(io_port, 1, "YMFPCI gameport"))) {
126 printk(KERN_ERR "ymfpci: joystick port %#x is in use.\n", io_port);
127 return -EBUSY;
128 }
129
130 chip->gameport = gp = gameport_allocate_port();
131 if (!gp) {
132 printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n");
133 release_resource(r);
134 kfree_nocheck(r);
135 return -ENOMEM;
136 }
137
138
139 gameport_set_name(gp, "Yamaha YMF Gameport");
140 gameport_set_phys(gp, "pci%s/gameport0", pci_name(chip->pci));
141 gameport_set_dev_parent(gp, &chip->pci->dev);
142 gp->io = io_port;
143 gameport_set_port_data(gp, r);
144
145 if (chip->pci->device >= 0x0010) /* YMF 744/754 */
146 pci_write_config_word(chip->pci, PCIR_DSXG_JOYBASE, io_port);
147
148 pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY, legacy_ctrl | YMFPCI_LEGACY_JPEN);
149 pci_write_config_word(chip->pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
150
151 gameport_register_port(chip->gameport);
152
153 return 0;
154}
155
156void snd_ymfpci_free_gameport(ymfpci_t *chip)
157{
158 if (chip->gameport) {
159 struct resource *r = gameport_get_port_data(chip->gameport);
160
161 gameport_unregister_port(chip->gameport);
162 chip->gameport = NULL;
163
164 release_resource(r);
165 kfree_nocheck(r);
166 }
167}
168#else
169static inline int snd_ymfpci_create_gameport(ymfpci_t *chip, int dev, int l, int l2) { return -ENOSYS; }
170void snd_ymfpci_free_gameport(ymfpci_t *chip) { }
171#endif /* SUPPORT_JOYSTICK */
172
173static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
174 const struct pci_device_id *pci_id)
175{
176 static int dev;
177 snd_card_t *card;
178 struct resource *fm_res = NULL;
179 struct resource *mpu_res = NULL;
180 ymfpci_t *chip;
181 opl3_t *opl3;
182 char *str;
183 int err;
184 u16 legacy_ctrl, legacy_ctrl2, old_legacy_ctrl;
185
186 if (dev >= SNDRV_CARDS)
187 return -ENODEV;
188 if (!enable[dev]) {
189 dev++;
190 return -ENOENT;
191 }
192
193 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
194 if (card == NULL)
195 return -ENOMEM;
196
197 switch (pci_id->device) {
198 case 0x0004: str = "YMF724"; break;
199 case 0x000d: str = "YMF724F"; break;
200 case 0x000a: str = "YMF740"; break;
201 case 0x000c: str = "YMF740C"; break;
202 case 0x0010: str = "YMF744"; break;
203 case 0x0012: str = "YMF754"; break;
204 default: str = "???"; break;
205 }
206
207 legacy_ctrl = 0;
208 legacy_ctrl2 = 0x0800; /* SBEN = 0, SMOD = 01, LAD = 0 */
209
210 if (pci_id->device >= 0x0010) { /* YMF 744/754 */
211 if (fm_port[dev] == 1) {
212 /* auto-detect */
213 fm_port[dev] = pci_resource_start(pci, 1);
214 }
215 if (fm_port[dev] > 0 &&
216 (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
217 legacy_ctrl |= YMFPCI_LEGACY_FMEN;
218 pci_write_config_word(pci, PCIR_DSXG_FMBASE, fm_port[dev]);
219 }
220 if (mpu_port[dev] == 1) {
221 /* auto-detect */
222 mpu_port[dev] = pci_resource_start(pci, 1) + 0x20;
223 }
224 if (mpu_port[dev] > 0 &&
225 (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
226 legacy_ctrl |= YMFPCI_LEGACY_MEN;
227 pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, mpu_port[dev]);
228 }
229 } else {
230 switch (fm_port[dev]) {
231 case 0x388: legacy_ctrl2 |= 0; break;
232 case 0x398: legacy_ctrl2 |= 1; break;
233 case 0x3a0: legacy_ctrl2 |= 2; break;
234 case 0x3a8: legacy_ctrl2 |= 3; break;
235 default: fm_port[dev] = 0; break;
236 }
237 if (fm_port[dev] > 0 &&
238 (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
239 legacy_ctrl |= YMFPCI_LEGACY_FMEN;
240 } else {
241 legacy_ctrl2 &= ~YMFPCI_LEGACY2_FMIO;
242 fm_port[dev] = 0;
243 }
244 switch (mpu_port[dev]) {
245 case 0x330: legacy_ctrl2 |= 0 << 4; break;
246 case 0x300: legacy_ctrl2 |= 1 << 4; break;
247 case 0x332: legacy_ctrl2 |= 2 << 4; break;
248 case 0x334: legacy_ctrl2 |= 3 << 4; break;
249 default: mpu_port[dev] = 0; break;
250 }
251 if (mpu_port[dev] > 0 &&
252 (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
253 legacy_ctrl |= YMFPCI_LEGACY_MEN;
254 } else {
255 legacy_ctrl2 &= ~YMFPCI_LEGACY2_MPUIO;
256 mpu_port[dev] = 0;
257 }
258 }
259 if (mpu_res) {
260 legacy_ctrl |= YMFPCI_LEGACY_MIEN;
261 legacy_ctrl2 |= YMFPCI_LEGACY2_IMOD;
262 }
263 pci_read_config_word(pci, PCIR_DSXG_LEGACY, &old_legacy_ctrl);
264 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
265 pci_write_config_word(pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
266 if ((err = snd_ymfpci_create(card, pci,
267 old_legacy_ctrl,
268 &chip)) < 0) {
269 snd_card_free(card);
270 if (mpu_res) {
271 release_resource(mpu_res);
272 kfree_nocheck(mpu_res);
273 }
274 if (fm_res) {
275 release_resource(fm_res);
276 kfree_nocheck(fm_res);
277 }
278 return err;
279 }
280 chip->fm_res = fm_res;
281 chip->mpu_res = mpu_res;
282 strcpy(card->driver, str);
283 sprintf(card->shortname, "Yamaha DS-XG (%s)", str);
284 sprintf(card->longname, "%s at 0x%lx, irq %i",
285 card->shortname,
286 chip->reg_area_phys,
287 chip->irq);
288 if ((err = snd_ymfpci_pcm(chip, 0, NULL)) < 0) {
289 snd_card_free(card);
290 return err;
291 }
292 if ((err = snd_ymfpci_pcm_spdif(chip, 1, NULL)) < 0) {
293 snd_card_free(card);
294 return err;
295 }
296 if ((err = snd_ymfpci_pcm_4ch(chip, 2, NULL)) < 0) {
297 snd_card_free(card);
298 return err;
299 }
300 if ((err = snd_ymfpci_pcm2(chip, 3, NULL)) < 0) {
301 snd_card_free(card);
302 return err;
303 }
304 if ((err = snd_ymfpci_mixer(chip, rear_switch[dev])) < 0) {
305 snd_card_free(card);
306 return err;
307 }
308 if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
309 snd_card_free(card);
310 return err;
311 }
312 if (chip->mpu_res) {
313 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
314 mpu_port[dev], 1,
315 pci->irq, 0, &chip->rawmidi)) < 0) {
316 printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]);
317 legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */
318 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
319 }
320 }
321 if (chip->fm_res) {
322 if ((err = snd_opl3_create(card,
323 fm_port[dev],
324 fm_port[dev] + 2,
325 OPL3_HW_OPL3, 1, &opl3)) < 0) {
326 printk(KERN_WARNING "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", fm_port[dev]);
327 legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
328 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
329 } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
330 snd_card_free(card);
331 snd_printk("cannot create opl3 hwdep\n");
332 return err;
333 }
334 }
335
336 snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
337
338 if ((err = snd_card_register(card)) < 0) {
339 snd_card_free(card);
340 return err;
341 }
342 pci_set_drvdata(pci, card);
343 dev++;
344 return 0;
345}
346
347static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci)
348{
349 snd_card_free(pci_get_drvdata(pci));
350 pci_set_drvdata(pci, NULL);
351}
352
353static struct pci_driver driver = {
354 .name = "Yamaha DS-XG PCI",
355 .id_table = snd_ymfpci_ids,
356 .probe = snd_card_ymfpci_probe,
357 .remove = __devexit_p(snd_card_ymfpci_remove),
358 SND_PCI_PM_CALLBACKS
359};
360
361static int __init alsa_card_ymfpci_init(void)
362{
363 return pci_module_init(&driver);
364}
365
366static void __exit alsa_card_ymfpci_exit(void)
367{
368 pci_unregister_driver(&driver);
369}
370
371module_init(alsa_card_ymfpci_init)
372module_exit(alsa_card_ymfpci_exit)
diff --git a/sound/pci/ymfpci/ymfpci_image.h b/sound/pci/ymfpci/ymfpci_image.h
new file mode 100644
index 000000000000..1b0746991669
--- /dev/null
+++ b/sound/pci/ymfpci/ymfpci_image.h
@@ -0,0 +1,1565 @@
1#ifndef _HWMCODE_
2#define _HWMCODE_
3
4static unsigned long DspInst[YDSXG_DSPLENGTH / 4] = {
5 0x00000081, 0x000001a4, 0x0000000a, 0x0000002f,
6 0x00080253, 0x01800317, 0x0000407b, 0x0000843f,
7 0x0001483c, 0x0001943c, 0x0005d83c, 0x00001c3c,
8 0x0000c07b, 0x00050c3f, 0x0121503c, 0x00000000,
9 0x00000000, 0x00000000, 0x00000000, 0x00000000,
10 0x00000000, 0x00000000, 0x00000000, 0x00000000,
11 0x00000000, 0x00000000, 0x00000000, 0x00000000,
12 0x00000000, 0x00000000, 0x00000000, 0x00000000
13};
14
15static unsigned long CntrlInst[YDSXG_CTRLLENGTH / 4] = {
16 0x000007, 0x240007, 0x0C0007, 0x1C0007,
17 0x060007, 0x700002, 0x000020, 0x030040,
18 0x007104, 0x004286, 0x030040, 0x000F0D,
19 0x000810, 0x20043A, 0x000282, 0x00020D,
20 0x000810, 0x20043A, 0x001282, 0x200E82,
21 0x001A82, 0x032D0D, 0x000810, 0x10043A,
22 0x02D38D, 0x000810, 0x18043A, 0x00010D,
23 0x020015, 0x0000FD, 0x000020, 0x038860,
24 0x039060, 0x038060, 0x038040, 0x038040,
25 0x038040, 0x018040, 0x000A7D, 0x038040,
26 0x038040, 0x018040, 0x200402, 0x000882,
27 0x08001A, 0x000904, 0x015986, 0x000007,
28 0x260007, 0x000007, 0x000007, 0x018A06,
29 0x000007, 0x030C8D, 0x000810, 0x18043A,
30 0x260007, 0x00087D, 0x018042, 0x00160A,
31 0x04A206, 0x000007, 0x00218D, 0x000810,
32 0x08043A, 0x21C206, 0x000007, 0x0007FD,
33 0x018042, 0x08000A, 0x000904, 0x029386,
34 0x000195, 0x090D04, 0x000007, 0x000820,
35 0x0000F5, 0x000B7D, 0x01F060, 0x0000FD,
36 0x032206, 0x018040, 0x000A7D, 0x038042,
37 0x13804A, 0x18000A, 0x001820, 0x059060,
38 0x058860, 0x018040, 0x0000FD, 0x018042,
39 0x70000A, 0x000115, 0x071144, 0x032386,
40 0x030000, 0x007020, 0x034A06, 0x018040,
41 0x00348D, 0x000810, 0x08043A, 0x21EA06,
42 0x000007, 0x02D38D, 0x000810, 0x18043A,
43 0x018206, 0x000007, 0x240007, 0x000F8D,
44 0x000810, 0x00163A, 0x002402, 0x005C02,
45 0x0028FD, 0x000020, 0x018040, 0x08000D,
46 0x000815, 0x510984, 0x000007, 0x00004D,
47 0x000E5D, 0x000E02, 0x00418D, 0x000810,
48 0x08043A, 0x2C8A06, 0x000007, 0x00008D,
49 0x000924, 0x000F02, 0x00458D, 0x000810,
50 0x08043A, 0x2C8A06, 0x000007, 0x00387D,
51 0x018042, 0x08000A, 0x001015, 0x010984,
52 0x018386, 0x000007, 0x01AA06, 0x000007,
53 0x0008FD, 0x018042, 0x18000A, 0x001904,
54 0x218086, 0x280007, 0x001810, 0x28043A,
55 0x280C02, 0x00000D, 0x000810, 0x28143A,
56 0x08808D, 0x000820, 0x0002FD, 0x018040,
57 0x200007, 0x00020D, 0x189904, 0x000007,
58 0x00402D, 0x0000BD, 0x0002FD, 0x018042,
59 0x08000A, 0x000904, 0x055A86, 0x000007,
60 0x000100, 0x000A20, 0x00047D, 0x018040,
61 0x018042, 0x20000A, 0x003015, 0x012144,
62 0x034986, 0x000007, 0x002104, 0x034986,
63 0x000007, 0x000F8D, 0x000810, 0x280C3A,
64 0x023944, 0x06C986, 0x000007, 0x001810,
65 0x28043A, 0x08810D, 0x000820, 0x0002FD,
66 0x018040, 0x200007, 0x002810, 0x78003A,
67 0x00688D, 0x000810, 0x08043A, 0x288A06,
68 0x000007, 0x00400D, 0x001015, 0x189904,
69 0x292904, 0x393904, 0x000007, 0x060206,
70 0x000007, 0x0004F5, 0x00007D, 0x000020,
71 0x00008D, 0x010860, 0x018040, 0x00047D,
72 0x038042, 0x21804A, 0x18000A, 0x021944,
73 0x215886, 0x000007, 0x004075, 0x71F104,
74 0x000007, 0x010042, 0x28000A, 0x002904,
75 0x212086, 0x000007, 0x003C0D, 0x30A904,
76 0x000007, 0x00077D, 0x018042, 0x08000A,
77 0x000904, 0x07DA86, 0x00057D, 0x002820,
78 0x03B060, 0x07F206, 0x018040, 0x003020,
79 0x03A860, 0x018040, 0x0002FD, 0x018042,
80 0x08000A, 0x000904, 0x07FA86, 0x000007,
81 0x00057D, 0x018042, 0x28040A, 0x000E8D,
82 0x000810, 0x280C3A, 0x00000D, 0x000810,
83 0x28143A, 0x09000D, 0x000820, 0x0002FD,
84 0x018040, 0x200007, 0x003DFD, 0x000020,
85 0x018040, 0x00107D, 0x008D8D, 0x000810,
86 0x08043A, 0x288A06, 0x000007, 0x000815,
87 0x08001A, 0x010984, 0x095186, 0x00137D,
88 0x200500, 0x280F20, 0x338F60, 0x3B8F60,
89 0x438F60, 0x4B8F60, 0x538F60, 0x5B8F60,
90 0x038A60, 0x018040, 0x007FBD, 0x383DC4,
91 0x000007, 0x001A7D, 0x001375, 0x018042,
92 0x09004A, 0x10000A, 0x0B8D04, 0x139504,
93 0x000007, 0x000820, 0x019060, 0x001104,
94 0x212086, 0x010040, 0x0017FD, 0x018042,
95 0x08000A, 0x000904, 0x212286, 0x000007,
96 0x00197D, 0x038042, 0x09804A, 0x10000A,
97 0x000924, 0x001664, 0x0011FD, 0x038042,
98 0x2B804A, 0x19804A, 0x00008D, 0x218944,
99 0x000007, 0x002244, 0x0AE186, 0x000007,
100 0x001A64, 0x002A24, 0x00197D, 0x080102,
101 0x100122, 0x000820, 0x039060, 0x018040,
102 0x003DFD, 0x00008D, 0x000820, 0x018040,
103 0x001375, 0x001A7D, 0x010042, 0x09804A,
104 0x10000A, 0x00021D, 0x0189E4, 0x2992E4,
105 0x309144, 0x000007, 0x00060D, 0x000A15,
106 0x000C1D, 0x001025, 0x00A9E4, 0x012BE4,
107 0x000464, 0x01B3E4, 0x0232E4, 0x000464,
108 0x000464, 0x000464, 0x000464, 0x00040D,
109 0x08B1C4, 0x000007, 0x000820, 0x000BF5,
110 0x030040, 0x00197D, 0x038042, 0x09804A,
111 0x000A24, 0x08000A, 0x080E64, 0x000007,
112 0x100122, 0x000820, 0x031060, 0x010040,
113 0x0064AC, 0x00027D, 0x000020, 0x018040,
114 0x00107D, 0x018042, 0x0011FD, 0x3B804A,
115 0x09804A, 0x20000A, 0x000095, 0x1A1144,
116 0x00A144, 0x0D2086, 0x00040D, 0x00B984,
117 0x0D2186, 0x0018FD, 0x018042, 0x0010FD,
118 0x09804A, 0x28000A, 0x000095, 0x010924,
119 0x002A64, 0x0D1186, 0x000007, 0x002904,
120 0x0D2286, 0x000007, 0x0D2A06, 0x080002,
121 0x00008D, 0x00387D, 0x000820, 0x018040,
122 0x00127D, 0x018042, 0x10000A, 0x003904,
123 0x0DD186, 0x00080D, 0x7FFFB5, 0x00B984,
124 0x0DA186, 0x000025, 0x0E7A06, 0x00002D,
125 0x000015, 0x00082D, 0x02C78D, 0x000820,
126 0x0EC206, 0x00000D, 0x7F8035, 0x00B984,
127 0x0E7186, 0x400025, 0x00008D, 0x110944,
128 0x000007, 0x00018D, 0x109504, 0x000007,
129 0x009164, 0x000424, 0x000424, 0x000424,
130 0x100102, 0x280002, 0x02C68D, 0x000820,
131 0x0EC206, 0x00018D, 0x00042D, 0x00008D,
132 0x109504, 0x000007, 0x00020D, 0x109184,
133 0x000007, 0x02C70D, 0x000820, 0x00008D,
134 0x0038FD, 0x018040, 0x003BFD, 0x001020,
135 0x03A860, 0x000815, 0x313184, 0x212184,
136 0x000007, 0x03B060, 0x03A060, 0x018040,
137 0x0022FD, 0x000095, 0x010924, 0x000424,
138 0x000424, 0x001264, 0x100102, 0x000820,
139 0x039060, 0x018040, 0x001924, 0x00FB8D,
140 0x00397D, 0x000820, 0x058040, 0x038042,
141 0x09844A, 0x000606, 0x08040A, 0x000424,
142 0x000424, 0x00117D, 0x018042, 0x08000A,
143 0x000A24, 0x280502, 0x280C02, 0x09800D,
144 0x000820, 0x0002FD, 0x018040, 0x200007,
145 0x0022FD, 0x018042, 0x08000A, 0x000095,
146 0x280DC4, 0x011924, 0x00197D, 0x018042,
147 0x0011FD, 0x09804A, 0x10000A, 0x0000B5,
148 0x113144, 0x0A8D04, 0x000007, 0x080A44,
149 0x129504, 0x000007, 0x0023FD, 0x001020,
150 0x038040, 0x101244, 0x000007, 0x000820,
151 0x039060, 0x018040, 0x0002FD, 0x018042,
152 0x08000A, 0x000904, 0x10FA86, 0x000007,
153 0x003BFD, 0x000100, 0x000A10, 0x0B807A,
154 0x13804A, 0x090984, 0x000007, 0x000095,
155 0x013D04, 0x118086, 0x10000A, 0x100002,
156 0x090984, 0x000007, 0x038042, 0x11804A,
157 0x090D04, 0x000007, 0x10000A, 0x090D84,
158 0x000007, 0x00257D, 0x000820, 0x018040,
159 0x00010D, 0x000810, 0x28143A, 0x00127D,
160 0x018042, 0x20000A, 0x00197D, 0x018042,
161 0x00117D, 0x31804A, 0x10000A, 0x003124,
162 0x01280D, 0x00397D, 0x000820, 0x058040,
163 0x038042, 0x09844A, 0x000606, 0x08040A,
164 0x300102, 0x003124, 0x000424, 0x000424,
165 0x001224, 0x280502, 0x001A4C, 0x130186,
166 0x700002, 0x00002D, 0x030000, 0x00387D,
167 0x018042, 0x10000A, 0x132A06, 0x002124,
168 0x0000AD, 0x100002, 0x00010D, 0x000924,
169 0x006B24, 0x01368D, 0x00397D, 0x000820,
170 0x058040, 0x038042, 0x09844A, 0x000606,
171 0x08040A, 0x003264, 0x00008D, 0x000A24,
172 0x001020, 0x00227D, 0x018040, 0x013C0D,
173 0x000810, 0x08043A, 0x29D206, 0x000007,
174 0x002820, 0x00207D, 0x018040, 0x00117D,
175 0x038042, 0x13804A, 0x33800A, 0x00387D,
176 0x018042, 0x08000A, 0x000904, 0x163A86,
177 0x000007, 0x00008D, 0x030964, 0x01478D,
178 0x00397D, 0x000820, 0x058040, 0x038042,
179 0x09844A, 0x000606, 0x08040A, 0x380102,
180 0x000424, 0x000424, 0x001224, 0x0002FD,
181 0x018042, 0x08000A, 0x000904, 0x14A286,
182 0x000007, 0x280502, 0x001A4C, 0x163986,
183 0x000007, 0x032164, 0x00632C, 0x003DFD,
184 0x018042, 0x08000A, 0x000095, 0x090904,
185 0x000007, 0x000820, 0x001A4C, 0x156186,
186 0x018040, 0x030000, 0x157A06, 0x002124,
187 0x00010D, 0x000924, 0x006B24, 0x015B8D,
188 0x00397D, 0x000820, 0x058040, 0x038042,
189 0x09844A, 0x000606, 0x08040A, 0x003A64,
190 0x000095, 0x001224, 0x0002FD, 0x018042,
191 0x08000A, 0x000904, 0x15DA86, 0x000007,
192 0x01628D, 0x000810, 0x08043A, 0x29D206,
193 0x000007, 0x14D206, 0x000007, 0x007020,
194 0x08010A, 0x10012A, 0x0020FD, 0x038860,
195 0x039060, 0x018040, 0x00227D, 0x018042,
196 0x003DFD, 0x08000A, 0x31844A, 0x000904,
197 0x16D886, 0x18008B, 0x00008D, 0x189904,
198 0x00312C, 0x17AA06, 0x000007, 0x00324C,
199 0x173386, 0x000007, 0x001904, 0x173086,
200 0x000007, 0x000095, 0x199144, 0x00222C,
201 0x003124, 0x00636C, 0x000E3D, 0x001375,
202 0x000BFD, 0x010042, 0x09804A, 0x10000A,
203 0x038AEC, 0x0393EC, 0x00224C, 0x17A986,
204 0x000007, 0x00008D, 0x189904, 0x00226C,
205 0x00322C, 0x30050A, 0x301DAB, 0x002083,
206 0x0018FD, 0x018042, 0x08000A, 0x018924,
207 0x300502, 0x001083, 0x001875, 0x010042,
208 0x10000A, 0x00008D, 0x010924, 0x001375,
209 0x330542, 0x330CCB, 0x332CCB, 0x3334CB,
210 0x333CCB, 0x3344CB, 0x334CCB, 0x3354CB,
211 0x305C8B, 0x006083, 0x0002F5, 0x010042,
212 0x08000A, 0x000904, 0x187A86, 0x000007,
213 0x001E2D, 0x0005FD, 0x018042, 0x08000A,
214 0x028924, 0x280502, 0x00060D, 0x000810,
215 0x280C3A, 0x00008D, 0x000810, 0x28143A,
216 0x0A808D, 0x000820, 0x0002F5, 0x010040,
217 0x220007, 0x001275, 0x030042, 0x21004A,
218 0x00008D, 0x1A0944, 0x000007, 0x01980D,
219 0x000810, 0x08043A, 0x2B2206, 0x000007,
220 0x0001F5, 0x030042, 0x0D004A, 0x10000A,
221 0x089144, 0x000007, 0x000820, 0x010040,
222 0x0025F5, 0x0A3144, 0x000007, 0x000820,
223 0x032860, 0x030040, 0x00217D, 0x038042,
224 0x0B804A, 0x10000A, 0x000820, 0x031060,
225 0x030040, 0x00008D, 0x000124, 0x00012C,
226 0x000E64, 0x001A64, 0x00636C, 0x08010A,
227 0x10012A, 0x000820, 0x031060, 0x030040,
228 0x0020FD, 0x018042, 0x08000A, 0x00227D,
229 0x018042, 0x10000A, 0x000820, 0x031060,
230 0x030040, 0x00197D, 0x018042, 0x08000A,
231 0x0022FD, 0x038042, 0x10000A, 0x000820,
232 0x031060, 0x030040, 0x090D04, 0x000007,
233 0x000820, 0x030040, 0x038042, 0x0B804A,
234 0x10000A, 0x000820, 0x031060, 0x030040,
235 0x038042, 0x13804A, 0x19804A, 0x110D04,
236 0x198D04, 0x000007, 0x08000A, 0x001020,
237 0x031860, 0x030860, 0x030040, 0x00008D,
238 0x0B0944, 0x000007, 0x000820, 0x010040,
239 0x0005F5, 0x030042, 0x08000A, 0x000820,
240 0x010040, 0x0000F5, 0x010042, 0x08000A,
241 0x000904, 0x1C6086, 0x001E75, 0x030042,
242 0x01044A, 0x000C0A, 0x1C7206, 0x000007,
243 0x000402, 0x000C02, 0x00177D, 0x001AF5,
244 0x018042, 0x03144A, 0x031C4A, 0x03244A,
245 0x032C4A, 0x03344A, 0x033C4A, 0x03444A,
246 0x004C0A, 0x00043D, 0x0013F5, 0x001AFD,
247 0x030042, 0x0B004A, 0x1B804A, 0x13804A,
248 0x20000A, 0x089144, 0x19A144, 0x0389E4,
249 0x0399EC, 0x005502, 0x005D0A, 0x030042,
250 0x0B004A, 0x1B804A, 0x13804A, 0x20000A,
251 0x089144, 0x19A144, 0x0389E4, 0x0399EC,
252 0x006502, 0x006D0A, 0x030042, 0x0B004A,
253 0x19004A, 0x2B804A, 0x13804A, 0x21804A,
254 0x30000A, 0x089144, 0x19A144, 0x2AB144,
255 0x0389E4, 0x0399EC, 0x007502, 0x007D0A,
256 0x03A9E4, 0x000702, 0x00107D, 0x000415,
257 0x018042, 0x08000A, 0x0109E4, 0x000F02,
258 0x002AF5, 0x0019FD, 0x010042, 0x09804A,
259 0x10000A, 0x000934, 0x001674, 0x0029F5,
260 0x010042, 0x10000A, 0x00917C, 0x002075,
261 0x010042, 0x08000A, 0x000904, 0x1ED286,
262 0x0026F5, 0x0027F5, 0x030042, 0x09004A,
263 0x10000A, 0x000A3C, 0x00167C, 0x001A75,
264 0x000BFD, 0x010042, 0x51804A, 0x48000A,
265 0x160007, 0x001075, 0x010042, 0x282C0A,
266 0x281D12, 0x282512, 0x001F32, 0x1E0007,
267 0x0E0007, 0x001975, 0x010042, 0x002DF5,
268 0x0D004A, 0x10000A, 0x009144, 0x1FB286,
269 0x010042, 0x28340A, 0x000E5D, 0x00008D,
270 0x000375, 0x000820, 0x010040, 0x05D2F4,
271 0x54D104, 0x00735C, 0x205386, 0x000007,
272 0x0C0007, 0x080007, 0x0A0007, 0x02040D,
273 0x000810, 0x08043A, 0x332206, 0x000007,
274 0x205A06, 0x000007, 0x080007, 0x002275,
275 0x010042, 0x20000A, 0x002104, 0x212086,
276 0x001E2D, 0x0002F5, 0x010042, 0x08000A,
277 0x000904, 0x209286, 0x000007, 0x002010,
278 0x30043A, 0x00057D, 0x0180C3, 0x08000A,
279 0x028924, 0x280502, 0x280C02, 0x0A810D,
280 0x000820, 0x0002F5, 0x010040, 0x220007,
281 0x0004FD, 0x018042, 0x70000A, 0x030000,
282 0x007020, 0x06FA06, 0x018040, 0x02180D,
283 0x000810, 0x08043A, 0x2B2206, 0x000007,
284 0x0002FD, 0x018042, 0x08000A, 0x000904,
285 0x218A86, 0x000007, 0x01F206, 0x000007,
286 0x000875, 0x0009FD, 0x00010D, 0x220A06,
287 0x000295, 0x000B75, 0x00097D, 0x00000D,
288 0x000515, 0x010042, 0x18000A, 0x001904,
289 0x287886, 0x0006F5, 0x001020, 0x010040,
290 0x0004F5, 0x000820, 0x010040, 0x000775,
291 0x010042, 0x09804A, 0x10000A, 0x001124,
292 0x000904, 0x22BA86, 0x000815, 0x080102,
293 0x101204, 0x22DA06, 0x000575, 0x081204,
294 0x000007, 0x100102, 0x000575, 0x000425,
295 0x021124, 0x100102, 0x000820, 0x031060,
296 0x010040, 0x001924, 0x287886, 0x00008D,
297 0x000464, 0x009D04, 0x278886, 0x180102,
298 0x000575, 0x010042, 0x28040A, 0x00018D,
299 0x000924, 0x280D02, 0x00000D, 0x000924,
300 0x281502, 0x10000D, 0x000820, 0x0002F5,
301 0x010040, 0x200007, 0x001175, 0x0002FD,
302 0x018042, 0x08000A, 0x000904, 0x23C286,
303 0x000007, 0x000100, 0x080B20, 0x130B60,
304 0x1B0B60, 0x030A60, 0x010040, 0x050042,
305 0x3D004A, 0x35004A, 0x2D004A, 0x20000A,
306 0x0006F5, 0x010042, 0x28140A, 0x0004F5,
307 0x010042, 0x08000A, 0x000315, 0x010D04,
308 0x24CA86, 0x004015, 0x000095, 0x010D04,
309 0x24B886, 0x100022, 0x10002A, 0x24E206,
310 0x000007, 0x333104, 0x2AA904, 0x000007,
311 0x032124, 0x280502, 0x001124, 0x000424,
312 0x000424, 0x003224, 0x00292C, 0x00636C,
313 0x25F386, 0x000007, 0x02B164, 0x000464,
314 0x000464, 0x00008D, 0x000A64, 0x280D02,
315 0x10008D, 0x000820, 0x0002F5, 0x010040,
316 0x220007, 0x00008D, 0x38B904, 0x000007,
317 0x03296C, 0x30010A, 0x0002F5, 0x010042,
318 0x08000A, 0x000904, 0x25BA86, 0x000007,
319 0x02312C, 0x28050A, 0x00008D, 0x01096C,
320 0x280D0A, 0x10010D, 0x000820, 0x0002F5,
321 0x010040, 0x220007, 0x001124, 0x000424,
322 0x000424, 0x003224, 0x300102, 0x032944,
323 0x267A86, 0x000007, 0x300002, 0x0004F5,
324 0x010042, 0x08000A, 0x000315, 0x010D04,
325 0x26C086, 0x003124, 0x000464, 0x300102,
326 0x0002F5, 0x010042, 0x08000A, 0x000904,
327 0x26CA86, 0x000007, 0x003124, 0x300502,
328 0x003924, 0x300583, 0x000883, 0x0005F5,
329 0x010042, 0x28040A, 0x00008D, 0x008124,
330 0x280D02, 0x00008D, 0x008124, 0x281502,
331 0x10018D, 0x000820, 0x0002F5, 0x010040,
332 0x220007, 0x001025, 0x000575, 0x030042,
333 0x09004A, 0x10000A, 0x0A0904, 0x121104,
334 0x000007, 0x001020, 0x050860, 0x050040,
335 0x0006FD, 0x018042, 0x09004A, 0x10000A,
336 0x0000A5, 0x0A0904, 0x121104, 0x000007,
337 0x000820, 0x019060, 0x010040, 0x0002F5,
338 0x010042, 0x08000A, 0x000904, 0x284286,
339 0x000007, 0x230A06, 0x000007, 0x000606,
340 0x000007, 0x0002F5, 0x010042, 0x08000A,
341 0x000904, 0x289286, 0x000007, 0x000100,
342 0x080B20, 0x138B60, 0x1B8B60, 0x238B60,
343 0x2B8B60, 0x338B60, 0x3B8B60, 0x438B60,
344 0x4B8B60, 0x538B60, 0x5B8B60, 0x638B60,
345 0x6B8B60, 0x738B60, 0x7B8B60, 0x038F60,
346 0x0B8F60, 0x138F60, 0x1B8F60, 0x238F60,
347 0x2B8F60, 0x338F60, 0x3B8F60, 0x438F60,
348 0x4B8F60, 0x538F60, 0x5B8F60, 0x638F60,
349 0x6B8F60, 0x738F60, 0x7B8F60, 0x038A60,
350 0x000606, 0x018040, 0x00008D, 0x000A64,
351 0x280D02, 0x000A24, 0x00027D, 0x018042,
352 0x10000A, 0x001224, 0x0003FD, 0x018042,
353 0x08000A, 0x000904, 0x2A8286, 0x000007,
354 0x00018D, 0x000A24, 0x000464, 0x000464,
355 0x080102, 0x000924, 0x000424, 0x000424,
356 0x100102, 0x02000D, 0x009144, 0x2AD986,
357 0x000007, 0x0001FD, 0x018042, 0x08000A,
358 0x000A44, 0x2ABB86, 0x018042, 0x0A000D,
359 0x000820, 0x0002FD, 0x018040, 0x200007,
360 0x00027D, 0x001020, 0x000606, 0x018040,
361 0x0002F5, 0x010042, 0x08000A, 0x000904,
362 0x2B2A86, 0x000007, 0x00037D, 0x018042,
363 0x08000A, 0x000904, 0x2B5A86, 0x000007,
364 0x000075, 0x002E7D, 0x010042, 0x0B804A,
365 0x000020, 0x000904, 0x000686, 0x010040,
366 0x31844A, 0x30048B, 0x000883, 0x00008D,
367 0x000810, 0x28143A, 0x00008D, 0x000810,
368 0x280C3A, 0x000675, 0x010042, 0x08000A,
369 0x003815, 0x010924, 0x280502, 0x0B000D,
370 0x000820, 0x0002F5, 0x010040, 0x000606,
371 0x220007, 0x000464, 0x000464, 0x000606,
372 0x000007, 0x000134, 0x007F8D, 0x00093C,
373 0x281D12, 0x282512, 0x001F32, 0x0E0007,
374 0x00010D, 0x00037D, 0x000820, 0x018040,
375 0x05D2F4, 0x000007, 0x080007, 0x00037D,
376 0x018042, 0x08000A, 0x000904, 0x2D0286,
377 0x000007, 0x000606, 0x000007, 0x000007,
378 0x000012, 0x100007, 0x320007, 0x600007,
379 0x100080, 0x48001A, 0x004904, 0x2D6186,
380 0x000007, 0x001210, 0x58003A, 0x000145,
381 0x5C5D04, 0x000007, 0x000080, 0x48001A,
382 0x004904, 0x2DB186, 0x000007, 0x001210,
383 0x50003A, 0x005904, 0x2E0886, 0x000045,
384 0x0000C5, 0x7FFFF5, 0x7FFF7D, 0x07D524,
385 0x004224, 0x500102, 0x200502, 0x000082,
386 0x40001A, 0x004104, 0x2E3986, 0x000007,
387 0x003865, 0x40001A, 0x004020, 0x00104D,
388 0x04C184, 0x301B86, 0x000040, 0x040007,
389 0x000165, 0x000145, 0x004020, 0x000040,
390 0x000765, 0x080080, 0x40001A, 0x004104,
391 0x2EC986, 0x000007, 0x001210, 0x40003A,
392 0x004104, 0x2F2286, 0x00004D, 0x0000CD,
393 0x004810, 0x20043A, 0x000882, 0x40001A,
394 0x004104, 0x2F3186, 0x000007, 0x004820,
395 0x005904, 0x300886, 0x000040, 0x0007E5,
396 0x200480, 0x2816A0, 0x3216E0, 0x3A16E0,
397 0x4216E0, 0x021260, 0x000040, 0x000032,
398 0x400075, 0x00007D, 0x07D574, 0x200512,
399 0x000082, 0x40001A, 0x004104, 0x2FE186,
400 0x000007, 0x037206, 0x640007, 0x060007,
401 0x0000E5, 0x000020, 0x000040, 0x000A65,
402 0x000020, 0x020040, 0x020040, 0x000040,
403 0x000165, 0x000042, 0x70000A, 0x007104,
404 0x30A286, 0x000007, 0x018206, 0x640007,
405 0x050000, 0x007020, 0x000040, 0x037206,
406 0x640007, 0x000007, 0x00306D, 0x028860,
407 0x029060, 0x08000A, 0x028860, 0x008040,
408 0x100012, 0x00100D, 0x009184, 0x314186,
409 0x000E0D, 0x009184, 0x325186, 0x000007,
410 0x300007, 0x001020, 0x003B6D, 0x008040,
411 0x000080, 0x08001A, 0x000904, 0x316186,
412 0x000007, 0x001220, 0x000DED, 0x008040,
413 0x008042, 0x10000A, 0x40000D, 0x109544,
414 0x000007, 0x001020, 0x000DED, 0x008040,
415 0x008042, 0x20040A, 0x000082, 0x08001A,
416 0x000904, 0x31F186, 0x000007, 0x003B6D,
417 0x008042, 0x08000A, 0x000E15, 0x010984,
418 0x329B86, 0x600007, 0x08001A, 0x000C15,
419 0x010984, 0x328386, 0x000020, 0x1A0007,
420 0x0002ED, 0x008040, 0x620007, 0x00306D,
421 0x028042, 0x0A804A, 0x000820, 0x0A804A,
422 0x000606, 0x10804A, 0x000007, 0x282512,
423 0x001F32, 0x05D2F4, 0x54D104, 0x00735C,
424 0x000786, 0x000007, 0x0C0007, 0x0A0007,
425 0x1C0007, 0x003465, 0x020040, 0x004820,
426 0x025060, 0x40000A, 0x024060, 0x000040,
427 0x454944, 0x000007, 0x004020, 0x003AE5,
428 0x000040, 0x0028E5, 0x000042, 0x48000A,
429 0x004904, 0x386886, 0x002C65, 0x000042,
430 0x40000A, 0x0000D5, 0x454104, 0x000007,
431 0x000655, 0x054504, 0x34F286, 0x0001D5,
432 0x054504, 0x34F086, 0x002B65, 0x000042,
433 0x003AE5, 0x50004A, 0x40000A, 0x45C3D4,
434 0x000007, 0x454504, 0x000007, 0x0000CD,
435 0x444944, 0x000007, 0x454504, 0x000007,
436 0x00014D, 0x554944, 0x000007, 0x045144,
437 0x34E986, 0x002C65, 0x000042, 0x48000A,
438 0x4CD104, 0x000007, 0x04C144, 0x34F386,
439 0x000007, 0x160007, 0x002CE5, 0x040042,
440 0x40000A, 0x004020, 0x000040, 0x002965,
441 0x000042, 0x40000A, 0x004104, 0x356086,
442 0x000007, 0x002402, 0x36A206, 0x005C02,
443 0x0025E5, 0x000042, 0x40000A, 0x004274,
444 0x002AE5, 0x000042, 0x40000A, 0x004274,
445 0x500112, 0x0029E5, 0x000042, 0x40000A,
446 0x004234, 0x454104, 0x000007, 0x004020,
447 0x000040, 0x003EE5, 0x000020, 0x000040,
448 0x002DE5, 0x400152, 0x50000A, 0x045144,
449 0x364A86, 0x0000C5, 0x003EE5, 0x004020,
450 0x000040, 0x002BE5, 0x000042, 0x40000A,
451 0x404254, 0x000007, 0x002AE5, 0x004020,
452 0x000040, 0x500132, 0x040134, 0x005674,
453 0x0029E5, 0x020042, 0x42000A, 0x000042,
454 0x50000A, 0x05417C, 0x0028E5, 0x000042,
455 0x48000A, 0x0000C5, 0x4CC144, 0x371086,
456 0x0026E5, 0x0027E5, 0x020042, 0x40004A,
457 0x50000A, 0x00423C, 0x00567C, 0x0028E5,
458 0x004820, 0x000040, 0x281D12, 0x282512,
459 0x001F72, 0x002965, 0x000042, 0x40000A,
460 0x004104, 0x37AA86, 0x0E0007, 0x160007,
461 0x1E0007, 0x003EE5, 0x000042, 0x40000A,
462 0x004104, 0x37E886, 0x002D65, 0x000042,
463 0x28340A, 0x003465, 0x020042, 0x42004A,
464 0x004020, 0x4A004A, 0x50004A, 0x05D2F4,
465 0x54D104, 0x00735C, 0x385186, 0x000007,
466 0x000606, 0x080007, 0x0C0007, 0x080007,
467 0x0A0007, 0x0001E5, 0x020045, 0x004020,
468 0x000060, 0x000365, 0x000040, 0x002E65,
469 0x001A20, 0x0A1A60, 0x000040, 0x003465,
470 0x020042, 0x42004A, 0x004020, 0x4A004A,
471 0x000606, 0x50004A, 0x000000, 0x000000,
472 0x000000, 0x000000, 0x000000, 0x000000,
473 0x000000, 0x000000, 0x000000, 0x000000,
474 0x000000, 0x000000, 0x000000, 0x000000,
475 0x000000, 0x000000, 0x000000, 0x000000,
476 0x000000, 0x000000, 0x000000, 0x000000,
477 0x000000, 0x000000, 0x000000, 0x000000,
478 0x000000, 0x000000, 0x000000, 0x000000,
479 0x000000, 0x000000, 0x000000, 0x000000,
480 0x000000, 0x000000, 0x000000, 0x000000,
481 0x000000, 0x000000, 0x000000, 0x000000,
482 0x000000, 0x000000, 0x000000, 0x000000,
483 0x000000, 0x000000, 0x000000, 0x000000,
484 0x000000, 0x000000, 0x000000, 0x000000,
485 0x000000, 0x000000, 0x000000, 0x000000,
486 0x000000, 0x000000, 0x000000, 0x000000,
487 0x000000, 0x000000, 0x000000, 0x000000,
488 0x000000, 0x000000, 0x000000, 0x000000,
489 0x000000, 0x000000, 0x000000, 0x000000,
490 0x000000, 0x000000, 0x000000, 0x000000,
491 0x000000, 0x000000, 0x000000, 0x000000,
492 0x000000, 0x000000, 0x000000, 0x000000,
493 0x000000, 0x000000, 0x000000, 0x000000,
494 0x000000, 0x000000, 0x000000, 0x000000,
495 0x000000, 0x000000, 0x000000, 0x000000,
496 0x000000, 0x000000, 0x000000, 0x000000,
497 0x000000, 0x000000, 0x000000, 0x000000,
498 0x000000, 0x000000, 0x000000, 0x000000,
499 0x000000, 0x000000, 0x000000, 0x000000,
500 0x000000, 0x000000, 0x000000, 0x000000,
501 0x000000, 0x000000, 0x000000, 0x000000,
502 0x000000, 0x000000, 0x000000, 0x000000,
503 0x000000, 0x000000, 0x000000, 0x000000,
504 0x000000, 0x000000, 0x000000, 0x000000,
505 0x000000, 0x000000, 0x000000, 0x000000,
506 0x000000, 0x000000, 0x000000, 0x000000,
507 0x000000, 0x000000, 0x000000, 0x000000,
508 0x000000, 0x000000, 0x000000, 0x000000,
509 0x000000, 0x000000, 0x000000, 0x000000,
510 0x000000, 0x000000, 0x000000, 0x000000,
511 0x000000, 0x000000, 0x000000, 0x000000,
512 0x000000, 0x000000, 0x000000, 0x000000,
513 0x000000, 0x000000, 0x000000, 0x000000,
514 0x000000, 0x000000, 0x000000, 0x000000,
515 0x000000, 0x000000, 0x000000, 0x000000,
516 0x000000, 0x000000, 0x000000, 0x000000,
517 0x000000, 0x000000, 0x000000, 0x000000,
518 0x000000, 0x000000, 0x000000, 0x000000,
519 0x000000, 0x000000, 0x000000, 0x000000,
520 0x000000, 0x000000, 0x000000, 0x000000,
521 0x000000, 0x000000, 0x000000, 0x000000,
522 0x000000, 0x000000, 0x000000, 0x000000,
523 0x000000, 0x000000, 0x000000, 0x000000,
524 0x000000, 0x000000, 0x000000, 0x000000,
525 0x000000, 0x000000, 0x000000, 0x000000,
526 0x000000, 0x000000, 0x000000, 0x000000,
527 0x000000, 0x000000, 0x000000, 0x000000,
528 0x000000, 0x000000, 0x000000, 0x000000,
529 0x000000, 0x000000, 0x000000, 0x000000,
530 0x000000, 0x000000, 0x000000, 0x000000,
531 0x000000, 0x000000, 0x000000, 0x000000,
532 0x000000, 0x000000, 0x000000, 0x000000,
533 0x000000, 0x000000, 0x000000, 0x000000,
534 0x000000, 0x000000, 0x000000, 0x000000,
535 0x000000, 0x000000, 0x000000, 0x000000,
536 0x000000, 0x000000, 0x000000, 0x000000,
537 0x000000, 0x000000, 0x000000, 0x000000,
538 0x000000, 0x000000, 0x000000, 0x000000,
539 0x000000, 0x000000, 0x000000, 0x000000,
540 0x000000, 0x000000, 0x000000, 0x000000,
541 0x000000, 0x000000, 0x000000, 0x000000,
542 0x000000, 0x000000, 0x000000, 0x000000,
543 0x000000, 0x000000, 0x000000, 0x000000,
544 0x000000, 0x000000, 0x000000, 0x000000,
545 0x000000, 0x000000, 0x000000, 0x000000,
546 0x000000, 0x000000, 0x000000, 0x000000,
547 0x000000, 0x000000, 0x000000, 0x000000,
548 0x000000, 0x000000, 0x000000, 0x000000,
549 0x000000, 0x000000, 0x000000, 0x000000,
550 0x000000, 0x000000, 0x000000, 0x000000,
551 0x000000, 0x000000, 0x000000, 0x000000,
552 0x000000, 0x000000, 0x000000, 0x000000,
553 0x000000, 0x000000, 0x000000, 0x000000,
554 0x000000, 0x000000, 0x000000, 0x000000,
555 0x000000, 0x000000, 0x000000, 0x000000,
556 0x000000, 0x000000, 0x000000, 0x000000,
557 0x000000, 0x000000, 0x000000, 0x000000,
558 0x000000, 0x000000, 0x000000, 0x000000,
559 0x000000, 0x000000, 0x000000, 0x000000,
560 0x000000, 0x000000, 0x000000, 0x000000,
561 0x000000, 0x000000, 0x000000, 0x000000,
562 0x000000, 0x000000, 0x000000, 0x000000,
563 0x000000, 0x000000, 0x000000, 0x000000,
564 0x000000, 0x000000, 0x000000, 0x000000,
565 0x000000, 0x000000, 0x000000, 0x000000,
566 0x000000, 0x000000, 0x000000, 0x000000,
567 0x000000, 0x000000, 0x000000, 0x000000,
568 0x000000, 0x000000, 0x000000, 0x000000,
569 0x000000, 0x000000, 0x000000, 0x000000,
570 0x000000, 0x000000, 0x000000, 0x000000,
571 0x000000, 0x000000, 0x000000, 0x000000,
572 0x000000, 0x000000, 0x000000, 0x000000,
573 0x000000, 0x000000, 0x000000, 0x000000,
574 0x000000, 0x000000, 0x000000, 0x000000,
575 0x000000, 0x000000, 0x000000, 0x000000,
576 0x000000, 0x000000, 0x000000, 0x000000,
577 0x000000, 0x000000, 0x000000, 0x000000,
578 0x000000, 0x000000, 0x000000, 0x000000,
579 0x000000, 0x000000, 0x000000, 0x000000,
580 0x000000, 0x000000, 0x000000, 0x000000,
581 0x000000, 0x000000, 0x000000, 0x000000,
582 0x000000, 0x000000, 0x000000, 0x000000,
583 0x000000, 0x000000, 0x000000, 0x000000,
584 0x000000, 0x000000, 0x000000, 0x000000,
585 0x000000, 0x000000, 0x000000, 0x000000,
586 0x000000, 0x000000, 0x000000, 0x000000,
587 0x000000, 0x000000, 0x000000, 0x000000,
588 0x000000, 0x000000, 0x000000, 0x000000,
589 0x000000, 0x000000, 0x000000, 0x000000,
590 0x000000, 0x000000, 0x000000, 0x000000,
591 0x000000, 0x000000, 0x000000, 0x000000,
592 0x000000, 0x000000, 0x000000, 0x000000,
593 0x000000, 0x000000, 0x000000, 0x000000,
594 0x000000, 0x000000, 0x000000, 0x000000,
595 0x000000, 0x000000, 0x000000, 0x000000,
596 0x000000, 0x000000, 0x000000, 0x000000,
597 0x000000, 0x000000, 0x000000, 0x000000,
598 0x000000, 0x000000, 0x000000, 0x000000,
599 0x000000, 0x000000, 0x000000, 0x000000,
600 0x000000, 0x000000, 0x000000, 0x000000,
601 0x000000, 0x000000, 0x000000, 0x000000,
602 0x000000, 0x000000, 0x000000, 0x000000,
603 0x000000, 0x000000, 0x000000, 0x000000,
604 0x000000, 0x000000, 0x000000, 0x000000,
605 0x000000, 0x000000, 0x000000, 0x000000,
606 0x000000, 0x000000, 0x000000, 0x000000,
607 0x000000, 0x000000, 0x000000, 0x000000,
608 0x000000, 0x000000, 0x000000, 0x000000,
609 0x000000, 0x000000, 0x000000, 0x000000,
610 0x000000, 0x000000, 0x000000, 0x000000,
611 0x000000, 0x000000, 0x000000, 0x000000,
612 0x000000, 0x000000, 0x000000, 0x000000,
613 0x000000, 0x000000, 0x000000, 0x000000,
614 0x000000, 0x000000, 0x000000, 0x000000,
615 0x000000, 0x000000, 0x000000, 0x000000,
616 0x000000, 0x000000, 0x000000, 0x000000,
617 0x000000, 0x000000, 0x000000, 0x000000,
618 0x000000, 0x000000, 0x000000, 0x000000,
619 0x000000, 0x000000, 0x000000, 0x000000,
620 0x000000, 0x000000, 0x000000, 0x000000,
621 0x000000, 0x000000, 0x000000, 0x000000,
622 0x000000, 0x000000, 0x000000, 0x000000,
623 0x000000, 0x000000, 0x000000, 0x000000,
624 0x000000, 0x000000, 0x000000, 0x000000,
625 0x000000, 0x000000, 0x000000, 0x000000,
626 0x000000, 0x000000, 0x000000, 0x000000,
627 0x000000, 0x000000, 0x000000, 0x000000,
628 0x000000, 0x000000, 0x000000, 0x000000,
629 0x000000, 0x000000, 0x000000, 0x000000,
630 0x000000, 0x000000, 0x000000, 0x000000,
631 0x000000, 0x000000, 0x000000, 0x000000,
632 0x000000, 0x000000, 0x000000, 0x000000,
633 0x000000, 0x000000, 0x000000, 0x000000,
634 0x000000, 0x000000, 0x000000, 0x000000,
635 0x000000, 0x000000, 0x000000, 0x000000,
636 0x000000, 0x000000, 0x000000, 0x000000,
637 0x000000, 0x000000, 0x000000, 0x000000,
638 0x000000, 0x000000, 0x000000, 0x000000,
639 0x000000, 0x000000, 0x000000, 0x000000,
640 0x000000, 0x000000, 0x000000, 0x000000,
641 0x000000, 0x000000, 0x000000, 0x000000,
642 0x000000, 0x000000, 0x000000, 0x000000,
643 0x000000, 0x000000, 0x000000, 0x000000,
644 0x000000, 0x000000, 0x000000, 0x000000,
645 0x000000, 0x000000, 0x000000, 0x000000,
646 0x000000, 0x000000, 0x000000, 0x000000,
647 0x000000, 0x000000, 0x000000, 0x000000,
648 0x000000, 0x000000, 0x000000, 0x000000,
649 0x000000, 0x000000, 0x000000, 0x000000,
650 0x000000, 0x000000, 0x000000, 0x000000,
651 0x000000, 0x000000, 0x000000, 0x000000,
652 0x000000, 0x000000, 0x000000, 0x000000,
653 0x000000, 0x000000, 0x000000, 0x000000,
654 0x000000, 0x000000, 0x000000, 0x000000,
655 0x000000, 0x000000, 0x000000, 0x000000,
656 0x000000, 0x000000, 0x000000, 0x000000,
657 0x000000, 0x000000, 0x000000, 0x000000,
658 0x000000, 0x000000, 0x000000, 0x000000,
659 0x000000, 0x000000, 0x000000, 0x000000,
660 0x000000, 0x000000, 0x000000, 0x000000,
661 0x000000, 0x000000, 0x000000, 0x000000,
662 0x000000, 0x000000, 0x000000, 0x000000,
663 0x000000, 0x000000, 0x000000, 0x000000,
664 0x000000, 0x000000, 0x000000, 0x000000,
665 0x000000, 0x000000, 0x000000, 0x000000,
666 0x000000, 0x000000, 0x000000, 0x000000,
667 0x000000, 0x000000, 0x000000, 0x000000,
668 0x000000, 0x000000, 0x000000, 0x000000,
669 0x000000, 0x000000, 0x000000, 0x000000,
670 0x000000, 0x000000, 0x000000, 0x000000,
671 0x000000, 0x000000, 0x000000, 0x000000,
672 0x000000, 0x000000, 0x000000, 0x000000,
673 0x000000, 0x000000, 0x000000, 0x000000,
674 0x000000, 0x000000, 0x000000, 0x000000,
675 0x000000, 0x000000, 0x000000, 0x000000,
676 0x000000, 0x000000, 0x000000, 0x000000,
677 0x000000, 0x000000, 0x000000, 0x000000,
678 0x000000, 0x000000, 0x000000, 0x000000,
679 0x000000, 0x000000, 0x000000, 0x000000,
680 0x000000, 0x000000, 0x000000, 0x000000,
681 0x000000, 0x000000, 0x000000, 0x000000,
682 0x000000, 0x000000, 0x000000, 0x000000,
683 0x000000, 0x000000, 0x000000, 0x000000,
684 0x000000, 0x000000, 0x000000, 0x000000,
685 0x000000, 0x000000, 0x000000, 0x000000,
686 0x000000, 0x000000, 0x000000, 0x000000,
687 0x000000, 0x000000, 0x000000, 0x000000,
688 0x000000, 0x000000, 0x000000, 0x000000,
689 0x000000, 0x000000, 0x000000, 0x000000,
690 0x000000, 0x000000, 0x000000, 0x000000,
691 0x000000, 0x000000, 0x000000, 0x000000,
692 0x000000, 0x000000, 0x000000, 0x000000,
693 0x000000, 0x000000, 0x000000, 0x000000,
694 0x000000, 0x000000, 0x000000, 0x000000,
695 0x000000, 0x000000, 0x000000, 0x000000,
696 0x000000, 0x000000, 0x000000, 0x000000,
697 0x000000, 0x000000, 0x000000, 0x000000,
698 0x000000, 0x000000, 0x000000, 0x000000,
699 0x000000, 0x000000, 0x000000, 0x000000,
700 0x000000, 0x000000, 0x000000, 0x000000,
701 0x000000, 0x000000, 0x000000, 0x000000,
702 0x000000, 0x000000, 0x000000, 0x000000,
703 0x000000, 0x000000, 0x000000, 0x000000,
704 0x000000, 0x000000, 0x000000, 0x000000,
705 0x000000, 0x000000, 0x000000, 0x000000,
706 0x000000, 0x000000, 0x000000, 0x000000,
707 0x000000, 0x000000, 0x000000, 0x000000,
708 0x000000, 0x000000, 0x000000, 0x000000,
709 0x000000, 0x000000, 0x000000, 0x000000,
710 0x000000, 0x000000, 0x000000, 0x000000,
711 0x000000, 0x000000, 0x000000, 0x000000,
712 0x000000, 0x000000, 0x000000, 0x000000,
713 0x000000, 0x000000, 0x000000, 0x000000,
714 0x000000, 0x000000, 0x000000, 0x000000,
715 0x000000, 0x000000, 0x000000, 0x000000,
716 0x000000, 0x000000, 0x000000, 0x000000,
717 0x000000, 0x000000, 0x000000, 0x000000,
718 0x000000, 0x000000, 0x000000, 0x000000,
719 0x000000, 0x000000, 0x000000, 0x000000,
720 0x000000, 0x000000, 0x000000, 0x000000,
721 0x000000, 0x000000, 0x000000, 0x000000,
722 0x000000, 0x000000, 0x000000, 0x000000,
723 0x000000, 0x000000, 0x000000, 0x000000,
724 0x000000, 0x000000, 0x000000, 0x000000,
725 0x000000, 0x000000, 0x000000, 0x000000,
726 0x000000, 0x000000, 0x000000, 0x000000,
727 0x000000, 0x000000, 0x000000, 0x000000,
728 0x000000, 0x000000, 0x000000, 0x000000,
729 0x000000, 0x000000, 0x000000, 0x000000,
730 0x000000, 0x000000, 0x000000, 0x000000,
731 0x000000, 0x000000, 0x000000, 0x000000,
732 0x000000, 0x000000, 0x000000, 0x000000,
733 0x000000, 0x000000, 0x000000, 0x000000,
734 0x000000, 0x000000, 0x000000, 0x000000,
735 0x000000, 0x000000, 0x000000, 0x000000,
736 0x000000, 0x000000, 0x000000, 0x000000,
737 0x000000, 0x000000, 0x000000, 0x000000,
738 0x000000, 0x000000, 0x000000, 0x000000,
739 0x000000, 0x000000, 0x000000, 0x000000,
740 0x000000, 0x000000, 0x000000, 0x000000,
741 0x000000, 0x000000, 0x000000, 0x000000,
742 0x000000, 0x000000, 0x000000, 0x000000,
743 0x000000, 0x000000, 0x000000, 0x000000,
744 0x000000, 0x000000, 0x000000, 0x000000,
745 0x000000, 0x000000, 0x000000, 0x000000,
746 0x000000, 0x000000, 0x000000, 0x000000,
747 0x000000, 0x000000, 0x000000, 0x000000,
748 0x000000, 0x000000, 0x000000, 0x000000,
749 0x000000, 0x000000, 0x000000, 0x000000,
750 0x000000, 0x000000, 0x000000, 0x000000,
751 0x000000, 0x000000, 0x000000, 0x000000,
752 0x000000, 0x000000, 0x000000, 0x000000,
753 0x000000, 0x000000, 0x000000, 0x000000,
754 0x000000, 0x000000, 0x000000, 0x000000,
755 0x000000, 0x000000, 0x000000, 0x000000,
756 0x000000, 0x000000, 0x000000, 0x000000,
757 0x000000, 0x000000, 0x000000, 0x000000,
758 0x000000, 0x000000, 0x000000, 0x000000,
759 0x000000, 0x000000, 0x000000, 0x000000,
760 0x000000, 0x000000, 0x000000, 0x000000,
761 0x000000, 0x000000, 0x000000, 0x000000,
762 0x000000, 0x000000, 0x000000, 0x000000,
763 0x000000, 0x000000, 0x000000, 0x000000,
764 0x000000, 0x000000, 0x000000, 0x000000,
765 0x000000, 0x000000, 0x000000, 0x000000,
766 0x000000, 0x000000, 0x000000, 0x000000,
767 0x000000, 0x000000, 0x000000, 0x000000,
768 0x000000, 0x000000, 0x000000, 0x000000,
769 0x000000, 0x000000, 0x000000, 0x000000,
770 0x000000, 0x000000, 0x000000, 0x000000,
771 0x000000, 0x000000, 0x000000, 0x000000,
772 0x000000, 0x000000, 0x000000, 0x000000,
773 0x000000, 0x000000, 0x000000, 0x000000,
774 0x000000, 0x000000, 0x000000, 0x000000,
775 0x000000, 0x000000, 0x000000, 0x000000,
776 0x000000, 0x000000, 0x000000, 0x000000,
777 0x000000, 0x000000, 0x000000, 0x000000,
778 0x000000, 0x000000, 0x000000, 0x000000,
779 0x000000, 0x000000, 0x000000, 0x000000,
780 0x000000, 0x000000, 0x000000, 0x000000,
781 0x000000, 0x000000, 0x000000, 0x000000,
782 0x000000, 0x000000, 0x000000, 0x000000,
783 0x000000, 0x000000, 0x000000, 0x000000
784};
785
786// --------------------------------------------
787// DS-1E Controller InstructionRAM Code
788// 1999/06/21
789// Buf441 slot is Enabled.
790// --------------------------------------------
791// 04/09 creat
792// 04/12 stop nise fix
793// 06/21 WorkingOff timming
794static unsigned long CntrlInst1E[YDSXG_CTRLLENGTH / 4] = {
795 0x000007, 0x240007, 0x0C0007, 0x1C0007,
796 0x060007, 0x700002, 0x000020, 0x030040,
797 0x007104, 0x004286, 0x030040, 0x000F0D,
798 0x000810, 0x20043A, 0x000282, 0x00020D,
799 0x000810, 0x20043A, 0x001282, 0x200E82,
800 0x00800D, 0x000810, 0x20043A, 0x001A82,
801 0x03460D, 0x000810, 0x10043A, 0x02EC0D,
802 0x000810, 0x18043A, 0x00010D, 0x020015,
803 0x0000FD, 0x000020, 0x038860, 0x039060,
804 0x038060, 0x038040, 0x038040, 0x038040,
805 0x018040, 0x000A7D, 0x038040, 0x038040,
806 0x018040, 0x200402, 0x000882, 0x08001A,
807 0x000904, 0x017186, 0x000007, 0x260007,
808 0x400007, 0x000007, 0x03258D, 0x000810,
809 0x18043A, 0x260007, 0x284402, 0x00087D,
810 0x018042, 0x00160A, 0x05A206, 0x000007,
811 0x440007, 0x00230D, 0x000810, 0x08043A,
812 0x22FA06, 0x000007, 0x0007FD, 0x018042,
813 0x08000A, 0x000904, 0x02AB86, 0x000195,
814 0x090D04, 0x000007, 0x000820, 0x0000F5,
815 0x000B7D, 0x01F060, 0x0000FD, 0x033A06,
816 0x018040, 0x000A7D, 0x038042, 0x13804A,
817 0x18000A, 0x001820, 0x059060, 0x058860,
818 0x018040, 0x0000FD, 0x018042, 0x70000A,
819 0x000115, 0x071144, 0x033B86, 0x030000,
820 0x007020, 0x036206, 0x018040, 0x00360D,
821 0x000810, 0x08043A, 0x232206, 0x000007,
822 0x02EC0D, 0x000810, 0x18043A, 0x019A06,
823 0x000007, 0x240007, 0x000F8D, 0x000810,
824 0x00163A, 0x002402, 0x005C02, 0x0028FD,
825 0x000020, 0x018040, 0x08000D, 0x000815,
826 0x510984, 0x000007, 0x00004D, 0x000E5D,
827 0x000E02, 0x00430D, 0x000810, 0x08043A,
828 0x2E1206, 0x000007, 0x00008D, 0x000924,
829 0x000F02, 0x00470D, 0x000810, 0x08043A,
830 0x2E1206, 0x000007, 0x480480, 0x001210,
831 0x28043A, 0x00778D, 0x000810, 0x280C3A,
832 0x00068D, 0x000810, 0x28143A, 0x284402,
833 0x03258D, 0x000810, 0x18043A, 0x07FF8D,
834 0x000820, 0x0002FD, 0x018040, 0x260007,
835 0x200007, 0x0002FD, 0x018042, 0x08000A,
836 0x000904, 0x051286, 0x000007, 0x240007,
837 0x02EC0D, 0x000810, 0x18043A, 0x00387D,
838 0x018042, 0x08000A, 0x001015, 0x010984,
839 0x019B86, 0x000007, 0x01B206, 0x000007,
840 0x0008FD, 0x018042, 0x18000A, 0x001904,
841 0x22B886, 0x280007, 0x001810, 0x28043A,
842 0x280C02, 0x00000D, 0x000810, 0x28143A,
843 0x08808D, 0x000820, 0x0002FD, 0x018040,
844 0x200007, 0x00020D, 0x189904, 0x000007,
845 0x00402D, 0x0000BD, 0x0002FD, 0x018042,
846 0x08000A, 0x000904, 0x065A86, 0x000007,
847 0x000100, 0x000A20, 0x00047D, 0x018040,
848 0x018042, 0x20000A, 0x003015, 0x012144,
849 0x036186, 0x000007, 0x002104, 0x036186,
850 0x000007, 0x000F8D, 0x000810, 0x280C3A,
851 0x023944, 0x07C986, 0x000007, 0x001810,
852 0x28043A, 0x08810D, 0x000820, 0x0002FD,
853 0x018040, 0x200007, 0x002810, 0x78003A,
854 0x00788D, 0x000810, 0x08043A, 0x2A1206,
855 0x000007, 0x00400D, 0x001015, 0x189904,
856 0x292904, 0x393904, 0x000007, 0x070206,
857 0x000007, 0x0004F5, 0x00007D, 0x000020,
858 0x00008D, 0x010860, 0x018040, 0x00047D,
859 0x038042, 0x21804A, 0x18000A, 0x021944,
860 0x229086, 0x000007, 0x004075, 0x71F104,
861 0x000007, 0x010042, 0x28000A, 0x002904,
862 0x225886, 0x000007, 0x003C0D, 0x30A904,
863 0x000007, 0x00077D, 0x018042, 0x08000A,
864 0x000904, 0x08DA86, 0x00057D, 0x002820,
865 0x03B060, 0x08F206, 0x018040, 0x003020,
866 0x03A860, 0x018040, 0x0002FD, 0x018042,
867 0x08000A, 0x000904, 0x08FA86, 0x000007,
868 0x00057D, 0x018042, 0x28040A, 0x000E8D,
869 0x000810, 0x280C3A, 0x00000D, 0x000810,
870 0x28143A, 0x09000D, 0x000820, 0x0002FD,
871 0x018040, 0x200007, 0x003DFD, 0x000020,
872 0x018040, 0x00107D, 0x009D8D, 0x000810,
873 0x08043A, 0x2A1206, 0x000007, 0x000815,
874 0x08001A, 0x010984, 0x0A5186, 0x00137D,
875 0x200500, 0x280F20, 0x338F60, 0x3B8F60,
876 0x438F60, 0x4B8F60, 0x538F60, 0x5B8F60,
877 0x038A60, 0x018040, 0x00107D, 0x018042,
878 0x08000A, 0x000215, 0x010984, 0x3A8186,
879 0x000007, 0x007FBD, 0x383DC4, 0x000007,
880 0x001A7D, 0x001375, 0x018042, 0x09004A,
881 0x10000A, 0x0B8D04, 0x139504, 0x000007,
882 0x000820, 0x019060, 0x001104, 0x225886,
883 0x010040, 0x0017FD, 0x018042, 0x08000A,
884 0x000904, 0x225A86, 0x000007, 0x00197D,
885 0x038042, 0x09804A, 0x10000A, 0x000924,
886 0x001664, 0x0011FD, 0x038042, 0x2B804A,
887 0x19804A, 0x00008D, 0x218944, 0x000007,
888 0x002244, 0x0C1986, 0x000007, 0x001A64,
889 0x002A24, 0x00197D, 0x080102, 0x100122,
890 0x000820, 0x039060, 0x018040, 0x003DFD,
891 0x00008D, 0x000820, 0x018040, 0x001375,
892 0x001A7D, 0x010042, 0x09804A, 0x10000A,
893 0x00021D, 0x0189E4, 0x2992E4, 0x309144,
894 0x000007, 0x00060D, 0x000A15, 0x000C1D,
895 0x001025, 0x00A9E4, 0x012BE4, 0x000464,
896 0x01B3E4, 0x0232E4, 0x000464, 0x000464,
897 0x000464, 0x000464, 0x00040D, 0x08B1C4,
898 0x000007, 0x000820, 0x000BF5, 0x030040,
899 0x00197D, 0x038042, 0x09804A, 0x000A24,
900 0x08000A, 0x080E64, 0x000007, 0x100122,
901 0x000820, 0x031060, 0x010040, 0x0064AC,
902 0x00027D, 0x000020, 0x018040, 0x00107D,
903 0x018042, 0x0011FD, 0x3B804A, 0x09804A,
904 0x20000A, 0x000095, 0x1A1144, 0x00A144,
905 0x0E5886, 0x00040D, 0x00B984, 0x0E5986,
906 0x0018FD, 0x018042, 0x0010FD, 0x09804A,
907 0x28000A, 0x000095, 0x010924, 0x002A64,
908 0x0E4986, 0x000007, 0x002904, 0x0E5A86,
909 0x000007, 0x0E6206, 0x080002, 0x00008D,
910 0x00387D, 0x000820, 0x018040, 0x00127D,
911 0x018042, 0x10000A, 0x003904, 0x0F0986,
912 0x00080D, 0x7FFFB5, 0x00B984, 0x0ED986,
913 0x000025, 0x0FB206, 0x00002D, 0x000015,
914 0x00082D, 0x02E00D, 0x000820, 0x0FFA06,
915 0x00000D, 0x7F8035, 0x00B984, 0x0FA986,
916 0x400025, 0x00008D, 0x110944, 0x000007,
917 0x00018D, 0x109504, 0x000007, 0x009164,
918 0x000424, 0x000424, 0x000424, 0x100102,
919 0x280002, 0x02DF0D, 0x000820, 0x0FFA06,
920 0x00018D, 0x00042D, 0x00008D, 0x109504,
921 0x000007, 0x00020D, 0x109184, 0x000007,
922 0x02DF8D, 0x000820, 0x00008D, 0x0038FD,
923 0x018040, 0x003BFD, 0x001020, 0x03A860,
924 0x000815, 0x313184, 0x212184, 0x000007,
925 0x03B060, 0x03A060, 0x018040, 0x0022FD,
926 0x000095, 0x010924, 0x000424, 0x000424,
927 0x001264, 0x100102, 0x000820, 0x039060,
928 0x018040, 0x001924, 0x010F0D, 0x00397D,
929 0x000820, 0x058040, 0x038042, 0x09844A,
930 0x000606, 0x08040A, 0x000424, 0x000424,
931 0x00117D, 0x018042, 0x08000A, 0x000A24,
932 0x280502, 0x280C02, 0x09800D, 0x000820,
933 0x0002FD, 0x018040, 0x200007, 0x0022FD,
934 0x018042, 0x08000A, 0x000095, 0x280DC4,
935 0x011924, 0x00197D, 0x018042, 0x0011FD,
936 0x09804A, 0x10000A, 0x0000B5, 0x113144,
937 0x0A8D04, 0x000007, 0x080A44, 0x129504,
938 0x000007, 0x0023FD, 0x001020, 0x038040,
939 0x101244, 0x000007, 0x000820, 0x039060,
940 0x018040, 0x0002FD, 0x018042, 0x08000A,
941 0x000904, 0x123286, 0x000007, 0x003BFD,
942 0x000100, 0x000A10, 0x0B807A, 0x13804A,
943 0x090984, 0x000007, 0x000095, 0x013D04,
944 0x12B886, 0x10000A, 0x100002, 0x090984,
945 0x000007, 0x038042, 0x11804A, 0x090D04,
946 0x000007, 0x10000A, 0x090D84, 0x000007,
947 0x00257D, 0x000820, 0x018040, 0x00010D,
948 0x000810, 0x28143A, 0x00127D, 0x018042,
949 0x20000A, 0x00197D, 0x018042, 0x00117D,
950 0x31804A, 0x10000A, 0x003124, 0x013B8D,
951 0x00397D, 0x000820, 0x058040, 0x038042,
952 0x09844A, 0x000606, 0x08040A, 0x300102,
953 0x003124, 0x000424, 0x000424, 0x001224,
954 0x280502, 0x001A4C, 0x143986, 0x700002,
955 0x00002D, 0x030000, 0x00387D, 0x018042,
956 0x10000A, 0x146206, 0x002124, 0x0000AD,
957 0x100002, 0x00010D, 0x000924, 0x006B24,
958 0x014A0D, 0x00397D, 0x000820, 0x058040,
959 0x038042, 0x09844A, 0x000606, 0x08040A,
960 0x003264, 0x00008D, 0x000A24, 0x001020,
961 0x00227D, 0x018040, 0x014F8D, 0x000810,
962 0x08043A, 0x2B5A06, 0x000007, 0x002820,
963 0x00207D, 0x018040, 0x00117D, 0x038042,
964 0x13804A, 0x33800A, 0x00387D, 0x018042,
965 0x08000A, 0x000904, 0x177286, 0x000007,
966 0x00008D, 0x030964, 0x015B0D, 0x00397D,
967 0x000820, 0x058040, 0x038042, 0x09844A,
968 0x000606, 0x08040A, 0x380102, 0x000424,
969 0x000424, 0x001224, 0x0002FD, 0x018042,
970 0x08000A, 0x000904, 0x15DA86, 0x000007,
971 0x280502, 0x001A4C, 0x177186, 0x000007,
972 0x032164, 0x00632C, 0x003DFD, 0x018042,
973 0x08000A, 0x000095, 0x090904, 0x000007,
974 0x000820, 0x001A4C, 0x169986, 0x018040,
975 0x030000, 0x16B206, 0x002124, 0x00010D,
976 0x000924, 0x006B24, 0x016F0D, 0x00397D,
977 0x000820, 0x058040, 0x038042, 0x09844A,
978 0x000606, 0x08040A, 0x003A64, 0x000095,
979 0x001224, 0x0002FD, 0x018042, 0x08000A,
980 0x000904, 0x171286, 0x000007, 0x01760D,
981 0x000810, 0x08043A, 0x2B5A06, 0x000007,
982 0x160A06, 0x000007, 0x007020, 0x08010A,
983 0x10012A, 0x0020FD, 0x038860, 0x039060,
984 0x018040, 0x00227D, 0x018042, 0x003DFD,
985 0x08000A, 0x31844A, 0x000904, 0x181086,
986 0x18008B, 0x00008D, 0x189904, 0x00312C,
987 0x18E206, 0x000007, 0x00324C, 0x186B86,
988 0x000007, 0x001904, 0x186886, 0x000007,
989 0x000095, 0x199144, 0x00222C, 0x003124,
990 0x00636C, 0x000E3D, 0x001375, 0x000BFD,
991 0x010042, 0x09804A, 0x10000A, 0x038AEC,
992 0x0393EC, 0x00224C, 0x18E186, 0x000007,
993 0x00008D, 0x189904, 0x00226C, 0x00322C,
994 0x30050A, 0x301DAB, 0x002083, 0x0018FD,
995 0x018042, 0x08000A, 0x018924, 0x300502,
996 0x001083, 0x001875, 0x010042, 0x10000A,
997 0x00008D, 0x010924, 0x001375, 0x330542,
998 0x330CCB, 0x332CCB, 0x3334CB, 0x333CCB,
999 0x3344CB, 0x334CCB, 0x3354CB, 0x305C8B,
1000 0x006083, 0x0002F5, 0x010042, 0x08000A,
1001 0x000904, 0x19B286, 0x000007, 0x001E2D,
1002 0x0005FD, 0x018042, 0x08000A, 0x028924,
1003 0x280502, 0x00060D, 0x000810, 0x280C3A,
1004 0x00008D, 0x000810, 0x28143A, 0x0A808D,
1005 0x000820, 0x0002F5, 0x010040, 0x220007,
1006 0x001275, 0x030042, 0x21004A, 0x00008D,
1007 0x1A0944, 0x000007, 0x01AB8D, 0x000810,
1008 0x08043A, 0x2CAA06, 0x000007, 0x0001F5,
1009 0x030042, 0x0D004A, 0x10000A, 0x089144,
1010 0x000007, 0x000820, 0x010040, 0x0025F5,
1011 0x0A3144, 0x000007, 0x000820, 0x032860,
1012 0x030040, 0x00217D, 0x038042, 0x0B804A,
1013 0x10000A, 0x000820, 0x031060, 0x030040,
1014 0x00008D, 0x000124, 0x00012C, 0x000E64,
1015 0x001A64, 0x00636C, 0x08010A, 0x10012A,
1016 0x000820, 0x031060, 0x030040, 0x0020FD,
1017 0x018042, 0x08000A, 0x00227D, 0x018042,
1018 0x10000A, 0x000820, 0x031060, 0x030040,
1019 0x00197D, 0x018042, 0x08000A, 0x0022FD,
1020 0x038042, 0x10000A, 0x000820, 0x031060,
1021 0x030040, 0x090D04, 0x000007, 0x000820,
1022 0x030040, 0x038042, 0x0B804A, 0x10000A,
1023 0x000820, 0x031060, 0x030040, 0x038042,
1024 0x13804A, 0x19804A, 0x110D04, 0x198D04,
1025 0x000007, 0x08000A, 0x001020, 0x031860,
1026 0x030860, 0x030040, 0x00008D, 0x0B0944,
1027 0x000007, 0x000820, 0x010040, 0x0005F5,
1028 0x030042, 0x08000A, 0x000820, 0x010040,
1029 0x0000F5, 0x010042, 0x08000A, 0x000904,
1030 0x1D9886, 0x001E75, 0x030042, 0x01044A,
1031 0x000C0A, 0x1DAA06, 0x000007, 0x000402,
1032 0x000C02, 0x00177D, 0x001AF5, 0x018042,
1033 0x03144A, 0x031C4A, 0x03244A, 0x032C4A,
1034 0x03344A, 0x033C4A, 0x03444A, 0x004C0A,
1035 0x00043D, 0x0013F5, 0x001AFD, 0x030042,
1036 0x0B004A, 0x1B804A, 0x13804A, 0x20000A,
1037 0x089144, 0x19A144, 0x0389E4, 0x0399EC,
1038 0x005502, 0x005D0A, 0x030042, 0x0B004A,
1039 0x1B804A, 0x13804A, 0x20000A, 0x089144,
1040 0x19A144, 0x0389E4, 0x0399EC, 0x006502,
1041 0x006D0A, 0x030042, 0x0B004A, 0x19004A,
1042 0x2B804A, 0x13804A, 0x21804A, 0x30000A,
1043 0x089144, 0x19A144, 0x2AB144, 0x0389E4,
1044 0x0399EC, 0x007502, 0x007D0A, 0x03A9E4,
1045 0x000702, 0x00107D, 0x000415, 0x018042,
1046 0x08000A, 0x0109E4, 0x000F02, 0x002AF5,
1047 0x0019FD, 0x010042, 0x09804A, 0x10000A,
1048 0x000934, 0x001674, 0x0029F5, 0x010042,
1049 0x10000A, 0x00917C, 0x002075, 0x010042,
1050 0x08000A, 0x000904, 0x200A86, 0x0026F5,
1051 0x0027F5, 0x030042, 0x09004A, 0x10000A,
1052 0x000A3C, 0x00167C, 0x001A75, 0x000BFD,
1053 0x010042, 0x51804A, 0x48000A, 0x160007,
1054 0x001075, 0x010042, 0x282C0A, 0x281D12,
1055 0x282512, 0x001F32, 0x1E0007, 0x0E0007,
1056 0x001975, 0x010042, 0x002DF5, 0x0D004A,
1057 0x10000A, 0x009144, 0x20EA86, 0x010042,
1058 0x28340A, 0x000E5D, 0x00008D, 0x000375,
1059 0x000820, 0x010040, 0x05D2F4, 0x54D104,
1060 0x00735C, 0x218B86, 0x000007, 0x0C0007,
1061 0x080007, 0x0A0007, 0x02178D, 0x000810,
1062 0x08043A, 0x34B206, 0x000007, 0x219206,
1063 0x000007, 0x080007, 0x002275, 0x010042,
1064 0x20000A, 0x002104, 0x225886, 0x001E2D,
1065 0x0002F5, 0x010042, 0x08000A, 0x000904,
1066 0x21CA86, 0x000007, 0x002010, 0x30043A,
1067 0x00057D, 0x0180C3, 0x08000A, 0x028924,
1068 0x280502, 0x280C02, 0x0A810D, 0x000820,
1069 0x0002F5, 0x010040, 0x220007, 0x0004FD,
1070 0x018042, 0x70000A, 0x030000, 0x007020,
1071 0x07FA06, 0x018040, 0x022B8D, 0x000810,
1072 0x08043A, 0x2CAA06, 0x000007, 0x0002FD,
1073 0x018042, 0x08000A, 0x000904, 0x22C286,
1074 0x000007, 0x020206, 0x000007, 0x000875,
1075 0x0009FD, 0x00010D, 0x234206, 0x000295,
1076 0x000B75, 0x00097D, 0x00000D, 0x000515,
1077 0x010042, 0x18000A, 0x001904, 0x2A0086,
1078 0x0006F5, 0x001020, 0x010040, 0x0004F5,
1079 0x000820, 0x010040, 0x000775, 0x010042,
1080 0x09804A, 0x10000A, 0x001124, 0x000904,
1081 0x23F286, 0x000815, 0x080102, 0x101204,
1082 0x241206, 0x000575, 0x081204, 0x000007,
1083 0x100102, 0x000575, 0x000425, 0x021124,
1084 0x100102, 0x000820, 0x031060, 0x010040,
1085 0x001924, 0x2A0086, 0x00008D, 0x000464,
1086 0x009D04, 0x291086, 0x180102, 0x000575,
1087 0x010042, 0x28040A, 0x00018D, 0x000924,
1088 0x280D02, 0x00000D, 0x000924, 0x281502,
1089 0x10000D, 0x000820, 0x0002F5, 0x010040,
1090 0x200007, 0x001175, 0x0002FD, 0x018042,
1091 0x08000A, 0x000904, 0x24FA86, 0x000007,
1092 0x000100, 0x080B20, 0x130B60, 0x1B0B60,
1093 0x030A60, 0x010040, 0x050042, 0x3D004A,
1094 0x35004A, 0x2D004A, 0x20000A, 0x0006F5,
1095 0x010042, 0x28140A, 0x0004F5, 0x010042,
1096 0x08000A, 0x000315, 0x010D04, 0x260286,
1097 0x004015, 0x000095, 0x010D04, 0x25F086,
1098 0x100022, 0x10002A, 0x261A06, 0x000007,
1099 0x333104, 0x2AA904, 0x000007, 0x032124,
1100 0x280502, 0x284402, 0x001124, 0x400102,
1101 0x000424, 0x000424, 0x003224, 0x00292C,
1102 0x00636C, 0x277386, 0x000007, 0x02B164,
1103 0x000464, 0x000464, 0x00008D, 0x000A64,
1104 0x280D02, 0x10008D, 0x000820, 0x0002F5,
1105 0x010040, 0x220007, 0x00008D, 0x38B904,
1106 0x000007, 0x03296C, 0x30010A, 0x0002F5,
1107 0x010042, 0x08000A, 0x000904, 0x270286,
1108 0x000007, 0x00212C, 0x28050A, 0x00316C,
1109 0x00046C, 0x00046C, 0x28450A, 0x001124,
1110 0x006B64, 0x100102, 0x00008D, 0x01096C,
1111 0x280D0A, 0x10010D, 0x000820, 0x0002F5,
1112 0x010040, 0x220007, 0x004124, 0x000424,
1113 0x000424, 0x003224, 0x300102, 0x032944,
1114 0x27FA86, 0x000007, 0x300002, 0x0004F5,
1115 0x010042, 0x08000A, 0x000315, 0x010D04,
1116 0x284086, 0x003124, 0x000464, 0x300102,
1117 0x0002F5, 0x010042, 0x08000A, 0x000904,
1118 0x284A86, 0x000007, 0x284402, 0x003124,
1119 0x300502, 0x003924, 0x300583, 0x000883,
1120 0x0005F5, 0x010042, 0x28040A, 0x00008D,
1121 0x008124, 0x280D02, 0x00008D, 0x008124,
1122 0x281502, 0x10018D, 0x000820, 0x0002F5,
1123 0x010040, 0x220007, 0x001025, 0x000575,
1124 0x030042, 0x09004A, 0x10000A, 0x0A0904,
1125 0x121104, 0x000007, 0x001020, 0x050860,
1126 0x050040, 0x0006FD, 0x018042, 0x09004A,
1127 0x10000A, 0x0000A5, 0x0A0904, 0x121104,
1128 0x000007, 0x000820, 0x019060, 0x010040,
1129 0x0002F5, 0x010042, 0x08000A, 0x000904,
1130 0x29CA86, 0x000007, 0x244206, 0x000007,
1131 0x000606, 0x000007, 0x0002F5, 0x010042,
1132 0x08000A, 0x000904, 0x2A1A86, 0x000007,
1133 0x000100, 0x080B20, 0x138B60, 0x1B8B60,
1134 0x238B60, 0x2B8B60, 0x338B60, 0x3B8B60,
1135 0x438B60, 0x4B8B60, 0x538B60, 0x5B8B60,
1136 0x638B60, 0x6B8B60, 0x738B60, 0x7B8B60,
1137 0x038F60, 0x0B8F60, 0x138F60, 0x1B8F60,
1138 0x238F60, 0x2B8F60, 0x338F60, 0x3B8F60,
1139 0x438F60, 0x4B8F60, 0x538F60, 0x5B8F60,
1140 0x638F60, 0x6B8F60, 0x738F60, 0x7B8F60,
1141 0x038A60, 0x000606, 0x018040, 0x00008D,
1142 0x000A64, 0x280D02, 0x000A24, 0x00027D,
1143 0x018042, 0x10000A, 0x001224, 0x0003FD,
1144 0x018042, 0x08000A, 0x000904, 0x2C0A86,
1145 0x000007, 0x00018D, 0x000A24, 0x000464,
1146 0x000464, 0x080102, 0x000924, 0x000424,
1147 0x000424, 0x100102, 0x02000D, 0x009144,
1148 0x2C6186, 0x000007, 0x0001FD, 0x018042,
1149 0x08000A, 0x000A44, 0x2C4386, 0x018042,
1150 0x0A000D, 0x000820, 0x0002FD, 0x018040,
1151 0x200007, 0x00027D, 0x001020, 0x000606,
1152 0x018040, 0x0002F5, 0x010042, 0x08000A,
1153 0x000904, 0x2CB286, 0x000007, 0x00037D,
1154 0x018042, 0x08000A, 0x000904, 0x2CE286,
1155 0x000007, 0x000075, 0x002E7D, 0x010042,
1156 0x0B804A, 0x000020, 0x000904, 0x000686,
1157 0x010040, 0x31844A, 0x30048B, 0x000883,
1158 0x00008D, 0x000810, 0x28143A, 0x00008D,
1159 0x000810, 0x280C3A, 0x000675, 0x010042,
1160 0x08000A, 0x003815, 0x010924, 0x280502,
1161 0x0B000D, 0x000820, 0x0002F5, 0x010040,
1162 0x000606, 0x220007, 0x000464, 0x000464,
1163 0x000606, 0x000007, 0x000134, 0x007F8D,
1164 0x00093C, 0x281D12, 0x282512, 0x001F32,
1165 0x0E0007, 0x00010D, 0x00037D, 0x000820,
1166 0x018040, 0x05D2F4, 0x000007, 0x080007,
1167 0x00037D, 0x018042, 0x08000A, 0x000904,
1168 0x2E8A86, 0x000007, 0x000606, 0x000007,
1169 0x000007, 0x000012, 0x100007, 0x320007,
1170 0x600007, 0x460007, 0x100080, 0x48001A,
1171 0x004904, 0x2EF186, 0x000007, 0x001210,
1172 0x58003A, 0x000145, 0x5C5D04, 0x000007,
1173 0x000080, 0x48001A, 0x004904, 0x2F4186,
1174 0x000007, 0x001210, 0x50003A, 0x005904,
1175 0x2F9886, 0x000045, 0x0000C5, 0x7FFFF5,
1176 0x7FFF7D, 0x07D524, 0x004224, 0x500102,
1177 0x200502, 0x000082, 0x40001A, 0x004104,
1178 0x2FC986, 0x000007, 0x003865, 0x40001A,
1179 0x004020, 0x00104D, 0x04C184, 0x31AB86,
1180 0x000040, 0x040007, 0x000165, 0x000145,
1181 0x004020, 0x000040, 0x000765, 0x080080,
1182 0x40001A, 0x004104, 0x305986, 0x000007,
1183 0x001210, 0x40003A, 0x004104, 0x30B286,
1184 0x00004D, 0x0000CD, 0x004810, 0x20043A,
1185 0x000882, 0x40001A, 0x004104, 0x30C186,
1186 0x000007, 0x004820, 0x005904, 0x319886,
1187 0x000040, 0x0007E5, 0x200480, 0x2816A0,
1188 0x3216E0, 0x3A16E0, 0x4216E0, 0x021260,
1189 0x000040, 0x000032, 0x400075, 0x00007D,
1190 0x07D574, 0x200512, 0x000082, 0x40001A,
1191 0x004104, 0x317186, 0x000007, 0x038A06,
1192 0x640007, 0x0000E5, 0x000020, 0x000040,
1193 0x000A65, 0x000020, 0x020040, 0x020040,
1194 0x000040, 0x000165, 0x000042, 0x70000A,
1195 0x007104, 0x323286, 0x000007, 0x060007,
1196 0x019A06, 0x640007, 0x050000, 0x007020,
1197 0x000040, 0x038A06, 0x640007, 0x000007,
1198 0x00306D, 0x028860, 0x029060, 0x08000A,
1199 0x028860, 0x008040, 0x100012, 0x00100D,
1200 0x009184, 0x32D186, 0x000E0D, 0x009184,
1201 0x33E186, 0x000007, 0x300007, 0x001020,
1202 0x003B6D, 0x008040, 0x000080, 0x08001A,
1203 0x000904, 0x32F186, 0x000007, 0x001220,
1204 0x000DED, 0x008040, 0x008042, 0x10000A,
1205 0x40000D, 0x109544, 0x000007, 0x001020,
1206 0x000DED, 0x008040, 0x008042, 0x20040A,
1207 0x000082, 0x08001A, 0x000904, 0x338186,
1208 0x000007, 0x003B6D, 0x008042, 0x08000A,
1209 0x000E15, 0x010984, 0x342B86, 0x600007,
1210 0x08001A, 0x000C15, 0x010984, 0x341386,
1211 0x000020, 0x1A0007, 0x0002ED, 0x008040,
1212 0x620007, 0x00306D, 0x028042, 0x0A804A,
1213 0x000820, 0x0A804A, 0x000606, 0x10804A,
1214 0x000007, 0x282512, 0x001F32, 0x05D2F4,
1215 0x54D104, 0x00735C, 0x000786, 0x000007,
1216 0x0C0007, 0x0A0007, 0x1C0007, 0x003465,
1217 0x020040, 0x004820, 0x025060, 0x40000A,
1218 0x024060, 0x000040, 0x454944, 0x000007,
1219 0x004020, 0x003AE5, 0x000040, 0x0028E5,
1220 0x000042, 0x48000A, 0x004904, 0x39F886,
1221 0x002C65, 0x000042, 0x40000A, 0x0000D5,
1222 0x454104, 0x000007, 0x000655, 0x054504,
1223 0x368286, 0x0001D5, 0x054504, 0x368086,
1224 0x002B65, 0x000042, 0x003AE5, 0x50004A,
1225 0x40000A, 0x45C3D4, 0x000007, 0x454504,
1226 0x000007, 0x0000CD, 0x444944, 0x000007,
1227 0x454504, 0x000007, 0x00014D, 0x554944,
1228 0x000007, 0x045144, 0x367986, 0x002C65,
1229 0x000042, 0x48000A, 0x4CD104, 0x000007,
1230 0x04C144, 0x368386, 0x000007, 0x160007,
1231 0x002CE5, 0x040042, 0x40000A, 0x004020,
1232 0x000040, 0x002965, 0x000042, 0x40000A,
1233 0x004104, 0x36F086, 0x000007, 0x002402,
1234 0x383206, 0x005C02, 0x0025E5, 0x000042,
1235 0x40000A, 0x004274, 0x002AE5, 0x000042,
1236 0x40000A, 0x004274, 0x500112, 0x0029E5,
1237 0x000042, 0x40000A, 0x004234, 0x454104,
1238 0x000007, 0x004020, 0x000040, 0x003EE5,
1239 0x000020, 0x000040, 0x002DE5, 0x400152,
1240 0x50000A, 0x045144, 0x37DA86, 0x0000C5,
1241 0x003EE5, 0x004020, 0x000040, 0x002BE5,
1242 0x000042, 0x40000A, 0x404254, 0x000007,
1243 0x002AE5, 0x004020, 0x000040, 0x500132,
1244 0x040134, 0x005674, 0x0029E5, 0x020042,
1245 0x42000A, 0x000042, 0x50000A, 0x05417C,
1246 0x0028E5, 0x000042, 0x48000A, 0x0000C5,
1247 0x4CC144, 0x38A086, 0x0026E5, 0x0027E5,
1248 0x020042, 0x40004A, 0x50000A, 0x00423C,
1249 0x00567C, 0x0028E5, 0x004820, 0x000040,
1250 0x281D12, 0x282512, 0x001F72, 0x002965,
1251 0x000042, 0x40000A, 0x004104, 0x393A86,
1252 0x0E0007, 0x160007, 0x1E0007, 0x003EE5,
1253 0x000042, 0x40000A, 0x004104, 0x397886,
1254 0x002D65, 0x000042, 0x28340A, 0x003465,
1255 0x020042, 0x42004A, 0x004020, 0x4A004A,
1256 0x50004A, 0x05D2F4, 0x54D104, 0x00735C,
1257 0x39E186, 0x000007, 0x000606, 0x080007,
1258 0x0C0007, 0x080007, 0x0A0007, 0x0001E5,
1259 0x020045, 0x004020, 0x000060, 0x000365,
1260 0x000040, 0x002E65, 0x001A20, 0x0A1A60,
1261 0x000040, 0x003465, 0x020042, 0x42004A,
1262 0x004020, 0x4A004A, 0x000606, 0x50004A,
1263 0x0017FD, 0x018042, 0x08000A, 0x000904,
1264 0x225A86, 0x000007, 0x00107D, 0x018042,
1265 0x0011FD, 0x33804A, 0x19804A, 0x20000A,
1266 0x000095, 0x2A1144, 0x01A144, 0x3B9086,
1267 0x00040D, 0x00B184, 0x3B9186, 0x0018FD,
1268 0x018042, 0x0010FD, 0x09804A, 0x38000A,
1269 0x000095, 0x010924, 0x003A64, 0x3B8186,
1270 0x000007, 0x003904, 0x3B9286, 0x000007,
1271 0x3B9A06, 0x00000D, 0x00008D, 0x000820,
1272 0x00387D, 0x018040, 0x700002, 0x00117D,
1273 0x018042, 0x00197D, 0x29804A, 0x30000A,
1274 0x380002, 0x003124, 0x000424, 0x000424,
1275 0x002A24, 0x280502, 0x00068D, 0x000810,
1276 0x28143A, 0x00750D, 0x00B124, 0x002264,
1277 0x3D0386, 0x284402, 0x000810, 0x280C3A,
1278 0x0B800D, 0x000820, 0x0002FD, 0x018040,
1279 0x200007, 0x00758D, 0x00B124, 0x100102,
1280 0x012144, 0x3E4986, 0x001810, 0x10003A,
1281 0x00387D, 0x018042, 0x08000A, 0x000904,
1282 0x3E4886, 0x030000, 0x3E4A06, 0x0000BD,
1283 0x00008D, 0x023164, 0x000A64, 0x280D02,
1284 0x0B808D, 0x000820, 0x0002FD, 0x018040,
1285 0x200007, 0x00387D, 0x018042, 0x08000A,
1286 0x000904, 0x3E3286, 0x030000, 0x0002FD,
1287 0x018042, 0x08000A, 0x000904, 0x3D8286,
1288 0x000007, 0x002810, 0x28043A, 0x00750D,
1289 0x030924, 0x002264, 0x280D02, 0x02316C,
1290 0x28450A, 0x0B810D, 0x000820, 0x0002FD,
1291 0x018040, 0x200007, 0x00008D, 0x000A24,
1292 0x3E4A06, 0x100102, 0x001810, 0x10003A,
1293 0x0000BD, 0x003810, 0x30043A, 0x00187D,
1294 0x018042, 0x0018FD, 0x09804A, 0x20000A,
1295 0x0000AD, 0x028924, 0x07212C, 0x001010,
1296 0x300583, 0x300D8B, 0x3014BB, 0x301C83,
1297 0x002083, 0x00137D, 0x038042, 0x33844A,
1298 0x33ACCB, 0x33B4CB, 0x33BCCB, 0x33C4CB,
1299 0x33CCCB, 0x33D4CB, 0x305C8B, 0x006083,
1300 0x001E0D, 0x0005FD, 0x018042, 0x20000A,
1301 0x020924, 0x00068D, 0x00A96C, 0x00009D,
1302 0x0002FD, 0x018042, 0x08000A, 0x000904,
1303 0x3F6A86, 0x000007, 0x280502, 0x280D0A,
1304 0x284402, 0x001810, 0x28143A, 0x0C008D,
1305 0x000820, 0x0002FD, 0x018040, 0x220007,
1306 0x003904, 0x225886, 0x001E0D, 0x00057D,
1307 0x018042, 0x20000A, 0x020924, 0x0000A5,
1308 0x0002FD, 0x018042, 0x08000A, 0x000904,
1309 0x402A86, 0x000007, 0x280502, 0x280C02,
1310 0x002010, 0x28143A, 0x0C010D, 0x000820,
1311 0x0002FD, 0x018040, 0x225A06, 0x220007,
1312 0x000000, 0x000000, 0x000000, 0x000000,
1313 0x000000, 0x000000, 0x000000, 0x000000,
1314 0x000000, 0x000000, 0x000000, 0x000000,
1315 0x000000, 0x000000, 0x000000, 0x000000,
1316 0x000000, 0x000000, 0x000000, 0x000000,
1317 0x000000, 0x000000, 0x000000, 0x000000,
1318 0x000000, 0x000000, 0x000000, 0x000000,
1319 0x000000, 0x000000, 0x000000, 0x000000,
1320 0x000000, 0x000000, 0x000000, 0x000000,
1321 0x000000, 0x000000, 0x000000, 0x000000,
1322 0x000000, 0x000000, 0x000000, 0x000000,
1323 0x000000, 0x000000, 0x000000, 0x000000,
1324 0x000000, 0x000000, 0x000000, 0x000000,
1325 0x000000, 0x000000, 0x000000, 0x000000,
1326 0x000000, 0x000000, 0x000000, 0x000000,
1327 0x000000, 0x000000, 0x000000, 0x000000,
1328 0x000000, 0x000000, 0x000000, 0x000000,
1329 0x000000, 0x000000, 0x000000, 0x000000,
1330 0x000000, 0x000000, 0x000000, 0x000000,
1331 0x000000, 0x000000, 0x000000, 0x000000,
1332 0x000000, 0x000000, 0x000000, 0x000000,
1333 0x000000, 0x000000, 0x000000, 0x000000,
1334 0x000000, 0x000000, 0x000000, 0x000000,
1335 0x000000, 0x000000, 0x000000, 0x000000,
1336 0x000000, 0x000000, 0x000000, 0x000000,
1337 0x000000, 0x000000, 0x000000, 0x000000,
1338 0x000000, 0x000000, 0x000000, 0x000000,
1339 0x000000, 0x000000, 0x000000, 0x000000,
1340 0x000000, 0x000000, 0x000000, 0x000000,
1341 0x000000, 0x000000, 0x000000, 0x000000,
1342 0x000000, 0x000000, 0x000000, 0x000000,
1343 0x000000, 0x000000, 0x000000, 0x000000,
1344 0x000000, 0x000000, 0x000000, 0x000000,
1345 0x000000, 0x000000, 0x000000, 0x000000,
1346 0x000000, 0x000000, 0x000000, 0x000000,
1347 0x000000, 0x000000, 0x000000, 0x000000,
1348 0x000000, 0x000000, 0x000000, 0x000000,
1349 0x000000, 0x000000, 0x000000, 0x000000,
1350 0x000000, 0x000000, 0x000000, 0x000000,
1351 0x000000, 0x000000, 0x000000, 0x000000,
1352 0x000000, 0x000000, 0x000000, 0x000000,
1353 0x000000, 0x000000, 0x000000, 0x000000,
1354 0x000000, 0x000000, 0x000000, 0x000000,
1355 0x000000, 0x000000, 0x000000, 0x000000,
1356 0x000000, 0x000000, 0x000000, 0x000000,
1357 0x000000, 0x000000, 0x000000, 0x000000,
1358 0x000000, 0x000000, 0x000000, 0x000000,
1359 0x000000, 0x000000, 0x000000, 0x000000,
1360 0x000000, 0x000000, 0x000000, 0x000000,
1361 0x000000, 0x000000, 0x000000, 0x000000,
1362 0x000000, 0x000000, 0x000000, 0x000000,
1363 0x000000, 0x000000, 0x000000, 0x000000,
1364 0x000000, 0x000000, 0x000000, 0x000000,
1365 0x000000, 0x000000, 0x000000, 0x000000,
1366 0x000000, 0x000000, 0x000000, 0x000000,
1367 0x000000, 0x000000, 0x000000, 0x000000,
1368 0x000000, 0x000000, 0x000000, 0x000000,
1369 0x000000, 0x000000, 0x000000, 0x000000,
1370 0x000000, 0x000000, 0x000000, 0x000000,
1371 0x000000, 0x000000, 0x000000, 0x000000,
1372 0x000000, 0x000000, 0x000000, 0x000000,
1373 0x000000, 0x000000, 0x000000, 0x000000,
1374 0x000000, 0x000000, 0x000000, 0x000000,
1375 0x000000, 0x000000, 0x000000, 0x000000,
1376 0x000000, 0x000000, 0x000000, 0x000000,
1377 0x000000, 0x000000, 0x000000, 0x000000,
1378 0x000000, 0x000000, 0x000000, 0x000000,
1379 0x000000, 0x000000, 0x000000, 0x000000,
1380 0x000000, 0x000000, 0x000000, 0x000000,
1381 0x000000, 0x000000, 0x000000, 0x000000,
1382 0x000000, 0x000000, 0x000000, 0x000000,
1383 0x000000, 0x000000, 0x000000, 0x000000,
1384 0x000000, 0x000000, 0x000000, 0x000000,
1385 0x000000, 0x000000, 0x000000, 0x000000,
1386 0x000000, 0x000000, 0x000000, 0x000000,
1387 0x000000, 0x000000, 0x000000, 0x000000,
1388 0x000000, 0x000000, 0x000000, 0x000000,
1389 0x000000, 0x000000, 0x000000, 0x000000,
1390 0x000000, 0x000000, 0x000000, 0x000000,
1391 0x000000, 0x000000, 0x000000, 0x000000,
1392 0x000000, 0x000000, 0x000000, 0x000000,
1393 0x000000, 0x000000, 0x000000, 0x000000,
1394 0x000000, 0x000000, 0x000000, 0x000000,
1395 0x000000, 0x000000, 0x000000, 0x000000,
1396 0x000000, 0x000000, 0x000000, 0x000000,
1397 0x000000, 0x000000, 0x000000, 0x000000,
1398 0x000000, 0x000000, 0x000000, 0x000000,
1399 0x000000, 0x000000, 0x000000, 0x000000,
1400 0x000000, 0x000000, 0x000000, 0x000000,
1401 0x000000, 0x000000, 0x000000, 0x000000,
1402 0x000000, 0x000000, 0x000000, 0x000000,
1403 0x000000, 0x000000, 0x000000, 0x000000,
1404 0x000000, 0x000000, 0x000000, 0x000000,
1405 0x000000, 0x000000, 0x000000, 0x000000,
1406 0x000000, 0x000000, 0x000000, 0x000000,
1407 0x000000, 0x000000, 0x000000, 0x000000,
1408 0x000000, 0x000000, 0x000000, 0x000000,
1409 0x000000, 0x000000, 0x000000, 0x000000,
1410 0x000000, 0x000000, 0x000000, 0x000000,
1411 0x000000, 0x000000, 0x000000, 0x000000,
1412 0x000000, 0x000000, 0x000000, 0x000000,
1413 0x000000, 0x000000, 0x000000, 0x000000,
1414 0x000000, 0x000000, 0x000000, 0x000000,
1415 0x000000, 0x000000, 0x000000, 0x000000,
1416 0x000000, 0x000000, 0x000000, 0x000000,
1417 0x000000, 0x000000, 0x000000, 0x000000,
1418 0x000000, 0x000000, 0x000000, 0x000000,
1419 0x000000, 0x000000, 0x000000, 0x000000,
1420 0x000000, 0x000000, 0x000000, 0x000000,
1421 0x000000, 0x000000, 0x000000, 0x000000,
1422 0x000000, 0x000000, 0x000000, 0x000000,
1423 0x000000, 0x000000, 0x000000, 0x000000,
1424 0x000000, 0x000000, 0x000000, 0x000000,
1425 0x000000, 0x000000, 0x000000, 0x000000,
1426 0x000000, 0x000000, 0x000000, 0x000000,
1427 0x000000, 0x000000, 0x000000, 0x000000,
1428 0x000000, 0x000000, 0x000000, 0x000000,
1429 0x000000, 0x000000, 0x000000, 0x000000,
1430 0x000000, 0x000000, 0x000000, 0x000000,
1431 0x000000, 0x000000, 0x000000, 0x000000,
1432 0x000000, 0x000000, 0x000000, 0x000000,
1433 0x000000, 0x000000, 0x000000, 0x000000,
1434 0x000000, 0x000000, 0x000000, 0x000000,
1435 0x000000, 0x000000, 0x000000, 0x000000,
1436 0x000000, 0x000000, 0x000000, 0x000000,
1437 0x000000, 0x000000, 0x000000, 0x000000,
1438 0x000000, 0x000000, 0x000000, 0x000000,
1439 0x000000, 0x000000, 0x000000, 0x000000,
1440 0x000000, 0x000000, 0x000000, 0x000000,
1441 0x000000, 0x000000, 0x000000, 0x000000,
1442 0x000000, 0x000000, 0x000000, 0x000000,
1443 0x000000, 0x000000, 0x000000, 0x000000,
1444 0x000000, 0x000000, 0x000000, 0x000000,
1445 0x000000, 0x000000, 0x000000, 0x000000,
1446 0x000000, 0x000000, 0x000000, 0x000000,
1447 0x000000, 0x000000, 0x000000, 0x000000,
1448 0x000000, 0x000000, 0x000000, 0x000000,
1449 0x000000, 0x000000, 0x000000, 0x000000,
1450 0x000000, 0x000000, 0x000000, 0x000000,
1451 0x000000, 0x000000, 0x000000, 0x000000,
1452 0x000000, 0x000000, 0x000000, 0x000000,
1453 0x000000, 0x000000, 0x000000, 0x000000,
1454 0x000000, 0x000000, 0x000000, 0x000000,
1455 0x000000, 0x000000, 0x000000, 0x000000,
1456 0x000000, 0x000000, 0x000000, 0x000000,
1457 0x000000, 0x000000, 0x000000, 0x000000,
1458 0x000000, 0x000000, 0x000000, 0x000000,
1459 0x000000, 0x000000, 0x000000, 0x000000,
1460 0x000000, 0x000000, 0x000000, 0x000000,
1461 0x000000, 0x000000, 0x000000, 0x000000,
1462 0x000000, 0x000000, 0x000000, 0x000000,
1463 0x000000, 0x000000, 0x000000, 0x000000,
1464 0x000000, 0x000000, 0x000000, 0x000000,
1465 0x000000, 0x000000, 0x000000, 0x000000,
1466 0x000000, 0x000000, 0x000000, 0x000000,
1467 0x000000, 0x000000, 0x000000, 0x000000,
1468 0x000000, 0x000000, 0x000000, 0x000000,
1469 0x000000, 0x000000, 0x000000, 0x000000,
1470 0x000000, 0x000000, 0x000000, 0x000000,
1471 0x000000, 0x000000, 0x000000, 0x000000,
1472 0x000000, 0x000000, 0x000000, 0x000000,
1473 0x000000, 0x000000, 0x000000, 0x000000,
1474 0x000000, 0x000000, 0x000000, 0x000000,
1475 0x000000, 0x000000, 0x000000, 0x000000,
1476 0x000000, 0x000000, 0x000000, 0x000000,
1477 0x000000, 0x000000, 0x000000, 0x000000,
1478 0x000000, 0x000000, 0x000000, 0x000000,
1479 0x000000, 0x000000, 0x000000, 0x000000,
1480 0x000000, 0x000000, 0x000000, 0x000000,
1481 0x000000, 0x000000, 0x000000, 0x000000,
1482 0x000000, 0x000000, 0x000000, 0x000000,
1483 0x000000, 0x000000, 0x000000, 0x000000,
1484 0x000000, 0x000000, 0x000000, 0x000000,
1485 0x000000, 0x000000, 0x000000, 0x000000,
1486 0x000000, 0x000000, 0x000000, 0x000000,
1487 0x000000, 0x000000, 0x000000, 0x000000,
1488 0x000000, 0x000000, 0x000000, 0x000000,
1489 0x000000, 0x000000, 0x000000, 0x000000,
1490 0x000000, 0x000000, 0x000000, 0x000000,
1491 0x000000, 0x000000, 0x000000, 0x000000,
1492 0x000000, 0x000000, 0x000000, 0x000000,
1493 0x000000, 0x000000, 0x000000, 0x000000,
1494 0x000000, 0x000000, 0x000000, 0x000000,
1495 0x000000, 0x000000, 0x000000, 0x000000,
1496 0x000000, 0x000000, 0x000000, 0x000000,
1497 0x000000, 0x000000, 0x000000, 0x000000,
1498 0x000000, 0x000000, 0x000000, 0x000000,
1499 0x000000, 0x000000, 0x000000, 0x000000,
1500 0x000000, 0x000000, 0x000000, 0x000000,
1501 0x000000, 0x000000, 0x000000, 0x000000,
1502 0x000000, 0x000000, 0x000000, 0x000000,
1503 0x000000, 0x000000, 0x000000, 0x000000,
1504 0x000000, 0x000000, 0x000000, 0x000000,
1505 0x000000, 0x000000, 0x000000, 0x000000,
1506 0x000000, 0x000000, 0x000000, 0x000000,
1507 0x000000, 0x000000, 0x000000, 0x000000,
1508 0x000000, 0x000000, 0x000000, 0x000000,
1509 0x000000, 0x000000, 0x000000, 0x000000,
1510 0x000000, 0x000000, 0x000000, 0x000000,
1511 0x000000, 0x000000, 0x000000, 0x000000,
1512 0x000000, 0x000000, 0x000000, 0x000000,
1513 0x000000, 0x000000, 0x000000, 0x000000,
1514 0x000000, 0x000000, 0x000000, 0x000000,
1515 0x000000, 0x000000, 0x000000, 0x000000,
1516 0x000000, 0x000000, 0x000000, 0x000000,
1517 0x000000, 0x000000, 0x000000, 0x000000,
1518 0x000000, 0x000000, 0x000000, 0x000000,
1519 0x000000, 0x000000, 0x000000, 0x000000,
1520 0x000000, 0x000000, 0x000000, 0x000000,
1521 0x000000, 0x000000, 0x000000, 0x000000,
1522 0x000000, 0x000000, 0x000000, 0x000000,
1523 0x000000, 0x000000, 0x000000, 0x000000,
1524 0x000000, 0x000000, 0x000000, 0x000000,
1525 0x000000, 0x000000, 0x000000, 0x000000,
1526 0x000000, 0x000000, 0x000000, 0x000000,
1527 0x000000, 0x000000, 0x000000, 0x000000,
1528 0x000000, 0x000000, 0x000000, 0x000000,
1529 0x000000, 0x000000, 0x000000, 0x000000,
1530 0x000000, 0x000000, 0x000000, 0x000000,
1531 0x000000, 0x000000, 0x000000, 0x000000,
1532 0x000000, 0x000000, 0x000000, 0x000000,
1533 0x000000, 0x000000, 0x000000, 0x000000,
1534 0x000000, 0x000000, 0x000000, 0x000000,
1535 0x000000, 0x000000, 0x000000, 0x000000,
1536 0x000000, 0x000000, 0x000000, 0x000000,
1537 0x000000, 0x000000, 0x000000, 0x000000,
1538 0x000000, 0x000000, 0x000000, 0x000000,
1539 0x000000, 0x000000, 0x000000, 0x000000,
1540 0x000000, 0x000000, 0x000000, 0x000000,
1541 0x000000, 0x000000, 0x000000, 0x000000,
1542 0x000000, 0x000000, 0x000000, 0x000000,
1543 0x000000, 0x000000, 0x000000, 0x000000,
1544 0x000000, 0x000000, 0x000000, 0x000000,
1545 0x000000, 0x000000, 0x000000, 0x000000,
1546 0x000000, 0x000000, 0x000000, 0x000000,
1547 0x000000, 0x000000, 0x000000, 0x000000,
1548 0x000000, 0x000000, 0x000000, 0x000000,
1549 0x000000, 0x000000, 0x000000, 0x000000,
1550 0x000000, 0x000000, 0x000000, 0x000000,
1551 0x000000, 0x000000, 0x000000, 0x000000,
1552 0x000000, 0x000000, 0x000000, 0x000000,
1553 0x000000, 0x000000, 0x000000, 0x000000,
1554 0x000000, 0x000000, 0x000000, 0x000000,
1555 0x000000, 0x000000, 0x000000, 0x000000,
1556 0x000000, 0x000000, 0x000000, 0x000000,
1557 0x000000, 0x000000, 0x000000, 0x000000,
1558 0x000000, 0x000000, 0x000000, 0x000000,
1559 0x000000, 0x000000, 0x000000, 0x000000,
1560 0x000000, 0x000000, 0x000000, 0x000000,
1561 0x000000, 0x000000, 0x000000, 0x000000,
1562 0x000000, 0x000000, 0x000000, 0x000000
1563};
1564
1565#endif //_HWMCODE_
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
new file mode 100644
index 000000000000..05f1629760bc
--- /dev/null
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -0,0 +1,2273 @@
1/*
2 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
3 * Routines for control of YMF724/740/744/754 chips
4 *
5 * BUGS:
6 * --
7 *
8 * TODO:
9 * --
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <sound/driver.h>
28#include <linux/delay.h>
29#include <linux/init.h>
30#include <linux/interrupt.h>
31#include <linux/pci.h>
32#include <linux/sched.h>
33#include <linux/slab.h>
34#include <linux/vmalloc.h>
35
36#include <sound/core.h>
37#include <sound/control.h>
38#include <sound/info.h>
39#include <sound/ymfpci.h>
40#include <sound/asoundef.h>
41#include <sound/mpu401.h>
42
43#include <asm/io.h>
44
45/*
46 * constants
47 */
48
49/*
50 * common I/O routines
51 */
52
53static void snd_ymfpci_irq_wait(ymfpci_t *chip);
54
55static inline u8 snd_ymfpci_readb(ymfpci_t *chip, u32 offset)
56{
57 return readb(chip->reg_area_virt + offset);
58}
59
60static inline void snd_ymfpci_writeb(ymfpci_t *chip, u32 offset, u8 val)
61{
62 writeb(val, chip->reg_area_virt + offset);
63}
64
65static inline u16 snd_ymfpci_readw(ymfpci_t *chip, u32 offset)
66{
67 return readw(chip->reg_area_virt + offset);
68}
69
70static inline void snd_ymfpci_writew(ymfpci_t *chip, u32 offset, u16 val)
71{
72 writew(val, chip->reg_area_virt + offset);
73}
74
75static inline u32 snd_ymfpci_readl(ymfpci_t *chip, u32 offset)
76{
77 return readl(chip->reg_area_virt + offset);
78}
79
80static inline void snd_ymfpci_writel(ymfpci_t *chip, u32 offset, u32 val)
81{
82 writel(val, chip->reg_area_virt + offset);
83}
84
85static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary)
86{
87 signed long end_time;
88 u32 reg = secondary ? YDSXGR_SECSTATUSADR : YDSXGR_PRISTATUSADR;
89
90 end_time = (jiffies + ((3 * HZ) / 4)) + 1;
91 do {
92 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
93 return 0;
94 set_current_state(TASK_UNINTERRUPTIBLE);
95 schedule_timeout(1);
96 } while (end_time - (signed long)jiffies >= 0);
97 snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
98 return -EBUSY;
99}
100
101static void snd_ymfpci_codec_write(ac97_t *ac97, u16 reg, u16 val)
102{
103 ymfpci_t *chip = ac97->private_data;
104 u32 cmd;
105
106 snd_ymfpci_codec_ready(chip, 0);
107 cmd = ((YDSXG_AC97WRITECMD | reg) << 16) | val;
108 snd_ymfpci_writel(chip, YDSXGR_AC97CMDDATA, cmd);
109}
110
111static u16 snd_ymfpci_codec_read(ac97_t *ac97, u16 reg)
112{
113 ymfpci_t *chip = ac97->private_data;
114
115 if (snd_ymfpci_codec_ready(chip, 0))
116 return ~0;
117 snd_ymfpci_writew(chip, YDSXGR_AC97CMDADR, YDSXG_AC97READCMD | reg);
118 if (snd_ymfpci_codec_ready(chip, 0))
119 return ~0;
120 if (chip->device_id == PCI_DEVICE_ID_YAMAHA_744 && chip->rev < 2) {
121 int i;
122 for (i = 0; i < 600; i++)
123 snd_ymfpci_readw(chip, YDSXGR_PRISTATUSDATA);
124 }
125 return snd_ymfpci_readw(chip, YDSXGR_PRISTATUSDATA);
126}
127
128/*
129 * Misc routines
130 */
131
132static u32 snd_ymfpci_calc_delta(u32 rate)
133{
134 switch (rate) {
135 case 8000: return 0x02aaab00;
136 case 11025: return 0x03accd00;
137 case 16000: return 0x05555500;
138 case 22050: return 0x07599a00;
139 case 32000: return 0x0aaaab00;
140 case 44100: return 0x0eb33300;
141 default: return ((rate << 16) / 375) << 5;
142 }
143}
144
145static u32 def_rate[8] = {
146 100, 2000, 8000, 11025, 16000, 22050, 32000, 48000
147};
148
149static u32 snd_ymfpci_calc_lpfK(u32 rate)
150{
151 u32 i;
152 static u32 val[8] = {
153 0x00570000, 0x06AA0000, 0x18B20000, 0x20930000,
154 0x2B9A0000, 0x35A10000, 0x3EAA0000, 0x40000000
155 };
156
157 if (rate == 44100)
158 return 0x40000000; /* FIXME: What's the right value? */
159 for (i = 0; i < 8; i++)
160 if (rate <= def_rate[i])
161 return val[i];
162 return val[0];
163}
164
165static u32 snd_ymfpci_calc_lpfQ(u32 rate)
166{
167 u32 i;
168 static u32 val[8] = {
169 0x35280000, 0x34A70000, 0x32020000, 0x31770000,
170 0x31390000, 0x31C90000, 0x33D00000, 0x40000000
171 };
172
173 if (rate == 44100)
174 return 0x370A0000;
175 for (i = 0; i < 8; i++)
176 if (rate <= def_rate[i])
177 return val[i];
178 return val[0];
179}
180
181/*
182 * Hardware start management
183 */
184
185static void snd_ymfpci_hw_start(ymfpci_t *chip)
186{
187 unsigned long flags;
188
189 spin_lock_irqsave(&chip->reg_lock, flags);
190 if (chip->start_count++ > 0)
191 goto __end;
192 snd_ymfpci_writel(chip, YDSXGR_MODE,
193 snd_ymfpci_readl(chip, YDSXGR_MODE) | 3);
194 chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT) & 1;
195 __end:
196 spin_unlock_irqrestore(&chip->reg_lock, flags);
197}
198
199static void snd_ymfpci_hw_stop(ymfpci_t *chip)
200{
201 unsigned long flags;
202 long timeout = 1000;
203
204 spin_lock_irqsave(&chip->reg_lock, flags);
205 if (--chip->start_count > 0)
206 goto __end;
207 snd_ymfpci_writel(chip, YDSXGR_MODE,
208 snd_ymfpci_readl(chip, YDSXGR_MODE) & ~3);
209 while (timeout-- > 0) {
210 if ((snd_ymfpci_readl(chip, YDSXGR_STATUS) & 2) == 0)
211 break;
212 }
213 if (atomic_read(&chip->interrupt_sleep_count)) {
214 atomic_set(&chip->interrupt_sleep_count, 0);
215 wake_up(&chip->interrupt_sleep);
216 }
217 __end:
218 spin_unlock_irqrestore(&chip->reg_lock, flags);
219}
220
221/*
222 * Playback voice management
223 */
224
225static int voice_alloc(ymfpci_t *chip, ymfpci_voice_type_t type, int pair, ymfpci_voice_t **rvoice)
226{
227 ymfpci_voice_t *voice, *voice2;
228 int idx;
229
230 *rvoice = NULL;
231 for (idx = 0; idx < YDSXG_PLAYBACK_VOICES; idx += pair ? 2 : 1) {
232 voice = &chip->voices[idx];
233 voice2 = pair ? &chip->voices[idx+1] : NULL;
234 if (voice->use || (voice2 && voice2->use))
235 continue;
236 voice->use = 1;
237 if (voice2)
238 voice2->use = 1;
239 switch (type) {
240 case YMFPCI_PCM:
241 voice->pcm = 1;
242 if (voice2)
243 voice2->pcm = 1;
244 break;
245 case YMFPCI_SYNTH:
246 voice->synth = 1;
247 break;
248 case YMFPCI_MIDI:
249 voice->midi = 1;
250 break;
251 }
252 snd_ymfpci_hw_start(chip);
253 if (voice2)
254 snd_ymfpci_hw_start(chip);
255 *rvoice = voice;
256 return 0;
257 }
258 return -ENOMEM;
259}
260
261static int snd_ymfpci_voice_alloc(ymfpci_t *chip, ymfpci_voice_type_t type, int pair, ymfpci_voice_t **rvoice)
262{
263 unsigned long flags;
264 int result;
265
266 snd_assert(rvoice != NULL, return -EINVAL);
267 snd_assert(!pair || type == YMFPCI_PCM, return -EINVAL);
268
269 spin_lock_irqsave(&chip->voice_lock, flags);
270 for (;;) {
271 result = voice_alloc(chip, type, pair, rvoice);
272 if (result == 0 || type != YMFPCI_PCM)
273 break;
274 /* TODO: synth/midi voice deallocation */
275 break;
276 }
277 spin_unlock_irqrestore(&chip->voice_lock, flags);
278 return result;
279}
280
281static int snd_ymfpci_voice_free(ymfpci_t *chip, ymfpci_voice_t *pvoice)
282{
283 unsigned long flags;
284
285 snd_assert(pvoice != NULL, return -EINVAL);
286 snd_ymfpci_hw_stop(chip);
287 spin_lock_irqsave(&chip->voice_lock, flags);
288 pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = 0;
289 pvoice->ypcm = NULL;
290 pvoice->interrupt = NULL;
291 spin_unlock_irqrestore(&chip->voice_lock, flags);
292 return 0;
293}
294
295/*
296 * PCM part
297 */
298
299static void snd_ymfpci_pcm_interrupt(ymfpci_t *chip, ymfpci_voice_t *voice)
300{
301 ymfpci_pcm_t *ypcm;
302 u32 pos, delta;
303
304 if ((ypcm = voice->ypcm) == NULL)
305 return;
306 if (ypcm->substream == NULL)
307 return;
308 spin_lock(&chip->reg_lock);
309 if (ypcm->running) {
310 pos = le32_to_cpu(voice->bank[chip->active_bank].start);
311 if (pos < ypcm->last_pos)
312 delta = pos + (ypcm->buffer_size - ypcm->last_pos);
313 else
314 delta = pos - ypcm->last_pos;
315 ypcm->period_pos += delta;
316 ypcm->last_pos = pos;
317 if (ypcm->period_pos >= ypcm->period_size) {
318 // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start);
319 ypcm->period_pos %= ypcm->period_size;
320 spin_unlock(&chip->reg_lock);
321 snd_pcm_period_elapsed(ypcm->substream);
322 spin_lock(&chip->reg_lock);
323 }
324 }
325 spin_unlock(&chip->reg_lock);
326}
327
328static void snd_ymfpci_pcm_capture_interrupt(snd_pcm_substream_t *substream)
329{
330 snd_pcm_runtime_t *runtime = substream->runtime;
331 ymfpci_pcm_t *ypcm = runtime->private_data;
332 ymfpci_t *chip = ypcm->chip;
333 u32 pos, delta;
334
335 spin_lock(&chip->reg_lock);
336 if (ypcm->running) {
337 pos = le32_to_cpu(chip->bank_capture[ypcm->capture_bank_number][chip->active_bank]->start) >> ypcm->shift;
338 if (pos < ypcm->last_pos)
339 delta = pos + (ypcm->buffer_size - ypcm->last_pos);
340 else
341 delta = pos - ypcm->last_pos;
342 ypcm->period_pos += delta;
343 ypcm->last_pos = pos;
344 if (ypcm->period_pos >= ypcm->period_size) {
345 ypcm->period_pos %= ypcm->period_size;
346 // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start);
347 spin_unlock(&chip->reg_lock);
348 snd_pcm_period_elapsed(substream);
349 spin_lock(&chip->reg_lock);
350 }
351 }
352 spin_unlock(&chip->reg_lock);
353}
354
355static int snd_ymfpci_playback_trigger(snd_pcm_substream_t * substream,
356 int cmd)
357{
358 ymfpci_t *chip = snd_pcm_substream_chip(substream);
359 ymfpci_pcm_t *ypcm = substream->runtime->private_data;
360 int result = 0;
361
362 spin_lock(&chip->reg_lock);
363 if (ypcm->voices[0] == NULL) {
364 result = -EINVAL;
365 goto __unlock;
366 }
367 switch (cmd) {
368 case SNDRV_PCM_TRIGGER_START:
369 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
370 case SNDRV_PCM_TRIGGER_RESUME:
371 chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr);
372 if (ypcm->voices[1] != NULL)
373 chip->ctrl_playback[ypcm->voices[1]->number + 1] = cpu_to_le32(ypcm->voices[1]->bank_addr);
374 ypcm->running = 1;
375 break;
376 case SNDRV_PCM_TRIGGER_STOP:
377 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
378 case SNDRV_PCM_TRIGGER_SUSPEND:
379 chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
380 if (ypcm->voices[1] != NULL)
381 chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0;
382 ypcm->running = 0;
383 break;
384 default:
385 result = -EINVAL;
386 break;
387 }
388 __unlock:
389 spin_unlock(&chip->reg_lock);
390 return result;
391}
392static int snd_ymfpci_capture_trigger(snd_pcm_substream_t * substream,
393 int cmd)
394{
395 ymfpci_t *chip = snd_pcm_substream_chip(substream);
396 ymfpci_pcm_t *ypcm = substream->runtime->private_data;
397 int result = 0;
398 u32 tmp;
399
400 spin_lock(&chip->reg_lock);
401 switch (cmd) {
402 case SNDRV_PCM_TRIGGER_START:
403 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
404 case SNDRV_PCM_TRIGGER_RESUME:
405 tmp = snd_ymfpci_readl(chip, YDSXGR_MAPOFREC) | (1 << ypcm->capture_bank_number);
406 snd_ymfpci_writel(chip, YDSXGR_MAPOFREC, tmp);
407 ypcm->running = 1;
408 break;
409 case SNDRV_PCM_TRIGGER_STOP:
410 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
411 case SNDRV_PCM_TRIGGER_SUSPEND:
412 tmp = snd_ymfpci_readl(chip, YDSXGR_MAPOFREC) & ~(1 << ypcm->capture_bank_number);
413 snd_ymfpci_writel(chip, YDSXGR_MAPOFREC, tmp);
414 ypcm->running = 0;
415 break;
416 default:
417 result = -EINVAL;
418 break;
419 }
420 spin_unlock(&chip->reg_lock);
421 return result;
422}
423
424static int snd_ymfpci_pcm_voice_alloc(ymfpci_pcm_t *ypcm, int voices)
425{
426 int err;
427
428 if (ypcm->voices[1] != NULL && voices < 2) {
429 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[1]);
430 ypcm->voices[1] = NULL;
431 }
432 if (voices == 1 && ypcm->voices[0] != NULL)
433 return 0; /* already allocated */
434 if (voices == 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL)
435 return 0; /* already allocated */
436 if (voices > 1) {
437 if (ypcm->voices[0] != NULL && ypcm->voices[1] == NULL) {
438 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]);
439 ypcm->voices[0] = NULL;
440 }
441 }
442 err = snd_ymfpci_voice_alloc(ypcm->chip, YMFPCI_PCM, voices > 1, &ypcm->voices[0]);
443 if (err < 0)
444 return err;
445 ypcm->voices[0]->ypcm = ypcm;
446 ypcm->voices[0]->interrupt = snd_ymfpci_pcm_interrupt;
447 if (voices > 1) {
448 ypcm->voices[1] = &ypcm->chip->voices[ypcm->voices[0]->number + 1];
449 ypcm->voices[1]->ypcm = ypcm;
450 }
451 return 0;
452}
453
454static void snd_ymfpci_pcm_init_voice(ymfpci_voice_t *voice, int stereo,
455 int rate, int w_16, unsigned long addr,
456 unsigned int end,
457 int output_front, int output_rear)
458{
459 u32 format;
460 u32 delta = snd_ymfpci_calc_delta(rate);
461 u32 lpfQ = snd_ymfpci_calc_lpfQ(rate);
462 u32 lpfK = snd_ymfpci_calc_lpfK(rate);
463 snd_ymfpci_playback_bank_t *bank;
464 unsigned int nbank;
465
466 snd_assert(voice != NULL, return);
467 format = (stereo ? 0x00010000 : 0) | (w_16 ? 0 : 0x80000000);
468 for (nbank = 0; nbank < 2; nbank++) {
469 bank = &voice->bank[nbank];
470 bank->format = cpu_to_le32(format);
471 bank->loop_default = 0;
472 bank->base = cpu_to_le32(addr);
473 bank->loop_start = 0;
474 bank->loop_end = cpu_to_le32(end);
475 bank->loop_frac = 0;
476 bank->eg_gain_end = cpu_to_le32(0x40000000);
477 bank->lpfQ = cpu_to_le32(lpfQ);
478 bank->status = 0;
479 bank->num_of_frames = 0;
480 bank->loop_count = 0;
481 bank->start = 0;
482 bank->start_frac = 0;
483 bank->delta =
484 bank->delta_end = cpu_to_le32(delta);
485 bank->lpfK =
486 bank->lpfK_end = cpu_to_le32(lpfK);
487 bank->eg_gain = cpu_to_le32(0x40000000);
488 bank->lpfD1 =
489 bank->lpfD2 = 0;
490
491 bank->left_gain =
492 bank->right_gain =
493 bank->left_gain_end =
494 bank->right_gain_end =
495 bank->eff1_gain =
496 bank->eff2_gain =
497 bank->eff3_gain =
498 bank->eff1_gain_end =
499 bank->eff2_gain_end =
500 bank->eff3_gain_end = 0;
501
502 if (!stereo) {
503 if (output_front) {
504 bank->left_gain =
505 bank->right_gain =
506 bank->left_gain_end =
507 bank->right_gain_end = cpu_to_le32(0x40000000);
508 }
509 if (output_rear) {
510 bank->eff2_gain =
511 bank->eff2_gain_end =
512 bank->eff3_gain =
513 bank->eff3_gain_end = cpu_to_le32(0x40000000);
514 }
515 } else {
516 if (output_front) {
517 if ((voice->number & 1) == 0) {
518 bank->left_gain =
519 bank->left_gain_end = cpu_to_le32(0x40000000);
520 } else {
521 bank->format |= cpu_to_le32(1);
522 bank->right_gain =
523 bank->right_gain_end = cpu_to_le32(0x40000000);
524 }
525 }
526 if (output_rear) {
527 if ((voice->number & 1) == 0) {
528 bank->eff3_gain =
529 bank->eff3_gain_end = cpu_to_le32(0x40000000);
530 } else {
531 bank->format |= cpu_to_le32(1);
532 bank->eff2_gain =
533 bank->eff2_gain_end = cpu_to_le32(0x40000000);
534 }
535 }
536 }
537 }
538}
539
540static int __devinit snd_ymfpci_ac3_init(ymfpci_t *chip)
541{
542 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
543 4096, &chip->ac3_tmp_base) < 0)
544 return -ENOMEM;
545
546 chip->bank_effect[3][0]->base =
547 chip->bank_effect[3][1]->base = cpu_to_le32(chip->ac3_tmp_base.addr);
548 chip->bank_effect[3][0]->loop_end =
549 chip->bank_effect[3][1]->loop_end = cpu_to_le32(1024);
550 chip->bank_effect[4][0]->base =
551 chip->bank_effect[4][1]->base = cpu_to_le32(chip->ac3_tmp_base.addr + 2048);
552 chip->bank_effect[4][0]->loop_end =
553 chip->bank_effect[4][1]->loop_end = cpu_to_le32(1024);
554
555 spin_lock_irq(&chip->reg_lock);
556 snd_ymfpci_writel(chip, YDSXGR_MAPOFEFFECT,
557 snd_ymfpci_readl(chip, YDSXGR_MAPOFEFFECT) | 3 << 3);
558 spin_unlock_irq(&chip->reg_lock);
559 return 0;
560}
561
562static int snd_ymfpci_ac3_done(ymfpci_t *chip)
563{
564 spin_lock_irq(&chip->reg_lock);
565 snd_ymfpci_writel(chip, YDSXGR_MAPOFEFFECT,
566 snd_ymfpci_readl(chip, YDSXGR_MAPOFEFFECT) & ~(3 << 3));
567 spin_unlock_irq(&chip->reg_lock);
568 // snd_ymfpci_irq_wait(chip);
569 if (chip->ac3_tmp_base.area) {
570 snd_dma_free_pages(&chip->ac3_tmp_base);
571 chip->ac3_tmp_base.area = NULL;
572 }
573 return 0;
574}
575
576static int snd_ymfpci_playback_hw_params(snd_pcm_substream_t * substream,
577 snd_pcm_hw_params_t * hw_params)
578{
579 snd_pcm_runtime_t *runtime = substream->runtime;
580 ymfpci_pcm_t *ypcm = runtime->private_data;
581 int err;
582
583 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
584 return err;
585 if ((err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params))) < 0)
586 return err;
587 return 0;
588}
589
590static int snd_ymfpci_playback_hw_free(snd_pcm_substream_t * substream)
591{
592 ymfpci_t *chip = snd_pcm_substream_chip(substream);
593 snd_pcm_runtime_t *runtime = substream->runtime;
594 ymfpci_pcm_t *ypcm;
595
596 if (runtime->private_data == NULL)
597 return 0;
598 ypcm = runtime->private_data;
599
600 /* wait, until the PCI operations are not finished */
601 snd_ymfpci_irq_wait(chip);
602 snd_pcm_lib_free_pages(substream);
603 if (ypcm->voices[1]) {
604 snd_ymfpci_voice_free(chip, ypcm->voices[1]);
605 ypcm->voices[1] = NULL;
606 }
607 if (ypcm->voices[0]) {
608 snd_ymfpci_voice_free(chip, ypcm->voices[0]);
609 ypcm->voices[0] = NULL;
610 }
611 return 0;
612}
613
614static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream)
615{
616 // ymfpci_t *chip = snd_pcm_substream_chip(substream);
617 snd_pcm_runtime_t *runtime = substream->runtime;
618 ymfpci_pcm_t *ypcm = runtime->private_data;
619 unsigned int nvoice;
620
621 ypcm->period_size = runtime->period_size;
622 ypcm->buffer_size = runtime->buffer_size;
623 ypcm->period_pos = 0;
624 ypcm->last_pos = 0;
625 for (nvoice = 0; nvoice < runtime->channels; nvoice++)
626 snd_ymfpci_pcm_init_voice(ypcm->voices[nvoice],
627 runtime->channels == 2,
628 runtime->rate,
629 snd_pcm_format_width(runtime->format) == 16,
630 runtime->dma_addr,
631 ypcm->buffer_size,
632 ypcm->output_front,
633 ypcm->output_rear);
634 return 0;
635}
636
637static int snd_ymfpci_capture_hw_params(snd_pcm_substream_t * substream,
638 snd_pcm_hw_params_t * hw_params)
639{
640 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
641}
642
643static int snd_ymfpci_capture_hw_free(snd_pcm_substream_t * substream)
644{
645 ymfpci_t *chip = snd_pcm_substream_chip(substream);
646
647 /* wait, until the PCI operations are not finished */
648 snd_ymfpci_irq_wait(chip);
649 return snd_pcm_lib_free_pages(substream);
650}
651
652static int snd_ymfpci_capture_prepare(snd_pcm_substream_t * substream)
653{
654 ymfpci_t *chip = snd_pcm_substream_chip(substream);
655 snd_pcm_runtime_t *runtime = substream->runtime;
656 ymfpci_pcm_t *ypcm = runtime->private_data;
657 snd_ymfpci_capture_bank_t * bank;
658 int nbank;
659 u32 rate, format;
660
661 ypcm->period_size = runtime->period_size;
662 ypcm->buffer_size = runtime->buffer_size;
663 ypcm->period_pos = 0;
664 ypcm->last_pos = 0;
665 ypcm->shift = 0;
666 rate = ((48000 * 4096) / runtime->rate) - 1;
667 format = 0;
668 if (runtime->channels == 2) {
669 format |= 2;
670 ypcm->shift++;
671 }
672 if (snd_pcm_format_width(runtime->format) == 8)
673 format |= 1;
674 else
675 ypcm->shift++;
676 switch (ypcm->capture_bank_number) {
677 case 0:
678 snd_ymfpci_writel(chip, YDSXGR_RECFORMAT, format);
679 snd_ymfpci_writel(chip, YDSXGR_RECSLOTSR, rate);
680 break;
681 case 1:
682 snd_ymfpci_writel(chip, YDSXGR_ADCFORMAT, format);
683 snd_ymfpci_writel(chip, YDSXGR_ADCSLOTSR, rate);
684 break;
685 }
686 for (nbank = 0; nbank < 2; nbank++) {
687 bank = chip->bank_capture[ypcm->capture_bank_number][nbank];
688 bank->base = cpu_to_le32(runtime->dma_addr);
689 bank->loop_end = cpu_to_le32(ypcm->buffer_size << ypcm->shift);
690 bank->start = 0;
691 bank->num_of_loops = 0;
692 }
693 return 0;
694}
695
696static snd_pcm_uframes_t snd_ymfpci_playback_pointer(snd_pcm_substream_t * substream)
697{
698 ymfpci_t *chip = snd_pcm_substream_chip(substream);
699 snd_pcm_runtime_t *runtime = substream->runtime;
700 ymfpci_pcm_t *ypcm = runtime->private_data;
701 ymfpci_voice_t *voice = ypcm->voices[0];
702
703 if (!(ypcm->running && voice))
704 return 0;
705 return le32_to_cpu(voice->bank[chip->active_bank].start);
706}
707
708static snd_pcm_uframes_t snd_ymfpci_capture_pointer(snd_pcm_substream_t * substream)
709{
710 ymfpci_t *chip = snd_pcm_substream_chip(substream);
711 snd_pcm_runtime_t *runtime = substream->runtime;
712 ymfpci_pcm_t *ypcm = runtime->private_data;
713
714 if (!ypcm->running)
715 return 0;
716 return le32_to_cpu(chip->bank_capture[ypcm->capture_bank_number][chip->active_bank]->start) >> ypcm->shift;
717}
718
719static void snd_ymfpci_irq_wait(ymfpci_t *chip)
720{
721 wait_queue_t wait;
722 int loops = 4;
723
724 while (loops-- > 0) {
725 if ((snd_ymfpci_readl(chip, YDSXGR_MODE) & 3) == 0)
726 continue;
727 init_waitqueue_entry(&wait, current);
728 add_wait_queue(&chip->interrupt_sleep, &wait);
729 atomic_inc(&chip->interrupt_sleep_count);
730 set_current_state(TASK_UNINTERRUPTIBLE);
731 schedule_timeout(HZ/20);
732 remove_wait_queue(&chip->interrupt_sleep, &wait);
733 }
734}
735
736static irqreturn_t snd_ymfpci_interrupt(int irq, void *dev_id, struct pt_regs *regs)
737{
738 ymfpci_t *chip = dev_id;
739 u32 status, nvoice, mode;
740 ymfpci_voice_t *voice;
741
742 status = snd_ymfpci_readl(chip, YDSXGR_STATUS);
743 if (status & 0x80000000) {
744 chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT) & 1;
745 spin_lock(&chip->voice_lock);
746 for (nvoice = 0; nvoice < YDSXG_PLAYBACK_VOICES; nvoice++) {
747 voice = &chip->voices[nvoice];
748 if (voice->interrupt)
749 voice->interrupt(chip, voice);
750 }
751 for (nvoice = 0; nvoice < YDSXG_CAPTURE_VOICES; nvoice++) {
752 if (chip->capture_substream[nvoice])
753 snd_ymfpci_pcm_capture_interrupt(chip->capture_substream[nvoice]);
754 }
755#if 0
756 for (nvoice = 0; nvoice < YDSXG_EFFECT_VOICES; nvoice++) {
757 if (chip->effect_substream[nvoice])
758 snd_ymfpci_pcm_effect_interrupt(chip->effect_substream[nvoice]);
759 }
760#endif
761 spin_unlock(&chip->voice_lock);
762 spin_lock(&chip->reg_lock);
763 snd_ymfpci_writel(chip, YDSXGR_STATUS, 0x80000000);
764 mode = snd_ymfpci_readl(chip, YDSXGR_MODE) | 2;
765 snd_ymfpci_writel(chip, YDSXGR_MODE, mode);
766 spin_unlock(&chip->reg_lock);
767
768 if (atomic_read(&chip->interrupt_sleep_count)) {
769 atomic_set(&chip->interrupt_sleep_count, 0);
770 wake_up(&chip->interrupt_sleep);
771 }
772 }
773
774 status = snd_ymfpci_readw(chip, YDSXGR_INTFLAG);
775 if (status & 1) {
776 if (chip->timer)
777 snd_timer_interrupt(chip->timer, chip->timer->sticks);
778 }
779 snd_ymfpci_writew(chip, YDSXGR_INTFLAG, status);
780
781 if (chip->rawmidi)
782 snd_mpu401_uart_interrupt(irq, chip->rawmidi->private_data, regs);
783 return IRQ_HANDLED;
784}
785
786static snd_pcm_hardware_t snd_ymfpci_playback =
787{
788 .info = (SNDRV_PCM_INFO_MMAP |
789 SNDRV_PCM_INFO_MMAP_VALID |
790 SNDRV_PCM_INFO_INTERLEAVED |
791 SNDRV_PCM_INFO_BLOCK_TRANSFER |
792 SNDRV_PCM_INFO_PAUSE |
793 SNDRV_PCM_INFO_RESUME),
794 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
795 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
796 .rate_min = 8000,
797 .rate_max = 48000,
798 .channels_min = 1,
799 .channels_max = 2,
800 .buffer_bytes_max = 256 * 1024, /* FIXME: enough? */
801 .period_bytes_min = 64,
802 .period_bytes_max = 256 * 1024, /* FIXME: enough? */
803 .periods_min = 3,
804 .periods_max = 1024,
805 .fifo_size = 0,
806};
807
808static snd_pcm_hardware_t snd_ymfpci_capture =
809{
810 .info = (SNDRV_PCM_INFO_MMAP |
811 SNDRV_PCM_INFO_MMAP_VALID |
812 SNDRV_PCM_INFO_INTERLEAVED |
813 SNDRV_PCM_INFO_BLOCK_TRANSFER |
814 SNDRV_PCM_INFO_PAUSE |
815 SNDRV_PCM_INFO_RESUME),
816 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
817 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
818 .rate_min = 8000,
819 .rate_max = 48000,
820 .channels_min = 1,
821 .channels_max = 2,
822 .buffer_bytes_max = 256 * 1024, /* FIXME: enough? */
823 .period_bytes_min = 64,
824 .period_bytes_max = 256 * 1024, /* FIXME: enough? */
825 .periods_min = 3,
826 .periods_max = 1024,
827 .fifo_size = 0,
828};
829
830static void snd_ymfpci_pcm_free_substream(snd_pcm_runtime_t *runtime)
831{
832 ymfpci_pcm_t *ypcm = runtime->private_data;
833
834 kfree(ypcm);
835}
836
837static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream)
838{
839 ymfpci_t *chip = snd_pcm_substream_chip(substream);
840 snd_pcm_runtime_t *runtime = substream->runtime;
841 ymfpci_pcm_t *ypcm;
842
843 ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL);
844 if (ypcm == NULL)
845 return -ENOMEM;
846 ypcm->chip = chip;
847 ypcm->type = PLAYBACK_VOICE;
848 ypcm->substream = substream;
849 runtime->hw = snd_ymfpci_playback;
850 runtime->private_data = ypcm;
851 runtime->private_free = snd_ymfpci_pcm_free_substream;
852 /* FIXME? True value is 256/48 = 5.33333 ms */
853 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 5333, UINT_MAX);
854 return 0;
855}
856
857/* call with spinlock held */
858static void ymfpci_open_extension(ymfpci_t *chip)
859{
860 if (! chip->rear_opened) {
861 if (! chip->spdif_opened) /* set AC3 */
862 snd_ymfpci_writel(chip, YDSXGR_MODE,
863 snd_ymfpci_readl(chip, YDSXGR_MODE) | (1 << 30));
864 /* enable second codec (4CHEN) */
865 snd_ymfpci_writew(chip, YDSXGR_SECCONFIG,
866 (snd_ymfpci_readw(chip, YDSXGR_SECCONFIG) & ~0x0330) | 0x0010);
867 }
868}
869
870/* call with spinlock held */
871static void ymfpci_close_extension(ymfpci_t *chip)
872{
873 if (! chip->rear_opened) {
874 if (! chip->spdif_opened)
875 snd_ymfpci_writel(chip, YDSXGR_MODE,
876 snd_ymfpci_readl(chip, YDSXGR_MODE) & ~(1 << 30));
877 snd_ymfpci_writew(chip, YDSXGR_SECCONFIG,
878 (snd_ymfpci_readw(chip, YDSXGR_SECCONFIG) & ~0x0330) & ~0x0010);
879 }
880}
881
882static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream)
883{
884 ymfpci_t *chip = snd_pcm_substream_chip(substream);
885 snd_pcm_runtime_t *runtime = substream->runtime;
886 ymfpci_pcm_t *ypcm;
887 int err;
888
889 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
890 return err;
891 ypcm = runtime->private_data;
892 ypcm->output_front = 1;
893 ypcm->output_rear = chip->mode_dup4ch ? 1 : 0;
894 spin_lock_irq(&chip->reg_lock);
895 if (ypcm->output_rear) {
896 ymfpci_open_extension(chip);
897 chip->rear_opened++;
898 }
899 spin_unlock_irq(&chip->reg_lock);
900 return 0;
901}
902
903static int snd_ymfpci_playback_spdif_open(snd_pcm_substream_t * substream)
904{
905 ymfpci_t *chip = snd_pcm_substream_chip(substream);
906 snd_pcm_runtime_t *runtime = substream->runtime;
907 ymfpci_pcm_t *ypcm;
908 int err;
909
910 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
911 return err;
912 ypcm = runtime->private_data;
913 ypcm->output_front = 0;
914 ypcm->output_rear = 1;
915 spin_lock_irq(&chip->reg_lock);
916 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTCTRL,
917 snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) | 2);
918 ymfpci_open_extension(chip);
919 chip->spdif_pcm_bits = chip->spdif_bits;
920 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_pcm_bits);
921 chip->spdif_opened++;
922 spin_unlock_irq(&chip->reg_lock);
923
924 chip->spdif_pcm_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
925 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
926 SNDRV_CTL_EVENT_MASK_INFO, &chip->spdif_pcm_ctl->id);
927 return 0;
928}
929
930static int snd_ymfpci_playback_4ch_open(snd_pcm_substream_t * substream)
931{
932 ymfpci_t *chip = snd_pcm_substream_chip(substream);
933 snd_pcm_runtime_t *runtime = substream->runtime;
934 ymfpci_pcm_t *ypcm;
935 int err;
936
937 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
938 return err;
939 ypcm = runtime->private_data;
940 ypcm->output_front = 0;
941 ypcm->output_rear = 1;
942 spin_lock_irq(&chip->reg_lock);
943 ymfpci_open_extension(chip);
944 chip->rear_opened++;
945 spin_unlock_irq(&chip->reg_lock);
946 return 0;
947}
948
949static int snd_ymfpci_capture_open(snd_pcm_substream_t * substream,
950 u32 capture_bank_number)
951{
952 ymfpci_t *chip = snd_pcm_substream_chip(substream);
953 snd_pcm_runtime_t *runtime = substream->runtime;
954 ymfpci_pcm_t *ypcm;
955
956 ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL);
957 if (ypcm == NULL)
958 return -ENOMEM;
959 ypcm->chip = chip;
960 ypcm->type = capture_bank_number + CAPTURE_REC;
961 ypcm->substream = substream;
962 ypcm->capture_bank_number = capture_bank_number;
963 chip->capture_substream[capture_bank_number] = substream;
964 runtime->hw = snd_ymfpci_capture;
965 /* FIXME? True value is 256/48 = 5.33333 ms */
966 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 5333, UINT_MAX);
967 runtime->private_data = ypcm;
968 runtime->private_free = snd_ymfpci_pcm_free_substream;
969 snd_ymfpci_hw_start(chip);
970 return 0;
971}
972
973static int snd_ymfpci_capture_rec_open(snd_pcm_substream_t * substream)
974{
975 return snd_ymfpci_capture_open(substream, 0);
976}
977
978static int snd_ymfpci_capture_ac97_open(snd_pcm_substream_t * substream)
979{
980 return snd_ymfpci_capture_open(substream, 1);
981}
982
983static int snd_ymfpci_playback_close_1(snd_pcm_substream_t * substream)
984{
985 return 0;
986}
987
988static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream)
989{
990 ymfpci_t *chip = snd_pcm_substream_chip(substream);
991 ymfpci_pcm_t *ypcm = substream->runtime->private_data;
992
993 spin_lock_irq(&chip->reg_lock);
994 if (ypcm->output_rear && chip->rear_opened > 0) {
995 chip->rear_opened--;
996 ymfpci_close_extension(chip);
997 }
998 spin_unlock_irq(&chip->reg_lock);
999 return snd_ymfpci_playback_close_1(substream);
1000}
1001
1002static int snd_ymfpci_playback_spdif_close(snd_pcm_substream_t * substream)
1003{
1004 ymfpci_t *chip = snd_pcm_substream_chip(substream);
1005
1006 spin_lock_irq(&chip->reg_lock);
1007 chip->spdif_opened = 0;
1008 ymfpci_close_extension(chip);
1009 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTCTRL,
1010 snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & ~2);
1011 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_bits);
1012 spin_unlock_irq(&chip->reg_lock);
1013 chip->spdif_pcm_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1014 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
1015 SNDRV_CTL_EVENT_MASK_INFO, &chip->spdif_pcm_ctl->id);
1016 return snd_ymfpci_playback_close_1(substream);
1017}
1018
1019static int snd_ymfpci_playback_4ch_close(snd_pcm_substream_t * substream)
1020{
1021 ymfpci_t *chip = snd_pcm_substream_chip(substream);
1022
1023 spin_lock_irq(&chip->reg_lock);
1024 if (chip->rear_opened > 0) {
1025 chip->rear_opened--;
1026 ymfpci_close_extension(chip);
1027 }
1028 spin_unlock_irq(&chip->reg_lock);
1029 return snd_ymfpci_playback_close_1(substream);
1030}
1031
1032static int snd_ymfpci_capture_close(snd_pcm_substream_t * substream)
1033{
1034 ymfpci_t *chip = snd_pcm_substream_chip(substream);
1035 snd_pcm_runtime_t *runtime = substream->runtime;
1036 ymfpci_pcm_t *ypcm = runtime->private_data;
1037
1038 if (ypcm != NULL) {
1039 chip->capture_substream[ypcm->capture_bank_number] = NULL;
1040 snd_ymfpci_hw_stop(chip);
1041 }
1042 return 0;
1043}
1044
1045static snd_pcm_ops_t snd_ymfpci_playback_ops = {
1046 .open = snd_ymfpci_playback_open,
1047 .close = snd_ymfpci_playback_close,
1048 .ioctl = snd_pcm_lib_ioctl,
1049 .hw_params = snd_ymfpci_playback_hw_params,
1050 .hw_free = snd_ymfpci_playback_hw_free,
1051 .prepare = snd_ymfpci_playback_prepare,
1052 .trigger = snd_ymfpci_playback_trigger,
1053 .pointer = snd_ymfpci_playback_pointer,
1054};
1055
1056static snd_pcm_ops_t snd_ymfpci_capture_rec_ops = {
1057 .open = snd_ymfpci_capture_rec_open,
1058 .close = snd_ymfpci_capture_close,
1059 .ioctl = snd_pcm_lib_ioctl,
1060 .hw_params = snd_ymfpci_capture_hw_params,
1061 .hw_free = snd_ymfpci_capture_hw_free,
1062 .prepare = snd_ymfpci_capture_prepare,
1063 .trigger = snd_ymfpci_capture_trigger,
1064 .pointer = snd_ymfpci_capture_pointer,
1065};
1066
1067static void snd_ymfpci_pcm_free(snd_pcm_t *pcm)
1068{
1069 ymfpci_t *chip = pcm->private_data;
1070 chip->pcm = NULL;
1071 snd_pcm_lib_preallocate_free_for_all(pcm);
1072}
1073
1074int __devinit snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t ** rpcm)
1075{
1076 snd_pcm_t *pcm;
1077 int err;
1078
1079 if (rpcm)
1080 *rpcm = NULL;
1081 if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0)
1082 return err;
1083 pcm->private_data = chip;
1084 pcm->private_free = snd_ymfpci_pcm_free;
1085
1086 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ymfpci_playback_ops);
1087 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ymfpci_capture_rec_ops);
1088
1089 /* global setup */
1090 pcm->info_flags = 0;
1091 strcpy(pcm->name, "YMFPCI");
1092 chip->pcm = pcm;
1093
1094 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1095 snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
1096
1097 if (rpcm)
1098 *rpcm = pcm;
1099 return 0;
1100}
1101
1102static snd_pcm_ops_t snd_ymfpci_capture_ac97_ops = {
1103 .open = snd_ymfpci_capture_ac97_open,
1104 .close = snd_ymfpci_capture_close,
1105 .ioctl = snd_pcm_lib_ioctl,
1106 .hw_params = snd_ymfpci_capture_hw_params,
1107 .hw_free = snd_ymfpci_capture_hw_free,
1108 .prepare = snd_ymfpci_capture_prepare,
1109 .trigger = snd_ymfpci_capture_trigger,
1110 .pointer = snd_ymfpci_capture_pointer,
1111};
1112
1113static void snd_ymfpci_pcm2_free(snd_pcm_t *pcm)
1114{
1115 ymfpci_t *chip = pcm->private_data;
1116 chip->pcm2 = NULL;
1117 snd_pcm_lib_preallocate_free_for_all(pcm);
1118}
1119
1120int __devinit snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t ** rpcm)
1121{
1122 snd_pcm_t *pcm;
1123 int err;
1124
1125 if (rpcm)
1126 *rpcm = NULL;
1127 if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0)
1128 return err;
1129 pcm->private_data = chip;
1130 pcm->private_free = snd_ymfpci_pcm2_free;
1131
1132 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ymfpci_capture_ac97_ops);
1133
1134 /* global setup */
1135 pcm->info_flags = 0;
1136 sprintf(pcm->name, "YMFPCI - %s",
1137 chip->device_id == PCI_DEVICE_ID_YAMAHA_754 ? "Direct Recording" : "AC'97");
1138 chip->pcm2 = pcm;
1139
1140 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1141 snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
1142
1143 if (rpcm)
1144 *rpcm = pcm;
1145 return 0;
1146}
1147
1148static snd_pcm_ops_t snd_ymfpci_playback_spdif_ops = {
1149 .open = snd_ymfpci_playback_spdif_open,
1150 .close = snd_ymfpci_playback_spdif_close,
1151 .ioctl = snd_pcm_lib_ioctl,
1152 .hw_params = snd_ymfpci_playback_hw_params,
1153 .hw_free = snd_ymfpci_playback_hw_free,
1154 .prepare = snd_ymfpci_playback_prepare,
1155 .trigger = snd_ymfpci_playback_trigger,
1156 .pointer = snd_ymfpci_playback_pointer,
1157};
1158
1159static void snd_ymfpci_pcm_spdif_free(snd_pcm_t *pcm)
1160{
1161 ymfpci_t *chip = pcm->private_data;
1162 chip->pcm_spdif = NULL;
1163 snd_pcm_lib_preallocate_free_for_all(pcm);
1164}
1165
1166int __devinit snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t ** rpcm)
1167{
1168 snd_pcm_t *pcm;
1169 int err;
1170
1171 if (rpcm)
1172 *rpcm = NULL;
1173 if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0)
1174 return err;
1175 pcm->private_data = chip;
1176 pcm->private_free = snd_ymfpci_pcm_spdif_free;
1177
1178 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ymfpci_playback_spdif_ops);
1179
1180 /* global setup */
1181 pcm->info_flags = 0;
1182 strcpy(pcm->name, "YMFPCI - IEC958");
1183 chip->pcm_spdif = pcm;
1184
1185 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1186 snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
1187
1188 if (rpcm)
1189 *rpcm = pcm;
1190 return 0;
1191}
1192
1193static snd_pcm_ops_t snd_ymfpci_playback_4ch_ops = {
1194 .open = snd_ymfpci_playback_4ch_open,
1195 .close = snd_ymfpci_playback_4ch_close,
1196 .ioctl = snd_pcm_lib_ioctl,
1197 .hw_params = snd_ymfpci_playback_hw_params,
1198 .hw_free = snd_ymfpci_playback_hw_free,
1199 .prepare = snd_ymfpci_playback_prepare,
1200 .trigger = snd_ymfpci_playback_trigger,
1201 .pointer = snd_ymfpci_playback_pointer,
1202};
1203
1204static void snd_ymfpci_pcm_4ch_free(snd_pcm_t *pcm)
1205{
1206 ymfpci_t *chip = pcm->private_data;
1207 chip->pcm_4ch = NULL;
1208 snd_pcm_lib_preallocate_free_for_all(pcm);
1209}
1210
1211int __devinit snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t ** rpcm)
1212{
1213 snd_pcm_t *pcm;
1214 int err;
1215
1216 if (rpcm)
1217 *rpcm = NULL;
1218 if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0)
1219 return err;
1220 pcm->private_data = chip;
1221 pcm->private_free = snd_ymfpci_pcm_4ch_free;
1222
1223 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ymfpci_playback_4ch_ops);
1224
1225 /* global setup */
1226 pcm->info_flags = 0;
1227 strcpy(pcm->name, "YMFPCI - Rear PCM");
1228 chip->pcm_4ch = pcm;
1229
1230 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1231 snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
1232
1233 if (rpcm)
1234 *rpcm = pcm;
1235 return 0;
1236}
1237
1238static int snd_ymfpci_spdif_default_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1239{
1240 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
1241 uinfo->count = 1;
1242 return 0;
1243}
1244
1245static int snd_ymfpci_spdif_default_get(snd_kcontrol_t * kcontrol,
1246 snd_ctl_elem_value_t * ucontrol)
1247{
1248 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1249
1250 spin_lock_irq(&chip->reg_lock);
1251 ucontrol->value.iec958.status[0] = (chip->spdif_bits >> 0) & 0xff;
1252 ucontrol->value.iec958.status[1] = (chip->spdif_bits >> 8) & 0xff;
1253 spin_unlock_irq(&chip->reg_lock);
1254 return 0;
1255}
1256
1257static int snd_ymfpci_spdif_default_put(snd_kcontrol_t * kcontrol,
1258 snd_ctl_elem_value_t * ucontrol)
1259{
1260 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1261 unsigned int val;
1262 int change;
1263
1264 val = ((ucontrol->value.iec958.status[0] & 0x3e) << 0) |
1265 (ucontrol->value.iec958.status[1] << 8);
1266 spin_lock_irq(&chip->reg_lock);
1267 change = chip->spdif_bits != val;
1268 chip->spdif_bits = val;
1269 if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) && chip->pcm_spdif == NULL)
1270 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_bits);
1271 spin_unlock_irq(&chip->reg_lock);
1272 return change;
1273}
1274
1275static snd_kcontrol_new_t snd_ymfpci_spdif_default __devinitdata =
1276{
1277 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1278 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
1279 .info = snd_ymfpci_spdif_default_info,
1280 .get = snd_ymfpci_spdif_default_get,
1281 .put = snd_ymfpci_spdif_default_put
1282};
1283
1284static int snd_ymfpci_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1285{
1286 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
1287 uinfo->count = 1;
1288 return 0;
1289}
1290
1291static int snd_ymfpci_spdif_mask_get(snd_kcontrol_t * kcontrol,
1292 snd_ctl_elem_value_t * ucontrol)
1293{
1294 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1295
1296 spin_lock_irq(&chip->reg_lock);
1297 ucontrol->value.iec958.status[0] = 0x3e;
1298 ucontrol->value.iec958.status[1] = 0xff;
1299 spin_unlock_irq(&chip->reg_lock);
1300 return 0;
1301}
1302
1303static snd_kcontrol_new_t snd_ymfpci_spdif_mask __devinitdata =
1304{
1305 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1306 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1307 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
1308 .info = snd_ymfpci_spdif_mask_info,
1309 .get = snd_ymfpci_spdif_mask_get,
1310};
1311
1312static int snd_ymfpci_spdif_stream_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1313{
1314 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
1315 uinfo->count = 1;
1316 return 0;
1317}
1318
1319static int snd_ymfpci_spdif_stream_get(snd_kcontrol_t * kcontrol,
1320 snd_ctl_elem_value_t * ucontrol)
1321{
1322 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1323
1324 spin_lock_irq(&chip->reg_lock);
1325 ucontrol->value.iec958.status[0] = (chip->spdif_pcm_bits >> 0) & 0xff;
1326 ucontrol->value.iec958.status[1] = (chip->spdif_pcm_bits >> 8) & 0xff;
1327 spin_unlock_irq(&chip->reg_lock);
1328 return 0;
1329}
1330
1331static int snd_ymfpci_spdif_stream_put(snd_kcontrol_t * kcontrol,
1332 snd_ctl_elem_value_t * ucontrol)
1333{
1334 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1335 unsigned int val;
1336 int change;
1337
1338 val = ((ucontrol->value.iec958.status[0] & 0x3e) << 0) |
1339 (ucontrol->value.iec958.status[1] << 8);
1340 spin_lock_irq(&chip->reg_lock);
1341 change = chip->spdif_pcm_bits != val;
1342 chip->spdif_pcm_bits = val;
1343 if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 2))
1344 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_pcm_bits);
1345 spin_unlock_irq(&chip->reg_lock);
1346 return change;
1347}
1348
1349static snd_kcontrol_new_t snd_ymfpci_spdif_stream __devinitdata =
1350{
1351 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
1352 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1353 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM),
1354 .info = snd_ymfpci_spdif_stream_info,
1355 .get = snd_ymfpci_spdif_stream_get,
1356 .put = snd_ymfpci_spdif_stream_put
1357};
1358
1359static int snd_ymfpci_drec_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *info)
1360{
1361 static char *texts[3] = {"AC'97", "IEC958", "ZV Port"};
1362
1363 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1364 info->count = 1;
1365 info->value.enumerated.items = 3;
1366 if (info->value.enumerated.item > 2)
1367 info->value.enumerated.item = 2;
1368 strcpy(info->value.enumerated.name, texts[info->value.enumerated.item]);
1369 return 0;
1370}
1371
1372static int snd_ymfpci_drec_source_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value)
1373{
1374 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1375 u16 reg;
1376
1377 spin_lock_irq(&chip->reg_lock);
1378 reg = snd_ymfpci_readw(chip, YDSXGR_GLOBALCTRL);
1379 spin_unlock_irq(&chip->reg_lock);
1380 if (!(reg & 0x100))
1381 value->value.enumerated.item[0] = 0;
1382 else
1383 value->value.enumerated.item[0] = 1 + ((reg & 0x200) != 0);
1384 return 0;
1385}
1386
1387static int snd_ymfpci_drec_source_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value)
1388{
1389 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1390 u16 reg, old_reg;
1391
1392 spin_lock_irq(&chip->reg_lock);
1393 old_reg = snd_ymfpci_readw(chip, YDSXGR_GLOBALCTRL);
1394 if (value->value.enumerated.item[0] == 0)
1395 reg = old_reg & ~0x100;
1396 else
1397 reg = (old_reg & ~0x300) | 0x100 | ((value->value.enumerated.item[0] == 2) << 9);
1398 snd_ymfpci_writew(chip, YDSXGR_GLOBALCTRL, reg);
1399 spin_unlock_irq(&chip->reg_lock);
1400 return reg != old_reg;
1401}
1402
1403static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = {
1404 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
1405 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1406 .name = "Direct Recording Source",
1407 .info = snd_ymfpci_drec_source_info,
1408 .get = snd_ymfpci_drec_source_get,
1409 .put = snd_ymfpci_drec_source_put
1410};
1411
1412/*
1413 * Mixer controls
1414 */
1415
1416#define YMFPCI_SINGLE(xname, xindex, reg) \
1417{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1418 .info = snd_ymfpci_info_single, \
1419 .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \
1420 .private_value = reg }
1421
1422static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1423{
1424 unsigned int mask = 1;
1425
1426 switch (kcontrol->private_value) {
1427 case YDSXGR_SPDIFOUTCTRL: break;
1428 case YDSXGR_SPDIFINCTRL: break;
1429 default: return -EINVAL;
1430 }
1431 uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;
1432 uinfo->count = 1;
1433 uinfo->value.integer.min = 0;
1434 uinfo->value.integer.max = mask;
1435 return 0;
1436}
1437
1438static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
1439{
1440 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1441 int reg = kcontrol->private_value;
1442 unsigned int shift = 0, mask = 1, invert = 0;
1443
1444 switch (kcontrol->private_value) {
1445 case YDSXGR_SPDIFOUTCTRL: break;
1446 case YDSXGR_SPDIFINCTRL: break;
1447 default: return -EINVAL;
1448 }
1449 ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask;
1450 if (invert)
1451 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
1452 return 0;
1453}
1454
1455static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
1456{
1457 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1458 int reg = kcontrol->private_value;
1459 unsigned int shift = 0, mask = 1, invert = 0;
1460 int change;
1461 unsigned int val, oval;
1462
1463 switch (kcontrol->private_value) {
1464 case YDSXGR_SPDIFOUTCTRL: break;
1465 case YDSXGR_SPDIFINCTRL: break;
1466 default: return -EINVAL;
1467 }
1468 val = (ucontrol->value.integer.value[0] & mask);
1469 if (invert)
1470 val = mask - val;
1471 val <<= shift;
1472 spin_lock_irq(&chip->reg_lock);
1473 oval = snd_ymfpci_readl(chip, reg);
1474 val = (oval & ~(mask << shift)) | val;
1475 change = val != oval;
1476 snd_ymfpci_writel(chip, reg, val);
1477 spin_unlock_irq(&chip->reg_lock);
1478 return change;
1479}
1480
1481#define YMFPCI_DOUBLE(xname, xindex, reg) \
1482{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1483 .info = snd_ymfpci_info_double, \
1484 .get = snd_ymfpci_get_double, .put = snd_ymfpci_put_double, \
1485 .private_value = reg }
1486
1487static int snd_ymfpci_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1488{
1489 unsigned int reg = kcontrol->private_value;
1490 unsigned int mask = 16383;
1491
1492 if (reg < 0x80 || reg >= 0xc0)
1493 return -EINVAL;
1494 uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;
1495 uinfo->count = 2;
1496 uinfo->value.integer.min = 0;
1497 uinfo->value.integer.max = mask;
1498 return 0;
1499}
1500
1501static int snd_ymfpci_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
1502{
1503 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1504 unsigned int reg = kcontrol->private_value;
1505 unsigned int shift_left = 0, shift_right = 16, mask = 16383, invert = 0;
1506 unsigned int val;
1507
1508 if (reg < 0x80 || reg >= 0xc0)
1509 return -EINVAL;
1510 spin_lock_irq(&chip->reg_lock);
1511 val = snd_ymfpci_readl(chip, reg);
1512 spin_unlock_irq(&chip->reg_lock);
1513 ucontrol->value.integer.value[0] = (val >> shift_left) & mask;
1514 ucontrol->value.integer.value[1] = (val >> shift_right) & mask;
1515 if (invert) {
1516 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
1517 ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1];
1518 }
1519 return 0;
1520}
1521
1522static int snd_ymfpci_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
1523{
1524 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1525 unsigned int reg = kcontrol->private_value;
1526 unsigned int shift_left = 0, shift_right = 16, mask = 16383, invert = 0;
1527 int change;
1528 unsigned int val1, val2, oval;
1529
1530 if (reg < 0x80 || reg >= 0xc0)
1531 return -EINVAL;
1532 val1 = ucontrol->value.integer.value[0] & mask;
1533 val2 = ucontrol->value.integer.value[1] & mask;
1534 if (invert) {
1535 val1 = mask - val1;
1536 val2 = mask - val2;
1537 }
1538 val1 <<= shift_left;
1539 val2 <<= shift_right;
1540 spin_lock_irq(&chip->reg_lock);
1541 oval = snd_ymfpci_readl(chip, reg);
1542 val1 = (oval & ~((mask << shift_left) | (mask << shift_right))) | val1 | val2;
1543 change = val1 != oval;
1544 snd_ymfpci_writel(chip, reg, val1);
1545 spin_unlock_irq(&chip->reg_lock);
1546 return change;
1547}
1548
1549/*
1550 * 4ch duplication
1551 */
1552static int snd_ymfpci_info_dup4ch(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1553{
1554 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1555 uinfo->count = 1;
1556 uinfo->value.integer.min = 0;
1557 uinfo->value.integer.max = 1;
1558 return 0;
1559}
1560
1561static int snd_ymfpci_get_dup4ch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
1562{
1563 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1564 ucontrol->value.integer.value[0] = chip->mode_dup4ch;
1565 return 0;
1566}
1567
1568static int snd_ymfpci_put_dup4ch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
1569{
1570 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1571 int change;
1572 change = (ucontrol->value.integer.value[0] != chip->mode_dup4ch);
1573 if (change)
1574 chip->mode_dup4ch = !!ucontrol->value.integer.value[0];
1575 return change;
1576}
1577
1578
1579static snd_kcontrol_new_t snd_ymfpci_controls[] __devinitdata = {
1580YMFPCI_DOUBLE("Wave Playback Volume", 0, YDSXGR_NATIVEDACOUTVOL),
1581YMFPCI_DOUBLE("Wave Capture Volume", 0, YDSXGR_NATIVEDACLOOPVOL),
1582YMFPCI_DOUBLE("Digital Capture Volume", 0, YDSXGR_NATIVEDACINVOL),
1583YMFPCI_DOUBLE("Digital Capture Volume", 1, YDSXGR_NATIVEADCINVOL),
1584YMFPCI_DOUBLE("ADC Playback Volume", 0, YDSXGR_PRIADCOUTVOL),
1585YMFPCI_DOUBLE("ADC Capture Volume", 0, YDSXGR_PRIADCLOOPVOL),
1586YMFPCI_DOUBLE("ADC Playback Volume", 1, YDSXGR_SECADCOUTVOL),
1587YMFPCI_DOUBLE("ADC Capture Volume", 1, YDSXGR_SECADCLOOPVOL),
1588YMFPCI_DOUBLE("FM Legacy Volume", 0, YDSXGR_LEGACYOUTVOL),
1589YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVOL),
1590YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL),
1591YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL),
1592YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
1593YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL),
1594YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL),
1595{
1596 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1597 .name = "4ch Duplication",
1598 .info = snd_ymfpci_info_dup4ch,
1599 .get = snd_ymfpci_get_dup4ch,
1600 .put = snd_ymfpci_put_dup4ch,
1601},
1602};
1603
1604
1605/*
1606 * GPIO
1607 */
1608
1609static int snd_ymfpci_get_gpio_out(ymfpci_t *chip, int pin)
1610{
1611 u16 reg, mode;
1612 unsigned long flags;
1613
1614 spin_lock_irqsave(&chip->reg_lock, flags);
1615 reg = snd_ymfpci_readw(chip, YDSXGR_GPIOFUNCENABLE);
1616 reg &= ~(1 << (pin + 8));
1617 reg |= (1 << pin);
1618 snd_ymfpci_writew(chip, YDSXGR_GPIOFUNCENABLE, reg);
1619 /* set the level mode for input line */
1620 mode = snd_ymfpci_readw(chip, YDSXGR_GPIOTYPECONFIG);
1621 mode &= ~(3 << (pin * 2));
1622 snd_ymfpci_writew(chip, YDSXGR_GPIOTYPECONFIG, mode);
1623 snd_ymfpci_writew(chip, YDSXGR_GPIOFUNCENABLE, reg | (1 << (pin + 8)));
1624 mode = snd_ymfpci_readw(chip, YDSXGR_GPIOINSTATUS);
1625 spin_unlock_irqrestore(&chip->reg_lock, flags);
1626 return (mode >> pin) & 1;
1627}
1628
1629static int snd_ymfpci_set_gpio_out(ymfpci_t *chip, int pin, int enable)
1630{
1631 u16 reg;
1632 unsigned long flags;
1633
1634 spin_lock_irqsave(&chip->reg_lock, flags);
1635 reg = snd_ymfpci_readw(chip, YDSXGR_GPIOFUNCENABLE);
1636 reg &= ~(1 << pin);
1637 reg &= ~(1 << (pin + 8));
1638 snd_ymfpci_writew(chip, YDSXGR_GPIOFUNCENABLE, reg);
1639 snd_ymfpci_writew(chip, YDSXGR_GPIOOUTCTRL, enable << pin);
1640 snd_ymfpci_writew(chip, YDSXGR_GPIOFUNCENABLE, reg | (1 << (pin + 8)));
1641 spin_unlock_irqrestore(&chip->reg_lock, flags);
1642
1643 return 0;
1644}
1645
1646static int snd_ymfpci_gpio_sw_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
1647{
1648 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1649 uinfo->count = 1;
1650 uinfo->value.integer.min = 0;
1651 uinfo->value.integer.max = 1;
1652 return 0;
1653}
1654
1655static int snd_ymfpci_gpio_sw_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
1656{
1657 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1658 int pin = (int)kcontrol->private_value;
1659 ucontrol->value.integer.value[0] = snd_ymfpci_get_gpio_out(chip, pin);
1660 return 0;
1661}
1662
1663static int snd_ymfpci_gpio_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
1664{
1665 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1666 int pin = (int)kcontrol->private_value;
1667
1668 if (snd_ymfpci_get_gpio_out(chip, pin) != ucontrol->value.integer.value[0]) {
1669 snd_ymfpci_set_gpio_out(chip, pin, !!ucontrol->value.integer.value[0]);
1670 ucontrol->value.integer.value[0] = snd_ymfpci_get_gpio_out(chip, pin);
1671 return 1;
1672 }
1673 return 0;
1674}
1675
1676static snd_kcontrol_new_t snd_ymfpci_rear_shared __devinitdata = {
1677 .name = "Shared Rear/Line-In Switch",
1678 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1679 .info = snd_ymfpci_gpio_sw_info,
1680 .get = snd_ymfpci_gpio_sw_get,
1681 .put = snd_ymfpci_gpio_sw_put,
1682 .private_value = 2,
1683};
1684
1685
1686/*
1687 * Mixer routines
1688 */
1689
1690static void snd_ymfpci_mixer_free_ac97_bus(ac97_bus_t *bus)
1691{
1692 ymfpci_t *chip = bus->private_data;
1693 chip->ac97_bus = NULL;
1694}
1695
1696static void snd_ymfpci_mixer_free_ac97(ac97_t *ac97)
1697{
1698 ymfpci_t *chip = ac97->private_data;
1699 chip->ac97 = NULL;
1700}
1701
1702int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch)
1703{
1704 ac97_template_t ac97;
1705 snd_kcontrol_t *kctl;
1706 unsigned int idx;
1707 int err;
1708 static ac97_bus_ops_t ops = {
1709 .write = snd_ymfpci_codec_write,
1710 .read = snd_ymfpci_codec_read,
1711 };
1712
1713 if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
1714 return err;
1715 chip->ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus;
1716 chip->ac97_bus->no_vra = 1; /* YMFPCI doesn't need VRA */
1717
1718 memset(&ac97, 0, sizeof(ac97));
1719 ac97.private_data = chip;
1720 ac97.private_free = snd_ymfpci_mixer_free_ac97;
1721 if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0)
1722 return err;
1723
1724 /* to be sure */
1725 snd_ac97_update_bits(chip->ac97, AC97_EXTENDED_STATUS,
1726 AC97_EA_VRA|AC97_EA_VRM, 0);
1727
1728 for (idx = 0; idx < ARRAY_SIZE(snd_ymfpci_controls); idx++) {
1729 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0)
1730 return err;
1731 }
1732
1733 /* add S/PDIF control */
1734 snd_assert(chip->pcm_spdif != NULL, return -EIO);
1735 if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip))) < 0)
1736 return err;
1737 kctl->id.device = chip->pcm_spdif->device;
1738 if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip))) < 0)
1739 return err;
1740 kctl->id.device = chip->pcm_spdif->device;
1741 if ((err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip))) < 0)
1742 return err;
1743 kctl->id.device = chip->pcm_spdif->device;
1744 chip->spdif_pcm_ctl = kctl;
1745
1746 /* direct recording source */
1747 if (chip->device_id == PCI_DEVICE_ID_YAMAHA_754 &&
1748 (err = snd_ctl_add(chip->card, kctl = snd_ctl_new1(&snd_ymfpci_drec_source, chip))) < 0)
1749 return err;
1750
1751 /*
1752 * shared rear/line-in
1753 */
1754 if (rear_switch) {
1755 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_rear_shared, chip))) < 0)
1756 return err;
1757 }
1758
1759 return 0;
1760}
1761
1762
1763/*
1764 * timer
1765 */
1766
1767static int snd_ymfpci_timer_start(snd_timer_t *timer)
1768{
1769 ymfpci_t *chip;
1770 unsigned long flags;
1771 unsigned int count;
1772
1773 chip = snd_timer_chip(timer);
1774 count = timer->sticks - 1;
1775 if (count == 0) /* minimum time is 20.8 us */
1776 count = 1;
1777 spin_lock_irqsave(&chip->reg_lock, flags);
1778 snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count);
1779 snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03);
1780 spin_unlock_irqrestore(&chip->reg_lock, flags);
1781 return 0;
1782}
1783
1784static int snd_ymfpci_timer_stop(snd_timer_t *timer)
1785{
1786 ymfpci_t *chip;
1787 unsigned long flags;
1788
1789 chip = snd_timer_chip(timer);
1790 spin_lock_irqsave(&chip->reg_lock, flags);
1791 snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x00);
1792 spin_unlock_irqrestore(&chip->reg_lock, flags);
1793 return 0;
1794}
1795
1796static int snd_ymfpci_timer_precise_resolution(snd_timer_t *timer,
1797 unsigned long *num, unsigned long *den)
1798{
1799 *num = 1;
1800 *den = 96000;
1801 return 0;
1802}
1803
1804static struct _snd_timer_hardware snd_ymfpci_timer_hw = {
1805 .flags = SNDRV_TIMER_HW_AUTO,
1806 .resolution = 10417, /* 1/2fs = 10.41666...us */
1807 .ticks = 65536,
1808 .start = snd_ymfpci_timer_start,
1809 .stop = snd_ymfpci_timer_stop,
1810 .precise_resolution = snd_ymfpci_timer_precise_resolution,
1811};
1812
1813int __devinit snd_ymfpci_timer(ymfpci_t *chip, int device)
1814{
1815 snd_timer_t *timer = NULL;
1816 snd_timer_id_t tid;
1817 int err;
1818
1819 tid.dev_class = SNDRV_TIMER_CLASS_CARD;
1820 tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
1821 tid.card = chip->card->number;
1822 tid.device = device;
1823 tid.subdevice = 0;
1824 if ((err = snd_timer_new(chip->card, "YMFPCI", &tid, &timer)) >= 0) {
1825 strcpy(timer->name, "YMFPCI timer");
1826 timer->private_data = chip;
1827 timer->hw = snd_ymfpci_timer_hw;
1828 }
1829 chip->timer = timer;
1830 return err;
1831}
1832
1833
1834/*
1835 * proc interface
1836 */
1837
1838static void snd_ymfpci_proc_read(snd_info_entry_t *entry,
1839 snd_info_buffer_t * buffer)
1840{
1841 ymfpci_t *chip = entry->private_data;
1842 int i;
1843
1844 snd_iprintf(buffer, "YMFPCI\n\n");
1845 for (i = 0; i <= YDSXGR_WORKBASE; i += 4)
1846 snd_iprintf(buffer, "%04x: %04x\n", i, snd_ymfpci_readl(chip, i));
1847}
1848
1849static int __devinit snd_ymfpci_proc_init(snd_card_t * card, ymfpci_t *chip)
1850{
1851 snd_info_entry_t *entry;
1852
1853 if (! snd_card_proc_new(card, "ymfpci", &entry))
1854 snd_info_set_text_ops(entry, chip, 1024, snd_ymfpci_proc_read);
1855 return 0;
1856}
1857
1858/*
1859 * initialization routines
1860 */
1861
1862static void snd_ymfpci_aclink_reset(struct pci_dev * pci)
1863{
1864 u8 cmd;
1865
1866 pci_read_config_byte(pci, PCIR_DSXG_CTRL, &cmd);
1867#if 0 // force to reset
1868 if (cmd & 0x03) {
1869#endif
1870 pci_write_config_byte(pci, PCIR_DSXG_CTRL, cmd & 0xfc);
1871 pci_write_config_byte(pci, PCIR_DSXG_CTRL, cmd | 0x03);
1872 pci_write_config_byte(pci, PCIR_DSXG_CTRL, cmd & 0xfc);
1873 pci_write_config_word(pci, PCIR_DSXG_PWRCTRL1, 0);
1874 pci_write_config_word(pci, PCIR_DSXG_PWRCTRL2, 0);
1875#if 0
1876 }
1877#endif
1878}
1879
1880static void snd_ymfpci_enable_dsp(ymfpci_t *chip)
1881{
1882 snd_ymfpci_writel(chip, YDSXGR_CONFIG, 0x00000001);
1883}
1884
1885static void snd_ymfpci_disable_dsp(ymfpci_t *chip)
1886{
1887 u32 val;
1888 int timeout = 1000;
1889
1890 val = snd_ymfpci_readl(chip, YDSXGR_CONFIG);
1891 if (val)
1892 snd_ymfpci_writel(chip, YDSXGR_CONFIG, 0x00000000);
1893 while (timeout-- > 0) {
1894 val = snd_ymfpci_readl(chip, YDSXGR_STATUS);
1895 if ((val & 0x00000002) == 0)
1896 break;
1897 }
1898}
1899
1900#include "ymfpci_image.h"
1901
1902static void snd_ymfpci_download_image(ymfpci_t *chip)
1903{
1904 int i;
1905 u16 ctrl;
1906 unsigned long *inst;
1907
1908 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0x00000000);
1909 snd_ymfpci_disable_dsp(chip);
1910 snd_ymfpci_writel(chip, YDSXGR_MODE, 0x00010000);
1911 snd_ymfpci_writel(chip, YDSXGR_MODE, 0x00000000);
1912 snd_ymfpci_writel(chip, YDSXGR_MAPOFREC, 0x00000000);
1913 snd_ymfpci_writel(chip, YDSXGR_MAPOFEFFECT, 0x00000000);
1914 snd_ymfpci_writel(chip, YDSXGR_PLAYCTRLBASE, 0x00000000);
1915 snd_ymfpci_writel(chip, YDSXGR_RECCTRLBASE, 0x00000000);
1916 snd_ymfpci_writel(chip, YDSXGR_EFFCTRLBASE, 0x00000000);
1917 ctrl = snd_ymfpci_readw(chip, YDSXGR_GLOBALCTRL);
1918 snd_ymfpci_writew(chip, YDSXGR_GLOBALCTRL, ctrl & ~0x0007);
1919
1920 /* setup DSP instruction code */
1921 for (i = 0; i < YDSXG_DSPLENGTH / 4; i++)
1922 snd_ymfpci_writel(chip, YDSXGR_DSPINSTRAM + (i << 2), DspInst[i]);
1923
1924 /* setup control instruction code */
1925 switch (chip->device_id) {
1926 case PCI_DEVICE_ID_YAMAHA_724F:
1927 case PCI_DEVICE_ID_YAMAHA_740C:
1928 case PCI_DEVICE_ID_YAMAHA_744:
1929 case PCI_DEVICE_ID_YAMAHA_754:
1930 inst = CntrlInst1E;
1931 break;
1932 default:
1933 inst = CntrlInst;
1934 break;
1935 }
1936 for (i = 0; i < YDSXG_CTRLLENGTH / 4; i++)
1937 snd_ymfpci_writel(chip, YDSXGR_CTRLINSTRAM + (i << 2), inst[i]);
1938
1939 snd_ymfpci_enable_dsp(chip);
1940}
1941
1942static int __devinit snd_ymfpci_memalloc(ymfpci_t *chip)
1943{
1944 long size, playback_ctrl_size;
1945 int voice, bank, reg;
1946 u8 *ptr;
1947 dma_addr_t ptr_addr;
1948
1949 playback_ctrl_size = 4 + 4 * YDSXG_PLAYBACK_VOICES;
1950 chip->bank_size_playback = snd_ymfpci_readl(chip, YDSXGR_PLAYCTRLSIZE) << 2;
1951 chip->bank_size_capture = snd_ymfpci_readl(chip, YDSXGR_RECCTRLSIZE) << 2;
1952 chip->bank_size_effect = snd_ymfpci_readl(chip, YDSXGR_EFFCTRLSIZE) << 2;
1953 chip->work_size = YDSXG_DEFAULT_WORK_SIZE;
1954
1955 size = ((playback_ctrl_size + 0x00ff) & ~0x00ff) +
1956 ((chip->bank_size_playback * 2 * YDSXG_PLAYBACK_VOICES + 0x00ff) & ~0x00ff) +
1957 ((chip->bank_size_capture * 2 * YDSXG_CAPTURE_VOICES + 0x00ff) & ~0x00ff) +
1958 ((chip->bank_size_effect * 2 * YDSXG_EFFECT_VOICES + 0x00ff) & ~0x00ff) +
1959 chip->work_size;
1960 /* work_ptr must be aligned to 256 bytes, but it's already
1961 covered with the kernel page allocation mechanism */
1962 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
1963 size, &chip->work_ptr) < 0)
1964 return -ENOMEM;
1965 ptr = chip->work_ptr.area;
1966 ptr_addr = chip->work_ptr.addr;
1967 memset(ptr, 0, size); /* for sure */
1968
1969 chip->bank_base_playback = ptr;
1970 chip->bank_base_playback_addr = ptr_addr;
1971 chip->ctrl_playback = (u32 *)ptr;
1972 chip->ctrl_playback[0] = cpu_to_le32(YDSXG_PLAYBACK_VOICES);
1973 ptr += (playback_ctrl_size + 0x00ff) & ~0x00ff;
1974 ptr_addr += (playback_ctrl_size + 0x00ff) & ~0x00ff;
1975 for (voice = 0; voice < YDSXG_PLAYBACK_VOICES; voice++) {
1976 chip->voices[voice].number = voice;
1977 chip->voices[voice].bank = (snd_ymfpci_playback_bank_t *)ptr;
1978 chip->voices[voice].bank_addr = ptr_addr;
1979 for (bank = 0; bank < 2; bank++) {
1980 chip->bank_playback[voice][bank] = (snd_ymfpci_playback_bank_t *)ptr;
1981 ptr += chip->bank_size_playback;
1982 ptr_addr += chip->bank_size_playback;
1983 }
1984 }
1985 ptr = (char *)(((unsigned long)ptr + 0x00ff) & ~0x00ff);
1986 ptr_addr = (ptr_addr + 0x00ff) & ~0x00ff;
1987 chip->bank_base_capture = ptr;
1988 chip->bank_base_capture_addr = ptr_addr;
1989 for (voice = 0; voice < YDSXG_CAPTURE_VOICES; voice++)
1990 for (bank = 0; bank < 2; bank++) {
1991 chip->bank_capture[voice][bank] = (snd_ymfpci_capture_bank_t *)ptr;
1992 ptr += chip->bank_size_capture;
1993 ptr_addr += chip->bank_size_capture;
1994 }
1995 ptr = (char *)(((unsigned long)ptr + 0x00ff) & ~0x00ff);
1996 ptr_addr = (ptr_addr + 0x00ff) & ~0x00ff;
1997 chip->bank_base_effect = ptr;
1998 chip->bank_base_effect_addr = ptr_addr;
1999 for (voice = 0; voice < YDSXG_EFFECT_VOICES; voice++)
2000 for (bank = 0; bank < 2; bank++) {
2001 chip->bank_effect[voice][bank] = (snd_ymfpci_effect_bank_t *)ptr;
2002 ptr += chip->bank_size_effect;
2003 ptr_addr += chip->bank_size_effect;
2004 }
2005 ptr = (char *)(((unsigned long)ptr + 0x00ff) & ~0x00ff);
2006 ptr_addr = (ptr_addr + 0x00ff) & ~0x00ff;
2007 chip->work_base = ptr;
2008 chip->work_base_addr = ptr_addr;
2009
2010 snd_assert(ptr + chip->work_size == chip->work_ptr.area + chip->work_ptr.bytes, );
2011
2012 snd_ymfpci_writel(chip, YDSXGR_PLAYCTRLBASE, chip->bank_base_playback_addr);
2013 snd_ymfpci_writel(chip, YDSXGR_RECCTRLBASE, chip->bank_base_capture_addr);
2014 snd_ymfpci_writel(chip, YDSXGR_EFFCTRLBASE, chip->bank_base_effect_addr);
2015 snd_ymfpci_writel(chip, YDSXGR_WORKBASE, chip->work_base_addr);
2016 snd_ymfpci_writel(chip, YDSXGR_WORKSIZE, chip->work_size >> 2);
2017
2018 /* S/PDIF output initialization */
2019 chip->spdif_bits = chip->spdif_pcm_bits = SNDRV_PCM_DEFAULT_CON_SPDIF & 0xffff;
2020 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTCTRL, 0);
2021 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_bits);
2022
2023 /* S/PDIF input initialization */
2024 snd_ymfpci_writew(chip, YDSXGR_SPDIFINCTRL, 0);
2025
2026 /* digital mixer setup */
2027 for (reg = 0x80; reg < 0xc0; reg += 4)
2028 snd_ymfpci_writel(chip, reg, 0);
2029 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0x3fff3fff);
2030 snd_ymfpci_writel(chip, YDSXGR_ZVOUTVOL, 0x3fff3fff);
2031 snd_ymfpci_writel(chip, YDSXGR_SPDIFOUTVOL, 0x3fff3fff);
2032 snd_ymfpci_writel(chip, YDSXGR_NATIVEADCINVOL, 0x3fff3fff);
2033 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACINVOL, 0x3fff3fff);
2034 snd_ymfpci_writel(chip, YDSXGR_PRIADCLOOPVOL, 0x3fff3fff);
2035 snd_ymfpci_writel(chip, YDSXGR_LEGACYOUTVOL, 0x3fff3fff);
2036
2037 return 0;
2038}
2039
2040static int snd_ymfpci_free(ymfpci_t *chip)
2041{
2042 u16 ctrl;
2043
2044 snd_assert(chip != NULL, return -EINVAL);
2045
2046 if (chip->res_reg_area) { /* don't touch busy hardware */
2047 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
2048 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
2049 snd_ymfpci_writel(chip, YDSXGR_LEGACYOUTVOL, 0);
2050 snd_ymfpci_writel(chip, YDSXGR_STATUS, ~0);
2051 snd_ymfpci_disable_dsp(chip);
2052 snd_ymfpci_writel(chip, YDSXGR_PLAYCTRLBASE, 0);
2053 snd_ymfpci_writel(chip, YDSXGR_RECCTRLBASE, 0);
2054 snd_ymfpci_writel(chip, YDSXGR_EFFCTRLBASE, 0);
2055 snd_ymfpci_writel(chip, YDSXGR_WORKBASE, 0);
2056 snd_ymfpci_writel(chip, YDSXGR_WORKSIZE, 0);
2057 ctrl = snd_ymfpci_readw(chip, YDSXGR_GLOBALCTRL);
2058 snd_ymfpci_writew(chip, YDSXGR_GLOBALCTRL, ctrl & ~0x0007);
2059 }
2060
2061 snd_ymfpci_ac3_done(chip);
2062
2063 /* Set PCI device to D3 state */
2064#if 0
2065 /* FIXME: temporarily disabled, otherwise we cannot fire up
2066 * the chip again unless reboot. ACPI bug?
2067 */
2068 pci_set_power_state(chip->pci, 3);
2069#endif
2070
2071#ifdef CONFIG_PM
2072 vfree(chip->saved_regs);
2073#endif
2074 if (chip->mpu_res) {
2075 release_resource(chip->mpu_res);
2076 kfree_nocheck(chip->mpu_res);
2077 }
2078 if (chip->fm_res) {
2079 release_resource(chip->fm_res);
2080 kfree_nocheck(chip->fm_res);
2081 }
2082 snd_ymfpci_free_gameport(chip);
2083 if (chip->reg_area_virt)
2084 iounmap(chip->reg_area_virt);
2085 if (chip->work_ptr.area)
2086 snd_dma_free_pages(&chip->work_ptr);
2087
2088 if (chip->irq >= 0)
2089 free_irq(chip->irq, (void *)chip);
2090 if (chip->res_reg_area) {
2091 release_resource(chip->res_reg_area);
2092 kfree_nocheck(chip->res_reg_area);
2093 }
2094
2095 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
2096
2097 pci_disable_device(chip->pci);
2098 kfree(chip);
2099 return 0;
2100}
2101
2102static int snd_ymfpci_dev_free(snd_device_t *device)
2103{
2104 ymfpci_t *chip = device->device_data;
2105 return snd_ymfpci_free(chip);
2106}
2107
2108#ifdef CONFIG_PM
2109static int saved_regs_index[] = {
2110 /* spdif */
2111 YDSXGR_SPDIFOUTCTRL,
2112 YDSXGR_SPDIFOUTSTATUS,
2113 YDSXGR_SPDIFINCTRL,
2114 /* volumes */
2115 YDSXGR_PRIADCLOOPVOL,
2116 YDSXGR_NATIVEDACINVOL,
2117 YDSXGR_NATIVEDACOUTVOL,
2118 // YDSXGR_BUF441OUTVOL,
2119 YDSXGR_NATIVEADCINVOL,
2120 YDSXGR_SPDIFLOOPVOL,
2121 YDSXGR_SPDIFOUTVOL,
2122 YDSXGR_ZVOUTVOL,
2123 YDSXGR_LEGACYOUTVOL,
2124 /* address bases */
2125 YDSXGR_PLAYCTRLBASE,
2126 YDSXGR_RECCTRLBASE,
2127 YDSXGR_EFFCTRLBASE,
2128 YDSXGR_WORKBASE,
2129 /* capture set up */
2130 YDSXGR_MAPOFREC,
2131 YDSXGR_RECFORMAT,
2132 YDSXGR_RECSLOTSR,
2133 YDSXGR_ADCFORMAT,
2134 YDSXGR_ADCSLOTSR,
2135};
2136#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
2137
2138static int snd_ymfpci_suspend(snd_card_t *card, pm_message_t state)
2139{
2140 ymfpci_t *chip = card->pm_private_data;
2141 unsigned int i;
2142
2143 snd_pcm_suspend_all(chip->pcm);
2144 snd_pcm_suspend_all(chip->pcm2);
2145 snd_pcm_suspend_all(chip->pcm_spdif);
2146 snd_pcm_suspend_all(chip->pcm_4ch);
2147 snd_ac97_suspend(chip->ac97);
2148 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
2149 chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]);
2150 chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
2151 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
2152 snd_ymfpci_disable_dsp(chip);
2153 pci_disable_device(chip->pci);
2154 return 0;
2155}
2156
2157static int snd_ymfpci_resume(snd_card_t *card)
2158{
2159 ymfpci_t *chip = card->pm_private_data;
2160 unsigned int i;
2161
2162 pci_enable_device(chip->pci);
2163 pci_set_master(chip->pci);
2164 snd_ymfpci_aclink_reset(chip->pci);
2165 snd_ymfpci_codec_ready(chip, 0);
2166 snd_ymfpci_download_image(chip);
2167 udelay(100);
2168
2169 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
2170 snd_ymfpci_writel(chip, saved_regs_index[i], chip->saved_regs[i]);
2171
2172 snd_ac97_resume(chip->ac97);
2173
2174 /* start hw again */
2175 if (chip->start_count > 0) {
2176 spin_lock_irq(&chip->reg_lock);
2177 snd_ymfpci_writel(chip, YDSXGR_MODE, chip->saved_ydsxgr_mode);
2178 chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT);
2179 spin_unlock_irq(&chip->reg_lock);
2180 }
2181 return 0;
2182}
2183#endif /* CONFIG_PM */
2184
2185int __devinit snd_ymfpci_create(snd_card_t * card,
2186 struct pci_dev * pci,
2187 unsigned short old_legacy_ctrl,
2188 ymfpci_t ** rchip)
2189{
2190 ymfpci_t *chip;
2191 int err;
2192 static snd_device_ops_t ops = {
2193 .dev_free = snd_ymfpci_dev_free,
2194 };
2195
2196 *rchip = NULL;
2197
2198 /* enable PCI device */
2199 if ((err = pci_enable_device(pci)) < 0)
2200 return err;
2201
2202 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
2203 if (chip == NULL) {
2204 pci_disable_device(pci);
2205 return -ENOMEM;
2206 }
2207 chip->old_legacy_ctrl = old_legacy_ctrl;
2208 spin_lock_init(&chip->reg_lock);
2209 spin_lock_init(&chip->voice_lock);
2210 init_waitqueue_head(&chip->interrupt_sleep);
2211 atomic_set(&chip->interrupt_sleep_count, 0);
2212 chip->card = card;
2213 chip->pci = pci;
2214 chip->irq = -1;
2215 chip->device_id = pci->device;
2216 pci_read_config_byte(pci, PCI_REVISION_ID, (u8 *)&chip->rev);
2217 chip->reg_area_phys = pci_resource_start(pci, 0);
2218 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000);
2219 pci_set_master(pci);
2220
2221 if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) {
2222 snd_printk("unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
2223 snd_ymfpci_free(chip);
2224 return -EBUSY;
2225 }
2226 if (request_irq(pci->irq, snd_ymfpci_interrupt, SA_INTERRUPT|SA_SHIRQ, "YMFPCI", (void *) chip)) {
2227 snd_printk("unable to grab IRQ %d\n", pci->irq);
2228 snd_ymfpci_free(chip);
2229 return -EBUSY;
2230 }
2231 chip->irq = pci->irq;
2232
2233 snd_ymfpci_aclink_reset(pci);
2234 if (snd_ymfpci_codec_ready(chip, 0) < 0) {
2235 snd_ymfpci_free(chip);
2236 return -EIO;
2237 }
2238
2239 snd_ymfpci_download_image(chip);
2240
2241 udelay(100); /* seems we need a delay after downloading image.. */
2242
2243 if (snd_ymfpci_memalloc(chip) < 0) {
2244 snd_ymfpci_free(chip);
2245 return -EIO;
2246 }
2247
2248 if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
2249 snd_ymfpci_free(chip);
2250 return err;
2251 }
2252
2253#ifdef CONFIG_PM
2254 chip->saved_regs = vmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32));
2255 if (chip->saved_regs == NULL) {
2256 snd_ymfpci_free(chip);
2257 return -ENOMEM;
2258 }
2259 snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
2260#endif
2261
2262 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
2263 snd_ymfpci_free(chip);
2264 return err;
2265 }
2266
2267 snd_ymfpci_proc_init(card, chip);
2268
2269 snd_card_set_dev(card, &pci->dev);
2270
2271 *rchip = chip;
2272 return 0;
2273}