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