Skip to contentSkip to conversation

hint needed

DISCUSSION Giuliano Pochini 4 participants 4 messages Dec 6, 2003

lore
Share & tools
lore
#0 lore raw

Echoaudio cards are grouped into two families: EchoGals (the old discontinued serie) and the Echo24. The driver is almost identical for both families, but some constants define at compile time. I currently select the family by a hack in the makefile:

ifneq ($(CONFIG_SND_GINA24),)
EXTRA_CFLAGS += -DECHO24_FAMILY
endif

ifneq ($(CONFIG_SND_GINA20),)
EXTRA_CFLAGS += -DECHOGALS_FAMILY
endif

This works fine only if you run configure --with-cards that belong to the same family. How can I solve this issue ? I can replace the constants with something choosen at runtime, but I don't like to put translation tables for dsp commands and such. Very ugly. Alternatively, I can duplicate all common parts of the driver. The files would be identical except a #define at the beginning :-6

--
Giuliano.

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#1 lore raw
Quoted 13 lines · Giuliano Pochini

Echoaudio cards are grouped into two families: EchoGals (the old discontinued serie) and the Echo24. The driver is almost identical for both families, but some constants define at compile time. I currently select the family by a hack in the makefile:

ifneq ($(CONFIG_SND_GINA24),)
EXTRA_CFLAGS += -DECHO24_FAMILY
endif

ifneq ($(CONFIG_SND_GINA20),)
EXTRA_CFLAGS += -DECHOGALS_FAMILY
endif

Quoted 6 lines

This works fine only if you run configure --with-cards that belong to the same family. How can I solve this issue ? I can replace the constants with something choosen at runtime, but I don't like to put translation tables for dsp commands and such. Very ugly. Alternatively, I can duplicate all common parts of the driver. The files would be identical except a #define at the beginning :-6

You can use #include "file.c" to avoid code duplication.

There is even an example in ALSA: see alsa-kernel/pci/ens1371.c.

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#2 lore raw
In reply to Giuliano Pochini
Quoted 14 lines · Giuliano Pochini

Echoaudio cards are grouped into two families: EchoGals (the old discontinued serie) and the Echo24. The driver is almost identical for both families, but some constants define at compile time. I currently select the family by a hack in the makefile:

ifneq ($(CONFIG_SND_GINA24),)
EXTRA_CFLAGS += -DECHO24_FAMILY
endif

ifneq ($(CONFIG_SND_GINA20),)
EXTRA_CFLAGS += -DECHOGALS_FAMILY
endif

Quoted 6 lines

This works fine only if you run configure --with-cards that belong to the same family. How can I solve this issue ? I can replace the constants with something choosen at runtime, but I don't like to put translation tables for dsp commands and such. Very ugly. Alternatively, I can duplicate all common parts of the driver. The files would be identical except a #define at the beginning :-6

See alsa-kernel/pci/ens1370.c and alsa-kernel/pci/ens1371.c for an elegant solution.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#3 lore raw
Quoted 1 line · Jaroslav Kysela

See alsa-kernel/pci/ens1370.c and alsa-kernel/pci/ens1371.c for an elegant solution.

Tnx.

--
Giuliano.

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/