⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multisound

📁 linux-2.6.15.6
💻
📖 第 1 页 / 共 3 页
字号:
{X	if (msnd_write_cfg(cfg, IREG_LOGDEVICE, num))X		return -EIO;X	if (msnd_read_cfg_io0(cfg, num, io0))X		return -EIO;X	if (msnd_read_cfg_io1(cfg, num, io1))X		return -EIO;X	if (msnd_read_cfg_irq(cfg, num, irq))X		return -EIO;X	if (msnd_read_cfg_mem(cfg, num, mem))X		return -EIO;X	return 0;}Xstatic void usage(void){X	fprintf(stderr,X		"\n"X		"pinnaclecfg 1.0\n"X		"\n"X		"usage: pinnaclecfg <config port> [device config]\n"X		"\n"X		"This is for use with the card in NON-PnP mode only.\n"X		"\n"X		"Available devices (not all available for Fiji):\n"X		"\n"X		"        Device                       Description\n"X		"        -------------------------------------------------------------------\n"X		"        reset                        Reset all devices (i.e. disable)\n"X		"        show                         Display current device configurations\n"X		"\n"X		"        dsp <io> <irq> <mem>         Audio device\n"X		"        mpu <io> <irq>               Internal Kurzweil synth\n"X		"        ide <io0> <io1> <irq>        On-board IDE controller\n"X		"        joystick <io>                Joystick port\n"X		"\n");X	exit(1);}Xstatic int cfg_reset(void){X	int i;XX	for (i = 0; i < 4; ++i)X		msnd_write_cfg_logical(config_port, i, 0, 0, 0, 0);X	X	return 0;}Xstatic int cfg_show(void){X	int i;X	int count = 0;XX	for (i = 0; i < 4; ++i) {X		WORD io0, io1, irq;X		int mem;X		msnd_read_cfg_logical(config_port, i, &io0, &io1, &irq, &mem);X		switch (i) {X		case 0:X			if (io0 || irq || mem) {X				printf("dsp 0x%x %d 0x%x\n", io0, irq, mem);X				++count;X			}X			break;X		case 1:X			if (io0 || irq) {X				printf("mpu 0x%x %d\n", io0, irq);X				++count;X			}X			break;X		case 2:X			if (io0 || io1 || irq) {X				printf("ide 0x%x 0x%x %d\n", io0, io1, irq);X				++count;X			}X			break;X		case 3:X			if (io0) {X				printf("joystick 0x%x\n", io0);X				++count;X			}X			break;X		}X	}XX	if (count == 0)X		fprintf(stderr, "no devices configured\n");X	X	return 0;}Xstatic int cfg_dsp(int argc, char *argv[]){X	int io, irq, mem;XX	if (argc < 3 ||X	    sscanf(argv[0], "0x%x", &io) != 1 ||X	    sscanf(argv[1], "%d", &irq) != 1 ||X	    sscanf(argv[2], "0x%x", &mem) != 1)X		usage();XX	if (!(io == 0x290 ||X	      io == 0x260 ||X	      io == 0x250 ||X	      io == 0x240 ||X	      io == 0x230 ||X	      io == 0x220 ||X	      io == 0x210 ||X	      io == 0x3e0)) {X		fprintf(stderr, "error: io must be one of "X			"210, 220, 230, 240, 250, 260, 290, or 3E0\n");X		usage();X	}X	X	if (!(irq == 5 ||X	      irq == 7 ||X	      irq == 9 ||X	      irq == 10 ||X	      irq == 11 ||X	      irq == 12)) {X		fprintf(stderr, "error: irq must be one of "X			"5, 7, 9, 10, 11 or 12\n");X		usage();X	}XX	if (!(mem == 0xb0000 ||X	      mem == 0xc8000 ||X	      mem == 0xd0000 ||X	      mem == 0xd8000 ||X	      mem == 0xe0000 ||X	      mem == 0xe8000)) {X		fprintf(stderr, "error: mem must be one of "X			"0xb0000, 0xc8000, 0xd0000, 0xd8000, 0xe0000 or 0xe8000\n");X		usage();X	}XX	return msnd_write_cfg_logical(config_port, 0, io, 0, irq, mem);}Xstatic int cfg_mpu(int argc, char *argv[]){X	int io, irq;XX	if (argc < 2 ||X	    sscanf(argv[0], "0x%x", &io) != 1 ||X	    sscanf(argv[1], "%d", &irq) != 1)X		usage();X	X	return msnd_write_cfg_logical(config_port, 1, io, 0, irq, 0);}Xstatic int cfg_ide(int argc, char *argv[]){X	int io0, io1, irq;XX	if (argc < 3 ||X	    sscanf(argv[0], "0x%x", &io0) != 1 ||X	    sscanf(argv[0], "0x%x", &io1) != 1 ||X	    sscanf(argv[1], "%d", &irq) != 1)X		usage();X	X	return msnd_write_cfg_logical(config_port, 2, io0, io1, irq, 0);}Xstatic int cfg_joystick(int argc, char *argv[]){X	int io;XX	if (argc < 1 ||X	    sscanf(argv[0], "0x%x", &io) != 1)X		usage();X	X	return msnd_write_cfg_logical(config_port, 3, io, 0, 0, 0);}Xint main(int argc, char *argv[]){X	char *device;X	int rv = 0;XX	--argc; ++argv;XX	if (argc < 2)X		usage();XX	sscanf(argv[0], "0x%x", &config_port);X	if (config_port != 0x250 && config_port != 0x260 && config_port != 0x270) {X		fprintf(stderr, "error: <config port> must be 0x250, 0x260 or 0x270\n");X		exit(1);X	}X	if (ioperm(config_port, 2, 1)) {X		perror("ioperm");X		fprintf(stderr, "note: pinnaclecfg must be run as root\n");X		exit(1);X	}X	device = argv[1];XX	argc -= 2; argv += 2;XX	if (strcmp(device, "reset") == 0)X		rv = cfg_reset();X	else if (strcmp(device, "show") == 0)X		rv = cfg_show();X	else if (strcmp(device, "dsp") == 0)X		rv = cfg_dsp(argc, argv);X	else if (strcmp(device, "mpu") == 0)X		rv = cfg_mpu(argc, argv);X	else if (strcmp(device, "ide") == 0)X		rv = cfg_ide(argc, argv);X	else if (strcmp(device, "joystick") == 0)X		rv = cfg_joystick(argc, argv);X	else {X		fprintf(stderr, "error: unknown device %s\n", device);X		usage();X	}XX	if (rv)X		fprintf(stderr, "error: device configuration failed\n");X	X	return 0;}SHAR_EOF  $shar_touch -am 1204092598 'MultiSound.d/pinnaclecfg.c' &&  chmod 0664 'MultiSound.d/pinnaclecfg.c' ||  $echo 'restore of' 'MultiSound.d/pinnaclecfg.c' 'failed'  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then    md5sum -c << SHAR_EOF >/dev/null 2>&1 \    || $echo 'MultiSound.d/pinnaclecfg.c:' 'MD5 check failed'366bdf27f0db767a3c7921d0a6db20fe  MultiSound.d/pinnaclecfg.cSHAR_EOF  else    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/pinnaclecfg.c'`"    test 10235 -eq "$shar_count" ||    $echo 'MultiSound.d/pinnaclecfg.c:' 'original size' '10235,' 'current size' "$shar_count!"  fifi# ============= MultiSound.d/Makefile ==============if test -f 'MultiSound.d/Makefile' && test "$first_param" != -c; then  $echo 'x -' SKIPPING 'MultiSound.d/Makefile' '(file already exists)'else  $echo 'x -' extracting 'MultiSound.d/Makefile' '(text)'  sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/Makefile' &&CC	= gccCFLAGS	= -OPROGS	= setdigital msndreset pinnaclecfg convXall: $(PROGS)Xclean:X	rm -f $(PROGS)SHAR_EOF  $shar_touch -am 1204092398 'MultiSound.d/Makefile' &&  chmod 0664 'MultiSound.d/Makefile' ||  $echo 'restore of' 'MultiSound.d/Makefile' 'failed'  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then    md5sum -c << SHAR_EOF >/dev/null 2>&1 \    || $echo 'MultiSound.d/Makefile:' 'MD5 check failed'76ca8bb44e3882edcf79c97df6c81845  MultiSound.d/MakefileSHAR_EOF  else    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/Makefile'`"    test 106 -eq "$shar_count" ||    $echo 'MultiSound.d/Makefile:' 'original size' '106,' 'current size' "$shar_count!"  fifi# ============= MultiSound.d/conv.l ==============if test -f 'MultiSound.d/conv.l' && test "$first_param" != -c; then  $echo 'x -' SKIPPING 'MultiSound.d/conv.l' '(file already exists)'else  $echo 'x -' extracting 'MultiSound.d/conv.l' '(text)'  sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/conv.l' &&%%[ \n\t,\r]\;.*DB[0-9A-Fa-f]+H	{ int n; sscanf(yytext, "%xH", &n); printf("%c", n); }%%int yywrap() { return 1; }main() { yylex(); }SHAR_EOF  $shar_touch -am 0828231798 'MultiSound.d/conv.l' &&  chmod 0664 'MultiSound.d/conv.l' ||  $echo 'restore of' 'MultiSound.d/conv.l' 'failed'  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then    md5sum -c << SHAR_EOF >/dev/null 2>&1 \    || $echo 'MultiSound.d/conv.l:' 'MD5 check failed'd2411fc32cd71a00dcdc1f009e858dd2  MultiSound.d/conv.lSHAR_EOF  else    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/conv.l'`"    test 141 -eq "$shar_count" ||    $echo 'MultiSound.d/conv.l:' 'original size' '141,' 'current size' "$shar_count!"  fifi# ============= MultiSound.d/msndreset.c ==============if test -f 'MultiSound.d/msndreset.c' && test "$first_param" != -c; then  $echo 'x -' SKIPPING 'MultiSound.d/msndreset.c' '(file already exists)'else  $echo 'x -' extracting 'MultiSound.d/msndreset.c' '(text)'  sed 's/^X//' << 'SHAR_EOF' > 'MultiSound.d/msndreset.c' &&/*********************************************************************X *X * msndreset.c - resets the MultiSound cardX *X * Copyright (C) 1998 Andrew VeliathX *X * This program is free software; you can redistribute it and/or modifyX * it under the terms of the GNU General Public License as published byX * the Free Software Foundation; either version 2 of the License, orX * (at your option) any later version.X *X * This program is distributed in the hope that it will be useful,X * but WITHOUT ANY WARRANTY; without even the implied warranty ofX * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theX * GNU General Public License for more details.X *X * You should have received a copy of the GNU General Public LicenseX * along with this program; if not, write to the Free SoftwareX * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.X *X ********************************************************************/X#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ioctl.h>#include <sys/soundcard.h>Xint main(int argc, char *argv[]){X	int fd;XX	if (argc != 2) {X		fprintf(stderr, "usage: msndreset <mixer device>\n");X		exit(1);X	}XX	if ((fd = open(argv[1], O_RDWR)) < 0) {X		perror(argv[1]);X		exit(1);X	}XX	if (ioctl(fd, SOUND_MIXER_PRIVATE1, 0) < 0) {X		fprintf(stderr, "error: msnd ioctl reset failed\n");X		perror("ioctl");X		close(fd);X		exit(1);X	}XX	close(fd);X	X	return 0;}SHAR_EOF  $shar_touch -am 1204100698 'MultiSound.d/msndreset.c' &&  chmod 0664 'MultiSound.d/msndreset.c' ||  $echo 'restore of' 'MultiSound.d/msndreset.c' 'failed'  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then    md5sum -c << SHAR_EOF >/dev/null 2>&1 \    || $echo 'MultiSound.d/msndreset.c:' 'MD5 check failed'c52f876521084e8eb25e12e01dcccb8a  MultiSound.d/msndreset.cSHAR_EOF  else    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'MultiSound.d/msndreset.c'`"    test 1472 -eq "$shar_count" ||    $echo 'MultiSound.d/msndreset.c:' 'original size' '1472,' 'current size' "$shar_count!"  fifirm -fr _sh01426exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -