openvortex-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openvortex-dev] Answer at last .... [Fwd: Re: [Alsa-devel] Multiple dr


From: Manuel Jander
Subject: [Openvortex-dev] Answer at last .... [Fwd: Re: [Alsa-devel] Multiple drivers. help]
Date: Mon, 28 Apr 2003 23:32:38 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030327 Debian/1.3-4



-------- Original Message --------
Subject:        Re: [Alsa-devel] Multiple drivers. help
Date:   Mon, 28 Apr 2003 15:36:22 +0200
From:   Takashi Iwai <address@hidden>
To:     address@hidden
CC:     address@hidden
References:     <address@hidden>



At Mon, 21 Apr 2003 22:41:15 -0400,
Manuel Jander wrote:

Hi,


With the current Aureal Driver we have the following dilema:
We support 3 soundcards: the AU8810, AU8820 and AU8830.
They are very similar to each other and share a lot of code (almost all). But they use different register address offsets and "sizes" of some resources.
So we have one .c file and one .h file for each card. All that in one
directory which is pci/au88x0/. How do I make it to compile on or another driver ?

The configure script story is allready OK. selscting the different
drivers triggers different CONFIG_SND_XXXXX environment variables to appear in the makefiles,
but :
how can that info be transmitted to header file #ifdef's ?
The corresponding CONFIG_SND_AU8810, CONFIG_SND_AU8820 and
CONFIG_SND_AU8830 defines of the Makefile's aren't recognized inside
any header file.

CONFIG_SND_AU8810_MODULE is defined (found in include/config1.h).
but please note that CONFIG_SND_AU8810 may be defined instead of
XXX_MODULE if the driver is built into the kernel.  so, you need to
check both in ifdef.

IIUC, you want to have several modules in a single directory
(pci/au88x0).  suppose that each module has its lowlevel routines and
common routines.  then the modules will be the top entries

        snd-au8810.o
        snd-au8820.o
        snd-au8830.o

and a common module

        snd-au88x0-lib.o

an example for this case is found in isa/sb directory.

alternatively, if each driver "includes" the common source file but is
compiled in different condition via ifdef, there will be no common
module.

in au8810.c:
        ...
        #include "au88x0_common.c"
        ...

in au88x0_common.c:
        ...
        #if defined(CONFIG_SND_AU8810) || defined(CONFIG_SND_AU8810_MODULE)
        // au8810 specific
        #endif
        #if defined(CONFIG_SND_AU8820) || defined(CONFIG_SND_AU8820_MODULE)
        // au8810 specific
        #endif
        
however, usually we define a constant for a file instead of checking
CONFIG_XXX, namely,

in au8810.c
        #define USE_AU8810
        #include "au88x0_common.c"
        ...

in au88x0_common.c:
        ...
        #ifdef USE_AU8810
        ...

examples are pci/ens1370.c (ens1371.c) and isa/opti9xx.


ciao,

Takashi








reply via email to

[Prev in Thread] Current Thread [Next in Thread]