18c2ecf20Sopenharmony_ci#! /bin/sh 28c2ecf20Sopenharmony_ci# 38c2ecf20Sopenharmony_ci# Turtle Beach MultiSound Driver Notes 48c2ecf20Sopenharmony_ci# -- Andrew Veliath <andrewtv@usa.net> 58c2ecf20Sopenharmony_ci# 68c2ecf20Sopenharmony_ci# Last update: September 10, 1998 78c2ecf20Sopenharmony_ci# Corresponding msnd driver: 0.8.3 88c2ecf20Sopenharmony_ci# 98c2ecf20Sopenharmony_ci# ** This file is a README (top part) and shell archive (bottom part). 108c2ecf20Sopenharmony_ci# The corresponding archived utility sources can be unpacked by 118c2ecf20Sopenharmony_ci# running `sh MultiSound' (the utilities are only needed for the 128c2ecf20Sopenharmony_ci# Pinnacle and Fiji cards). ** 138c2ecf20Sopenharmony_ci# 148c2ecf20Sopenharmony_ci# 158c2ecf20Sopenharmony_ci# -=-=- Getting Firmware -=-=- 168c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 178c2ecf20Sopenharmony_ci# 188c2ecf20Sopenharmony_ci# See the section `Obtaining and Creating Firmware Files' in this 198c2ecf20Sopenharmony_ci# document for instructions on obtaining the necessary firmware 208c2ecf20Sopenharmony_ci# files. 218c2ecf20Sopenharmony_ci# 228c2ecf20Sopenharmony_ci# 238c2ecf20Sopenharmony_ci# Supported Features 248c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~ 258c2ecf20Sopenharmony_ci# 268c2ecf20Sopenharmony_ci# Currently, full-duplex digital audio (/dev/dsp only, /dev/audio is 278c2ecf20Sopenharmony_ci# not currently available) and mixer functionality (/dev/mixer) are 288c2ecf20Sopenharmony_ci# supported (memory mapped digital audio is not yet supported). 298c2ecf20Sopenharmony_ci# Digital transfers and monitoring can be done as well if you have 308c2ecf20Sopenharmony_ci# the digital daughterboard (see the section on using the S/PDIF port 318c2ecf20Sopenharmony_ci# for more information). 328c2ecf20Sopenharmony_ci# 338c2ecf20Sopenharmony_ci# Support for the Turtle Beach MultiSound Hurricane architecture is 348c2ecf20Sopenharmony_ci# composed of the following modules (these can also operate compiled 358c2ecf20Sopenharmony_ci# into the kernel): 368c2ecf20Sopenharmony_ci# 378c2ecf20Sopenharmony_ci# snd-msnd-lib - MultiSound base (requires snd) 388c2ecf20Sopenharmony_ci# 398c2ecf20Sopenharmony_ci# snd-msnd-classic - Base audio/mixer support for Classic, Monetery and 408c2ecf20Sopenharmony_ci# Tahiti cards 418c2ecf20Sopenharmony_ci# 428c2ecf20Sopenharmony_ci# snd-msnd-pinnacle - Base audio/mixer support for Pinnacle and Fiji cards 438c2ecf20Sopenharmony_ci# 448c2ecf20Sopenharmony_ci# 458c2ecf20Sopenharmony_ci# Important Notes - Read Before Using 468c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478c2ecf20Sopenharmony_ci# 488c2ecf20Sopenharmony_ci# The firmware files are not included (may change in future). You 498c2ecf20Sopenharmony_ci# must obtain these images from Turtle Beach (they are included in 508c2ecf20Sopenharmony_ci# the MultiSound Development Kits), and place them in /etc/sound for 518c2ecf20Sopenharmony_ci# example, and give the full paths in the Linux configuration. If 528c2ecf20Sopenharmony_ci# you are compiling in support for the MultiSound driver rather than 538c2ecf20Sopenharmony_ci# using it as a module, these firmware files must be accessible 548c2ecf20Sopenharmony_ci# during kernel compilation. 558c2ecf20Sopenharmony_ci# 568c2ecf20Sopenharmony_ci# Please note these files must be binary files, not assembler. See 578c2ecf20Sopenharmony_ci# the section later in this document for instructions to obtain these 588c2ecf20Sopenharmony_ci# files. 598c2ecf20Sopenharmony_ci# 608c2ecf20Sopenharmony_ci# 618c2ecf20Sopenharmony_ci# Configuring Card Resources 628c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~ 638c2ecf20Sopenharmony_ci# 648c2ecf20Sopenharmony_ci# ** This section is very important, as your card may not work at all 658c2ecf20Sopenharmony_ci# or your machine may crash if you do not do this correctly. ** 668c2ecf20Sopenharmony_ci# 678c2ecf20Sopenharmony_ci# * Classic/Monterey/Tahiti 688c2ecf20Sopenharmony_ci# 698c2ecf20Sopenharmony_ci# These cards are configured through the driver snd-msnd-classic. You must 708c2ecf20Sopenharmony_ci# know the io port, then the driver will select the irq and memory resources 718c2ecf20Sopenharmony_ci# on the card. It is up to you to know if these are free locations or now, 728c2ecf20Sopenharmony_ci# a conflict can lock the machine up. 738c2ecf20Sopenharmony_ci# 748c2ecf20Sopenharmony_ci# * Pinnacle/Fiji 758c2ecf20Sopenharmony_ci# 768c2ecf20Sopenharmony_ci# The Pinnacle and Fiji cards have an extra config port, either 778c2ecf20Sopenharmony_ci# 0x250, 0x260 or 0x270. This port can be disabled to have the card 788c2ecf20Sopenharmony_ci# configured strictly through PnP, however you lose the ability to 798c2ecf20Sopenharmony_ci# access the IDE controller and joystick devices on this card when 808c2ecf20Sopenharmony_ci# using PnP. The included pinnaclecfg program in this shell archive 818c2ecf20Sopenharmony_ci# can be used to configure the card in non-PnP mode, and in PnP mode 828c2ecf20Sopenharmony_ci# you can use isapnptools. These are described briefly here. 838c2ecf20Sopenharmony_ci# 848c2ecf20Sopenharmony_ci# pinnaclecfg is not required; you can use the snd-msnd-pinnacle module 858c2ecf20Sopenharmony_ci# to fully configure the card as well. However, pinnaclecfg can be 868c2ecf20Sopenharmony_ci# used to change the resource values of a particular device after the 878c2ecf20Sopenharmony_ci# snd-msnd-pinnacle module has been loaded. If you are compiling the 888c2ecf20Sopenharmony_ci# driver into the kernel, you must set these values during compile 898c2ecf20Sopenharmony_ci# time, however other peripheral resource values can be changed with 908c2ecf20Sopenharmony_ci# the pinnaclecfg program after the kernel is loaded. 918c2ecf20Sopenharmony_ci# 928c2ecf20Sopenharmony_ci# 938c2ecf20Sopenharmony_ci# *** PnP mode 948c2ecf20Sopenharmony_ci# 958c2ecf20Sopenharmony_ci# Use pnpdump to obtain a sample configuration if you can; I was able 968c2ecf20Sopenharmony_ci# to obtain one with the command `pnpdump 1 0x203' -- this may vary 978c2ecf20Sopenharmony_ci# for you (running pnpdump by itself did not work for me). Then, 988c2ecf20Sopenharmony_ci# edit this file and use isapnp to uncomment and set the card values. 998c2ecf20Sopenharmony_ci# Use these values when inserting the snd-msnd-pinnacle module. Using 1008c2ecf20Sopenharmony_ci# this method, you can set the resources for the DSP and the Kurzweil 1018c2ecf20Sopenharmony_ci# synth (Pinnacle). Since Linux does not directly support PnP 1028c2ecf20Sopenharmony_ci# devices, you may have difficulty when using the card in PnP mode 1038c2ecf20Sopenharmony_ci# when it the driver is compiled into the kernel. Using non-PnP mode 1048c2ecf20Sopenharmony_ci# is preferable in this case. 1058c2ecf20Sopenharmony_ci# 1068c2ecf20Sopenharmony_ci# Here is an example mypinnacle.conf for isapnp that sets the card to 1078c2ecf20Sopenharmony_ci# io base 0x210, irq 5 and mem 0xd8000, and also sets the Kurzweil 1088c2ecf20Sopenharmony_ci# synth to 0x330 and irq 9 (may need editing for your system): 1098c2ecf20Sopenharmony_ci# 1108c2ecf20Sopenharmony_ci# (READPORT 0x0203) 1118c2ecf20Sopenharmony_ci# (CSN 2) 1128c2ecf20Sopenharmony_ci# (IDENTIFY *) 1138c2ecf20Sopenharmony_ci# 1148c2ecf20Sopenharmony_ci# # DSP 1158c2ecf20Sopenharmony_ci# (CONFIGURE BVJ0440/-1 (LD 0 1168c2ecf20Sopenharmony_ci# (INT 0 (IRQ 5 (MODE +E))) (IO 0 (BASE 0x0210)) (MEM 0 (BASE 0x0d8000)) 1178c2ecf20Sopenharmony_ci# (ACT Y))) 1188c2ecf20Sopenharmony_ci# 1198c2ecf20Sopenharmony_ci# # Kurzweil Synth (Pinnacle Only) 1208c2ecf20Sopenharmony_ci# (CONFIGURE BVJ0440/-1 (LD 1 1218c2ecf20Sopenharmony_ci# (IO 0 (BASE 0x0330)) (INT 0 (IRQ 9 (MODE +E))) 1228c2ecf20Sopenharmony_ci# (ACT Y))) 1238c2ecf20Sopenharmony_ci# 1248c2ecf20Sopenharmony_ci# (WAITFORKEY) 1258c2ecf20Sopenharmony_ci# 1268c2ecf20Sopenharmony_ci# 1278c2ecf20Sopenharmony_ci# *** Non-PnP mode 1288c2ecf20Sopenharmony_ci# 1298c2ecf20Sopenharmony_ci# The second way is by running the card in non-PnP mode. This 1308c2ecf20Sopenharmony_ci# actually has some advantages in that you can access some other 1318c2ecf20Sopenharmony_ci# devices on the card, such as the joystick and IDE controller. To 1328c2ecf20Sopenharmony_ci# configure the card, unpack this shell archive and build the 1338c2ecf20Sopenharmony_ci# pinnaclecfg program. Using this program, you can assign the 1348c2ecf20Sopenharmony_ci# resource values to the card's devices, or disable the devices. As 1358c2ecf20Sopenharmony_ci# an alternative to using pinnaclecfg, you can specify many of the 1368c2ecf20Sopenharmony_ci# configuration values when loading the snd-msnd-pinnacle module (or 1378c2ecf20Sopenharmony_ci# during kernel configuration when compiling the driver into the 1388c2ecf20Sopenharmony_ci# kernel). 1398c2ecf20Sopenharmony_ci# 1408c2ecf20Sopenharmony_ci# If you specify cfg=0x250 for the snd-msnd-pinnacle module, it 1418c2ecf20Sopenharmony_ci# automatically configure the card to the given io, irq and memory 1428c2ecf20Sopenharmony_ci# values using that config port (the config port is jumper selectable 1438c2ecf20Sopenharmony_ci# on the card to 0x250, 0x260 or 0x270). 1448c2ecf20Sopenharmony_ci# 1458c2ecf20Sopenharmony_ci# See the `snd-msnd-pinnacle Additional Options' section below for more 1468c2ecf20Sopenharmony_ci# information on these parameters (also, if you compile the driver 1478c2ecf20Sopenharmony_ci# directly into the kernel, these extra parameters can be useful 1488c2ecf20Sopenharmony_ci# here). 1498c2ecf20Sopenharmony_ci# 1508c2ecf20Sopenharmony_ci# 1518c2ecf20Sopenharmony_ci# ** It is very easy to cause problems in your machine if you choose a 1528c2ecf20Sopenharmony_ci# resource value which is incorrect. ** 1538c2ecf20Sopenharmony_ci# 1548c2ecf20Sopenharmony_ci# 1558c2ecf20Sopenharmony_ci# Examples 1568c2ecf20Sopenharmony_ci# ~~~~~~~~ 1578c2ecf20Sopenharmony_ci# 1588c2ecf20Sopenharmony_ci# * MultiSound Classic/Monterey/Tahiti: 1598c2ecf20Sopenharmony_ci# 1608c2ecf20Sopenharmony_ci# modprobe snd 1618c2ecf20Sopenharmony_ci# insmod snd-msnd-lib 1628c2ecf20Sopenharmony_ci# insmod snd-msnd-classic io=0x290 irq=7 mem=0xd0000 1638c2ecf20Sopenharmony_ci# 1648c2ecf20Sopenharmony_ci# * MultiSound Pinnacle in PnP mode: 1658c2ecf20Sopenharmony_ci# 1668c2ecf20Sopenharmony_ci# modprobe snd 1678c2ecf20Sopenharmony_ci# insmod snd-msnd-lib 1688c2ecf20Sopenharmony_ci# isapnp mypinnacle.conf 1698c2ecf20Sopenharmony_ci# insmod snd-msnd-pinnacle io=0x210 irq=5 mem=0xd8000 <-- match mypinnacle.conf values 1708c2ecf20Sopenharmony_ci# 1718c2ecf20Sopenharmony_ci# * MultiSound Pinnacle in non-PnP mode (replace 0x250 with your configuration port, 1728c2ecf20Sopenharmony_ci# one of 0x250, 0x260 or 0x270): 1738c2ecf20Sopenharmony_ci# 1748c2ecf20Sopenharmony_ci# modprobe snd 1758c2ecf20Sopenharmony_ci# insmod snd-msnd-lib 1768c2ecf20Sopenharmony_ci# insmod snd-msnd-pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 1778c2ecf20Sopenharmony_ci# 1788c2ecf20Sopenharmony_ci# * To use the MPU-compatible Kurzweil synth on the Pinnacle in PnP 1798c2ecf20Sopenharmony_ci# mode, add the following (assumes you did `isapnp mypinnacle.conf'): 1808c2ecf20Sopenharmony_ci# 1818c2ecf20Sopenharmony_ci# insmod snd 1828c2ecf20Sopenharmony_ci# insmod mpu401 io=0x330 irq=9 <-- match mypinnacle.conf values 1838c2ecf20Sopenharmony_ci# 1848c2ecf20Sopenharmony_ci# * To use the MPU-compatible Kurzweil synth on the Pinnacle in non-PnP 1858c2ecf20Sopenharmony_ci# mode, add the following. Note how we first configure the peripheral's 1868c2ecf20Sopenharmony_ci# resources, _then_ install a Linux driver for it: 1878c2ecf20Sopenharmony_ci# 1888c2ecf20Sopenharmony_ci# insmod snd 1898c2ecf20Sopenharmony_ci# pinnaclecfg 0x250 mpu 0x330 9 1908c2ecf20Sopenharmony_ci# insmod mpu401 io=0x330 irq=9 1918c2ecf20Sopenharmony_ci# 1928c2ecf20Sopenharmony_ci# -- OR you can use the following sequence without pinnaclecfg in non-PnP mode: 1938c2ecf20Sopenharmony_ci# 1948c2ecf20Sopenharmony_ci# modprobe snd 1958c2ecf20Sopenharmony_ci# insmod snd-msnd-lib 1968c2ecf20Sopenharmony_ci# insmod snd-msnd-pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 mpu_io=0x330 mpu_irq=9 1978c2ecf20Sopenharmony_ci# insmod snd 1988c2ecf20Sopenharmony_ci# insmod mpu401 io=0x330 irq=9 1998c2ecf20Sopenharmony_ci# 2008c2ecf20Sopenharmony_ci# * To setup the joystick port on the Pinnacle in non-PnP mode (though 2018c2ecf20Sopenharmony_ci# you have to find the actual Linux joystick driver elsewhere), you 2028c2ecf20Sopenharmony_ci# can use pinnaclecfg: 2038c2ecf20Sopenharmony_ci# 2048c2ecf20Sopenharmony_ci# pinnaclecfg 0x250 joystick 0x200 2058c2ecf20Sopenharmony_ci# 2068c2ecf20Sopenharmony_ci# -- OR you can configure this using snd-msnd-pinnacle with the following: 2078c2ecf20Sopenharmony_ci# 2088c2ecf20Sopenharmony_ci# modprobe snd 2098c2ecf20Sopenharmony_ci# insmod snd-msnd-lib 2108c2ecf20Sopenharmony_ci# insmod snd-msnd-pinnacle cfg=0x250 io=0x290 irq=5 mem=0xd0000 joystick_io=0x200 2118c2ecf20Sopenharmony_ci# 2128c2ecf20Sopenharmony_ci# 2138c2ecf20Sopenharmony_ci# snd-msnd-classic, snd-msnd-pinnacle Required Options 2148c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2158c2ecf20Sopenharmony_ci# 2168c2ecf20Sopenharmony_ci# If the following options are not given, the module will not load. 2178c2ecf20Sopenharmony_ci# Examine the kernel message log for informative error messages. 2188c2ecf20Sopenharmony_ci# WARNING--probing isn't supported so try to make sure you have the 2198c2ecf20Sopenharmony_ci# correct shared memory area, otherwise you may experience problems. 2208c2ecf20Sopenharmony_ci# 2218c2ecf20Sopenharmony_ci# io I/O base of DSP, e.g. io=0x210 2228c2ecf20Sopenharmony_ci# irq IRQ number, e.g. irq=5 2238c2ecf20Sopenharmony_ci# mem Shared memory area, e.g. mem=0xd8000 2248c2ecf20Sopenharmony_ci# 2258c2ecf20Sopenharmony_ci# 2268c2ecf20Sopenharmony_ci# snd-msnd-classic, snd-msnd-pinnacle Additional Options 2278c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2288c2ecf20Sopenharmony_ci# 2298c2ecf20Sopenharmony_ci# fifosize The digital audio FIFOs, in kilobytes. If not 2308c2ecf20Sopenharmony_ci# specified, the default will be used. Increasing 2318c2ecf20Sopenharmony_ci# this value will reduce the chance of a FIFO 2328c2ecf20Sopenharmony_ci# underflow at the expense of increasing overall 2338c2ecf20Sopenharmony_ci# latency. For example, fifosize=512 will 2348c2ecf20Sopenharmony_ci# allocate 512kB read and write FIFOs (1MB total). 2358c2ecf20Sopenharmony_ci# While this may reduce dropouts, a heavy machine 2368c2ecf20Sopenharmony_ci# load will undoubtedly starve the FIFO of data 2378c2ecf20Sopenharmony_ci# and you will eventually get dropouts. One 2388c2ecf20Sopenharmony_ci# option is to alter the scheduling priority of 2398c2ecf20Sopenharmony_ci# the playback process, using `nice' or some form 2408c2ecf20Sopenharmony_ci# of POSIX soft real-time scheduling. 2418c2ecf20Sopenharmony_ci# 2428c2ecf20Sopenharmony_ci# calibrate_signal Setting this to one calibrates the ADCs to the 2438c2ecf20Sopenharmony_ci# signal, zero calibrates to the card (defaults 2448c2ecf20Sopenharmony_ci# to zero). 2458c2ecf20Sopenharmony_ci# 2468c2ecf20Sopenharmony_ci# 2478c2ecf20Sopenharmony_ci# snd-msnd-pinnacle Additional Options 2488c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2498c2ecf20Sopenharmony_ci# 2508c2ecf20Sopenharmony_ci# digital Specify digital=1 to enable the S/PDIF input 2518c2ecf20Sopenharmony_ci# if you have the digital daughterboard 2528c2ecf20Sopenharmony_ci# adapter. This will enable access to the 2538c2ecf20Sopenharmony_ci# DIGITAL1 input for the soundcard in the mixer. 2548c2ecf20Sopenharmony_ci# Some mixer programs might have trouble setting 2558c2ecf20Sopenharmony_ci# the DIGITAL1 source as an input. If you have 2568c2ecf20Sopenharmony_ci# trouble, you can try the setdigital.c program 2578c2ecf20Sopenharmony_ci# at the bottom of this document. 2588c2ecf20Sopenharmony_ci# 2598c2ecf20Sopenharmony_ci# cfg Non-PnP configuration port for the Pinnacle 2608c2ecf20Sopenharmony_ci# and Fiji (typically 0x250, 0x260 or 0x270, 2618c2ecf20Sopenharmony_ci# depending on the jumper configuration). If 2628c2ecf20Sopenharmony_ci# this option is omitted, then it is assumed 2638c2ecf20Sopenharmony_ci# that the card is in PnP mode, and that the 2648c2ecf20Sopenharmony_ci# specified DSP resource values are already 2658c2ecf20Sopenharmony_ci# configured with PnP (i.e. it won't attempt to 2668c2ecf20Sopenharmony_ci# do any sort of configuration). 2678c2ecf20Sopenharmony_ci# 2688c2ecf20Sopenharmony_ci# When the Pinnacle is in non-PnP mode, you can use the following 2698c2ecf20Sopenharmony_ci# options to configure particular devices. If a full specification 2708c2ecf20Sopenharmony_ci# for a device is not given, then the device is not configured. Note 2718c2ecf20Sopenharmony_ci# that you still must use a Linux driver for any of these devices 2728c2ecf20Sopenharmony_ci# once their resources are setup (such as the Linux joystick driver, 2738c2ecf20Sopenharmony_ci# or the MPU401 driver from OSS for the Kurzweil synth). 2748c2ecf20Sopenharmony_ci# 2758c2ecf20Sopenharmony_ci# mpu_io I/O port of MPU (on-board Kurzweil synth) 2768c2ecf20Sopenharmony_ci# mpu_irq IRQ of MPU (on-board Kurzweil synth) 2778c2ecf20Sopenharmony_ci# ide_io0 First I/O port of IDE controller 2788c2ecf20Sopenharmony_ci# ide_io1 Second I/O port of IDE controller 2798c2ecf20Sopenharmony_ci# ide_irq IRQ IDE controller 2808c2ecf20Sopenharmony_ci# joystick_io I/O port of joystick 2818c2ecf20Sopenharmony_ci# 2828c2ecf20Sopenharmony_ci# 2838c2ecf20Sopenharmony_ci# Obtaining and Creating Firmware Files 2848c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2858c2ecf20Sopenharmony_ci# 2868c2ecf20Sopenharmony_ci# For the Classic/Tahiti/Monterey 2878c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2888c2ecf20Sopenharmony_ci# 2898c2ecf20Sopenharmony_ci# Download to /tmp and unzip the following file from Turtle Beach: 2908c2ecf20Sopenharmony_ci# 2918c2ecf20Sopenharmony_ci# ftp://ftp.voyetra.com/pub/tbs/msndcl/msndvkit.zip 2928c2ecf20Sopenharmony_ci# 2938c2ecf20Sopenharmony_ci# When unzipped, unzip the file named MsndFiles.zip. Then copy the 2948c2ecf20Sopenharmony_ci# following firmware files to /etc/sound (note the file renaming): 2958c2ecf20Sopenharmony_ci# 2968c2ecf20Sopenharmony_ci# cp DSPCODE/MSNDINIT.BIN /etc/sound/msndinit.bin 2978c2ecf20Sopenharmony_ci# cp DSPCODE/MSNDPERM.REB /etc/sound/msndperm.bin 2988c2ecf20Sopenharmony_ci# 2998c2ecf20Sopenharmony_ci# When configuring the Linux kernel, specify /etc/sound/msndinit.bin and 3008c2ecf20Sopenharmony_ci# /etc/sound/msndperm.bin for the two firmware files (Linux kernel 3018c2ecf20Sopenharmony_ci# versions older than 2.2 do not ask for firmware paths, and are 3028c2ecf20Sopenharmony_ci# hardcoded to /etc/sound). 3038c2ecf20Sopenharmony_ci# 3048c2ecf20Sopenharmony_ci# If you are compiling the driver into the kernel, these files must 3058c2ecf20Sopenharmony_ci# be accessible during compilation, but will not be needed later. 3068c2ecf20Sopenharmony_ci# The files must remain, however, if the driver is used as a module. 3078c2ecf20Sopenharmony_ci# 3088c2ecf20Sopenharmony_ci# 3098c2ecf20Sopenharmony_ci# For the Pinnacle/Fiji 3108c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~ 3118c2ecf20Sopenharmony_ci# 3128c2ecf20Sopenharmony_ci# Download to /tmp and unzip the following file from Turtle Beach (be 3138c2ecf20Sopenharmony_ci# sure to use the entire URL; some have had trouble navigating to the 3148c2ecf20Sopenharmony_ci# URL): 3158c2ecf20Sopenharmony_ci# 3168c2ecf20Sopenharmony_ci# ftp://ftp.voyetra.com/pub/tbs/pinn/pnddk100.zip 3178c2ecf20Sopenharmony_ci# 3188c2ecf20Sopenharmony_ci# Unpack this shell archive, and run make in the created directory 3198c2ecf20Sopenharmony_ci# (you need a C compiler and flex to build the utilities). This 3208c2ecf20Sopenharmony_ci# should give you the executables conv, pinnaclecfg and setdigital. 3218c2ecf20Sopenharmony_ci# conv is only used temporarily here to create the firmware files, 3228c2ecf20Sopenharmony_ci# while pinnaclecfg is used to configure the Pinnacle or Fiji card in 3238c2ecf20Sopenharmony_ci# non-PnP mode, and setdigital can be used to set the S/PDIF input on 3248c2ecf20Sopenharmony_ci# the mixer (pinnaclecfg and setdigital should be copied to a 3258c2ecf20Sopenharmony_ci# convenient place, possibly run during system initialization). 3268c2ecf20Sopenharmony_ci# 3278c2ecf20Sopenharmony_ci# To generating the firmware files with the `conv' program, we create 3288c2ecf20Sopenharmony_ci# the binary firmware files by doing the following conversion 3298c2ecf20Sopenharmony_ci# (assuming the archive unpacked into a directory named PINNDDK): 3308c2ecf20Sopenharmony_ci# 3318c2ecf20Sopenharmony_ci# ./conv < PINNDDK/dspcode/pndspini.asm > /etc/sound/pndspini.bin 3328c2ecf20Sopenharmony_ci# ./conv < PINNDDK/dspcode/pndsperm.asm > /etc/sound/pndsperm.bin 3338c2ecf20Sopenharmony_ci# 3348c2ecf20Sopenharmony_ci# The conv (and conv.l) program is not needed after conversion and can 3358c2ecf20Sopenharmony_ci# be safely deleted. Then, when configuring the Linux kernel, specify 3368c2ecf20Sopenharmony_ci# /etc/sound/pndspini.bin and /etc/sound/pndsperm.bin for the two 3378c2ecf20Sopenharmony_ci# firmware files (Linux kernel versions older than 2.2 do not ask for 3388c2ecf20Sopenharmony_ci# firmware paths, and are hardcoded to /etc/sound). 3398c2ecf20Sopenharmony_ci# 3408c2ecf20Sopenharmony_ci# If you are compiling the driver into the kernel, these files must 3418c2ecf20Sopenharmony_ci# be accessible during compilation, but will not be needed later. 3428c2ecf20Sopenharmony_ci# The files must remain, however, if the driver is used as a module. 3438c2ecf20Sopenharmony_ci# 3448c2ecf20Sopenharmony_ci# 3458c2ecf20Sopenharmony_ci# Using Digital I/O with the S/PDIF Port 3468c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3478c2ecf20Sopenharmony_ci# 3488c2ecf20Sopenharmony_ci# If you have a Pinnacle or Fiji with the digital daughterboard and 3498c2ecf20Sopenharmony_ci# want to set it as the input source, you can use this program if you 3508c2ecf20Sopenharmony_ci# have trouble trying to do it with a mixer program (be sure to 3518c2ecf20Sopenharmony_ci# insert the module with the digital=1 option, or say Y to the option 3528c2ecf20Sopenharmony_ci# during compiled-in kernel operation). Upon selection of the S/PDIF 3538c2ecf20Sopenharmony_ci# port, you should be able monitor and record from it. 3548c2ecf20Sopenharmony_ci# 3558c2ecf20Sopenharmony_ci# There is something to note about using the S/PDIF port. Digital 3568c2ecf20Sopenharmony_ci# timing is taken from the digital signal, so if a signal is not 3578c2ecf20Sopenharmony_ci# connected to the port and it is selected as recording input, you 3588c2ecf20Sopenharmony_ci# will find PCM playback to be distorted in playback rate. Also, 3598c2ecf20Sopenharmony_ci# attempting to record at a sampling rate other than the DAT rate may 3608c2ecf20Sopenharmony_ci# be problematic (i.e. trying to record at 8000Hz when the DAT signal 3618c2ecf20Sopenharmony_ci# is 44100Hz). If you have a problem with this, set the recording 3628c2ecf20Sopenharmony_ci# input to analog if you need to record at a rate other than that of 3638c2ecf20Sopenharmony_ci# the DAT rate. 3648c2ecf20Sopenharmony_ci# 3658c2ecf20Sopenharmony_ci# 3668c2ecf20Sopenharmony_ci# -- Shell archive attached below, just run `sh MultiSound' to extract. 3678c2ecf20Sopenharmony_ci# Contains Pinnacle/Fiji utilities to convert firmware, configure 3688c2ecf20Sopenharmony_ci# in non-PnP mode, and select the DIGITAL1 input for the mixer. 3698c2ecf20Sopenharmony_ci# 3708c2ecf20Sopenharmony_ci# 3718c2ecf20Sopenharmony_ci#!/bin/sh 3728c2ecf20Sopenharmony_ci# This is a shell archive (produced by GNU sharutils 4.2). 3738c2ecf20Sopenharmony_ci# To extract the files from this archive, save it to some FILE, remove 3748c2ecf20Sopenharmony_ci# everything before the `!/bin/sh' line above, then type `sh FILE'. 3758c2ecf20Sopenharmony_ci# 3768c2ecf20Sopenharmony_ci# Made on 1998-12-04 10:07 EST by <andrewtv@ztransform.velsoft.com>. 3778c2ecf20Sopenharmony_ci# Source directory was `/home/andrewtv/programming/pinnacle/pinnacle'. 3788c2ecf20Sopenharmony_ci# 3798c2ecf20Sopenharmony_ci# Existing files will *not* be overwritten unless `-c' is specified. 3808c2ecf20Sopenharmony_ci# 3818c2ecf20Sopenharmony_ci# This shar contains: 3828c2ecf20Sopenharmony_ci# length mode name 3838c2ecf20Sopenharmony_ci# ------ ---------- ------------------------------------------ 3848c2ecf20Sopenharmony_ci# 2064 -rw-rw-r-- MultiSound.d/setdigital.c 3858c2ecf20Sopenharmony_ci# 10224 -rw-rw-r-- MultiSound.d/pinnaclecfg.c 3868c2ecf20Sopenharmony_ci# 106 -rw-rw-r-- MultiSound.d/Makefile 3878c2ecf20Sopenharmony_ci# 146 -rw-rw-r-- MultiSound.d/conv.l 3888c2ecf20Sopenharmony_ci# 1491 -rw-rw-r-- MultiSound.d/msndreset.c 3898c2ecf20Sopenharmony_ci# 3908c2ecf20Sopenharmony_cisave_IFS="${IFS}" 3918c2ecf20Sopenharmony_ciIFS="${IFS}:" 3928c2ecf20Sopenharmony_cigettext_dir=FAILED 3938c2ecf20Sopenharmony_cilocale_dir=FAILED 3948c2ecf20Sopenharmony_cifirst_param="$1" 3958c2ecf20Sopenharmony_cifor dir in $PATH 3968c2ecf20Sopenharmony_cido 3978c2ecf20Sopenharmony_ci if test "$gettext_dir" = FAILED && test -f $dir/gettext \ 3988c2ecf20Sopenharmony_ci && ($dir/gettext --version >/dev/null 2>&1) 3998c2ecf20Sopenharmony_ci then 4008c2ecf20Sopenharmony_ci set `$dir/gettext --version 2>&1` 4018c2ecf20Sopenharmony_ci if test "$3" = GNU 4028c2ecf20Sopenharmony_ci then 4038c2ecf20Sopenharmony_ci gettext_dir=$dir 4048c2ecf20Sopenharmony_ci fi 4058c2ecf20Sopenharmony_ci fi 4068c2ecf20Sopenharmony_ci if test "$locale_dir" = FAILED && test -f $dir/shar \ 4078c2ecf20Sopenharmony_ci && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) 4088c2ecf20Sopenharmony_ci then 4098c2ecf20Sopenharmony_ci locale_dir=`$dir/shar --print-text-domain-dir` 4108c2ecf20Sopenharmony_ci fi 4118c2ecf20Sopenharmony_cidone 4128c2ecf20Sopenharmony_ciIFS="$save_IFS" 4138c2ecf20Sopenharmony_ciif test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED 4148c2ecf20Sopenharmony_cithen 4158c2ecf20Sopenharmony_ci echo=echo 4168c2ecf20Sopenharmony_cielse 4178c2ecf20Sopenharmony_ci TEXTDOMAINDIR=$locale_dir 4188c2ecf20Sopenharmony_ci export TEXTDOMAINDIR 4198c2ecf20Sopenharmony_ci TEXTDOMAIN=sharutils 4208c2ecf20Sopenharmony_ci export TEXTDOMAIN 4218c2ecf20Sopenharmony_ci echo="$gettext_dir/gettext -s" 4228c2ecf20Sopenharmony_cifi 4238c2ecf20Sopenharmony_citouch -am 1231235999 $$.touch >/dev/null 2>&1 4248c2ecf20Sopenharmony_ciif test ! -f 1231235999 && test -f $$.touch; then 4258c2ecf20Sopenharmony_ci shar_touch=touch 4268c2ecf20Sopenharmony_cielse 4278c2ecf20Sopenharmony_ci shar_touch=: 4288c2ecf20Sopenharmony_ci echo 4298c2ecf20Sopenharmony_ci $echo 'WARNING: not restoring timestamps. Consider getting and' 4308c2ecf20Sopenharmony_ci $echo "installing GNU \`touch', distributed in GNU File Utilities..." 4318c2ecf20Sopenharmony_ci echo 4328c2ecf20Sopenharmony_cifi 4338c2ecf20Sopenharmony_cirm -f 1231235999 $$.touch 4348c2ecf20Sopenharmony_ci# 4358c2ecf20Sopenharmony_ciif mkdir _sh01426; then 4368c2ecf20Sopenharmony_ci $echo 'x -' 'creating lock directory' 4378c2ecf20Sopenharmony_cielse 4388c2ecf20Sopenharmony_ci $echo 'failed to create lock directory' 4398c2ecf20Sopenharmony_ci exit 1 4408c2ecf20Sopenharmony_cifi 4418c2ecf20Sopenharmony_ci# ============= MultiSound.d/setdigital.c ============== 4428c2ecf20Sopenharmony_ciif test ! -d 'MultiSound.d'; then 4438c2ecf20Sopenharmony_ci $echo 'x -' 'creating directory' 'MultiSound.d' 4448c2ecf20Sopenharmony_ci mkdir 'MultiSound.d' 4458c2ecf20Sopenharmony_cifi 4468c2ecf20Sopenharmony_ciif test -f 'MultiSound.d/setdigital.c' && test "$first_param" != -c; then 4478c2ecf20Sopenharmony_ci $echo 'x -' SKIPPING 'MultiSound.d/setdigital.c' '(file already exists)' 4488c2ecf20Sopenharmony_cielse 4498c2ecf20Sopenharmony_ci $echo 'x -' extracting 'MultiSound.d/setdigital.c' '(text)' 4508c2ecf20Sopenharmony_ci sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/setdigital.c' && 4518c2ecf20Sopenharmony_ci/********************************************************************* 4528c2ecf20Sopenharmony_ciX * 4538c2ecf20Sopenharmony_ciX * setdigital.c - sets the DIGITAL1 input for a mixer 4548c2ecf20Sopenharmony_ciX * 4558c2ecf20Sopenharmony_ciX * Copyright (C) 1998 Andrew Veliath 4568c2ecf20Sopenharmony_ciX * 4578c2ecf20Sopenharmony_ciX * This program is free software; you can redistribute it and/or modify 4588c2ecf20Sopenharmony_ciX * it under the terms of the GNU General Public License as published by 4598c2ecf20Sopenharmony_ciX * the Free Software Foundation; either version 2 of the License, or 4608c2ecf20Sopenharmony_ciX * (at your option) any later version. 4618c2ecf20Sopenharmony_ciX * 4628c2ecf20Sopenharmony_ciX * This program is distributed in the hope that it will be useful, 4638c2ecf20Sopenharmony_ciX * but WITHOUT ANY WARRANTY; without even the implied warranty of 4648c2ecf20Sopenharmony_ciX * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 4658c2ecf20Sopenharmony_ciX * GNU General Public License for more details. 4668c2ecf20Sopenharmony_ciX * 4678c2ecf20Sopenharmony_ciX * You should have received a copy of the GNU General Public License 4688c2ecf20Sopenharmony_ciX * along with this program; if not, write to the Free Software 4698c2ecf20Sopenharmony_ciX * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 4708c2ecf20Sopenharmony_ciX * 4718c2ecf20Sopenharmony_ciX ********************************************************************/ 4728c2ecf20Sopenharmony_ciX 4738c2ecf20Sopenharmony_ci#include <stdio.h> 4748c2ecf20Sopenharmony_ci#include <stdlib.h> 4758c2ecf20Sopenharmony_ci#include <unistd.h> 4768c2ecf20Sopenharmony_ci#include <fcntl.h> 4778c2ecf20Sopenharmony_ci#include <sys/types.h> 4788c2ecf20Sopenharmony_ci#include <sys/stat.h> 4798c2ecf20Sopenharmony_ci#include <sys/ioctl.h> 4808c2ecf20Sopenharmony_ci#include <sys/soundcard.h> 4818c2ecf20Sopenharmony_ciX 4828c2ecf20Sopenharmony_ciint main(int argc, char *argv[]) 4838c2ecf20Sopenharmony_ci{ 4848c2ecf20Sopenharmony_ciX int fd; 4858c2ecf20Sopenharmony_ciX unsigned long recmask, recsrc; 4868c2ecf20Sopenharmony_ciX 4878c2ecf20Sopenharmony_ciX if (argc != 2) { 4888c2ecf20Sopenharmony_ciX fprintf(stderr, "usage: setdigital <mixer device>\n"); 4898c2ecf20Sopenharmony_ciX exit(1); 4908c2ecf20Sopenharmony_ciX } 4918c2ecf20Sopenharmony_ciX 4928c2ecf20Sopenharmony_ciX if ((fd = open(argv[1], O_RDWR)) < 0) { 4938c2ecf20Sopenharmony_ciX perror(argv[1]); 4948c2ecf20Sopenharmony_ciX exit(1); 4958c2ecf20Sopenharmony_ciX } 4968c2ecf20Sopenharmony_ciX 4978c2ecf20Sopenharmony_ciX if (ioctl(fd, SOUND_MIXER_READ_RECMASK, &recmask) < 0) { 4988c2ecf20Sopenharmony_ciX fprintf(stderr, "error: ioctl read recording mask failed\n"); 4998c2ecf20Sopenharmony_ciX perror("ioctl"); 5008c2ecf20Sopenharmony_ciX close(fd); 5018c2ecf20Sopenharmony_ciX exit(1); 5028c2ecf20Sopenharmony_ciX } 5038c2ecf20Sopenharmony_ciX 5048c2ecf20Sopenharmony_ciX if (!(recmask & SOUND_MASK_DIGITAL1)) { 5058c2ecf20Sopenharmony_ciX fprintf(stderr, "error: cannot find DIGITAL1 device in mixer\n"); 5068c2ecf20Sopenharmony_ciX close(fd); 5078c2ecf20Sopenharmony_ciX exit(1); 5088c2ecf20Sopenharmony_ciX } 5098c2ecf20Sopenharmony_ciX 5108c2ecf20Sopenharmony_ciX if (ioctl(fd, SOUND_MIXER_READ_RECSRC, &recsrc) < 0) { 5118c2ecf20Sopenharmony_ciX fprintf(stderr, "error: ioctl read recording source failed\n"); 5128c2ecf20Sopenharmony_ciX perror("ioctl"); 5138c2ecf20Sopenharmony_ciX close(fd); 5148c2ecf20Sopenharmony_ciX exit(1); 5158c2ecf20Sopenharmony_ciX } 5168c2ecf20Sopenharmony_ciX 5178c2ecf20Sopenharmony_ciX recsrc |= SOUND_MASK_DIGITAL1; 5188c2ecf20Sopenharmony_ciX 5198c2ecf20Sopenharmony_ciX if (ioctl(fd, SOUND_MIXER_WRITE_RECSRC, &recsrc) < 0) { 5208c2ecf20Sopenharmony_ciX fprintf(stderr, "error: ioctl write recording source failed\n"); 5218c2ecf20Sopenharmony_ciX perror("ioctl"); 5228c2ecf20Sopenharmony_ciX close(fd); 5238c2ecf20Sopenharmony_ciX exit(1); 5248c2ecf20Sopenharmony_ciX } 5258c2ecf20Sopenharmony_ciX 5268c2ecf20Sopenharmony_ciX close(fd); 5278c2ecf20Sopenharmony_ciX 5288c2ecf20Sopenharmony_ciX return 0; 5298c2ecf20Sopenharmony_ci} 5308c2ecf20Sopenharmony_ciSHAR_EOF 5318c2ecf20Sopenharmony_ci $shar_touch -am 1204092598 'MultiSound.d/setdigital.c' && 5328c2ecf20Sopenharmony_ci chmod 0664 'MultiSound.d/setdigital.c' || 5338c2ecf20Sopenharmony_ci $echo 'restore of' 'MultiSound.d/setdigital.c' 'failed' 5348c2ecf20Sopenharmony_ci if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ 5358c2ecf20Sopenharmony_ci && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then 5368c2ecf20Sopenharmony_ci md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 5378c2ecf20Sopenharmony_ci || $echo 'MultiSound.d/setdigital.c:' 'MD5 check failed' 5388c2ecf20Sopenharmony_cie87217fc3e71288102ba41fd81f71ec4 MultiSound.d/setdigital.c 5398c2ecf20Sopenharmony_ciSHAR_EOF 5408c2ecf20Sopenharmony_ci else 5418c2ecf20Sopenharmony_ci shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/setdigital.c'`" 5428c2ecf20Sopenharmony_ci test 2064 -eq "$shar_count" || 5438c2ecf20Sopenharmony_ci $echo 'MultiSound.d/setdigital.c:' 'original size' '2064,' 'current size' "$shar_count!" 5448c2ecf20Sopenharmony_ci fi 5458c2ecf20Sopenharmony_cifi 5468c2ecf20Sopenharmony_ci# ============= MultiSound.d/pinnaclecfg.c ============== 5478c2ecf20Sopenharmony_ciif test -f 'MultiSound.d/pinnaclecfg.c' && test "$first_param" != -c; then 5488c2ecf20Sopenharmony_ci $echo 'x -' SKIPPING 'MultiSound.d/pinnaclecfg.c' '(file already exists)' 5498c2ecf20Sopenharmony_cielse 5508c2ecf20Sopenharmony_ci $echo 'x -' extracting 'MultiSound.d/pinnaclecfg.c' '(text)' 5518c2ecf20Sopenharmony_ci sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/pinnaclecfg.c' && 5528c2ecf20Sopenharmony_ci/********************************************************************* 5538c2ecf20Sopenharmony_ciX * 5548c2ecf20Sopenharmony_ciX * pinnaclecfg.c - Pinnacle/Fiji Device Configuration Program 5558c2ecf20Sopenharmony_ciX * 5568c2ecf20Sopenharmony_ciX * This is for NON-PnP mode only. For PnP mode, use isapnptools. 5578c2ecf20Sopenharmony_ciX * 5588c2ecf20Sopenharmony_ciX * This is Linux-specific, and must be run with root permissions. 5598c2ecf20Sopenharmony_ciX * 5608c2ecf20Sopenharmony_ciX * Part of the Turtle Beach MultiSound Sound Card Driver for Linux 5618c2ecf20Sopenharmony_ciX * 5628c2ecf20Sopenharmony_ciX * Copyright (C) 1998 Andrew Veliath 5638c2ecf20Sopenharmony_ciX * 5648c2ecf20Sopenharmony_ciX * This program is free software; you can redistribute it and/or modify 5658c2ecf20Sopenharmony_ciX * it under the terms of the GNU General Public License as published by 5668c2ecf20Sopenharmony_ciX * the Free Software Foundation; either version 2 of the License, or 5678c2ecf20Sopenharmony_ciX * (at your option) any later version. 5688c2ecf20Sopenharmony_ciX * 5698c2ecf20Sopenharmony_ciX * This program is distributed in the hope that it will be useful, 5708c2ecf20Sopenharmony_ciX * but WITHOUT ANY WARRANTY; without even the implied warranty of 5718c2ecf20Sopenharmony_ciX * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 5728c2ecf20Sopenharmony_ciX * GNU General Public License for more details. 5738c2ecf20Sopenharmony_ciX * 5748c2ecf20Sopenharmony_ciX * You should have received a copy of the GNU General Public License 5758c2ecf20Sopenharmony_ciX * along with this program; if not, write to the Free Software 5768c2ecf20Sopenharmony_ciX * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 5778c2ecf20Sopenharmony_ciX * 5788c2ecf20Sopenharmony_ciX ********************************************************************/ 5798c2ecf20Sopenharmony_ciX 5808c2ecf20Sopenharmony_ci#include <stdio.h> 5818c2ecf20Sopenharmony_ci#include <stdlib.h> 5828c2ecf20Sopenharmony_ci#include <string.h> 5838c2ecf20Sopenharmony_ci#include <errno.h> 5848c2ecf20Sopenharmony_ci#include <unistd.h> 5858c2ecf20Sopenharmony_ci#include <asm/types.h> 5868c2ecf20Sopenharmony_ci#include <sys/io.h> 5878c2ecf20Sopenharmony_ciX 5888c2ecf20Sopenharmony_ci#define IREG_LOGDEVICE 0x07 5898c2ecf20Sopenharmony_ci#define IREG_ACTIVATE 0x30 5908c2ecf20Sopenharmony_ci#define LD_ACTIVATE 0x01 5918c2ecf20Sopenharmony_ci#define LD_DISACTIVATE 0x00 5928c2ecf20Sopenharmony_ci#define IREG_EECONTROL 0x3F 5938c2ecf20Sopenharmony_ci#define IREG_MEMBASEHI 0x40 5948c2ecf20Sopenharmony_ci#define IREG_MEMBASELO 0x41 5958c2ecf20Sopenharmony_ci#define IREG_MEMCONTROL 0x42 5968c2ecf20Sopenharmony_ci#define IREG_MEMRANGEHI 0x43 5978c2ecf20Sopenharmony_ci#define IREG_MEMRANGELO 0x44 5988c2ecf20Sopenharmony_ci#define MEMTYPE_8BIT 0x00 5998c2ecf20Sopenharmony_ci#define MEMTYPE_16BIT 0x02 6008c2ecf20Sopenharmony_ci#define MEMTYPE_RANGE 0x00 6018c2ecf20Sopenharmony_ci#define MEMTYPE_HIADDR 0x01 6028c2ecf20Sopenharmony_ci#define IREG_IO0_BASEHI 0x60 6038c2ecf20Sopenharmony_ci#define IREG_IO0_BASELO 0x61 6048c2ecf20Sopenharmony_ci#define IREG_IO1_BASEHI 0x62 6058c2ecf20Sopenharmony_ci#define IREG_IO1_BASELO 0x63 6068c2ecf20Sopenharmony_ci#define IREG_IRQ_NUMBER 0x70 6078c2ecf20Sopenharmony_ci#define IREG_IRQ_TYPE 0x71 6088c2ecf20Sopenharmony_ci#define IRQTYPE_HIGH 0x02 6098c2ecf20Sopenharmony_ci#define IRQTYPE_LOW 0x00 6108c2ecf20Sopenharmony_ci#define IRQTYPE_LEVEL 0x01 6118c2ecf20Sopenharmony_ci#define IRQTYPE_EDGE 0x00 6128c2ecf20Sopenharmony_ciX 6138c2ecf20Sopenharmony_ci#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) 6148c2ecf20Sopenharmony_ci#define LOBYTE(w) ((BYTE)(w)) 6158c2ecf20Sopenharmony_ci#define MAKEWORD(low,hi) ((WORD)(((BYTE)(low))|(((WORD)((BYTE)(hi)))<<8))) 6168c2ecf20Sopenharmony_ciX 6178c2ecf20Sopenharmony_citypedef __u8 BYTE; 6188c2ecf20Sopenharmony_citypedef __u16 USHORT; 6198c2ecf20Sopenharmony_citypedef __u16 WORD; 6208c2ecf20Sopenharmony_ciX 6218c2ecf20Sopenharmony_cistatic int config_port = -1; 6228c2ecf20Sopenharmony_ciX 6238c2ecf20Sopenharmony_cistatic int msnd_write_cfg(int cfg, int reg, int value) 6248c2ecf20Sopenharmony_ci{ 6258c2ecf20Sopenharmony_ciX outb(reg, cfg); 6268c2ecf20Sopenharmony_ciX outb(value, cfg + 1); 6278c2ecf20Sopenharmony_ciX if (value != inb(cfg + 1)) { 6288c2ecf20Sopenharmony_ciX fprintf(stderr, "error: msnd_write_cfg: I/O error\n"); 6298c2ecf20Sopenharmony_ciX return -EIO; 6308c2ecf20Sopenharmony_ciX } 6318c2ecf20Sopenharmony_ciX return 0; 6328c2ecf20Sopenharmony_ci} 6338c2ecf20Sopenharmony_ciX 6348c2ecf20Sopenharmony_cistatic int msnd_read_cfg(int cfg, int reg) 6358c2ecf20Sopenharmony_ci{ 6368c2ecf20Sopenharmony_ciX outb(reg, cfg); 6378c2ecf20Sopenharmony_ciX return inb(cfg + 1); 6388c2ecf20Sopenharmony_ci} 6398c2ecf20Sopenharmony_ciX 6408c2ecf20Sopenharmony_cistatic int msnd_write_cfg_io0(int cfg, int num, WORD io) 6418c2ecf20Sopenharmony_ci{ 6428c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 6438c2ecf20Sopenharmony_ciX return -EIO; 6448c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io))) 6458c2ecf20Sopenharmony_ciX return -EIO; 6468c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io))) 6478c2ecf20Sopenharmony_ciX return -EIO; 6488c2ecf20Sopenharmony_ciX return 0; 6498c2ecf20Sopenharmony_ci} 6508c2ecf20Sopenharmony_ciX 6518c2ecf20Sopenharmony_cistatic int msnd_read_cfg_io0(int cfg, int num, WORD *io) 6528c2ecf20Sopenharmony_ci{ 6538c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 6548c2ecf20Sopenharmony_ciX return -EIO; 6558c2ecf20Sopenharmony_ciX 6568c2ecf20Sopenharmony_ciX *io = MAKEWORD(msnd_read_cfg(cfg, IREG_IO0_BASELO), 6578c2ecf20Sopenharmony_ciX msnd_read_cfg(cfg, IREG_IO0_BASEHI)); 6588c2ecf20Sopenharmony_ciX 6598c2ecf20Sopenharmony_ciX return 0; 6608c2ecf20Sopenharmony_ci} 6618c2ecf20Sopenharmony_ciX 6628c2ecf20Sopenharmony_cistatic int msnd_write_cfg_io1(int cfg, int num, WORD io) 6638c2ecf20Sopenharmony_ci{ 6648c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 6658c2ecf20Sopenharmony_ciX return -EIO; 6668c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_IO1_BASEHI, HIBYTE(io))) 6678c2ecf20Sopenharmony_ciX return -EIO; 6688c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_IO1_BASELO, LOBYTE(io))) 6698c2ecf20Sopenharmony_ciX return -EIO; 6708c2ecf20Sopenharmony_ciX return 0; 6718c2ecf20Sopenharmony_ci} 6728c2ecf20Sopenharmony_ciX 6738c2ecf20Sopenharmony_cistatic int msnd_read_cfg_io1(int cfg, int num, WORD *io) 6748c2ecf20Sopenharmony_ci{ 6758c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 6768c2ecf20Sopenharmony_ciX return -EIO; 6778c2ecf20Sopenharmony_ciX 6788c2ecf20Sopenharmony_ciX *io = MAKEWORD(msnd_read_cfg(cfg, IREG_IO1_BASELO), 6798c2ecf20Sopenharmony_ciX msnd_read_cfg(cfg, IREG_IO1_BASEHI)); 6808c2ecf20Sopenharmony_ciX 6818c2ecf20Sopenharmony_ciX return 0; 6828c2ecf20Sopenharmony_ci} 6838c2ecf20Sopenharmony_ciX 6848c2ecf20Sopenharmony_cistatic int msnd_write_cfg_irq(int cfg, int num, WORD irq) 6858c2ecf20Sopenharmony_ci{ 6868c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 6878c2ecf20Sopenharmony_ciX return -EIO; 6888c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_IRQ_NUMBER, LOBYTE(irq))) 6898c2ecf20Sopenharmony_ciX return -EIO; 6908c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_IRQ_TYPE, IRQTYPE_EDGE)) 6918c2ecf20Sopenharmony_ciX return -EIO; 6928c2ecf20Sopenharmony_ciX return 0; 6938c2ecf20Sopenharmony_ci} 6948c2ecf20Sopenharmony_ciX 6958c2ecf20Sopenharmony_cistatic int msnd_read_cfg_irq(int cfg, int num, WORD *irq) 6968c2ecf20Sopenharmony_ci{ 6978c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 6988c2ecf20Sopenharmony_ciX return -EIO; 6998c2ecf20Sopenharmony_ciX 7008c2ecf20Sopenharmony_ciX *irq = msnd_read_cfg(cfg, IREG_IRQ_NUMBER); 7018c2ecf20Sopenharmony_ciX 7028c2ecf20Sopenharmony_ciX return 0; 7038c2ecf20Sopenharmony_ci} 7048c2ecf20Sopenharmony_ciX 7058c2ecf20Sopenharmony_cistatic int msnd_write_cfg_mem(int cfg, int num, int mem) 7068c2ecf20Sopenharmony_ci{ 7078c2ecf20Sopenharmony_ciX WORD wmem; 7088c2ecf20Sopenharmony_ciX 7098c2ecf20Sopenharmony_ciX mem >>= 8; 7108c2ecf20Sopenharmony_ciX mem &= 0xfff; 7118c2ecf20Sopenharmony_ciX wmem = (WORD)mem; 7128c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 7138c2ecf20Sopenharmony_ciX return -EIO; 7148c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_MEMBASEHI, HIBYTE(wmem))) 7158c2ecf20Sopenharmony_ciX return -EIO; 7168c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_MEMBASELO, LOBYTE(wmem))) 7178c2ecf20Sopenharmony_ciX return -EIO; 7188c2ecf20Sopenharmony_ciX if (wmem && msnd_write_cfg(cfg, IREG_MEMCONTROL, (MEMTYPE_HIADDR | MEMTYPE_16BIT))) 7198c2ecf20Sopenharmony_ciX return -EIO; 7208c2ecf20Sopenharmony_ciX return 0; 7218c2ecf20Sopenharmony_ci} 7228c2ecf20Sopenharmony_ciX 7238c2ecf20Sopenharmony_cistatic int msnd_read_cfg_mem(int cfg, int num, int *mem) 7248c2ecf20Sopenharmony_ci{ 7258c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 7268c2ecf20Sopenharmony_ciX return -EIO; 7278c2ecf20Sopenharmony_ciX 7288c2ecf20Sopenharmony_ciX *mem = MAKEWORD(msnd_read_cfg(cfg, IREG_MEMBASELO), 7298c2ecf20Sopenharmony_ciX msnd_read_cfg(cfg, IREG_MEMBASEHI)); 7308c2ecf20Sopenharmony_ciX *mem <<= 8; 7318c2ecf20Sopenharmony_ciX 7328c2ecf20Sopenharmony_ciX return 0; 7338c2ecf20Sopenharmony_ci} 7348c2ecf20Sopenharmony_ciX 7358c2ecf20Sopenharmony_cistatic int msnd_activate_logical(int cfg, int num) 7368c2ecf20Sopenharmony_ci{ 7378c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 7388c2ecf20Sopenharmony_ciX return -EIO; 7398c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_ACTIVATE, LD_ACTIVATE)) 7408c2ecf20Sopenharmony_ciX return -EIO; 7418c2ecf20Sopenharmony_ciX return 0; 7428c2ecf20Sopenharmony_ci} 7438c2ecf20Sopenharmony_ciX 7448c2ecf20Sopenharmony_cistatic int msnd_write_cfg_logical(int cfg, int num, WORD io0, WORD io1, WORD irq, int mem) 7458c2ecf20Sopenharmony_ci{ 7468c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 7478c2ecf20Sopenharmony_ciX return -EIO; 7488c2ecf20Sopenharmony_ciX if (msnd_write_cfg_io0(cfg, num, io0)) 7498c2ecf20Sopenharmony_ciX return -EIO; 7508c2ecf20Sopenharmony_ciX if (msnd_write_cfg_io1(cfg, num, io1)) 7518c2ecf20Sopenharmony_ciX return -EIO; 7528c2ecf20Sopenharmony_ciX if (msnd_write_cfg_irq(cfg, num, irq)) 7538c2ecf20Sopenharmony_ciX return -EIO; 7548c2ecf20Sopenharmony_ciX if (msnd_write_cfg_mem(cfg, num, mem)) 7558c2ecf20Sopenharmony_ciX return -EIO; 7568c2ecf20Sopenharmony_ciX if (msnd_activate_logical(cfg, num)) 7578c2ecf20Sopenharmony_ciX return -EIO; 7588c2ecf20Sopenharmony_ciX return 0; 7598c2ecf20Sopenharmony_ci} 7608c2ecf20Sopenharmony_ciX 7618c2ecf20Sopenharmony_cistatic int msnd_read_cfg_logical(int cfg, int num, WORD *io0, WORD *io1, WORD *irq, int *mem) 7628c2ecf20Sopenharmony_ci{ 7638c2ecf20Sopenharmony_ciX if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 7648c2ecf20Sopenharmony_ciX return -EIO; 7658c2ecf20Sopenharmony_ciX if (msnd_read_cfg_io0(cfg, num, io0)) 7668c2ecf20Sopenharmony_ciX return -EIO; 7678c2ecf20Sopenharmony_ciX if (msnd_read_cfg_io1(cfg, num, io1)) 7688c2ecf20Sopenharmony_ciX return -EIO; 7698c2ecf20Sopenharmony_ciX if (msnd_read_cfg_irq(cfg, num, irq)) 7708c2ecf20Sopenharmony_ciX return -EIO; 7718c2ecf20Sopenharmony_ciX if (msnd_read_cfg_mem(cfg, num, mem)) 7728c2ecf20Sopenharmony_ciX return -EIO; 7738c2ecf20Sopenharmony_ciX return 0; 7748c2ecf20Sopenharmony_ci} 7758c2ecf20Sopenharmony_ciX 7768c2ecf20Sopenharmony_cistatic void usage(void) 7778c2ecf20Sopenharmony_ci{ 7788c2ecf20Sopenharmony_ciX fprintf(stderr, 7798c2ecf20Sopenharmony_ciX "\n" 7808c2ecf20Sopenharmony_ciX "pinnaclecfg 1.0\n" 7818c2ecf20Sopenharmony_ciX "\n" 7828c2ecf20Sopenharmony_ciX "usage: pinnaclecfg <config port> [device config]\n" 7838c2ecf20Sopenharmony_ciX "\n" 7848c2ecf20Sopenharmony_ciX "This is for use with the card in NON-PnP mode only.\n" 7858c2ecf20Sopenharmony_ciX "\n" 7868c2ecf20Sopenharmony_ciX "Available devices (not all available for Fiji):\n" 7878c2ecf20Sopenharmony_ciX "\n" 7888c2ecf20Sopenharmony_ciX " Device Description\n" 7898c2ecf20Sopenharmony_ciX " -------------------------------------------------------------------\n" 7908c2ecf20Sopenharmony_ciX " reset Reset all devices (i.e. disable)\n" 7918c2ecf20Sopenharmony_ciX " show Display current device configurations\n" 7928c2ecf20Sopenharmony_ciX "\n" 7938c2ecf20Sopenharmony_ciX " dsp <io> <irq> <mem> Audio device\n" 7948c2ecf20Sopenharmony_ciX " mpu <io> <irq> Internal Kurzweil synth\n" 7958c2ecf20Sopenharmony_ciX " ide <io0> <io1> <irq> On-board IDE controller\n" 7968c2ecf20Sopenharmony_ciX " joystick <io> Joystick port\n" 7978c2ecf20Sopenharmony_ciX "\n"); 7988c2ecf20Sopenharmony_ciX exit(1); 7998c2ecf20Sopenharmony_ci} 8008c2ecf20Sopenharmony_ciX 8018c2ecf20Sopenharmony_cistatic int cfg_reset(void) 8028c2ecf20Sopenharmony_ci{ 8038c2ecf20Sopenharmony_ciX int i; 8048c2ecf20Sopenharmony_ciX 8058c2ecf20Sopenharmony_ciX for (i = 0; i < 4; ++i) 8068c2ecf20Sopenharmony_ciX msnd_write_cfg_logical(config_port, i, 0, 0, 0, 0); 8078c2ecf20Sopenharmony_ciX 8088c2ecf20Sopenharmony_ciX return 0; 8098c2ecf20Sopenharmony_ci} 8108c2ecf20Sopenharmony_ciX 8118c2ecf20Sopenharmony_cistatic int cfg_show(void) 8128c2ecf20Sopenharmony_ci{ 8138c2ecf20Sopenharmony_ciX int i; 8148c2ecf20Sopenharmony_ciX int count = 0; 8158c2ecf20Sopenharmony_ciX 8168c2ecf20Sopenharmony_ciX for (i = 0; i < 4; ++i) { 8178c2ecf20Sopenharmony_ciX WORD io0, io1, irq; 8188c2ecf20Sopenharmony_ciX int mem; 8198c2ecf20Sopenharmony_ciX msnd_read_cfg_logical(config_port, i, &io0, &io1, &irq, &mem); 8208c2ecf20Sopenharmony_ciX switch (i) { 8218c2ecf20Sopenharmony_ciX case 0: 8228c2ecf20Sopenharmony_ciX if (io0 || irq || mem) { 8238c2ecf20Sopenharmony_ciX printf("dsp 0x%x %d 0x%x\n", io0, irq, mem); 8248c2ecf20Sopenharmony_ciX ++count; 8258c2ecf20Sopenharmony_ciX } 8268c2ecf20Sopenharmony_ciX break; 8278c2ecf20Sopenharmony_ciX case 1: 8288c2ecf20Sopenharmony_ciX if (io0 || irq) { 8298c2ecf20Sopenharmony_ciX printf("mpu 0x%x %d\n", io0, irq); 8308c2ecf20Sopenharmony_ciX ++count; 8318c2ecf20Sopenharmony_ciX } 8328c2ecf20Sopenharmony_ciX break; 8338c2ecf20Sopenharmony_ciX case 2: 8348c2ecf20Sopenharmony_ciX if (io0 || io1 || irq) { 8358c2ecf20Sopenharmony_ciX printf("ide 0x%x 0x%x %d\n", io0, io1, irq); 8368c2ecf20Sopenharmony_ciX ++count; 8378c2ecf20Sopenharmony_ciX } 8388c2ecf20Sopenharmony_ciX break; 8398c2ecf20Sopenharmony_ciX case 3: 8408c2ecf20Sopenharmony_ciX if (io0) { 8418c2ecf20Sopenharmony_ciX printf("joystick 0x%x\n", io0); 8428c2ecf20Sopenharmony_ciX ++count; 8438c2ecf20Sopenharmony_ciX } 8448c2ecf20Sopenharmony_ciX break; 8458c2ecf20Sopenharmony_ciX } 8468c2ecf20Sopenharmony_ciX } 8478c2ecf20Sopenharmony_ciX 8488c2ecf20Sopenharmony_ciX if (count == 0) 8498c2ecf20Sopenharmony_ciX fprintf(stderr, "no devices configured\n"); 8508c2ecf20Sopenharmony_ciX 8518c2ecf20Sopenharmony_ciX return 0; 8528c2ecf20Sopenharmony_ci} 8538c2ecf20Sopenharmony_ciX 8548c2ecf20Sopenharmony_cistatic int cfg_dsp(int argc, char *argv[]) 8558c2ecf20Sopenharmony_ci{ 8568c2ecf20Sopenharmony_ciX int io, irq, mem; 8578c2ecf20Sopenharmony_ciX 8588c2ecf20Sopenharmony_ciX if (argc < 3 || 8598c2ecf20Sopenharmony_ciX sscanf(argv[0], "0x%x", &io) != 1 || 8608c2ecf20Sopenharmony_ciX sscanf(argv[1], "%d", &irq) != 1 || 8618c2ecf20Sopenharmony_ciX sscanf(argv[2], "0x%x", &mem) != 1) 8628c2ecf20Sopenharmony_ciX usage(); 8638c2ecf20Sopenharmony_ciX 8648c2ecf20Sopenharmony_ciX if (!(io == 0x290 || 8658c2ecf20Sopenharmony_ciX io == 0x260 || 8668c2ecf20Sopenharmony_ciX io == 0x250 || 8678c2ecf20Sopenharmony_ciX io == 0x240 || 8688c2ecf20Sopenharmony_ciX io == 0x230 || 8698c2ecf20Sopenharmony_ciX io == 0x220 || 8708c2ecf20Sopenharmony_ciX io == 0x210 || 8718c2ecf20Sopenharmony_ciX io == 0x3e0)) { 8728c2ecf20Sopenharmony_ciX fprintf(stderr, "error: io must be one of " 8738c2ecf20Sopenharmony_ciX "210, 220, 230, 240, 250, 260, 290, or 3E0\n"); 8748c2ecf20Sopenharmony_ciX usage(); 8758c2ecf20Sopenharmony_ciX } 8768c2ecf20Sopenharmony_ciX 8778c2ecf20Sopenharmony_ciX if (!(irq == 5 || 8788c2ecf20Sopenharmony_ciX irq == 7 || 8798c2ecf20Sopenharmony_ciX irq == 9 || 8808c2ecf20Sopenharmony_ciX irq == 10 || 8818c2ecf20Sopenharmony_ciX irq == 11 || 8828c2ecf20Sopenharmony_ciX irq == 12)) { 8838c2ecf20Sopenharmony_ciX fprintf(stderr, "error: irq must be one of " 8848c2ecf20Sopenharmony_ciX "5, 7, 9, 10, 11 or 12\n"); 8858c2ecf20Sopenharmony_ciX usage(); 8868c2ecf20Sopenharmony_ciX } 8878c2ecf20Sopenharmony_ciX 8888c2ecf20Sopenharmony_ciX if (!(mem == 0xb0000 || 8898c2ecf20Sopenharmony_ciX mem == 0xc8000 || 8908c2ecf20Sopenharmony_ciX mem == 0xd0000 || 8918c2ecf20Sopenharmony_ciX mem == 0xd8000 || 8928c2ecf20Sopenharmony_ciX mem == 0xe0000 || 8938c2ecf20Sopenharmony_ciX mem == 0xe8000)) { 8948c2ecf20Sopenharmony_ciX fprintf(stderr, "error: mem must be one of " 8958c2ecf20Sopenharmony_ciX "0xb0000, 0xc8000, 0xd0000, 0xd8000, 0xe0000 or 0xe8000\n"); 8968c2ecf20Sopenharmony_ciX usage(); 8978c2ecf20Sopenharmony_ciX } 8988c2ecf20Sopenharmony_ciX 8998c2ecf20Sopenharmony_ciX return msnd_write_cfg_logical(config_port, 0, io, 0, irq, mem); 9008c2ecf20Sopenharmony_ci} 9018c2ecf20Sopenharmony_ciX 9028c2ecf20Sopenharmony_cistatic int cfg_mpu(int argc, char *argv[]) 9038c2ecf20Sopenharmony_ci{ 9048c2ecf20Sopenharmony_ciX int io, irq; 9058c2ecf20Sopenharmony_ciX 9068c2ecf20Sopenharmony_ciX if (argc < 2 || 9078c2ecf20Sopenharmony_ciX sscanf(argv[0], "0x%x", &io) != 1 || 9088c2ecf20Sopenharmony_ciX sscanf(argv[1], "%d", &irq) != 1) 9098c2ecf20Sopenharmony_ciX usage(); 9108c2ecf20Sopenharmony_ciX 9118c2ecf20Sopenharmony_ciX return msnd_write_cfg_logical(config_port, 1, io, 0, irq, 0); 9128c2ecf20Sopenharmony_ci} 9138c2ecf20Sopenharmony_ciX 9148c2ecf20Sopenharmony_cistatic int cfg_ide(int argc, char *argv[]) 9158c2ecf20Sopenharmony_ci{ 9168c2ecf20Sopenharmony_ciX int io0, io1, irq; 9178c2ecf20Sopenharmony_ciX 9188c2ecf20Sopenharmony_ciX if (argc < 3 || 9198c2ecf20Sopenharmony_ciX sscanf(argv[0], "0x%x", &io0) != 1 || 9208c2ecf20Sopenharmony_ciX sscanf(argv[0], "0x%x", &io1) != 1 || 9218c2ecf20Sopenharmony_ciX sscanf(argv[1], "%d", &irq) != 1) 9228c2ecf20Sopenharmony_ciX usage(); 9238c2ecf20Sopenharmony_ciX 9248c2ecf20Sopenharmony_ciX return msnd_write_cfg_logical(config_port, 2, io0, io1, irq, 0); 9258c2ecf20Sopenharmony_ci} 9268c2ecf20Sopenharmony_ciX 9278c2ecf20Sopenharmony_cistatic int cfg_joystick(int argc, char *argv[]) 9288c2ecf20Sopenharmony_ci{ 9298c2ecf20Sopenharmony_ciX int io; 9308c2ecf20Sopenharmony_ciX 9318c2ecf20Sopenharmony_ciX if (argc < 1 || 9328c2ecf20Sopenharmony_ciX sscanf(argv[0], "0x%x", &io) != 1) 9338c2ecf20Sopenharmony_ciX usage(); 9348c2ecf20Sopenharmony_ciX 9358c2ecf20Sopenharmony_ciX return msnd_write_cfg_logical(config_port, 3, io, 0, 0, 0); 9368c2ecf20Sopenharmony_ci} 9378c2ecf20Sopenharmony_ciX 9388c2ecf20Sopenharmony_ciint main(int argc, char *argv[]) 9398c2ecf20Sopenharmony_ci{ 9408c2ecf20Sopenharmony_ciX char *device; 9418c2ecf20Sopenharmony_ciX int rv = 0; 9428c2ecf20Sopenharmony_ciX 9438c2ecf20Sopenharmony_ciX --argc; ++argv; 9448c2ecf20Sopenharmony_ciX 9458c2ecf20Sopenharmony_ciX if (argc < 2) 9468c2ecf20Sopenharmony_ciX usage(); 9478c2ecf20Sopenharmony_ciX 9488c2ecf20Sopenharmony_ciX sscanf(argv[0], "0x%x", &config_port); 9498c2ecf20Sopenharmony_ciX if (config_port != 0x250 && config_port != 0x260 && config_port != 0x270) { 9508c2ecf20Sopenharmony_ciX fprintf(stderr, "error: <config port> must be 0x250, 0x260 or 0x270\n"); 9518c2ecf20Sopenharmony_ciX exit(1); 9528c2ecf20Sopenharmony_ciX } 9538c2ecf20Sopenharmony_ciX if (ioperm(config_port, 2, 1)) { 9548c2ecf20Sopenharmony_ciX perror("ioperm"); 9558c2ecf20Sopenharmony_ciX fprintf(stderr, "note: pinnaclecfg must be run as root\n"); 9568c2ecf20Sopenharmony_ciX exit(1); 9578c2ecf20Sopenharmony_ciX } 9588c2ecf20Sopenharmony_ciX device = argv[1]; 9598c2ecf20Sopenharmony_ciX 9608c2ecf20Sopenharmony_ciX argc -= 2; argv += 2; 9618c2ecf20Sopenharmony_ciX 9628c2ecf20Sopenharmony_ciX if (strcmp(device, "reset") == 0) 9638c2ecf20Sopenharmony_ciX rv = cfg_reset(); 9648c2ecf20Sopenharmony_ciX else if (strcmp(device, "show") == 0) 9658c2ecf20Sopenharmony_ciX rv = cfg_show(); 9668c2ecf20Sopenharmony_ciX else if (strcmp(device, "dsp") == 0) 9678c2ecf20Sopenharmony_ciX rv = cfg_dsp(argc, argv); 9688c2ecf20Sopenharmony_ciX else if (strcmp(device, "mpu") == 0) 9698c2ecf20Sopenharmony_ciX rv = cfg_mpu(argc, argv); 9708c2ecf20Sopenharmony_ciX else if (strcmp(device, "ide") == 0) 9718c2ecf20Sopenharmony_ciX rv = cfg_ide(argc, argv); 9728c2ecf20Sopenharmony_ciX else if (strcmp(device, "joystick") == 0) 9738c2ecf20Sopenharmony_ciX rv = cfg_joystick(argc, argv); 9748c2ecf20Sopenharmony_ciX else { 9758c2ecf20Sopenharmony_ciX fprintf(stderr, "error: unknown device %s\n", device); 9768c2ecf20Sopenharmony_ciX usage(); 9778c2ecf20Sopenharmony_ciX } 9788c2ecf20Sopenharmony_ciX 9798c2ecf20Sopenharmony_ciX if (rv) 9808c2ecf20Sopenharmony_ciX fprintf(stderr, "error: device configuration failed\n"); 9818c2ecf20Sopenharmony_ciX 9828c2ecf20Sopenharmony_ciX return 0; 9838c2ecf20Sopenharmony_ci} 9848c2ecf20Sopenharmony_ciSHAR_EOF 9858c2ecf20Sopenharmony_ci $shar_touch -am 1204092598 'MultiSound.d/pinnaclecfg.c' && 9868c2ecf20Sopenharmony_ci chmod 0664 'MultiSound.d/pinnaclecfg.c' || 9878c2ecf20Sopenharmony_ci $echo 'restore of' 'MultiSound.d/pinnaclecfg.c' 'failed' 9888c2ecf20Sopenharmony_ci if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ 9898c2ecf20Sopenharmony_ci && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then 9908c2ecf20Sopenharmony_ci md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 9918c2ecf20Sopenharmony_ci || $echo 'MultiSound.d/pinnaclecfg.c:' 'MD5 check failed' 9928c2ecf20Sopenharmony_ci366bdf27f0db767a3c7921d0a6db20fe MultiSound.d/pinnaclecfg.c 9938c2ecf20Sopenharmony_ciSHAR_EOF 9948c2ecf20Sopenharmony_ci else 9958c2ecf20Sopenharmony_ci shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/pinnaclecfg.c'`" 9968c2ecf20Sopenharmony_ci test 10224 -eq "$shar_count" || 9978c2ecf20Sopenharmony_ci $echo 'MultiSound.d/pinnaclecfg.c:' 'original size' '10224,' 'current size' "$shar_count!" 9988c2ecf20Sopenharmony_ci fi 9998c2ecf20Sopenharmony_cifi 10008c2ecf20Sopenharmony_ci# ============= MultiSound.d/Makefile ============== 10018c2ecf20Sopenharmony_ciif test -f 'MultiSound.d/Makefile' && test "$first_param" != -c; then 10028c2ecf20Sopenharmony_ci $echo 'x -' SKIPPING 'MultiSound.d/Makefile' '(file already exists)' 10038c2ecf20Sopenharmony_cielse 10048c2ecf20Sopenharmony_ci $echo 'x -' extracting 'MultiSound.d/Makefile' '(text)' 10058c2ecf20Sopenharmony_ci sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/Makefile' && 10068c2ecf20Sopenharmony_ciCC = gcc 10078c2ecf20Sopenharmony_ciCFLAGS = -O 10088c2ecf20Sopenharmony_ciPROGS = setdigital msndreset pinnaclecfg conv 10098c2ecf20Sopenharmony_ciX 10108c2ecf20Sopenharmony_ciall: $(PROGS) 10118c2ecf20Sopenharmony_ciX 10128c2ecf20Sopenharmony_ciclean: 10138c2ecf20Sopenharmony_ciX rm -f $(PROGS) 10148c2ecf20Sopenharmony_ciSHAR_EOF 10158c2ecf20Sopenharmony_ci $shar_touch -am 1204092398 'MultiSound.d/Makefile' && 10168c2ecf20Sopenharmony_ci chmod 0664 'MultiSound.d/Makefile' || 10178c2ecf20Sopenharmony_ci $echo 'restore of' 'MultiSound.d/Makefile' 'failed' 10188c2ecf20Sopenharmony_ci if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ 10198c2ecf20Sopenharmony_ci && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then 10208c2ecf20Sopenharmony_ci md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 10218c2ecf20Sopenharmony_ci || $echo 'MultiSound.d/Makefile:' 'MD5 check failed' 10228c2ecf20Sopenharmony_ci76ca8bb44e3882edcf79c97df6c81845 MultiSound.d/Makefile 10238c2ecf20Sopenharmony_ciSHAR_EOF 10248c2ecf20Sopenharmony_ci else 10258c2ecf20Sopenharmony_ci shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/Makefile'`" 10268c2ecf20Sopenharmony_ci test 106 -eq "$shar_count" || 10278c2ecf20Sopenharmony_ci $echo 'MultiSound.d/Makefile:' 'original size' '106,' 'current size' "$shar_count!" 10288c2ecf20Sopenharmony_ci fi 10298c2ecf20Sopenharmony_cifi 10308c2ecf20Sopenharmony_ci# ============= MultiSound.d/conv.l ============== 10318c2ecf20Sopenharmony_ciif test -f 'MultiSound.d/conv.l' && test "$first_param" != -c; then 10328c2ecf20Sopenharmony_ci $echo 'x -' SKIPPING 'MultiSound.d/conv.l' '(file already exists)' 10338c2ecf20Sopenharmony_cielse 10348c2ecf20Sopenharmony_ci $echo 'x -' extracting 'MultiSound.d/conv.l' '(text)' 10358c2ecf20Sopenharmony_ci sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/conv.l' && 10368c2ecf20Sopenharmony_ci%% 10378c2ecf20Sopenharmony_ci[ \n\t,\r] 10388c2ecf20Sopenharmony_ci\;.* 10398c2ecf20Sopenharmony_ciDB 10408c2ecf20Sopenharmony_ci[0-9A-Fa-f]+H { int n; sscanf(yytext, "%xH", &n); printf("%c", n); } 10418c2ecf20Sopenharmony_ci%% 10428c2ecf20Sopenharmony_ciint yywrap() { return 1; } 10438c2ecf20Sopenharmony_civoid main() { yylex(); } 10448c2ecf20Sopenharmony_ciSHAR_EOF 10458c2ecf20Sopenharmony_ci $shar_touch -am 0828231798 'MultiSound.d/conv.l' && 10468c2ecf20Sopenharmony_ci chmod 0664 'MultiSound.d/conv.l' || 10478c2ecf20Sopenharmony_ci $echo 'restore of' 'MultiSound.d/conv.l' 'failed' 10488c2ecf20Sopenharmony_ci if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ 10498c2ecf20Sopenharmony_ci && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then 10508c2ecf20Sopenharmony_ci md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 10518c2ecf20Sopenharmony_ci || $echo 'MultiSound.d/conv.l:' 'MD5 check failed' 10528c2ecf20Sopenharmony_cid2411fc32cd71a00dcdc1f009e858dd2 MultiSound.d/conv.l 10538c2ecf20Sopenharmony_ciSHAR_EOF 10548c2ecf20Sopenharmony_ci else 10558c2ecf20Sopenharmony_ci shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/conv.l'`" 10568c2ecf20Sopenharmony_ci test 146 -eq "$shar_count" || 10578c2ecf20Sopenharmony_ci $echo 'MultiSound.d/conv.l:' 'original size' '146,' 'current size' "$shar_count!" 10588c2ecf20Sopenharmony_ci fi 10598c2ecf20Sopenharmony_cifi 10608c2ecf20Sopenharmony_ci# ============= MultiSound.d/msndreset.c ============== 10618c2ecf20Sopenharmony_ciif test -f 'MultiSound.d/msndreset.c' && test "$first_param" != -c; then 10628c2ecf20Sopenharmony_ci $echo 'x -' SKIPPING 'MultiSound.d/msndreset.c' '(file already exists)' 10638c2ecf20Sopenharmony_cielse 10648c2ecf20Sopenharmony_ci $echo 'x -' extracting 'MultiSound.d/msndreset.c' '(text)' 10658c2ecf20Sopenharmony_ci sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/msndreset.c' && 10668c2ecf20Sopenharmony_ci/********************************************************************* 10678c2ecf20Sopenharmony_ciX * 10688c2ecf20Sopenharmony_ciX * msndreset.c - resets the MultiSound card 10698c2ecf20Sopenharmony_ciX * 10708c2ecf20Sopenharmony_ciX * Copyright (C) 1998 Andrew Veliath 10718c2ecf20Sopenharmony_ciX * 10728c2ecf20Sopenharmony_ciX * This program is free software; you can redistribute it and/or modify 10738c2ecf20Sopenharmony_ciX * it under the terms of the GNU General Public License as published by 10748c2ecf20Sopenharmony_ciX * the Free Software Foundation; either version 2 of the License, or 10758c2ecf20Sopenharmony_ciX * (at your option) any later version. 10768c2ecf20Sopenharmony_ciX * 10778c2ecf20Sopenharmony_ciX * This program is distributed in the hope that it will be useful, 10788c2ecf20Sopenharmony_ciX * but WITHOUT ANY WARRANTY; without even the implied warranty of 10798c2ecf20Sopenharmony_ciX * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10808c2ecf20Sopenharmony_ciX * GNU General Public License for more details. 10818c2ecf20Sopenharmony_ciX * 10828c2ecf20Sopenharmony_ciX * You should have received a copy of the GNU General Public License 10838c2ecf20Sopenharmony_ciX * along with this program; if not, write to the Free Software 10848c2ecf20Sopenharmony_ciX * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 10858c2ecf20Sopenharmony_ciX * 10868c2ecf20Sopenharmony_ciX ********************************************************************/ 10878c2ecf20Sopenharmony_ciX 10888c2ecf20Sopenharmony_ci#include <stdio.h> 10898c2ecf20Sopenharmony_ci#include <stdlib.h> 10908c2ecf20Sopenharmony_ci#include <unistd.h> 10918c2ecf20Sopenharmony_ci#include <fcntl.h> 10928c2ecf20Sopenharmony_ci#include <sys/types.h> 10938c2ecf20Sopenharmony_ci#include <sys/stat.h> 10948c2ecf20Sopenharmony_ci#include <sys/ioctl.h> 10958c2ecf20Sopenharmony_ci#include <sys/soundcard.h> 10968c2ecf20Sopenharmony_ciX 10978c2ecf20Sopenharmony_ciint main(int argc, char *argv[]) 10988c2ecf20Sopenharmony_ci{ 10998c2ecf20Sopenharmony_ciX int fd; 11008c2ecf20Sopenharmony_ciX 11018c2ecf20Sopenharmony_ciX if (argc != 2) { 11028c2ecf20Sopenharmony_ciX fprintf(stderr, "usage: msndreset <mixer device>\n"); 11038c2ecf20Sopenharmony_ciX exit(1); 11048c2ecf20Sopenharmony_ciX } 11058c2ecf20Sopenharmony_ciX 11068c2ecf20Sopenharmony_ciX if ((fd = open(argv[1], O_RDWR)) < 0) { 11078c2ecf20Sopenharmony_ciX perror(argv[1]); 11088c2ecf20Sopenharmony_ciX exit(1); 11098c2ecf20Sopenharmony_ciX } 11108c2ecf20Sopenharmony_ciX 11118c2ecf20Sopenharmony_ciX if (ioctl(fd, SOUND_MIXER_PRIVATE1, 0) < 0) { 11128c2ecf20Sopenharmony_ciX fprintf(stderr, "error: msnd ioctl reset failed\n"); 11138c2ecf20Sopenharmony_ciX perror("ioctl"); 11148c2ecf20Sopenharmony_ciX close(fd); 11158c2ecf20Sopenharmony_ciX exit(1); 11168c2ecf20Sopenharmony_ciX } 11178c2ecf20Sopenharmony_ciX 11188c2ecf20Sopenharmony_ciX close(fd); 11198c2ecf20Sopenharmony_ciX 11208c2ecf20Sopenharmony_ciX return 0; 11218c2ecf20Sopenharmony_ci} 11228c2ecf20Sopenharmony_ciSHAR_EOF 11238c2ecf20Sopenharmony_ci $shar_touch -am 1204100698 'MultiSound.d/msndreset.c' && 11248c2ecf20Sopenharmony_ci chmod 0664 'MultiSound.d/msndreset.c' || 11258c2ecf20Sopenharmony_ci $echo 'restore of' 'MultiSound.d/msndreset.c' 'failed' 11268c2ecf20Sopenharmony_ci if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ 11278c2ecf20Sopenharmony_ci && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then 11288c2ecf20Sopenharmony_ci md5sum -c << SHAR_EOF >/dev/null 2>&1 \ 11298c2ecf20Sopenharmony_ci || $echo 'MultiSound.d/msndreset.c:' 'MD5 check failed' 11308c2ecf20Sopenharmony_cic52f876521084e8eb25e12e01dcccb8a MultiSound.d/msndreset.c 11318c2ecf20Sopenharmony_ciSHAR_EOF 11328c2ecf20Sopenharmony_ci else 11338c2ecf20Sopenharmony_ci shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/msndreset.c'`" 11348c2ecf20Sopenharmony_ci test 1491 -eq "$shar_count" || 11358c2ecf20Sopenharmony_ci $echo 'MultiSound.d/msndreset.c:' 'original size' '1491,' 'current size' "$shar_count!" 11368c2ecf20Sopenharmony_ci fi 11378c2ecf20Sopenharmony_cifi 11388c2ecf20Sopenharmony_cirm -fr _sh01426 11398c2ecf20Sopenharmony_ciexit 0 1140