Grupo Linuxero del Bajío

Para configurar las tarjetas CMI8330

Víctor Manuel Jáquez Leal

Bueno ahi les va lo que me sirvió para configurar mi tarjeta de sonido CMI8330. Después de ejecutar el programa, el Linux (utilizando los drivers Open Sound System - OSS) la reconoce como una SoundBlaster común y silvestre. Pero la neta les recomiendo que utilizen el proyecto ALSA. Yo ya daba por perdida una Yamaha integrada a la tarjeta madre y los módulos del ALSA no sólo me dieron sonido… sino un muy buen sonido en mi máquina.

Bueno aqui va el hack:

/***************************************************************/
/*                                                             */
/* 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@fisica.ufmg.br)            */
/*                                                             */
/* Version: 1.0                Date: Nov 23, 1998              */
/*                                                             */
/* 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
#include
#include

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

#define  WSS_BASE                0x530     /* or whatever */

#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        0x0C
#define  CMI8330_EXT_REG2        0x11
#define  ENABLE_EXT_REGS         0x40
#define  CDROM_ON                0x06

main()
{

  short int tmp;
  int status;

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

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

/* Check the CMI8330 WSS register locations */

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


/* Now set the required bits for turning on the audio CD left and */
/* right channels                                                 */

  outb(CMI8330_EXT_REG1, CMI8330_WSS_INDEX_ADDR);
  outb(ENABLE_EXT_REGS,  CMI8330_WSS_INDEX_REG);

  outb(CMI8330_EXT_REG2, CMI8330_WSS_INDEX_ADDR);
  tmp = inb(CMI8330_WSS_INDEX_REG) | CDROM_ON;
  outb(tmp, CMI8330_WSS_INDEX_REG);

}