Back to home page

OSCL-LXR

 
 

    


0001 #! /bin/sh
0002 #
0003 #  Turtle Beach MultiSound Driver Notes
0004 #  -- Andrew Veliath <andrewtv@usa.net>
0005 #
0006 #  Last update:                      September 10, 1998
0007 #  Corresponding msnd driver:        0.8.3
0008 #
0009 # ** This file is a README (top part) and shell archive (bottom part).
0010 #    The corresponding archived utility sources can be unpacked by
0011 #    running `sh MultiSound' (the utilities are only needed for the
0012 #    Pinnacle and Fiji cards). **
0013 #
0014 #
0015 #  -=-=- Getting Firmware -=-=-
0016 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0017 #
0018 #  See the section `Obtaining and Creating Firmware Files' in this
0019 #  document for instructions on obtaining the necessary firmware
0020 #  files.
0021 #
0022 #
0023 #  Supported Features
0024 #  ~~~~~~~~~~~~~~~~~~
0025 #
0026 #  Currently, full-duplex digital audio (/dev/dsp only, /dev/audio is
0027 #  not currently available) and mixer functionality (/dev/mixer) are
0028 #  supported (memory mapped digital audio is not yet supported).
0029 #  Digital transfers and monitoring can be done as well if you have
0030 #  the digital daughterboard (see the section on using the S/PDIF port
0031 #  for more information).
0032 #
0033 #  Support for the Turtle Beach MultiSound Hurricane architecture is
0034 #  composed of the following modules (these can also operate compiled
0035 #  into the kernel):
0036 #
0037 #  snd-msnd-lib           - MultiSound base (requires snd)
0038 #
0039 #  snd-msnd-classic       - Base audio/mixer support for Classic, Monetery and
0040 #                           Tahiti cards
0041 #
0042 #  snd-msnd-pinnacle      - Base audio/mixer support for Pinnacle and Fiji cards
0043 #
0044 #
0045 #  Important Notes - Read Before Using
0046 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0047 #
0048 #  The firmware files are not included (may change in future).  You
0049 #  must obtain these images from Turtle Beach (they are included in
0050 #  the MultiSound Development Kits), and place them in /etc/sound for
0051 #  example, and give the full paths in the Linux configuration.  If
0052 #  you are compiling in support for the MultiSound driver rather than
0053 #  using it as a module, these firmware files must be accessible
0054 #  during kernel compilation.
0055 #
0056 #  Please note these files must be binary files, not assembler.  See
0057 #  the section later in this document for instructions to obtain these
0058 #  files.
0059 #
0060 #
0061 #  Configuring Card Resources
0062 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~
0063 #
0064 #  ** This section is very important, as your card may not work at all
0065 #     or your machine may crash if you do not do this correctly. **
0066 #
0067 #  * Classic/Monterey/Tahiti
0068 #
0069 #  These cards are configured through the driver snd-msnd-classic.  You must
0070 #  know the io port, then the driver will select the irq and memory resources
0071 #  on the card.  It is up to you to know if these are free locations or now,
0072 #  a conflict can lock the machine up.
0073 #
0074 #  * Pinnacle/Fiji
0075 #
0076 #  The Pinnacle and Fiji cards have an extra config port, either
0077 #  0x250, 0x260 or 0x270.  This port can be disabled to have the card
0078 #  configured strictly through PnP, however you lose the ability to
0079 #  access the IDE controller and joystick devices on this card when
0080 #  using PnP.  The included pinnaclecfg program in this shell archive
0081 #  can be used to configure the card in non-PnP mode, and in PnP mode
0082 #  you can use isapnptools.  These are described briefly here.
0083 #
0084 #  pinnaclecfg is not required; you can use the snd-msnd-pinnacle module
0085 #  to fully configure the card as well.  However, pinnaclecfg can be
0086 #  used to change the resource values of a particular device after the
0087 #  snd-msnd-pinnacle module has been loaded.  If you are compiling the
0088 #  driver into the kernel, you must set these values during compile
0089 #  time, however other peripheral resource values can be changed with
0090 #  the pinnaclecfg program after the kernel is loaded.
0091 #
0092 #
0093 #  *** PnP mode
0094 #
0095 #  Use pnpdump to obtain a sample configuration if you can; I was able
0096 #  to obtain one with the command `pnpdump 1 0x203' -- this may vary
0097 #  for you (running pnpdump by itself did not work for me).  Then,
0098 #  edit this file and use isapnp to uncomment and set the card values.
0099 #  Use these values when inserting the snd-msnd-pinnacle module.  Using
0100 #  this method, you can set the resources for the DSP and the Kurzweil
0101 #  synth (Pinnacle).  Since Linux does not directly support PnP
0102 #  devices, you may have difficulty when using the card in PnP mode
0103 #  when it the driver is compiled into the kernel.  Using non-PnP mode
0104 #  is preferable in this case.
0105 #
0106 #  Here is an example mypinnacle.conf for isapnp that sets the card to
0107 #  io base 0x210, irq 5 and mem 0xd8000, and also sets the Kurzweil
0108 #  synth to 0x330 and irq 9 (may need editing for your system):
0109 #
0110 #  (READPORT 0x0203)
0111 #  (CSN 2)
0112 #  (IDENTIFY *)
0113 #
0114 #  # DSP
0115 #  (CONFIGURE BVJ0440/-1 (LD 0
0116 #          (INT 0 (IRQ 5 (MODE +E))) (IO 0 (BASE 0x0210)) (MEM 0 (BASE 0x0d8000))
0117 #          (ACT Y)))
0118 #
0119 #  # Kurzweil Synth (Pinnacle Only)
0120 #  (CONFIGURE BVJ0440/-1 (LD 1
0121 #          (IO 0 (BASE 0x0330)) (INT 0 (IRQ 9 (MODE +E)))
0122 #          (ACT Y)))
0123 #
0124 #  (WAITFORKEY)
0125 #
0126 #
0127 #  *** Non-PnP mode
0128 #
0129 #  The second way is by running the card in non-PnP mode.  This
0130 #  actually has some advantages in that you can access some other
0131 #  devices on the card, such as the joystick and IDE controller.  To
0132 #  configure the card, unpack this shell archive and build the
0133 #  pinnaclecfg program.  Using this program, you can assign the
0134 #  resource values to the card's devices, or disable the devices.  As
0135 #  an alternative to using pinnaclecfg, you can specify many of the
0136 #  configuration values when loading the snd-msnd-pinnacle module (or
0137 #  during kernel configuration when compiling the driver into the
0138 #  kernel).
0139 #
0140 #  If you specify cfg=0x250 for the snd-msnd-pinnacle module, it
0141 #  automatically configure the card to the given io, irq and memory
0142 #  values using that config port (the config port is jumper selectable
0143 #  on the card to 0x250, 0x260 or 0x270).
0144 #
0145 #  See the `snd-msnd-pinnacle Additional Options' section below for more
0146 #  information on these parameters (also, if you compile the driver
0147 #  directly into the kernel, these extra parameters can be useful
0148 #  here).
0149 #
0150 #
0151 # ** It is very easy to cause problems in your machine if you choose a
0152 #    resource value which is incorrect. **
0153 #
0154 #
0155 #  Examples
0156 #  ~~~~~~~~
0157 #
0158 #  * MultiSound Classic/Monterey/Tahiti:
0159 #
0160 #  modprobe snd
0161 #  insmod snd-msnd-lib
0162 #  insmod snd-msnd-classic io=0x290 irq=7 mem=0xd0000
0163 #
0164 #  * MultiSound Pinnacle in PnP mode:
0165 #
0166 #  modprobe snd
0167 #  insmod snd-msnd-lib
0168 #  isapnp mypinnacle.conf
0169 #  insmod snd-msnd-pinnacle io=0x210 irq=5 mem=0xd8000 <-- match mypinnacle.conf values
0170 #
0171 #  * MultiSound Pinnacle in non-PnP mode (replace 0x250 with your configuration port,
0172 #    one of 0x250, 0x260 or 0x270):
0173 #
0174 #  modprobe snd
0175 #  insmod snd-msnd-lib
0176 #  insmod snd-msnd-pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000
0177 #
0178 # * To use the MPU-compatible Kurzweil synth on the Pinnacle in PnP
0179 #   mode, add the following (assumes you did `isapnp mypinnacle.conf'):
0180 #
0181 #  insmod snd
0182 #  insmod mpu401 io=0x330 irq=9                    <-- match mypinnacle.conf values
0183 #
0184 # * To use the MPU-compatible Kurzweil synth on the Pinnacle in non-PnP
0185 #   mode, add the following.  Note how we first configure the peripheral's
0186 #   resources, _then_ install a Linux driver for it:
0187 #
0188 #  insmod snd
0189 #  pinnaclecfg 0x250 mpu 0x330 9
0190 #  insmod mpu401 io=0x330 irq=9
0191 #
0192 #  -- OR you can use the following sequence without pinnaclecfg in non-PnP mode:
0193 #
0194 #  modprobe snd
0195 #  insmod snd-msnd-lib
0196 #  insmod snd-msnd-pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 mpu_io=0x330 mpu_irq=9
0197 #  insmod snd
0198 #  insmod mpu401 io=0x330 irq=9
0199 #
0200 # * To setup the joystick port on the Pinnacle in non-PnP mode (though
0201 #   you have to find the actual Linux joystick driver elsewhere), you
0202 #   can use pinnaclecfg:
0203 #
0204 #   pinnaclecfg 0x250 joystick 0x200
0205 #
0206 #  -- OR you can configure this using snd-msnd-pinnacle with the following:
0207 #
0208 #  modprobe snd
0209 #  insmod snd-msnd-lib
0210 #  insmod snd-msnd-pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 joystick_io=0x200
0211 #
0212 #
0213 #  snd-msnd-classic, snd-msnd-pinnacle Required Options
0214 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0215 #
0216 #  If the following options are not given, the module will not load.
0217 #  Examine the kernel message log for informative error messages.
0218 #  WARNING--probing isn't supported so try to make sure you have the
0219 #  correct shared memory area, otherwise you may experience problems.
0220 #
0221 #  io                   I/O base of DSP, e.g. io=0x210
0222 #  irq                  IRQ number, e.g. irq=5
0223 #  mem                  Shared memory area, e.g. mem=0xd8000
0224 #
0225 #
0226 #  snd-msnd-classic, snd-msnd-pinnacle Additional Options
0227 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0228 #
0229 #  fifosize             The digital audio FIFOs, in kilobytes.  If not
0230 #                       specified, the default will be used.  Increasing
0231 #                       this value will reduce the chance of a FIFO
0232 #                       underflow at the expense of increasing overall
0233 #                       latency.  For example, fifosize=512 will
0234 #                       allocate 512kB read and write FIFOs (1MB total).
0235 #                       While this may reduce dropouts, a heavy machine
0236 #                       load will undoubtedly starve the FIFO of data
0237 #                       and you will eventually get dropouts.  One
0238 #                       option is to alter the scheduling priority of
0239 #                       the playback process, using `nice' or some form
0240 #                       of POSIX soft real-time scheduling.
0241 #
0242 #  calibrate_signal     Setting this to one calibrates the ADCs to the
0243 #                       signal, zero calibrates to the card (defaults
0244 #                       to zero).
0245 #
0246 #
0247 #  snd-msnd-pinnacle Additional Options
0248 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0249 #
0250 #  digital              Specify digital=1 to enable the S/PDIF input
0251 #                       if you have the digital daughterboard
0252 #                       adapter. This will enable access to the
0253 #                       DIGITAL1 input for the soundcard in the mixer.
0254 #                       Some mixer programs might have trouble setting
0255 #                       the DIGITAL1 source as an input.  If you have
0256 #                       trouble, you can try the setdigital.c program
0257 #                       at the bottom of this document.
0258 #
0259 #  cfg                  Non-PnP configuration port for the Pinnacle
0260 #                       and Fiji (typically 0x250, 0x260 or 0x270,
0261 #                       depending on the jumper configuration).  If
0262 #                       this option is omitted, then it is assumed
0263 #                       that the card is in PnP mode, and that the
0264 #                       specified DSP resource values are already
0265 #                       configured with PnP (i.e. it won't attempt to
0266 #                       do any sort of configuration).
0267 #
0268 #  When the Pinnacle is in non-PnP mode, you can use the following
0269 #  options to configure particular devices.  If a full specification
0270 #  for a device is not given, then the device is not configured.  Note
0271 #  that you still must use a Linux driver for any of these devices
0272 #  once their resources are setup (such as the Linux joystick driver,
0273 #  or the MPU401 driver from OSS for the Kurzweil synth).
0274 #
0275 #  mpu_io               I/O port of MPU (on-board Kurzweil synth)
0276 #  mpu_irq              IRQ of MPU (on-board Kurzweil synth)
0277 #  ide_io0              First I/O port of IDE controller
0278 #  ide_io1              Second I/O port of IDE controller
0279 #  ide_irq              IRQ IDE controller
0280 #  joystick_io          I/O port of joystick
0281 #
0282 #
0283 #  Obtaining and Creating Firmware Files
0284 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0285 #
0286 #       For the Classic/Tahiti/Monterey
0287 #       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0288 #
0289 #  Download to /tmp and unzip the following file from Turtle Beach:
0290 #
0291 #       ftp://ftp.voyetra.com/pub/tbs/msndcl/msndvkit.zip
0292 #
0293 #  When unzipped, unzip the file named MsndFiles.zip.  Then copy the
0294 #  following firmware files to /etc/sound (note the file renaming):
0295 #
0296 #    cp DSPCODE/MSNDINIT.BIN /etc/sound/msndinit.bin
0297 #    cp DSPCODE/MSNDPERM.REB /etc/sound/msndperm.bin
0298 #
0299 #  When configuring the Linux kernel, specify /etc/sound/msndinit.bin and
0300 #  /etc/sound/msndperm.bin for the two firmware files (Linux kernel
0301 #  versions older than 2.2 do not ask for firmware paths, and are
0302 #  hardcoded to /etc/sound).
0303 #
0304 #  If you are compiling the driver into the kernel, these files must
0305 #  be accessible during compilation, but will not be needed later.
0306 #  The files must remain, however, if the driver is used as a module.
0307 #
0308 #
0309 #       For the Pinnacle/Fiji
0310 #       ~~~~~~~~~~~~~~~~~~~~~
0311 #
0312 #  Download to /tmp and unzip the following file from Turtle Beach (be
0313 #  sure to use the entire URL; some have had trouble navigating to the
0314 #  URL):
0315 #
0316 #       ftp://ftp.voyetra.com/pub/tbs/pinn/pnddk100.zip
0317 #
0318 #  Unpack this shell archive, and run make in the created directory
0319 #  (you need a C compiler and flex to build the utilities).  This
0320 #  should give you the executables conv, pinnaclecfg and setdigital.
0321 #  conv is only used temporarily here to create the firmware files,
0322 #  while pinnaclecfg is used to configure the Pinnacle or Fiji card in
0323 #  non-PnP mode, and setdigital can be used to set the S/PDIF input on
0324 #  the mixer (pinnaclecfg and setdigital should be copied to a
0325 #  convenient place, possibly run during system initialization).
0326 #
0327 #  To generating the firmware files with the `conv' program, we create
0328 #  the binary firmware files by doing the following conversion
0329 #  (assuming the archive unpacked into a directory named PINNDDK):
0330 #
0331 #    ./conv < PINNDDK/dspcode/pndspini.asm > /etc/sound/pndspini.bin
0332 #    ./conv < PINNDDK/dspcode/pndsperm.asm > /etc/sound/pndsperm.bin
0333 #
0334 #  The conv (and conv.l) program is not needed after conversion and can
0335 #  be safely deleted.  Then, when configuring the Linux kernel, specify
0336 #  /etc/sound/pndspini.bin and /etc/sound/pndsperm.bin for the two
0337 #  firmware files (Linux kernel versions older than 2.2 do not ask for
0338 #  firmware paths, and are hardcoded to /etc/sound).
0339 #
0340 #  If you are compiling the driver into the kernel, these files must
0341 #  be accessible during compilation, but will not be needed later.
0342 #  The files must remain, however, if the driver is used as a module.
0343 #
0344 #
0345 #  Using Digital I/O with the S/PDIF Port
0346 #  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0347 #
0348 #  If you have a Pinnacle or Fiji with the digital daughterboard and
0349 #  want to set it as the input source, you can use this program if you
0350 #  have trouble trying to do it with a mixer program (be sure to
0351 #  insert the module with the digital=1 option, or say Y to the option
0352 #  during compiled-in kernel operation).  Upon selection of the S/PDIF
0353 #  port, you should be able monitor and record from it.
0354 #
0355 #  There is something to note about using the S/PDIF port.  Digital
0356 #  timing is taken from the digital signal, so if a signal is not
0357 #  connected to the port and it is selected as recording input, you
0358 #  will find PCM playback to be distorted in playback rate.  Also,
0359 #  attempting to record at a sampling rate other than the DAT rate may
0360 #  be problematic (i.e. trying to record at 8000Hz when the DAT signal
0361 #  is 44100Hz).  If you have a problem with this, set the recording
0362 #  input to analog if you need to record at a rate other than that of
0363 #  the DAT rate.
0364 #
0365 #
0366 #  -- Shell archive attached below, just run `sh MultiSound' to extract.
0367 #     Contains Pinnacle/Fiji utilities to convert firmware, configure
0368 #     in non-PnP mode, and select the DIGITAL1 input for the mixer.
0369 #
0370 #
0371 #!/bin/sh
0372 # This is a shell archive (produced by GNU sharutils 4.2).
0373 # To extract the files from this archive, save it to some FILE, remove
0374 # everything before the `!/bin/sh' line above, then type `sh FILE'.
0375 #
0376 # Made on 1998-12-04 10:07 EST by <andrewtv@ztransform.velsoft.com>.
0377 # Source directory was `/home/andrewtv/programming/pinnacle/pinnacle'.
0378 #
0379 # Existing files will *not* be overwritten unless `-c' is specified.
0380 #
0381 # This shar contains:
0382 # length mode       name
0383 # ------ ---------- ------------------------------------------
0384 #   2064 -rw-rw-r-- MultiSound.d/setdigital.c
0385 #  10224 -rw-rw-r-- MultiSound.d/pinnaclecfg.c
0386 #    106 -rw-rw-r-- MultiSound.d/Makefile
0387 #    146 -rw-rw-r-- MultiSound.d/conv.l
0388 #   1491 -rw-rw-r-- MultiSound.d/msndreset.c
0389 #
0390 save_IFS="${IFS}"
0391 IFS="${IFS}:"
0392 gettext_dir=FAILED
0393 locale_dir=FAILED
0394 first_param="$1"
0395 for dir in $PATH
0396 do
0397   if test "$gettext_dir" = FAILED && test -f $dir/gettext \
0398      && ($dir/gettext --version >/dev/null 2>&1)
0399   then
0400     set `$dir/gettext --version 2>&1`
0401     if test "$3" = GNU
0402     then
0403       gettext_dir=$dir
0404     fi
0405   fi
0406   if test "$locale_dir" = FAILED && test -f $dir/shar \
0407      && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
0408   then
0409     locale_dir=`$dir/shar --print-text-domain-dir`
0410   fi
0411 done
0412 IFS="$save_IFS"
0413 if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
0414 then
0415   echo=echo
0416 else
0417   TEXTDOMAINDIR=$locale_dir
0418   export TEXTDOMAINDIR
0419   TEXTDOMAIN=sharutils
0420   export TEXTDOMAIN
0421   echo="$gettext_dir/gettext -s"
0422 fi
0423 touch -am 1231235999 $$.touch >/dev/null 2>&1
0424 if test ! -f 1231235999 && test -f $$.touch; then
0425   shar_touch=touch
0426 else
0427   shar_touch=:
0428   echo
0429   $echo 'WARNING: not restoring timestamps.  Consider getting and'
0430   $echo "installing GNU \`touch', distributed in GNU File Utilities..."
0431   echo
0432 fi
0433 rm -f 1231235999 $$.touch
0434 #
0435 if mkdir _sh01426; then
0436   $echo 'x -' 'creating lock directory'
0437 else
0438   $echo 'failed to create lock directory'
0439   exit 1
0440 fi
0441 # ============= MultiSound.d/setdigital.c ==============
0442 if test ! -d 'MultiSound.d'; then
0443   $echo 'x -' 'creating directory' 'MultiSound.d'
0444   mkdir 'MultiSound.d'
0445 fi
0446 if test -f 'MultiSound.d/setdigital.c' && test "$first_param" != -c; then
0447   $echo 'x -' SKIPPING 'MultiSound.d/setdigital.c' '(file already exists)'
0448 else
0449   $echo 'x -' extracting 'MultiSound.d/setdigital.c' '(text)'
0450   sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/setdigital.c' &&
0451 /*********************************************************************
0452 X *
0453 X * setdigital.c - sets the DIGITAL1 input for a mixer
0454 X *
0455 X * Copyright (C) 1998 Andrew Veliath
0456 X *
0457 X * This program is free software; you can redistribute it and/or modify
0458 X * it under the terms of the GNU General Public License as published by
0459 X * the Free Software Foundation; either version 2 of the License, or
0460 X * (at your option) any later version.
0461 X *
0462 X * This program is distributed in the hope that it will be useful,
0463 X * but WITHOUT ANY WARRANTY; without even the implied warranty of
0464 X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0465 X * GNU General Public License for more details.
0466 X *
0467 X * You should have received a copy of the GNU General Public License
0468 X * along with this program; if not, write to the Free Software
0469 X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0470 X *
0471 X ********************************************************************/
0472 X
0473 #include <stdio.h>
0474 #include <stdlib.h>
0475 #include <unistd.h>
0476 #include <fcntl.h>
0477 #include <sys/types.h>
0478 #include <sys/stat.h>
0479 #include <sys/ioctl.h>
0480 #include <sys/soundcard.h>
0481 X
0482 int main(int argc, char *argv[])
0483 {
0484 X       int fd;
0485 X       unsigned long recmask, recsrc;
0486 X
0487 X       if (argc != 2) {
0488 X               fprintf(stderr, "usage: setdigital <mixer device>\n");
0489 X               exit(1);
0490 X       }
0491 X
0492 X       if ((fd = open(argv[1], O_RDWR)) < 0) {
0493 X               perror(argv[1]);
0494 X               exit(1);
0495 X       }
0496 X
0497 X       if (ioctl(fd, SOUND_MIXER_READ_RECMASK, &recmask) < 0) {
0498 X               fprintf(stderr, "error: ioctl read recording mask failed\n");
0499 X               perror("ioctl");
0500 X               close(fd);
0501 X               exit(1);
0502 X       }
0503 X
0504 X       if (!(recmask & SOUND_MASK_DIGITAL1)) {
0505 X               fprintf(stderr, "error: cannot find DIGITAL1 device in mixer\n");
0506 X               close(fd);
0507 X               exit(1);
0508 X       }
0509 X
0510 X       if (ioctl(fd, SOUND_MIXER_READ_RECSRC, &recsrc) < 0) {
0511 X               fprintf(stderr, "error: ioctl read recording source failed\n");
0512 X               perror("ioctl");
0513 X               close(fd);
0514 X               exit(1);
0515 X       }
0516 X
0517 X       recsrc |= SOUND_MASK_DIGITAL1;
0518 X
0519 X       if (ioctl(fd, SOUND_MIXER_WRITE_RECSRC, &recsrc) < 0) {
0520 X               fprintf(stderr, "error: ioctl write recording source failed\n");
0521 X               perror("ioctl");
0522 X               close(fd);
0523 X               exit(1);
0524 X       }
0525 X
0526 X       close(fd);
0527 X
0528 X       return 0;
0529 }
0530 SHAR_EOF
0531   $shar_touch -am 1204092598 'MultiSound.d/setdigital.c' &&
0532   chmod 0664 'MultiSound.d/setdigital.c' ||
0533   $echo 'restore of' 'MultiSound.d/setdigital.c' 'failed'
0534   if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
0535   && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
0536     md5sum -c << SHAR_EOF >/dev/null 2>&1 \
0537     || $echo 'MultiSound.d/setdigital.c:' 'MD5 check failed'
0538 e87217fc3e71288102ba41fd81f71ec4  MultiSound.d/setdigital.c
0539 SHAR_EOF
0540   else
0541     shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/setdigital.c'`"
0542     test 2064 -eq "$shar_count" ||
0543     $echo 'MultiSound.d/setdigital.c:' 'original size' '2064,' 'current size' "$shar_count!"
0544   fi
0545 fi
0546 # ============= MultiSound.d/pinnaclecfg.c ==============
0547 if test -f 'MultiSound.d/pinnaclecfg.c' && test "$first_param" != -c; then
0548   $echo 'x -' SKIPPING 'MultiSound.d/pinnaclecfg.c' '(file already exists)'
0549 else
0550   $echo 'x -' extracting 'MultiSound.d/pinnaclecfg.c' '(text)'
0551   sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/pinnaclecfg.c' &&
0552 /*********************************************************************
0553 X *
0554 X * pinnaclecfg.c - Pinnacle/Fiji Device Configuration Program
0555 X *
0556 X * This is for NON-PnP mode only.  For PnP mode, use isapnptools.
0557 X *
0558 X * This is Linux-specific, and must be run with root permissions.
0559 X *
0560 X * Part of the Turtle Beach MultiSound Sound Card Driver for Linux
0561 X *
0562 X * Copyright (C) 1998 Andrew Veliath
0563 X *
0564 X * This program is free software; you can redistribute it and/or modify
0565 X * it under the terms of the GNU General Public License as published by
0566 X * the Free Software Foundation; either version 2 of the License, or
0567 X * (at your option) any later version.
0568 X *
0569 X * This program is distributed in the hope that it will be useful,
0570 X * but WITHOUT ANY WARRANTY; without even the implied warranty of
0571 X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0572 X * GNU General Public License for more details.
0573 X *
0574 X * You should have received a copy of the GNU General Public License
0575 X * along with this program; if not, write to the Free Software
0576 X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0577 X *
0578 X ********************************************************************/
0579 X
0580 #include <stdio.h>
0581 #include <stdlib.h>
0582 #include <string.h>
0583 #include <errno.h>
0584 #include <unistd.h>
0585 #include <asm/types.h>
0586 #include <sys/io.h>
0587 X
0588 #define IREG_LOGDEVICE          0x07
0589 #define IREG_ACTIVATE           0x30
0590 #define LD_ACTIVATE             0x01
0591 #define LD_DISACTIVATE          0x00
0592 #define IREG_EECONTROL          0x3F
0593 #define IREG_MEMBASEHI          0x40
0594 #define IREG_MEMBASELO          0x41
0595 #define IREG_MEMCONTROL         0x42
0596 #define IREG_MEMRANGEHI         0x43
0597 #define IREG_MEMRANGELO         0x44
0598 #define MEMTYPE_8BIT            0x00
0599 #define MEMTYPE_16BIT           0x02
0600 #define MEMTYPE_RANGE           0x00
0601 #define MEMTYPE_HIADDR          0x01
0602 #define IREG_IO0_BASEHI         0x60
0603 #define IREG_IO0_BASELO         0x61
0604 #define IREG_IO1_BASEHI         0x62
0605 #define IREG_IO1_BASELO         0x63
0606 #define IREG_IRQ_NUMBER         0x70
0607 #define IREG_IRQ_TYPE           0x71
0608 #define IRQTYPE_HIGH            0x02
0609 #define IRQTYPE_LOW             0x00
0610 #define IRQTYPE_LEVEL           0x01
0611 #define IRQTYPE_EDGE            0x00
0612 X
0613 #define HIBYTE(w)               ((BYTE)(((WORD)(w) >> 8) & 0xFF))
0614 #define LOBYTE(w)               ((BYTE)(w))
0615 #define MAKEWORD(low,hi)        ((WORD)(((BYTE)(low))|(((WORD)((BYTE)(hi)))<<8)))
0616 X
0617 typedef __u8                    BYTE;
0618 typedef __u16                   USHORT;
0619 typedef __u16                   WORD;
0620 X
0621 static int config_port = -1;
0622 X
0623 static int msnd_write_cfg(int cfg, int reg, int value)
0624 {
0625 X       outb(reg, cfg);
0626 X       outb(value, cfg + 1);
0627 X       if (value != inb(cfg + 1)) {
0628 X               fprintf(stderr, "error: msnd_write_cfg: I/O error\n");
0629 X               return -EIO;
0630 X       }
0631 X       return 0;
0632 }
0633 X
0634 static int msnd_read_cfg(int cfg, int reg)
0635 {
0636 X       outb(reg, cfg);
0637 X       return inb(cfg + 1);
0638 }
0639 X
0640 static int msnd_write_cfg_io0(int cfg, int num, WORD io)
0641 {
0642 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0643 X               return -EIO;
0644 X       if (msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io)))
0645 X               return -EIO;
0646 X       if (msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io)))
0647 X               return -EIO;
0648 X       return 0;
0649 }
0650 X
0651 static int msnd_read_cfg_io0(int cfg, int num, WORD *io)
0652 {
0653 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0654 X               return -EIO;
0655 X
0656 X       *io = MAKEWORD(msnd_read_cfg(cfg, IREG_IO0_BASELO),
0657 X                      msnd_read_cfg(cfg, IREG_IO0_BASEHI));
0658 X
0659 X       return 0;
0660 }
0661 X
0662 static int msnd_write_cfg_io1(int cfg, int num, WORD io)
0663 {
0664 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0665 X               return -EIO;
0666 X       if (msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io)))
0667 X               return -EIO;
0668 X       if (msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io)))
0669 X               return -EIO;
0670 X       return 0;
0671 }
0672 X
0673 static int msnd_read_cfg_io1(int cfg, int num, WORD *io)
0674 {
0675 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0676 X               return -EIO;
0677 X
0678 X       *io = MAKEWORD(msnd_read_cfg(cfg, IREG_IO1_BASELO),
0679 X                      msnd_read_cfg(cfg, IREG_IO1_BASEHI));
0680 X
0681 X       return 0;
0682 }
0683 X
0684 static int msnd_write_cfg_irq(int cfg, int num, WORD irq)
0685 {
0686 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0687 X               return -EIO;
0688 X       if (msnd_write_cfg(cfg, IREG_IRQ_NUMBER, LOBYTE(irq)))
0689 X               return -EIO;
0690 X       if (msnd_write_cfg(cfg, IREG_IRQ_TYPE, IRQTYPE_EDGE))
0691 X               return -EIO;
0692 X       return 0;
0693 }
0694 X
0695 static int msnd_read_cfg_irq(int cfg, int num, WORD *irq)
0696 {
0697 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0698 X               return -EIO;
0699 X
0700 X       *irq = msnd_read_cfg(cfg, IREG_IRQ_NUMBER);
0701 X
0702 X       return 0;
0703 }
0704 X
0705 static int msnd_write_cfg_mem(int cfg, int num, int mem)
0706 {
0707 X       WORD wmem;
0708 X
0709 X       mem >>= 8;
0710 X       mem &= 0xfff;
0711 X       wmem = (WORD)mem;
0712 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0713 X               return -EIO;
0714 X       if (msnd_write_cfg(cfg, IREG_MEMBASEHI, HIBYTE(wmem)))
0715 X               return -EIO;
0716 X       if (msnd_write_cfg(cfg, IREG_MEMBASELO, LOBYTE(wmem)))
0717 X               return -EIO;
0718 X       if (wmem && msnd_write_cfg(cfg, IREG_MEMCONTROL, (MEMTYPE_HIADDR | MEMTYPE_16BIT)))
0719 X               return -EIO;
0720 X       return 0;
0721 }
0722 X
0723 static int msnd_read_cfg_mem(int cfg, int num, int *mem)
0724 {
0725 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0726 X               return -EIO;
0727 X
0728 X       *mem = MAKEWORD(msnd_read_cfg(cfg, IREG_MEMBASELO),
0729 X                       msnd_read_cfg(cfg, IREG_MEMBASEHI));
0730 X       *mem <<= 8;
0731 X
0732 X       return 0;
0733 }
0734 X
0735 static int msnd_activate_logical(int cfg, int num)
0736 {
0737 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0738 X               return -EIO;
0739 X       if (msnd_write_cfg(cfg, IREG_ACTIVATE, LD_ACTIVATE))
0740 X               return -EIO;
0741 X       return 0;
0742 }
0743 X
0744 static int msnd_write_cfg_logical(int cfg, int num, WORD io0, WORD io1, WORD irq, int mem)
0745 {
0746 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0747 X               return -EIO;
0748 X       if (msnd_write_cfg_io0(cfg, num, io0))
0749 X               return -EIO;
0750 X       if (msnd_write_cfg_io1(cfg, num, io1))
0751 X               return -EIO;
0752 X       if (msnd_write_cfg_irq(cfg, num, irq))
0753 X               return -EIO;
0754 X       if (msnd_write_cfg_mem(cfg, num, mem))
0755 X               return -EIO;
0756 X       if (msnd_activate_logical(cfg, num))
0757 X               return -EIO;
0758 X       return 0;
0759 }
0760 X
0761 static int msnd_read_cfg_logical(int cfg, int num, WORD *io0, WORD *io1, WORD *irq, int *mem)
0762 {
0763 X       if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
0764 X               return -EIO;
0765 X       if (msnd_read_cfg_io0(cfg, num, io0))
0766 X               return -EIO;
0767 X       if (msnd_read_cfg_io1(cfg, num, io1))
0768 X               return -EIO;
0769 X       if (msnd_read_cfg_irq(cfg, num, irq))
0770 X               return -EIO;
0771 X       if (msnd_read_cfg_mem(cfg, num, mem))
0772 X               return -EIO;
0773 X       return 0;
0774 }
0775 X
0776 static void usage(void)
0777 {
0778 X       fprintf(stderr,
0779 X               "\n"
0780 X               "pinnaclecfg 1.0\n"
0781 X               "\n"
0782 X               "usage: pinnaclecfg <config port> [device config]\n"
0783 X               "\n"
0784 X               "This is for use with the card in NON-PnP mode only.\n"
0785 X               "\n"
0786 X               "Available devices (not all available for Fiji):\n"
0787 X               "\n"
0788 X               "        Device                       Description\n"
0789 X               "        -------------------------------------------------------------------\n"
0790 X               "        reset                        Reset all devices (i.e. disable)\n"
0791 X               "        show                         Display current device configurations\n"
0792 X               "\n"
0793 X               "        dsp <io> <irq> <mem>         Audio device\n"
0794 X               "        mpu <io> <irq>               Internal Kurzweil synth\n"
0795 X               "        ide <io0> <io1> <irq>        On-board IDE controller\n"
0796 X               "        joystick <io>                Joystick port\n"
0797 X               "\n");
0798 X       exit(1);
0799 }
0800 X
0801 static int cfg_reset(void)
0802 {
0803 X       int i;
0804 X
0805 X       for (i = 0; i < 4; ++i)
0806 X               msnd_write_cfg_logical(config_port, i, 0, 0, 0, 0);
0807 X
0808 X       return 0;
0809 }
0810 X
0811 static int cfg_show(void)
0812 {
0813 X       int i;
0814 X       int count = 0;
0815 X
0816 X       for (i = 0; i < 4; ++i) {
0817 X               WORD io0, io1, irq;
0818 X               int mem;
0819 X               msnd_read_cfg_logical(config_port, i, &io0, &io1, &irq, &mem);
0820 X               switch (i) {
0821 X               case 0:
0822 X                       if (io0 || irq || mem) {
0823 X                               printf("dsp 0x%x %d 0x%x\n", io0, irq, mem);
0824 X                               ++count;
0825 X                       }
0826 X                       break;
0827 X               case 1:
0828 X                       if (io0 || irq) {
0829 X                               printf("mpu 0x%x %d\n", io0, irq);
0830 X                               ++count;
0831 X                       }
0832 X                       break;
0833 X               case 2:
0834 X                       if (io0 || io1 || irq) {
0835 X                               printf("ide 0x%x 0x%x %d\n", io0, io1, irq);
0836 X                               ++count;
0837 X                       }
0838 X                       break;
0839 X               case 3:
0840 X                       if (io0) {
0841 X                               printf("joystick 0x%x\n", io0);
0842 X                               ++count;
0843 X                       }
0844 X                       break;
0845 X               }
0846 X       }
0847 X
0848 X       if (count == 0)
0849 X               fprintf(stderr, "no devices configured\n");
0850 X
0851 X       return 0;
0852 }
0853 X
0854 static int cfg_dsp(int argc, char *argv[])
0855 {
0856 X       int io, irq, mem;
0857 X
0858 X       if (argc < 3 ||
0859 X           sscanf(argv[0], "0x%x", &io) != 1 ||
0860 X           sscanf(argv[1], "%d", &irq) != 1 ||
0861 X           sscanf(argv[2], "0x%x", &mem) != 1)
0862 X               usage();
0863 X
0864 X       if (!(io == 0x290 ||
0865 X             io == 0x260 ||
0866 X             io == 0x250 ||
0867 X             io == 0x240 ||
0868 X             io == 0x230 ||
0869 X             io == 0x220 ||
0870 X             io == 0x210 ||
0871 X             io == 0x3e0)) {
0872 X               fprintf(stderr, "error: io must be one of "
0873 X                       "210, 220, 230, 240, 250, 260, 290, or 3E0\n");
0874 X               usage();
0875 X       }
0876 X
0877 X       if (!(irq == 5 ||
0878 X             irq == 7 ||
0879 X             irq == 9 ||
0880 X             irq == 10 ||
0881 X             irq == 11 ||
0882 X             irq == 12)) {
0883 X               fprintf(stderr, "error: irq must be one of "
0884 X                       "5, 7, 9, 10, 11 or 12\n");
0885 X               usage();
0886 X       }
0887 X
0888 X       if (!(mem == 0xb0000 ||
0889 X             mem == 0xc8000 ||
0890 X             mem == 0xd0000 ||
0891 X             mem == 0xd8000 ||
0892 X             mem == 0xe0000 ||
0893 X             mem == 0xe8000)) {
0894 X               fprintf(stderr, "error: mem must be one of "
0895 X                       "0xb0000, 0xc8000, 0xd0000, 0xd8000, 0xe0000 or 0xe8000\n");
0896 X               usage();
0897 X       }
0898 X
0899 X       return msnd_write_cfg_logical(config_port, 0, io, 0, irq, mem);
0900 }
0901 X
0902 static int cfg_mpu(int argc, char *argv[])
0903 {
0904 X       int io, irq;
0905 X
0906 X       if (argc < 2 ||
0907 X           sscanf(argv[0], "0x%x", &io) != 1 ||
0908 X           sscanf(argv[1], "%d", &irq) != 1)
0909 X               usage();
0910 X
0911 X       return msnd_write_cfg_logical(config_port, 1, io, 0, irq, 0);
0912 }
0913 X
0914 static int cfg_ide(int argc, char *argv[])
0915 {
0916 X       int io0, io1, irq;
0917 X
0918 X       if (argc < 3 ||
0919 X           sscanf(argv[0], "0x%x", &io0) != 1 ||
0920 X           sscanf(argv[0], "0x%x", &io1) != 1 ||
0921 X           sscanf(argv[1], "%d", &irq) != 1)
0922 X               usage();
0923 X
0924 X       return msnd_write_cfg_logical(config_port, 2, io0, io1, irq, 0);
0925 }
0926 X
0927 static int cfg_joystick(int argc, char *argv[])
0928 {
0929 X       int io;
0930 X
0931 X       if (argc < 1 ||
0932 X           sscanf(argv[0], "0x%x", &io) != 1)
0933 X               usage();
0934 X
0935 X       return msnd_write_cfg_logical(config_port, 3, io, 0, 0, 0);
0936 }
0937 X
0938 int main(int argc, char *argv[])
0939 {
0940 X       char *device;
0941 X       int rv = 0;
0942 X
0943 X       --argc; ++argv;
0944 X
0945 X       if (argc < 2)
0946 X               usage();
0947 X
0948 X       sscanf(argv[0], "0x%x", &config_port);
0949 X       if (config_port != 0x250 && config_port != 0x260 && config_port != 0x270) {
0950 X               fprintf(stderr, "error: <config port> must be 0x250, 0x260 or 0x270\n");
0951 X               exit(1);
0952 X       }
0953 X       if (ioperm(config_port, 2, 1)) {
0954 X               perror("ioperm");
0955 X               fprintf(stderr, "note: pinnaclecfg must be run as root\n");
0956 X               exit(1);
0957 X       }
0958 X       device = argv[1];
0959 X
0960 X       argc -= 2; argv += 2;
0961 X
0962 X       if (strcmp(device, "reset") == 0)
0963 X               rv = cfg_reset();
0964 X       else if (strcmp(device, "show") == 0)
0965 X               rv = cfg_show();
0966 X       else if (strcmp(device, "dsp") == 0)
0967 X               rv = cfg_dsp(argc, argv);
0968 X       else if (strcmp(device, "mpu") == 0)
0969 X               rv = cfg_mpu(argc, argv);
0970 X       else if (strcmp(device, "ide") == 0)
0971 X               rv = cfg_ide(argc, argv);
0972 X       else if (strcmp(device, "joystick") == 0)
0973 X               rv = cfg_joystick(argc, argv);
0974 X       else {
0975 X               fprintf(stderr, "error: unknown device %s\n", device);
0976 X               usage();
0977 X       }
0978 X
0979 X       if (rv)
0980 X               fprintf(stderr, "error: device configuration failed\n");
0981 X
0982 X       return 0;
0983 }
0984 SHAR_EOF
0985   $shar_touch -am 1204092598 'MultiSound.d/pinnaclecfg.c' &&
0986   chmod 0664 'MultiSound.d/pinnaclecfg.c' ||
0987   $echo 'restore of' 'MultiSound.d/pinnaclecfg.c' 'failed'
0988   if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
0989   && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
0990     md5sum -c << SHAR_EOF >/dev/null 2>&1 \
0991     || $echo 'MultiSound.d/pinnaclecfg.c:' 'MD5 check failed'
0992 366bdf27f0db767a3c7921d0a6db20fe  MultiSound.d/pinnaclecfg.c
0993 SHAR_EOF
0994   else
0995     shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/pinnaclecfg.c'`"
0996     test 10224 -eq "$shar_count" ||
0997     $echo 'MultiSound.d/pinnaclecfg.c:' 'original size' '10224,' 'current size' "$shar_count!"
0998   fi
0999 fi
1000 # ============= MultiSound.d/Makefile ==============
1001 if test -f 'MultiSound.d/Makefile' && test "$first_param" != -c; then
1002   $echo 'x -' SKIPPING 'MultiSound.d/Makefile' '(file already exists)'
1003 else
1004   $echo 'x -' extracting 'MultiSound.d/Makefile' '(text)'
1005   sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/Makefile' &&
1006 CC      = gcc
1007 CFLAGS  = -O
1008 PROGS   = setdigital msndreset pinnaclecfg conv
1009 X
1010 all: $(PROGS)
1011 X
1012 clean:
1013 X       rm -f $(PROGS)
1014 SHAR_EOF
1015   $shar_touch -am 1204092398 'MultiSound.d/Makefile' &&
1016   chmod 0664 'MultiSound.d/Makefile' ||
1017   $echo 'restore of' 'MultiSound.d/Makefile' 'failed'
1018   if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
1019   && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
1020     md5sum -c << SHAR_EOF >/dev/null 2>&1 \
1021     || $echo 'MultiSound.d/Makefile:' 'MD5 check failed'
1022 76ca8bb44e3882edcf79c97df6c81845  MultiSound.d/Makefile
1023 SHAR_EOF
1024   else
1025     shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/Makefile'`"
1026     test 106 -eq "$shar_count" ||
1027     $echo 'MultiSound.d/Makefile:' 'original size' '106,' 'current size' "$shar_count!"
1028   fi
1029 fi
1030 # ============= MultiSound.d/conv.l ==============
1031 if test -f 'MultiSound.d/conv.l' && test "$first_param" != -c; then
1032   $echo 'x -' SKIPPING 'MultiSound.d/conv.l' '(file already exists)'
1033 else
1034   $echo 'x -' extracting 'MultiSound.d/conv.l' '(text)'
1035   sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/conv.l' &&
1036 %%
1037 [ \n\t,\r]
1038 \;.*
1039 DB
1040 [0-9A-Fa-f]+H   { int n; sscanf(yytext, "%xH", &n); printf("%c", n); }
1041 %%
1042 int yywrap() { return 1; }
1043 void main() { yylex(); }
1044 SHAR_EOF
1045   $shar_touch -am 0828231798 'MultiSound.d/conv.l' &&
1046   chmod 0664 'MultiSound.d/conv.l' ||
1047   $echo 'restore of' 'MultiSound.d/conv.l' 'failed'
1048   if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
1049   && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
1050     md5sum -c << SHAR_EOF >/dev/null 2>&1 \
1051     || $echo 'MultiSound.d/conv.l:' 'MD5 check failed'
1052 d2411fc32cd71a00dcdc1f009e858dd2  MultiSound.d/conv.l
1053 SHAR_EOF
1054   else
1055     shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/conv.l'`"
1056     test 146 -eq "$shar_count" ||
1057     $echo 'MultiSound.d/conv.l:' 'original size' '146,' 'current size' "$shar_count!"
1058   fi
1059 fi
1060 # ============= MultiSound.d/msndreset.c ==============
1061 if test -f 'MultiSound.d/msndreset.c' && test "$first_param" != -c; then
1062   $echo 'x -' SKIPPING 'MultiSound.d/msndreset.c' '(file already exists)'
1063 else
1064   $echo 'x -' extracting 'MultiSound.d/msndreset.c' '(text)'
1065   sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/msndreset.c' &&
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 redistribute it and/or modify
1073 X * it under the terms of the GNU General Public License as published by
1074 X * the Free Software Foundation; either version 2 of the License, or
1075 X * (at your option) any later version.
1076 X *
1077 X * This program is distributed in the hope that it will be useful,
1078 X * but WITHOUT ANY WARRANTY; without even the implied warranty of
1079 X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1080 X * GNU General Public License for more details.
1081 X *
1082 X * You should have received a copy of the GNU General Public License
1083 X * along with this program; if not, write to the Free Software
1084 X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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: msndreset <mixer device>\n");
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) < 0) {
1112 X               fprintf(stderr, "error: msnd ioctl reset failed\n");
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/msndreset.c' &&
1124   chmod 0664 'MultiSound.d/msndreset.c' ||
1125   $echo 'restore of' 'MultiSound.d/msndreset.c' 'failed'
1126   if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
1127   && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
1128     md5sum -c << SHAR_EOF >/dev/null 2>&1 \
1129     || $echo 'MultiSound.d/msndreset.c:' 'MD5 check failed'
1130 c52f876521084e8eb25e12e01dcccb8a  MultiSound.d/msndreset.c
1131 SHAR_EOF
1132   else
1133     shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/msndreset.c'`"
1134     test 1491 -eq "$shar_count" ||
1135     $echo 'MultiSound.d/msndreset.c:' 'original size' '1491,' 'current size' "$shar_count!"
1136   fi
1137 fi
1138 rm -fr _sh01426
1139 exit 0