1 #! /bin/sh 2 # 3 # Turtle Beach MultiSound Driver Notes 4 # -- Andrew Veliath <andrewtv@usa.net> 5 # 6 # Last update: September 7 # Corresponding msnd driver: 0.8.3 8 # 9 # ** This file is a README (top part) and shel 10 # The corresponding archived utility source 11 # running `sh MultiSound' (the utilities ar 12 # Pinnacle and Fiji cards). ** 13 # 14 # 15 # -=-=- Getting Firmware -=-=- 16 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 # 18 # See the section `Obtaining and Creating Fir 19 # document for instructions on obtaining the 20 # files. 21 # 22 # 23 # Supported Features 24 # ~~~~~~~~~~~~~~~~~~ 25 # 26 # Currently, full-duplex digital audio (/dev/ 27 # not currently available) and mixer function 28 # supported (memory mapped digital audio is n 29 # Digital transfers and monitoring can be don 30 # the digital daughterboard (see the section 31 # for more information). 32 # 33 # Support for the Turtle Beach MultiSound Hur 34 # composed of the following modules (these ca 35 # into the kernel): 36 # 37 # snd-msnd-lib - MultiSound base (r 38 # 39 # snd-msnd-classic - Base audio/mixer s 40 # Tahiti cards 41 # 42 # snd-msnd-pinnacle - Base audio/mixer s 43 # 44 # 45 # Important Notes - Read Before Using 46 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 47 # 48 # The firmware files are not included (may ch 49 # must obtain these images from Turtle Beach 50 # the MultiSound Development Kits), and place 51 # example, and give the full paths in the Lin 52 # you are compiling in support for the MultiS 53 # using it as a module, these firmware files 54 # during kernel compilation. 55 # 56 # Please note these files must be binary file 57 # the section later in this document for inst 58 # files. 59 # 60 # 61 # Configuring Card Resources 62 # ~~~~~~~~~~~~~~~~~~~~~~~~~~ 63 # 64 # ** This section is very important, as your 65 # or your machine may crash if you do not 66 # 67 # * Classic/Monterey/Tahiti 68 # 69 # These cards are configured through the driv 70 # know the io port, then the driver will sele 71 # on the card. It is up to you to know if th 72 # a conflict can lock the machine up. 73 # 74 # * Pinnacle/Fiji 75 # 76 # The Pinnacle and Fiji cards have an extra c 77 # 0x250, 0x260 or 0x270. This port can be di 78 # configured strictly through PnP, however yo 79 # access the IDE controller and joystick devi 80 # using PnP. The included pinnaclecfg progra 81 # can be used to configure the card in non-Pn 82 # you can use isapnptools. These are describ 83 # 84 # pinnaclecfg is not required; you can use th 85 # to fully configure the card as well. Howev 86 # used to change the resource values of a par 87 # snd-msnd-pinnacle module has been loaded. 88 # driver into the kernel, you must set these 89 # time, however other peripheral resource val 90 # the pinnaclecfg program after the kernel is 91 # 92 # 93 # *** PnP mode 94 # 95 # Use pnpdump to obtain a sample configuratio 96 # to obtain one with the command `pnpdump 1 0 97 # for you (running pnpdump by itself did not 98 # edit this file and use isapnp to uncomment 99 # Use these values when inserting the snd-msn 100 # this method, you can set the resources for 101 # synth (Pinnacle). Since Linux does not dir 102 # devices, you may have difficulty when using 103 # when it the driver is compiled into the ker 104 # is preferable in this case. 105 # 106 # Here is an example mypinnacle.conf for isap 107 # io base 0x210, irq 5 and mem 0xd8000, and a 108 # synth to 0x330 and irq 9 (may need editing 109 # 110 # (READPORT 0x0203) 111 # (CSN 2) 112 # (IDENTIFY *) 113 # 114 # # DSP 115 # (CONFIGURE BVJ0440/-1 (LD 0 116 # (INT 0 (IRQ 5 (MODE +E))) (IO 0 (BA 117 # (ACT Y))) 118 # 119 # # Kurzweil Synth (Pinnacle Only) 120 # (CONFIGURE BVJ0440/-1 (LD 1 121 # (IO 0 (BASE 0x0330)) (INT 0 (IRQ 9 122 # (ACT Y))) 123 # 124 # (WAITFORKEY) 125 # 126 # 127 # *** Non-PnP mode 128 # 129 # The second way is by running the card in no 130 # actually has some advantages in that you ca 131 # devices on the card, such as the joystick a 132 # configure the card, unpack this shell archi 133 # pinnaclecfg program. Using this program, y 134 # resource values to the card's devices, or d 135 # an alternative to using pinnaclecfg, you ca 136 # configuration values when loading the snd-m 137 # during kernel configuration when compiling 138 # kernel). 139 # 140 # If you specify cfg=0x250 for the snd-msnd-p 141 # automatically configure the card to the giv 142 # values using that config port (the config p 143 # on the card to 0x250, 0x260 or 0x270). 144 # 145 # See the `snd-msnd-pinnacle Additional Optio 146 # information on these parameters (also, if y 147 # directly into the kernel, these extra param 148 # here). 149 # 150 # 151 # ** It is very easy to cause problems in your 152 # resource value which is incorrect. ** 153 # 154 # 155 # Examples 156 # ~~~~~~~~ 157 # 158 # * MultiSound Classic/Monterey/Tahiti: 159 # 160 # modprobe snd 161 # insmod snd-msnd-lib 162 # insmod snd-msnd-classic io=0x290 irq=7 mem= 163 # 164 # * MultiSound Pinnacle in PnP mode: 165 # 166 # modprobe snd 167 # insmod snd-msnd-lib 168 # isapnp mypinnacle.conf 169 # insmod snd-msnd-pinnacle io=0x210 irq=5 mem 170 # 171 # * MultiSound Pinnacle in non-PnP mode (repl 172 # one of 0x250, 0x260 or 0x270): 173 # 174 # modprobe snd 175 # insmod snd-msnd-lib 176 # insmod snd-msnd-pinnacle cfg=0x250 io=0x290 177 # 178 # * To use the MPU-compatible Kurzweil synth o 179 # mode, add the following (assumes you did ` 180 # 181 # insmod snd 182 # insmod mpu401 io=0x330 irq=9 183 # 184 # * To use the MPU-compatible Kurzweil synth o 185 # mode, add the following. Note how we firs 186 # resources, _then_ install a Linux driver f 187 # 188 # insmod snd 189 # pinnaclecfg 0x250 mpu 0x330 9 190 # insmod mpu401 io=0x330 irq=9 191 # 192 # -- OR you can use the following sequence wi 193 # 194 # modprobe snd 195 # insmod snd-msnd-lib 196 # insmod snd-msnd-pinnacle cfg=0x250 io=0x290 197 # insmod snd 198 # insmod mpu401 io=0x330 irq=9 199 # 200 # * To setup the joystick port on the Pinnacle 201 # you have to find the actual Linux joystick 202 # can use pinnaclecfg: 203 # 204 # pinnaclecfg 0x250 joystick 0x200 205 # 206 # -- OR you can configure this using snd-msnd 207 # 208 # modprobe snd 209 # insmod snd-msnd-lib 210 # insmod snd-msnd-pinnacle cfg=0x250 io=0x290 211 # 212 # 213 # snd-msnd-classic, snd-msnd-pinnacle Require 214 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 # 216 # If the following options are not given, the 217 # Examine the kernel message log for informat 218 # WARNING--probing isn't supported so try to 219 # correct shared memory area, otherwise you m 220 # 221 # io I/O base of DSP, e.g. 222 # irq IRQ number, e.g. irq=5 223 # mem Shared memory area, e. 224 # 225 # 226 # snd-msnd-classic, snd-msnd-pinnacle Additio 227 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 # 229 # fifosize The digital audio FIFO 230 # specified, the default 231 # this value will reduce 232 # underflow at the expen 233 # latency. For example, 234 # allocate 512kB read an 235 # While this may reduce 236 # load will undoubtedly 237 # and you will eventuall 238 # option is to alter the 239 # the playback process, 240 # of POSIX soft real-tim 241 # 242 # calibrate_signal Setting this to one ca 243 # signal, zero calibrate 244 # to zero). 245 # 246 # 247 # snd-msnd-pinnacle Additional Options 248 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 # 250 # digital Specify digital=1 to e 251 # if you have the digita 252 # adapter. This will ena 253 # DIGITAL1 input for the 254 # Some mixer programs mi 255 # the DIGITAL1 source as 256 # trouble, you can try t 257 # at the bottom of this 258 # 259 # cfg Non-PnP configuration 260 # and Fiji (typically 0x 261 # depending on the jumpe 262 # this option is omitted 263 # that the card is in Pn 264 # specified DSP resource 265 # configured with PnP (i 266 # do any sort of configu 267 # 268 # When the Pinnacle is in non-PnP mode, you c 269 # options to configure particular devices. I 270 # for a device is not given, then the device 271 # that you still must use a Linux driver for 272 # once their resources are setup (such as the 273 # or the MPU401 driver from OSS for the Kurzw 274 # 275 # mpu_io I/O port of MPU (on-bo 276 # mpu_irq IRQ of MPU (on-board K 277 # ide_io0 First I/O port of IDE 278 # ide_io1 Second I/O port of IDE 279 # ide_irq IRQ IDE controller 280 # joystick_io I/O port of joystick 281 # 282 # 283 # Obtaining and Creating Firmware Files 284 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 # 286 # For the Classic/Tahiti/Monterey 287 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 # 289 # Download to /tmp and unzip the following fi 290 # 291 # ftp://ftp.voyetra.com/pub/tbs/msndcl/m 292 # 293 # When unzipped, unzip the file named MsndFil 294 # following firmware files to /etc/sound (not 295 # 296 # cp DSPCODE/MSNDINIT.BIN /etc/sound/msndin 297 # cp DSPCODE/MSNDPERM.REB /etc/sound/msndpe 298 # 299 # When configuring the Linux kernel, specify 300 # /etc/sound/msndperm.bin for the two firmwar 301 # versions older than 2.2 do not ask for firm 302 # hardcoded to /etc/sound). 303 # 304 # If you are compiling the driver into the ke 305 # be accessible during compilation, but will 306 # The files must remain, however, if the driv 307 # 308 # 309 # For the Pinnacle/Fiji 310 # ~~~~~~~~~~~~~~~~~~~~~ 311 # 312 # Download to /tmp and unzip the following fi 313 # sure to use the entire URL; some have had t 314 # URL): 315 # 316 # ftp://ftp.voyetra.com/pub/tbs/pinn/pnd 317 # 318 # Unpack this shell archive, and run make in 319 # (you need a C compiler and flex to build th 320 # should give you the executables conv, pinna 321 # conv is only used temporarily here to creat 322 # while pinnaclecfg is used to configure the 323 # non-PnP mode, and setdigital can be used to 324 # the mixer (pinnaclecfg and setdigital shoul 325 # convenient place, possibly run during syste 326 # 327 # To generating the firmware files with the ` 328 # the binary firmware files by doing the foll 329 # (assuming the archive unpacked into a direc 330 # 331 # ./conv < PINNDDK/dspcode/pndspini.asm > / 332 # ./conv < PINNDDK/dspcode/pndsperm.asm > / 333 # 334 # The conv (and conv.l) program is not needed 335 # be safely deleted. Then, when configuring 336 # /etc/sound/pndspini.bin and /etc/sound/pnds 337 # firmware files (Linux kernel versions older 338 # firmware paths, and are hardcoded to /etc/s 339 # 340 # If you are compiling the driver into the ke 341 # be accessible during compilation, but will 342 # The files must remain, however, if the driv 343 # 344 # 345 # Using Digital I/O with the S/PDIF Port 346 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 347 # 348 # If you have a Pinnacle or Fiji with the dig 349 # want to set it as the input source, you can 350 # have trouble trying to do it with a mixer p 351 # insert the module with the digital=1 option 352 # during compiled-in kernel operation). Upon 353 # port, you should be able monitor and record 354 # 355 # There is something to note about using the 356 # timing is taken from the digital signal, so 357 # connected to the port and it is selected as 358 # will find PCM playback to be distorted in p 359 # attempting to record at a sampling rate oth 360 # be problematic (i.e. trying to record at 80 361 # is 44100Hz). If you have a problem with th 362 # input to analog if you need to record at a 363 # the DAT rate. 364 # 365 # 366 # -- Shell archive attached below, just run ` 367 # Contains Pinnacle/Fiji utilities to conv 368 # in non-PnP mode, and select the DIGITAL1 369 # 370 # 371 #!/bin/sh 372 # This is a shell archive (produced by GNU sha 373 # To extract the files from this archive, save 374 # everything before the `!/bin/sh' line above, 375 # 376 # Made on 1998-12-04 10:07 EST by <andrewtv@ztr 377 # Source directory was `/home/andrewtv/program 378 # 379 # Existing files will *not* be overwritten unl 380 # 381 # This shar contains: 382 # length mode name 383 # ------ ---------- -------------------------- 384 # 2064 -rw-rw-r-- MultiSound.d/setdigital.c 385 # 10224 -rw-rw-r-- MultiSound.d/pinnaclecfg.c 386 # 106 -rw-rw-r-- MultiSound.d/Makefile 387 # 146 -rw-rw-r-- MultiSound.d/conv.l 388 # 1491 -rw-rw-r-- MultiSound.d/msndreset.c 389 # 390 save_IFS="${IFS}" 391 IFS="${IFS}:" 392 gettext_dir=FAILED 393 locale_dir=FAILED 394 first_param="$1" 395 for dir in $PATH 396 do 397 if test "$gettext_dir" = FAILED && test -f $ 398 && ($dir/gettext --version >/dev/null 2>& 399 then 400 set `$dir/gettext --version 2>&1` 401 if test "$3" = GNU 402 then 403 gettext_dir=$dir 404 fi 405 fi 406 if test "$locale_dir" = FAILED && test -f $d 407 && ($dir/shar --print-text-domain-dir >/d 408 then 409 locale_dir=`$dir/shar --print-text-domain- 410 fi 411 done 412 IFS="$save_IFS" 413 if test "$locale_dir" = FAILED || test "$gette 414 then 415 echo=echo 416 else 417 TEXTDOMAINDIR=$locale_dir 418 export TEXTDOMAINDIR 419 TEXTDOMAIN=sharutils 420 export TEXTDOMAIN 421 echo="$gettext_dir/gettext -s" 422 fi 423 touch -am 1231235999 $$.touch >/dev/null 2>&1 424 if test ! -f 1231235999 && test -f $$.touch; t 425 shar_touch=touch 426 else 427 shar_touch=: 428 echo 429 $echo 'WARNING: not restoring timestamps. C 430 $echo "installing GNU \`touch', distributed 431 echo 432 fi 433 rm -f 1231235999 $$.touch 434 # 435 if mkdir _sh01426; then 436 $echo 'x -' 'creating lock directory' 437 else 438 $echo 'failed to create lock directory' 439 exit 1 440 fi 441 # ============= MultiSound.d/setdigital.c ==== 442 if test ! -d 'MultiSound.d'; then 443 $echo 'x -' 'creating directory' 'MultiSound 444 mkdir 'MultiSound.d' 445 fi 446 if test -f 'MultiSound.d/setdigital.c' && test 447 $echo 'x -' SKIPPING 'MultiSound.d/setdigita 448 else 449 $echo 'x -' extracting 'MultiSound.d/setdigi 450 sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/s 451 /********************************************* 452 X * 453 X * setdigital.c - sets the DIGITAL1 input for 454 X * 455 X * Copyright (C) 1998 Andrew Veliath 456 X * 457 X * This program is free software; you can red 458 X * it under the terms of the GNU General Publ 459 X * the Free Software Foundation; either versi 460 X * (at your option) any later version. 461 X * 462 X * This program is distributed in the hope th 463 X * but WITHOUT ANY WARRANTY; without even the 464 X * MERCHANTABILITY or FITNESS FOR A PARTICULA 465 X * GNU General Public License for more detail 466 X * 467 X * You should have received a copy of the GNU 468 X * along with this program; if not, write to 469 X * Foundation, Inc., 675 Mass Ave, Cambridge, 470 X * 471 X ******************************************** 472 X 473 #include <stdio.h> 474 #include <stdlib.h> 475 #include <unistd.h> 476 #include <fcntl.h> 477 #include <sys/types.h> 478 #include <sys/stat.h> 479 #include <sys/ioctl.h> 480 #include <sys/soundcard.h> 481 X 482 int main(int argc, char *argv[]) 483 { 484 X int fd; 485 X unsigned long recmask, recsrc; 486 X 487 X if (argc != 2) { 488 X fprintf(stderr, "usage: setdig 489 X exit(1); 490 X } 491 X 492 X if ((fd = open(argv[1], O_RDWR)) < 0) 493 X perror(argv[1]); 494 X exit(1); 495 X } 496 X 497 X if (ioctl(fd, SOUND_MIXER_READ_RECMASK 498 X fprintf(stderr, "error: ioctl 499 X perror("ioctl"); 500 X close(fd); 501 X exit(1); 502 X } 503 X 504 X if (!(recmask & SOUND_MASK_DIGITAL1)) 505 X fprintf(stderr, "error: cannot 506 X close(fd); 507 X exit(1); 508 X } 509 X 510 X if (ioctl(fd, SOUND_MIXER_READ_RECSRC, 511 X fprintf(stderr, "error: ioctl 512 X perror("ioctl"); 513 X close(fd); 514 X exit(1); 515 X } 516 X 517 X recsrc |= SOUND_MASK_DIGITAL1; 518 X 519 X if (ioctl(fd, SOUND_MIXER_WRITE_RECSRC 520 X fprintf(stderr, "error: ioctl 521 X perror("ioctl"); 522 X close(fd); 523 X exit(1); 524 X } 525 X 526 X close(fd); 527 X 528 X return 0; 529 } 530 SHAR_EOF 531 $shar_touch -am 1204092598 'MultiSound.d/set 532 chmod 0664 'MultiSound.d/setdigital.c' || 533 $echo 'restore of' 'MultiSound.d/setdigital. 534 if ( md5sum --help 2>&1 | grep 'sage: md5sum 535 && ( md5sum --version 2>&1 | grep -v 'textut 536 md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 537 || $echo 'MultiSound.d/setdigital.c:' 'MD5 538 e87217fc3e71288102ba41fd81f71ec4 MultiSound.d 539 SHAR_EOF 540 else 541 shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c 542 test 2064 -eq "$shar_count" || 543 $echo 'MultiSound.d/setdigital.c:' 'origin 544 fi 545 fi 546 # ============= MultiSound.d/pinnaclecfg.c === 547 if test -f 'MultiSound.d/pinnaclecfg.c' && tes 548 $echo 'x -' SKIPPING 'MultiSound.d/pinnaclec 549 else 550 $echo 'x -' extracting 'MultiSound.d/pinnacl 551 sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/p 552 /********************************************* 553 X * 554 X * pinnaclecfg.c - Pinnacle/Fiji Device Confi 555 X * 556 X * This is for NON-PnP mode only. For PnP mo 557 X * 558 X * This is Linux-specific, and must be run wi 559 X * 560 X * Part of the Turtle Beach MultiSound Sound 561 X * 562 X * Copyright (C) 1998 Andrew Veliath 563 X * 564 X * This program is free software; you can red 565 X * it under the terms of the GNU General Publ 566 X * the Free Software Foundation; either versi 567 X * (at your option) any later version. 568 X * 569 X * This program is distributed in the hope th 570 X * but WITHOUT ANY WARRANTY; without even the 571 X * MERCHANTABILITY or FITNESS FOR A PARTICULA 572 X * GNU General Public License for more detail 573 X * 574 X * You should have received a copy of the GNU 575 X * along with this program; if not, write to 576 X * Foundation, Inc., 675 Mass Ave, Cambridge, 577 X * 578 X ******************************************** 579 X 580 #include <stdio.h> 581 #include <stdlib.h> 582 #include <string.h> 583 #include <errno.h> 584 #include <unistd.h> 585 #include <asm/types.h> 586 #include <sys/io.h> 587 X 588 #define IREG_LOGDEVICE 0x07 589 #define IREG_ACTIVATE 0x30 590 #define LD_ACTIVATE 0x01 591 #define LD_DISACTIVATE 0x00 592 #define IREG_EECONTROL 0x3F 593 #define IREG_MEMBASEHI 0x40 594 #define IREG_MEMBASELO 0x41 595 #define IREG_MEMCONTROL 0x42 596 #define IREG_MEMRANGEHI 0x43 597 #define IREG_MEMRANGELO 0x44 598 #define MEMTYPE_8BIT 0x00 599 #define MEMTYPE_16BIT 0x02 600 #define MEMTYPE_RANGE 0x00 601 #define MEMTYPE_HIADDR 0x01 602 #define IREG_IO0_BASEHI 0x60 603 #define IREG_IO0_BASELO 0x61 604 #define IREG_IO1_BASEHI 0x62 605 #define IREG_IO1_BASELO 0x63 606 #define IREG_IRQ_NUMBER 0x70 607 #define IREG_IRQ_TYPE 0x71 608 #define IRQTYPE_HIGH 0x02 609 #define IRQTYPE_LOW 0x00 610 #define IRQTYPE_LEVEL 0x01 611 #define IRQTYPE_EDGE 0x00 612 X 613 #define HIBYTE(w) ((BYTE)(((WORD 614 #define LOBYTE(w) ((BYTE)(w)) 615 #define MAKEWORD(low,hi) ((WORD)(((BYTE 616 X 617 typedef __u8 BYTE; 618 typedef __u16 USHORT; 619 typedef __u16 WORD; 620 X 621 static int config_port = -1; 622 X 623 static int msnd_write_cfg(int cfg, int reg, in 624 { 625 X outb(reg, cfg); 626 X outb(value, cfg + 1); 627 X if (value != inb(cfg + 1)) { 628 X fprintf(stderr, "error: msnd_w 629 X return -EIO; 630 X } 631 X return 0; 632 } 633 X 634 static int msnd_read_cfg(int cfg, int reg) 635 { 636 X outb(reg, cfg); 637 X return inb(cfg + 1); 638 } 639 X 640 static int msnd_write_cfg_io0(int cfg, int num 641 { 642 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 643 X return -EIO; 644 X if (msnd_write_cfg(cfg, IREG_IO0_BASEH 645 X return -EIO; 646 X if (msnd_write_cfg(cfg, IREG_IO0_BASEL 647 X return -EIO; 648 X return 0; 649 } 650 X 651 static int msnd_read_cfg_io0(int cfg, int num, 652 { 653 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 654 X return -EIO; 655 X 656 X *io = MAKEWORD(msnd_read_cfg(cfg, IREG 657 X msnd_read_cfg(cfg, IREG 658 X 659 X return 0; 660 } 661 X 662 static int msnd_write_cfg_io1(int cfg, int num 663 { 664 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 665 X return -EIO; 666 X if (msnd_write_cfg(cfg, IREG_IO1_BASEH 667 X return -EIO; 668 X if (msnd_write_cfg(cfg, IREG_IO1_BASEL 669 X return -EIO; 670 X return 0; 671 } 672 X 673 static int msnd_read_cfg_io1(int cfg, int num, 674 { 675 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 676 X return -EIO; 677 X 678 X *io = MAKEWORD(msnd_read_cfg(cfg, IREG 679 X msnd_read_cfg(cfg, IREG 680 X 681 X return 0; 682 } 683 X 684 static int msnd_write_cfg_irq(int cfg, int num 685 { 686 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 687 X return -EIO; 688 X if (msnd_write_cfg(cfg, IREG_IRQ_NUMBE 689 X return -EIO; 690 X if (msnd_write_cfg(cfg, IREG_IRQ_TYPE, 691 X return -EIO; 692 X return 0; 693 } 694 X 695 static int msnd_read_cfg_irq(int cfg, int num, 696 { 697 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 698 X return -EIO; 699 X 700 X *irq = msnd_read_cfg(cfg, IREG_IRQ_NUM 701 X 702 X return 0; 703 } 704 X 705 static int msnd_write_cfg_mem(int cfg, int num 706 { 707 X WORD wmem; 708 X 709 X mem >>= 8; 710 X mem &= 0xfff; 711 X wmem = (WORD)mem; 712 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 713 X return -EIO; 714 X if (msnd_write_cfg(cfg, IREG_MEMBASEHI 715 X return -EIO; 716 X if (msnd_write_cfg(cfg, IREG_MEMBASELO 717 X return -EIO; 718 X if (wmem && msnd_write_cfg(cfg, IREG_M 719 X return -EIO; 720 X return 0; 721 } 722 X 723 static int msnd_read_cfg_mem(int cfg, int num, 724 { 725 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 726 X return -EIO; 727 X 728 X *mem = MAKEWORD(msnd_read_cfg(cfg, IRE 729 X msnd_read_cfg(cfg, IRE 730 X *mem <<= 8; 731 X 732 X return 0; 733 } 734 X 735 static int msnd_activate_logical(int cfg, int 736 { 737 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 738 X return -EIO; 739 X if (msnd_write_cfg(cfg, IREG_ACTIVATE, 740 X return -EIO; 741 X return 0; 742 } 743 X 744 static int msnd_write_cfg_logical(int cfg, int 745 { 746 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 747 X return -EIO; 748 X if (msnd_write_cfg_io0(cfg, num, io0)) 749 X return -EIO; 750 X if (msnd_write_cfg_io1(cfg, num, io1)) 751 X return -EIO; 752 X if (msnd_write_cfg_irq(cfg, num, irq)) 753 X return -EIO; 754 X if (msnd_write_cfg_mem(cfg, num, mem)) 755 X return -EIO; 756 X if (msnd_activate_logical(cfg, num)) 757 X return -EIO; 758 X return 0; 759 } 760 X 761 static int msnd_read_cfg_logical(int cfg, int 762 { 763 X if (msnd_write_cfg(cfg, IREG_LOGDEVICE 764 X return -EIO; 765 X if (msnd_read_cfg_io0(cfg, num, io0)) 766 X return -EIO; 767 X if (msnd_read_cfg_io1(cfg, num, io1)) 768 X return -EIO; 769 X if (msnd_read_cfg_irq(cfg, num, irq)) 770 X return -EIO; 771 X if (msnd_read_cfg_mem(cfg, num, mem)) 772 X return -EIO; 773 X return 0; 774 } 775 X 776 static void usage(void) 777 { 778 X fprintf(stderr, 779 X "\n" 780 X "pinnaclecfg 1.0\n" 781 X "\n" 782 X "usage: pinnaclecfg <config po 783 X "\n" 784 X "This is for use with the card 785 X "\n" 786 X "Available devices (not all av 787 X "\n" 788 X " Device 789 X " --------------------- 790 X " reset 791 X " show 792 X "\n" 793 X " dsp <io> <irq> <mem> 794 X " mpu <io> <irq> 795 X " ide <io0> <io1> <irq> 796 X " joystick <io> 797 X "\n"); 798 X exit(1); 799 } 800 X 801 static int cfg_reset(void) 802 { 803 X int i; 804 X 805 X for (i = 0; i < 4; ++i) 806 X msnd_write_cfg_logical(config_ 807 X 808 X return 0; 809 } 810 X 811 static int cfg_show(void) 812 { 813 X int i; 814 X int count = 0; 815 X 816 X for (i = 0; i < 4; ++i) { 817 X WORD io0, io1, irq; 818 X int mem; 819 X msnd_read_cfg_logical(config_p 820 X switch (i) { 821 X case 0: 822 X if (io0 || irq || mem) 823 X printf("dsp 0x 824 X ++count; 825 X } 826 X break; 827 X case 1: 828 X if (io0 || irq) { 829 X printf("mpu 0x 830 X ++count; 831 X } 832 X break; 833 X case 2: 834 X if (io0 || io1 || irq) 835 X printf("ide 0x 836 X ++count; 837 X } 838 X break; 839 X case 3: 840 X if (io0) { 841 X printf("joysti 842 X ++count; 843 X } 844 X break; 845 X } 846 X } 847 X 848 X if (count == 0) 849 X fprintf(stderr, "no devices co 850 X 851 X return 0; 852 } 853 X 854 static int cfg_dsp(int argc, char *argv[]) 855 { 856 X int io, irq, mem; 857 X 858 X if (argc < 3 || 859 X sscanf(argv[0], "0x%x", &io) != 1 860 X sscanf(argv[1], "%d", &irq) != 1 | 861 X sscanf(argv[2], "0x%x", &mem) != 1 862 X usage(); 863 X 864 X if (!(io == 0x290 || 865 X io == 0x260 || 866 X io == 0x250 || 867 X io == 0x240 || 868 X io == 0x230 || 869 X io == 0x220 || 870 X io == 0x210 || 871 X io == 0x3e0)) { 872 X fprintf(stderr, "error: io mus 873 X "210, 220, 230, 240, 2 874 X usage(); 875 X } 876 X 877 X if (!(irq == 5 || 878 X irq == 7 || 879 X irq == 9 || 880 X irq == 10 || 881 X irq == 11 || 882 X irq == 12)) { 883 X fprintf(stderr, "error: irq mu 884 X "5, 7, 9, 10, 11 or 12 885 X usage(); 886 X } 887 X 888 X if (!(mem == 0xb0000 || 889 X mem == 0xc8000 || 890 X mem == 0xd0000 || 891 X mem == 0xd8000 || 892 X mem == 0xe0000 || 893 X mem == 0xe8000)) { 894 X fprintf(stderr, "error: mem mu 895 X "0xb0000, 0xc8000, 0xd 896 X usage(); 897 X } 898 X 899 X return msnd_write_cfg_logical(config_p 900 } 901 X 902 static int cfg_mpu(int argc, char *argv[]) 903 { 904 X int io, irq; 905 X 906 X if (argc < 2 || 907 X sscanf(argv[0], "0x%x", &io) != 1 908 X sscanf(argv[1], "%d", &irq) != 1) 909 X usage(); 910 X 911 X return msnd_write_cfg_logical(config_p 912 } 913 X 914 static int cfg_ide(int argc, char *argv[]) 915 { 916 X int io0, io1, irq; 917 X 918 X if (argc < 3 || 919 X sscanf(argv[0], "0x%x", &io0) != 1 920 X sscanf(argv[0], "0x%x", &io1) != 1 921 X sscanf(argv[1], "%d", &irq) != 1) 922 X usage(); 923 X 924 X return msnd_write_cfg_logical(config_p 925 } 926 X 927 static int cfg_joystick(int argc, char *argv[] 928 { 929 X int io; 930 X 931 X if (argc < 1 || 932 X sscanf(argv[0], "0x%x", &io) != 1) 933 X usage(); 934 X 935 X return msnd_write_cfg_logical(config_p 936 } 937 X 938 int main(int argc, char *argv[]) 939 { 940 X char *device; 941 X int rv = 0; 942 X 943 X --argc; ++argv; 944 X 945 X if (argc < 2) 946 X usage(); 947 X 948 X sscanf(argv[0], "0x%x", &config_port); 949 X if (config_port != 0x250 && config_por 950 X fprintf(stderr, "error: <confi 951 X exit(1); 952 X } 953 X if (ioperm(config_port, 2, 1)) { 954 X perror("ioperm"); 955 X fprintf(stderr, "note: pinnacl 956 X exit(1); 957 X } 958 X device = argv[1]; 959 X 960 X argc -= 2; argv += 2; 961 X 962 X if (strcmp(device, "reset") == 0) 963 X rv = cfg_reset(); 964 X else if (strcmp(device, "show") == 0) 965 X rv = cfg_show(); 966 X else if (strcmp(device, "dsp") == 0) 967 X rv = cfg_dsp(argc, argv); 968 X else if (strcmp(device, "mpu") == 0) 969 X rv = cfg_mpu(argc, argv); 970 X else if (strcmp(device, "ide") == 0) 971 X rv = cfg_ide(argc, argv); 972 X else if (strcmp(device, "joystick") == 973 X rv = cfg_joystick(argc, argv); 974 X else { 975 X fprintf(stderr, "error: unknow 976 X usage(); 977 X } 978 X 979 X if (rv) 980 X fprintf(stderr, "error: device 981 X 982 X return 0; 983 } 984 SHAR_EOF 985 $shar_touch -am 1204092598 'MultiSound.d/pin 986 chmod 0664 'MultiSound.d/pinnaclecfg.c' || 987 $echo 'restore of' 'MultiSound.d/pinnaclecfg 988 if ( md5sum --help 2>&1 | grep 'sage: md5sum 989 && ( md5sum --version 2>&1 | grep -v 'textut 990 md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 991 || $echo 'MultiSound.d/pinnaclecfg.c:' 'MD 992 366bdf27f0db767a3c7921d0a6db20fe MultiSound.d 993 SHAR_EOF 994 else 995 shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c 996 test 10224 -eq "$shar_count" || 997 $echo 'MultiSound.d/pinnaclecfg.c:' 'origi 998 fi 999 fi 1000 # ============= MultiSound.d/Makefile ======= 1001 if test -f 'MultiSound.d/Makefile' && test "$ 1002 $echo 'x -' SKIPPING 'MultiSound.d/Makefile 1003 else 1004 $echo 'x -' extracting 'MultiSound.d/Makefi 1005 sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/ 1006 CC = gcc 1007 CFLAGS = -O 1008 PROGS = setdigital msndreset pinnaclecfg co 1009 X 1010 all: $(PROGS) 1011 X 1012 clean: 1013 X rm -f $(PROGS) 1014 SHAR_EOF 1015 $shar_touch -am 1204092398 'MultiSound.d/Ma 1016 chmod 0664 'MultiSound.d/Makefile' || 1017 $echo 'restore of' 'MultiSound.d/Makefile' 1018 if ( md5sum --help 2>&1 | grep 'sage: md5su 1019 && ( md5sum --version 2>&1 | grep -v 'textu 1020 md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 1021 || $echo 'MultiSound.d/Makefile:' 'MD5 ch 1022 76ca8bb44e3882edcf79c97df6c81845 MultiSound. 1023 SHAR_EOF 1024 else 1025 shar_count="`LC_ALL= LC_CTYPE= LANG= wc - 1026 test 106 -eq "$shar_count" || 1027 $echo 'MultiSound.d/Makefile:' 'original 1028 fi 1029 fi 1030 # ============= MultiSound.d/conv.l ========= 1031 if test -f 'MultiSound.d/conv.l' && test "$fi 1032 $echo 'x -' SKIPPING 'MultiSound.d/conv.l' 1033 else 1034 $echo 'x -' extracting 'MultiSound.d/conv.l 1035 sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/ 1036 %% 1037 [ \n\t,\r] 1038 \;.* 1039 DB 1040 [0-9A-Fa-f]+H { int n; sscanf(yytext, "%xH" 1041 %% 1042 int yywrap() { return 1; } 1043 void main() { yylex(); } 1044 SHAR_EOF 1045 $shar_touch -am 0828231798 'MultiSound.d/co 1046 chmod 0664 'MultiSound.d/conv.l' || 1047 $echo 'restore of' 'MultiSound.d/conv.l' 'f 1048 if ( md5sum --help 2>&1 | grep 'sage: md5su 1049 && ( md5sum --version 2>&1 | grep -v 'textu 1050 md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 1051 || $echo 'MultiSound.d/conv.l:' 'MD5 chec 1052 d2411fc32cd71a00dcdc1f009e858dd2 MultiSound. 1053 SHAR_EOF 1054 else 1055 shar_count="`LC_ALL= LC_CTYPE= LANG= wc - 1056 test 146 -eq "$shar_count" || 1057 $echo 'MultiSound.d/conv.l:' 'original si 1058 fi 1059 fi 1060 # ============= MultiSound.d/msndreset.c ==== 1061 if test -f 'MultiSound.d/msndreset.c' && test 1062 $echo 'x -' SKIPPING 'MultiSound.d/msndrese 1063 else 1064 $echo 'x -' extracting 'MultiSound.d/msndre 1065 sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/ 1066 /******************************************** 1067 X * 1068 X * msndreset.c - resets the MultiSound card 1069 X * 1070 X * Copyright (C) 1998 Andrew Veliath 1071 X * 1072 X * This program is free software; you can re 1073 X * it under the terms of the GNU General Pub 1074 X * the Free Software Foundation; either vers 1075 X * (at your option) any later version. 1076 X * 1077 X * This program is distributed in the hope t 1078 X * but WITHOUT ANY WARRANTY; without even th 1079 X * MERCHANTABILITY or FITNESS FOR A PARTICUL 1080 X * GNU General Public License for more detai 1081 X * 1082 X * You should have received a copy of the GN 1083 X * along with this program; if not, write to 1084 X * Foundation, Inc., 675 Mass Ave, Cambridge 1085 X * 1086 X ******************************************* 1087 X 1088 #include <stdio.h> 1089 #include <stdlib.h> 1090 #include <unistd.h> 1091 #include <fcntl.h> 1092 #include <sys/types.h> 1093 #include <sys/stat.h> 1094 #include <sys/ioctl.h> 1095 #include <sys/soundcard.h> 1096 X 1097 int main(int argc, char *argv[]) 1098 { 1099 X int fd; 1100 X 1101 X if (argc != 2) { 1102 X fprintf(stderr, "usage: msndr 1103 X exit(1); 1104 X } 1105 X 1106 X if ((fd = open(argv[1], O_RDWR)) < 0) 1107 X perror(argv[1]); 1108 X exit(1); 1109 X } 1110 X 1111 X if (ioctl(fd, SOUND_MIXER_PRIVATE1, 0 1112 X fprintf(stderr, "error: msnd 1113 X perror("ioctl"); 1114 X close(fd); 1115 X exit(1); 1116 X } 1117 X 1118 X close(fd); 1119 X 1120 X return 0; 1121 } 1122 SHAR_EOF 1123 $shar_touch -am 1204100698 'MultiSound.d/ms 1124 chmod 0664 'MultiSound.d/msndreset.c' || 1125 $echo 'restore of' 'MultiSound.d/msndreset. 1126 if ( md5sum --help 2>&1 | grep 'sage: md5su 1127 && ( md5sum --version 2>&1 | grep -v 'textu 1128 md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 1129 || $echo 'MultiSound.d/msndreset.c:' 'MD5 1130 c52f876521084e8eb25e12e01dcccb8a MultiSound. 1131 SHAR_EOF 1132 else 1133 shar_count="`LC_ALL= LC_CTYPE= LANG= wc - 1134 test 1491 -eq "$shar_count" || 1135 $echo 'MultiSound.d/msndreset.c:' 'origin 1136 fi 1137 fi 1138 rm -fr _sh01426 1139 exit 0
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.