Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: sound


  • Subject: Re: lug-bg: sound
  • From: taiko@xxxxxxxxxxx (taiko)
  • Date: Thu, 27 May 1999 18:08:25 +0300



Hristo Georgiev wrote:
> 
> -----Original Message-----
> From: Mano <jonimano@xxxxxxxxxx>
> To: lug-bg@xxxxxxxxxxxxxxxx <lug-bg@xxxxxxxxxxxxxxxx>
> Date: 25 Ìàé 1999 ã. 19:14
> Subject: lug-bg: sound
> 
> Kato zapocnahme problemite sys sound-a da se wkluca i az. Imam sound chip na
> dynoto (cmi8330) absuluten PnP i ne move da se pusne po drug nacin.
> prekompilirwam kernela sled towa go incializiram sys pnpdump i po princip
> pri startirane mi dawa :Sound initialisation started , sound initialisation
> complete CMI8330 Enabled-OK ...towa e..do tuka dobre ama kato trqbwa da se
> cue sound mi kazwa: Cannot open audio device" ...nqkoj puskal li e takyw
> sound chip ili ne si srtuwa da se myca :)
>                                                                     Ico
> 
> ==================================================================
> A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
> For more send to lug-bg-request@xxxxxxxxxxxx a single word 'info'
> ==================================================================




CMI8330 Mini-HOWTO
Version 0.05
February 13, 1999
Author: Ken McCord (ken.mccord@xxxxxxx)

This Mini-HOWTO explains how to configure sound from motherboards containing
the CMI8330 chip set.

Disclaimer:

This Mini-HOWTO is an outline of what I needed to do to add sound to my
system.  I assume no responsibility for any damage that may occur from
following the instructions.  Use it at your own risk.

Background:

This Mini-HOWTO was tested on a PC Chips M571 with the CMI8330 chipset.  This chipset has the following capabilities (from the M571 manual):

- SoundBlaster 16/PRO compatible with stereo voice up to 48KHz sampling rates.
- HRTF 3D Positional Audio Technology
- Windows Sound System 2.0 compatible
- HSP-23 Wavetable Synthesizer
- Full Duplex 16-bit CODEC with filters
- High Quality 3D Sound (On/Off Controllable)
- Auto switch the hardware between Windows Sound System and SoundBlaster 16.
- Stereo Mixer supports analog mixing from CD-Audio.  Line-In supports digital mixing
  from Voice, FM/Wavetable and digital CD-Audio.
- Supports 44.1K digital audio (SPDIF) in.

The following peripherals were attached to the system at the time of testing:

Linksys Ether16 NE2000 clone - set to io=0x300 and irq=3
Western Digital Caviar 2540 IDE Hard Drive as Primary IDE Master
Digital Research (Jamicon) ATAPI 32x CD-Rom as Primary IDE Slave
Sanyo 3.5" floppy drive as Primary floppy
32 MB SDRAM

I used RedHat 5.2 (from CheapBytes) to install and configure the system.

NOTE - I haven't tried the 2.2.x kernel series yet and don't expect to for some time.  I'd rather wait and have it cleaned up first.  If you've gone ahead and gotten this to work with 2.2.x, drop me a line and I'll include your notes.

I. Check BIOS and Verify Sound Card Settings

This section is be optional.  I have included it for completeness (and
it's always good to have a driver disk nearly).

Reboot your computer and go into the BIOS setup.  Make sure the 'Onboard
Sound' is enabled.  Save and exit.

Create a driver disk from the installation CD-Rom that came with your
motherboard.

If you do not have the CD-Rom (or may want to use an updated version), you
can download the driver from
http://www.cmedia.com.tw/e_snd_drv.htm#released-drivers.  I used the file
V4100132.EXE.  This file includes DOS, Win 3.x and Win 95 drivers.  We will
only need to use the DOS drivers.  Download the file and extract to a
temporary directory.  Create a bootable floppy disk to which the DOS files
will be installed.  Run the Install program from the temporary directory.
At the installation screen, for the DOS drivers, use the path 'A:\DOS', and
leave the Windows path blank.  Please note that after installation is
completed, the program will add three lines to your C:\AUTOEXEC.BAT.  You
will want to remove these lines.

Reboot the system, using the floppy disk just created.  At the DOS prompt,
type 'A:\DOS\CMINIT' and press <ENTER>.  Jot down the settings shown on the
screen.  These are the settings on my card:

WSS BASE I/O ADDRESS         530
WSS IRQ CHANNEL          IRQ 11
WSS DMA CHANNEL          DMA 0
VOICE I/O ADDRESS            220
VOICE IRQ CHANNEL        IRQ 5
VOICE DMA CHANNEL        DMA 1
VOICE 16 BIT DMA CHANNEL DMA 5
MPU-401 MIDI DEVICE      DISABLE
MPU-401 I/O ADDRESS          330
MPU-401 IRQ CHANNEL      IRQ 9
GAME PORT I/O ADDRESS    DISABLE
FM(OPL3) I/O ADDRESS     DISABLE

Press <ESC> and select 'save settings and exit'.

At the DOS prompt, type 'A:\DOS\CMTEST' and press <ENTER>.  Press <ENTER> as
necessary to scan for settings.  Select 'output voice' and press <ENTER> to
test for sound output.  Repeat for 'output music'.  If all is working well,
then we're ready to set up Linux!  Press <ESC> to exit.

II. Recompile Linux kernel for sound.

Reboot into (or Install) your favorite Linux distribution.  For this
Mini-HOWTO, I'm using RedHat 5.2 with kernel 2.0.36.  Your settings may be
different with another distribution or kernel version.  Make sure your
system has the 'isapnptools' package.  Information about this package can be
found at http://www.roestock.demon.co.uk/isapnptools.

Recompile the kernel. For the section dealing with sound, I selected the
following options as 'M'odules (everything else in the section as 'N'o):

Sound Card Support
OSS Sound Modules (new for 2.0.36??)
100% Sound Blaster compatibles
Generic OPL2/OPL3 FM synthesizer support
MPU-401 support
Microsoft Sound System

Reboot the system.

III. Configure /etc/isapnp.conf

At a bash prompt, type 'pnpdump > /etc/isapnp.conf'.

Modify the '/etc/isapnp.conf' file as necessary.  My file is as follows:

#
# CMI8330 /etc/isapnp.conf configuration file
#
(READPORT 0x0203)
(ISOLATE PRESERVE)
(IDENTIFY *)
#
# Windows Sound System Configuration
#
(CONFIGURE CMI0001/16777472 (LD 0
(IO 0 (BASE 0x0530))
(IO 1 (BASE 0x0388))
(INT 0 (IRQ 11 (MODE +E)))
(DMA 0 (CHANNEL 0))
(ACT Y)
))
#
# MPU-401 Midi Configuration
#
(CONFIGURE CMI0001/16777472 (LD 1
(IO 0 (BASE 0x0330))
(INT 0 (IRQ 9 (MODE +E)))
(ACT Y)
))
#
# Soundblaster 16 Configuration
#
(CONFIGURE CMI0001/16777472 (LD 3
(IO 0 (BASE 0x0220))
(INT 0 (IRQ 5 (MODE +E)))
(DMA 0 (CHANNEL 1))
(DMA 1 (CHANNEL 5))
(ACT Y)
))
(WAITFORKEY)

Compare these settings and those in section I to what you found.  Save and
exit.

IV. Modify /etc/conf.modules

Add the following lines to /etc/conf.modules:

alias sound sb
alias midi opl3
options opl3 io=0x388
options sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330
options ad1848 io=0x530 irq=11 dma=0,0

Save and exit.

V. Compile the program fixcmi.c

Compile the program fixcmi.c listed below.  Please note the author's comments.

/***************************************************************/
/*                                                             */
/* Program name: fixcmi.c                                      */
/*                                                             */
/* Simple program to adjust the analog CD-in right and left    */
/* channels of the CMI8330 sound chip                          */
/*                                                             */
/* Author: Luiz T. S. Mendes (luizt@xxxxxxxxxxxxxx)            */
/*                                                             */
/* Version: 1.0                Date: Nov 23, 1998              */
/*                                                             */
/*          1.1                Date: Dec 1, 1998               */
/*                             by Mark W. Vandersteen          */
/*              (mvanders@xxxxxxxxxxxxxxx)                     */
/*              Added extra support for enabling Line-In,      */
/*              loud, 3d_surround etc                          */
/*                                                             */
/* DISCLAIMER: This software is provided as it is and comes    */
/*             with absolutely NO WARRANTY . Use it at your    */
/*             own risk.                                       */
/*                                                             */
/* NOTES: (1) This program is meant for the people who already */
/*            have their CMI8330-based sound cards working     */
/*            (except for playing audio CDs, of course). This  */
/*            means that the following two steps should have   */
/*            already succeeded on your linux box:             */
/*                                                             */
/*            - installing the proper Linux sound driver;      */
/*            - configuring the CMI8330 sound chip by means    */
/*              of the isapnptools (see the Web site at        */
/*              http://www.roestock.demon.co.uk/isapnptools/). */
/*              In this configuration the WSS logical device   */
/*              (logical device 0 in the CMI8330) MUST be      */
/*              included, even if the sound card is to be used */
/*              in the SoundBlaster mode.                      */
/*                                                             */
/*            These steps are fairly documented in the Linux   */
/*            HOWTOs and in the above isapnptools WWW site.    */
/*                                                             */
/*        (2) This program have been tested ONLY in my Linux   */
/*            box (Slackware 3.5, kernel 2.0.34). Though it    */
/*            should work in other configurations, there is    */
/*            no way to guarantee that.                        */
/*                                                             */
/*                                                             */
/* INSTRUCTIONS:                                               */
/*                                                             */
/* 1. Change the definition WSS_BASE to match the CMI8330 WSS  */
/*    I/O base address specified in your /etc/isapnp.conf      */
/*                                                             */
/* 2. Save the file and compile it with                        */
/*                                                             */
/*            $ gcc -o fixcmi -O fixcmi.c                      */
/*                                                             */
/*    (CAUTION: the -O option is MANDATORY)                    */
/*                                                             */
/* 3. You must be logged in as root to run the program, or     */
/*    SETUID it as root:                                       */
/*                                                             */
/*            # chmod +s fixcmi                                */
/*                                                             */
/* 4. Run it _after_ configuring the chip by the isapnp        */
/*    command.                                                 */
/*                                                             */
/***************************************************************/

#include <stdio.h>
#include <asm/io.h>
#include <unistd.h>

/* Some definitions, most related to the I/O addressing */

/* The base io address of WSS from isapnp.conf */
#define  WSS_BASE                0x530

#define  CMI8330_WSS_BASE        WSS_BASE+4
#define  CMI8330_WSS_INDEX_ADDR  CMI8330_WSS_BASE
#define  CMI8330_WSS_INDEX_REG   CMI8330_WSS_BASE+1
#define  CMI8330_WSS_STATUS_REG  CMI8330_WSS_BASE+2

#define  CMI8330_EXT_REG1 0x10
#define  CMI8330_EXT_REG2 0x11

/* for register 0x10h (each bit)*/
#define  SURROUND  0x20

/* for reg 0x11h (each bit)
* 0   - mute microphone
* 1-2 - mute CD-in right & left
* 3-4 - mute Line-in right & left
* 5   - Reserved
* 6   - sound output louder
* 7   - S/PDIF-IN channel
*/
#define  MICROPHONE    0x01
#define  CDROM_RIGHT   0x02
#define  CDROM_LEFT    0x04
#define  CDROM         CDROM_LEFT | CDROM_RIGHT
#define  LINEIN_RIGHT  0x08
#define  LINEIN_LEFT   0x10
#define  LINEIN        LINEIN_LEFT | LINEIN_RIGHT
#define  ENABLE_LOUD   0x40
#define  SPDIFIN       0x80

/* Will enable access to Indirect Registers of the chip
 * bit 6 of register 0x0C en/disables access */
void cmi8330_enable_write(int onoff)
{
  outb(0x0C, CMI8330_WSS_INDEX_ADDR);
  if (onoff)
    outb(0x40,  CMI8330_WSS_INDEX_REG); /* set bit */
  else
    outb(0x00,  CMI8330_WSS_INDEX_REG); /* clear bit */
}

void cmi8330_set_reg(int reg, short int data)
{
  short int tmp;

  outb(reg, CMI8330_WSS_INDEX_ADDR);
  tmp = inb(CMI8330_WSS_INDEX_REG) | data;
  outb(tmp, CMI8330_WSS_INDEX_REG);
}

main()
{
  int status, i;

  /* Set the required I/O privilege level for accessing the I/O ports. */

  status=iopl(3);
  if (status != 0)
    {
      perror("FIXCMI: IOPL() Error\n");
      exit(1);
    }

  /* Check the CMI8330 WSS register locations */

  if (inb(CMI8330_WSS_STATUS_REG) != 0xCC)
    {
      printf("FIXCMI: Invalid WSS I/O address\n");
      exit(1);
    }

  /* Now set the required bits for turning on whatever */

  cmi8330_enable_write(1);

  cmi8330_set_reg( CMI8330_EXT_REG1, SURROUND);
  cmi8330_set_reg( CMI8330_EXT_REG2, CDROM | LINEIN | ENABLE_LOUD | MICROPHONE);

  cmi8330_enable_write(0);
}

VI. Test the system.

Reboot the system.

If your system's startup does not automatically run 'isapnp
/etc/isapnp.conf' and 'insmod sound', type in each line and press <ENTER>
(Note that RedHat 5.2 includes these lines in '/etc/rc.d/rc.sysinit').

Run the program 'fixcmi'.

Type 'cat /boot/vmlinuz > /dev/audio' and press <ENTER>.  You should get
output from your speakers.  Press <Control>+<C> to stop.

Place your favorite CD in the CD-Rom.

From a command line, run 'cdplay' (or from X, run 'xplaycd' and press
start).  You should now hear music coming from the speakers.

If everything is working, edit '/etc/rc.d/rc.local' and place a call to
'fixcmi' in it so the file is loaded upon startup.  Save the file and exit.

VII. Notes

Marco Antonio Checa Funcke mentions that isapnptools 1.17 and sndconfig 0.29 (RH 5.2 ships with versions 1.15 and 0.27) autodetects the chipset and creates the following conf.modules file:

Alias sound sb
Alias midi mpu401
Options mpu401 io=0x330 irq=9
Options sb io=0x220 irq=5 dam=1 dma16=5

He recommends changing this setup manually to the setup listed in section IV.

Marco also mentions that RH5.2 stores *.o3 and *.sb files in /etc/midi instead of /etc.  This was causing problems with playmidi.  Copying them to /etc solved the problem for him.  Can anyone concur?

Adam Rice wrote in to note that pnpdump needs to be run when all devices are in use, and/or /etc/isapnp.conf needs to be configured properly.  I don't have any other pnp cards in my box, so I can't confirm this.  Little help, anyone?

Adam continues to add that only RedHat seems to have modularized sound in the kernel 2.0.x series.  Other distributions may have to slightly modify this How-To.  Also, fixcmi seems to do it's job before the sound modules are loaded (if fixcmi is running in your init scripts, for example).  His CD player programs wouldn't produce any sound until he does

echo >/dev/audio

to load the sound drivers.

If you're running another distribution, please send me your changes.  I'm starting to switch over to Debian from RedHat, so I'll try to incorporate Debian changes in the next version.

Trevor Boicey mentions that the WSS part of the card doesn't require an IRQ, just a base address.  If you're tight for IRQ's, you may want to give this a try.

Finally, Matthew Joseph needs some help with the following problem.  For some reason, he's only getting 8 bit mono sound.  Any suggestions??

VIII. Acknowledgments

I'd like to thank:

Luiz Mendes for the program 'fixcmi', for which this mini how-to would not be possible.
Mark Vandersteen for his improvements to the original program.
Hans Wolters for the Dutch version of this document.  The translation is located at http://home.gelrevision.nl/~h.wolter/linux.htm (Yes, I've got to get this on a site!)
Marco Antonio Checa Funcke, Adam Rice and Trevor Boicey for their contributions to the Notes section.

==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
For more send to lug-bg-request@xxxxxxxxxxxx a single word 'info'
==================================================================


  • Относно:
    • lug-bg: sound
      • Изпратено от: judas@xxxxxx (Hristo Georgiev)

 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.