Commit fdaca8bd authored by Linus Torvalds's avatar Linus Torvalds

Merge home.transmeta.com:/home/torvalds/v2.5/alsa

into home.transmeta.com:/home/torvalds/v2.5/linux
parents e9d9db6b 91e39521
......@@ -1391,6 +1391,12 @@ M: tsbogend@alpha.franken.de
L: linux-net@vger.kernel.org
S: Maintained
SOUND - ALSA
P: Jaroslav Kysela
M: perex@suse.cz
L: alsa-devel@alsa-project.org
S: Maintained
SOUND
P: Alan Cox
M: alan@redhat.com
......
......@@ -122,7 +122,7 @@ CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
NETWORKS =net/network.o
LIBS =$(TOPDIR)/lib/lib.a
SUBDIRS =kernel lib drivers mm fs net ipc
SUBDIRS =kernel lib drivers mm fs net ipc sound
DRIVERS-n :=
DRIVERS-y :=
......@@ -156,7 +156,7 @@ ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFI
DRIVERS-y += drivers/cdrom/driver.o
endif
DRIVERS-$(CONFIG_SOUND) += drivers/sound/sounddrivers.o
DRIVERS-$(CONFIG_SOUND) += sound/sound.o
DRIVERS-$(CONFIG_PCI) += drivers/pci/driver.o
DRIVERS-$(CONFIG_MTD) += drivers/mtd/mtdlink.o
DRIVERS-$(CONFIG_PCMCIA) += drivers/pcmcia/pcmcia.o
......@@ -201,7 +201,7 @@ CLEAN_FILES = \
drivers/char/drm/*-mod.c \
drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist \
drivers/zorro/devlist.h drivers/zorro/gen-devlist \
drivers/sound/bin2hex drivers/sound/hex2hex \
sound/oss/bin2hex sound/oss/hex2hex \
drivers/atm/fore200e_mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2} \
drivers/scsi/aic7xxx/aicasm/aicasm_gram.c \
drivers/scsi/aic7xxx/aicasm/aicasm_scan.c \
......@@ -222,11 +222,11 @@ MRPROPER_FILES = \
drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h \
drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h \
drivers/net/hamradio/soundmodem/gentbl \
drivers/sound/*_boot.h drivers/sound/.*.boot \
drivers/sound/msndinit.c \
drivers/sound/msndperm.c \
drivers/sound/pndsperm.c \
drivers/sound/pndspini.c \
sound/oss/*_boot.h sound/oss/.*.boot \
sound/oss/msndinit.c \
sound/oss/msndperm.c \
sound/oss/pndsperm.c \
sound/oss/pndspini.c \
drivers/atm/fore200e_*_fw.c drivers/atm/.fore200e_*.fw \
.version .config* config.in config.old \
scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \
......@@ -343,7 +343,7 @@ init/main.o: init/main.c include/config/MARKER
init/do_mounts.o: init/do_mounts.c include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
fs lib mm ipc kernel drivers net: dummy
fs lib mm ipc kernel drivers net sound: dummy
$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)
TAGS: dummy
......
......@@ -208,6 +208,8 @@ ifdef CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" ""
MODINCL = $(TOPDIR)/include/linux/modules
MODCURDIR = $(subst $(TOPDIR)/,,$(shell /bin/pwd))
MODPREFIX = $(subst /,-,$(MODCURDIR))__
# The -w option (enable warnings) for genksyms will return here in 2.1
# So where has it gone?
......@@ -222,20 +224,20 @@ else
genksyms_smp_prefix :=
endif
$(MODINCL)/%.ver: %.c
@if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $< ]; then \
$(MODINCL)/$(MODPREFIX)%.ver: %.c
@if [ ! -r $(MODINCL)/$(MODPREFIX)$*.stamp -o $(MODINCL)/$(MODPREFIX)$*.stamp -ot $< ]; then \
echo '$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $<'; \
echo '| $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp'; \
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< \
| $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \
if [ -r $@ ] && cmp -s $@ $@.tmp; then echo $@ is unchanged; rm -f $@.tmp; \
else echo mv $@.tmp $@; mv -f $@.tmp $@; fi; \
fi; touch $(MODINCL)/$*.stamp
fi; touch $(MODINCL)/$(MODPREFIX)$*.stamp
$(addprefix $(MODINCL)/,$(export-objs:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
$(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
# updates .ver files but not modversions.h
fastdep: $(addprefix $(MODINCL)/,$(export-objs:.o=.ver))
fastdep: $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver))
# updates .ver files and modversions.h like before (is this needed?)
dep: fastdep update-modverfile
......
......@@ -346,7 +346,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -656,7 +656,7 @@ if [ "$CONFIG_ARCH_ACORN" = "y" -o \
tristate 'Sound support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
fi
......
......@@ -222,7 +222,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -382,7 +382,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -212,7 +212,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -511,7 +511,7 @@ comment 'Sound support'
tristate 'Sound support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/dmasound/Config.in
source sound/oss/dmasound/Config.in
fi
endmenu
......
......@@ -483,7 +483,7 @@ if [ "$CONFIG_DECSTATION" != "y" ]; then
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
fi
......
......@@ -234,7 +234,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -170,7 +170,7 @@ mainmenu_option next_comment
comment 'Sound Drivers'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -574,8 +574,8 @@ mainmenu_option next_comment
comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/dmasound/Config.in
source drivers/sound/Config.in
source sound/oss/dmasound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -356,7 +356,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -262,7 +262,7 @@ comment 'Sound'
tristate 'Sound card support' CONFIG_SOUND
if [ "$CONFIG_SOUND" != "n" ]; then
source drivers/sound/Config.in
source sound/Config.in
fi
endmenu
......
......@@ -10,7 +10,7 @@ mod-subdirs := dio mtd sbus video macintosh usb input telephony sgi ide \
message/i2o message/fusion scsi md ieee1394 pnp isdn atm \
fc4 net/hamradio i2c acpi bluetooth input/serio input/gameport
subdir-y := base parport char block net sound misc media cdrom hotplug
subdir-y := base parport char block net misc media cdrom hotplug
subdir-m := $(subdir-y)
......
#ifndef __SOUND_AC97_CODEC_H
#define __SOUND_AC97_CODEC_H
/*
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>
* Universal interface for Audio Codec '97
*
* For more details look to AC '97 component specification revision 2.1
* by Intel Corporation (http://developer.intel.com).
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "control.h"
#include "info.h"
/*
* AC'97 codec registers
*/
#define AC97_RESET 0x00 /* Reset */
#define AC97_MASTER 0x02 /* Master Volume */
#define AC97_HEADPHONE 0x04 /* Headphone Volume (optional) */
#define AC97_MASTER_MONO 0x06 /* Master Volume Mono (optional) */
#define AC97_MASTER_TONE 0x08 /* Master Tone (Bass & Treble) (optional) */
#define AC97_PC_BEEP 0x0a /* PC Beep Volume (optinal) */
#define AC97_PHONE 0x0c /* Phone Volume (optional) */
#define AC97_MIC 0x0e /* MIC Volume */
#define AC97_LINE 0x10 /* Line In Volume */
#define AC97_CD 0x12 /* CD Volume */
#define AC97_VIDEO 0x14 /* Video Volume (optional) */
#define AC97_AUX 0x16 /* AUX Volume (optional) */
#define AC97_PCM 0x18 /* PCM Volume */
#define AC97_REC_SEL 0x1a /* Record Select */
#define AC97_REC_GAIN 0x1c /* Record Gain */
#define AC97_REC_GAIN_MIC 0x1e /* Record Gain MIC (optional) */
#define AC97_GENERAL_PURPOSE 0x20 /* General Purpose (optional) */
#define AC97_3D_CONTROL 0x22 /* 3D Control (optional) */
#define AC97_RESERVED 0x24 /* Reserved */
#define AC97_POWERDOWN 0x26 /* Powerdown control / status */
/* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */
#define AC97_EXTENDED_ID 0x28 /* Extended Audio ID */
#define AC97_EXTENDED_STATUS 0x2a /* Extended Audio Status */
#define AC97_PCM_FRONT_DAC_RATE 0x2c /* PCM Front DAC Rate */
#define AC97_PCM_SURR_DAC_RATE 0x2e /* PCM Surround DAC Rate */
#define AC97_PCM_LFE_DAC_RATE 0x30 /* PCM LFE DAC Rate */
#define AC97_PCM_LR_ADC_RATE 0x32 /* PCM LR DAC Rate */
#define AC97_PCM_MIC_ADC_RATE 0x34 /* PCM MIC ADC Rate */
#define AC97_CENTER_LFE_MASTER 0x36 /* Center + LFE Master Volume */
#define AC97_SURROUND_MASTER 0x38 /* Surround (Rear) Master Volume */
#define AC97_SPDIF 0x3a /* S/PDIF control */
/* range 0x3c-0x58 - MODEM */
/* range 0x5a-0x7b - Vendor Specific */
#define AC97_VENDOR_ID1 0x7c /* Vendor ID1 */
#define AC97_VENDOR_ID2 0x7e /* Vendor ID2 / revision */
/* extended audio status and control bit defines */
#define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */
#define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */
#define AC97_EA_SPDIF 0x0004 /* S/PDIF Enable bit */
#define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */
#define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */
#define AC97_EA_SDAC 0x0040 /* PCM Surround DACs are ready (Read only) */
#define AC97_EA_LDAC 0x0080 /* PCM LFE DAC is ready (Read only) */
#define AC97_EA_MDAC 0x0100 /* MIC ADC is ready (Read only) */
#define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */
#define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */
#define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */
#define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */
#define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */
#define AC97_EA_SLOT_MASK 0xffcf /* Mask for slot assignment bits */
#define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */
#define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */
#define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */
#define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */
/* S/PDIF control bit defines */
#define AC97_SC_PRO 0x0001 /* Professional status */
#define AC97_SC_NAUDIO 0x0002 /* Non audio stream */
#define AC97_SC_COPY 0x0004 /* Copyright status */
#define AC97_SC_PRE 0x0008 /* Preemphasis status */
#define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */
#define AC97_SC_L 0x0800 /* Generation Level status */
#define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */
#define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */
#define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */
#define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */
#define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */
#define AC97_SC_V 0x8000 /* Validity status */
/* specific - SigmaTel */
#define AC97_SIGMATEL_ANALOG 0x6c /* Analog Special */
#define AC97_SIGMATEL_DAC2INVERT 0x6e
#define AC97_SIGMATEL_BIAS1 0x70
#define AC97_SIGMATEL_BIAS2 0x72
#define AC97_SIGMATEL_MULTICHN 0x74 /* Multi-Channel programming */
#define AC97_SIGMATEL_CIC1 0x76
#define AC97_SIGMATEL_CIC2 0x78
/* specific - Analog Devices */
#define AC97_AD_TEST 0x5a /* test register */
#define AC97_AD_CODEC_CFG 0x70 /* codec configuration */
#define AC97_AD_JACK_SPDIF 0x72 /* Jack Sense & S/PDIF */
#define AC97_AD_SERIAL_CFG 0x74 /* Serial Configuration */
#define AC97_AD_MISC 0x76 /* Misc Control Bits */
/* ac97->scaps */
#define AC97_SCAP_SURROUND_DAC (1<<0) /* surround L&R DACs are present */
#define AC97_SCAP_CENTER_LFE_DAC (1<<1) /* center and LFE DACs are present */
/* ac97->flags */
#define AC97_HAS_PC_BEEP (1<<0)
#define AC97_AD_MULTI (1<<1) /* Analog Devices - multi codecs */
/*
*/
typedef struct _snd_ac97 ac97_t;
struct _snd_ac97 {
void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val);
unsigned short (*read) (ac97_t *ac97, unsigned short reg);
void (*init) (ac97_t *ac97);
snd_info_entry_t *proc_entry;
snd_info_entry_t *proc_regs_entry;
void *private_data;
void (*private_free) (ac97_t *ac97);
/* --- */
snd_card_t *card;
spinlock_t reg_lock;
unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
unsigned short addr; /* physical address of codec [0-3] */
unsigned int id; /* identification of codec */
unsigned short caps; /* capabilities (register 0) */
unsigned short ext_id; /* extended feature identification (register 28) */
unsigned int scaps; /* driver capabilities */
unsigned int flags; /* specific code */
unsigned int clock; /* AC'97 clock (usually 48000Hz) */
unsigned int rates_front_dac;
unsigned int rates_surr_dac;
unsigned int rates_lfe_dac;
unsigned int rates_adc;
unsigned int rates_mic_adc;
unsigned int spdif_status;
unsigned short regs[0x80]; /* register cache */
unsigned char reg_accessed[0x80 / 8]; /* bit flags */
union { /* vendor specific code */
struct {
unsigned short unchained[3]; // 0 = C34, 1 = C79, 2 = C69
unsigned short chained[3]; // 0 = C34, 1 = C79, 2 = C69
unsigned short id[3]; // codec IDs (lower 16-bit word)
unsigned short pcmreg[3]; // PCM registers
struct semaphore mutex;
} ad18xx;
} spec;
};
int snd_ac97_mixer(snd_card_t * card, ac97_t * _ac97, ac97_t ** rac97);
void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value);
unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg);
void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value);
int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value);
int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value);
int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned short rate);
#ifdef CONFIG_PM
void snd_ac97_suspend(ac97_t *ac97);
void snd_ac97_resume(ac97_t *ac97);
#endif
#endif /* __SOUND_AC97_CODEC_H */
#ifndef __SOUND_AD1816A_H
#define __SOUND_AD1816A_H
/*
ad1816a.h - definitions for ADI SoundPort AD1816A chip.
Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "control.h"
#include "pcm.h"
#include "timer.h"
#define AD1816A_REG(r) (chip->port + r)
#define AD1816A_CHIP_STATUS 0x00
#define AD1816A_INDIR_ADDR 0x00
#define AD1816A_INTERRUPT_STATUS 0x01
#define AD1816A_INDIR_DATA_LOW 0x02
#define AD1816A_INDIR_DATA_HIGH 0x03
#define AD1816A_PIO_DEBUG 0x04
#define AD1816A_PIO_STATUS 0x05
#define AD1816A_PIO_DATA 0x06
#define AD1816A_RESERVED_7 0x07
#define AD1816A_PLAYBACK_CONFIG 0x08
#define AD1816A_CAPTURE_CONFIG 0x09
#define AD1816A_RESERVED_10 0x0a
#define AD1816A_RESERVED_11 0x0b
#define AD1816A_JOYSTICK_RAW_DATA 0x0c
#define AD1816A_JOYSTICK_CTRL 0x0d
#define AD1816A_JOY_POS_DATA_LOW 0x0e
#define AD1816A_JOY_POS_DATA_HIGH 0x0f
#define AD1816A_LOW_BYTE_TMP 0x00
#define AD1816A_INTERRUPT_ENABLE 0x01
#define AD1816A_EXTERNAL_CTRL 0x01
#define AD1816A_PLAYBACK_SAMPLE_RATE 0x02
#define AD1816A_CAPTURE_SAMPLE_RATE 0x03
#define AD1816A_VOICE_ATT 0x04
#define AD1816A_FM_ATT 0x05
#define AD1816A_I2S_1_ATT 0x06
#define AD1816A_I2S_0_ATT 0x07
#define AD1816A_PLAYBACK_BASE_COUNT 0x08
#define AD1816A_PLAYBACK_CURR_COUNT 0x09
#define AD1816A_CAPTURE_BASE_COUNT 0x0a
#define AD1816A_CAPTURE_CURR_COUNT 0x0b
#define AD1816A_TIMER_BASE_COUNT 0x0c
#define AD1816A_TIMER_CURR_COUNT 0x0d
#define AD1816A_MASTER_ATT 0x0e
#define AD1816A_CD_GAIN_ATT 0x0f
#define AD1816A_SYNTH_GAIN_ATT 0x10
#define AD1816A_VID_GAIN_ATT 0x11
#define AD1816A_LINE_GAIN_ATT 0x12
#define AD1816A_MIC_GAIN_ATT 0x13
#define AD1816A_PHONE_IN_GAIN_ATT 0x13
#define AD1816A_ADC_SOURCE_SEL 0x14
#define AD1816A_ADC_PGA 0x14
#define AD1816A_CHIP_CONFIG 0x20
#define AD1816A_DSP_CONFIG 0x21
#define AD1816A_FM_SAMPLE_RATE 0x22
#define AD1816A_I2S_1_SAMPLE_RATE 0x23
#define AD1816A_I2S_0_SAMPLE_RATE 0x24
#define AD1816A_RESERVED_37 0x25
#define AD1816A_PROGRAM_CLOCK_RATE 0x26
#define AD1816A_3D_PHAT_CTRL 0x27
#define AD1816A_PHONE_OUT_ATT 0x27
#define AD1816A_RESERVED_40 0x28
#define AD1816A_HW_VOL_BUT 0x29
#define AD1816A_DSP_MAILBOX_0 0x2a
#define AD1816A_DSP_MAILBOX_1 0x2b
#define AD1816A_POWERDOWN_CTRL 0x2c
#define AD1816A_TIMER_CTRL 0x2c
#define AD1816A_VERSION_ID 0x2d
#define AD1816A_RESERVED_46 0x2e
#define AD1816A_READY 0x80
#define AD1816A_PLAYBACK_IRQ_PENDING 0x80
#define AD1816A_CAPTURE_IRQ_PENDING 0x40
#define AD1816A_TIMER_IRQ_PENDING 0x20
#define AD1816A_PLAYBACK_ENABLE 0x01
#define AD1816A_PLAYBACK_PIO 0x02
#define AD1816A_CAPTURE_ENABLE 0x01
#define AD1816A_CAPTURE_PIO 0x02
#define AD1816A_FMT_LINEAR_8 0x00
#define AD1816A_FMT_ULAW_8 0x08
#define AD1816A_FMT_LINEAR_16_LIT 0x10
#define AD1816A_FMT_ALAW_8 0x18
#define AD1816A_FMT_LINEAR_16_BIG 0x30
#define AD1816A_FMT_ALL 0x38
#define AD1816A_FMT_STEREO 0x04
#define AD1816A_PLAYBACK_IRQ_ENABLE 0x8000
#define AD1816A_CAPTURE_IRQ_ENABLE 0x4000
#define AD1816A_TIMER_IRQ_ENABLE 0x2000
#define AD1816A_TIMER_ENABLE 0x0080
#define AD1816A_SRC_LINE 0x00
#define AD1816A_SRC_OUT 0x10
#define AD1816A_SRC_CD 0x20
#define AD1816A_SRC_SYNTH 0x30
#define AD1816A_SRC_VIDEO 0x40
#define AD1816A_SRC_MIC 0x50
#define AD1816A_SRC_MONO 0x50
#define AD1816A_SRC_PHONE_IN 0x60
#define AD1816A_SRC_MASK 0x70
#define AD1816A_CAPTURE_NOT_EQUAL 0x1000
#define AD1816A_WSS_ENABLE 0x8000
typedef struct _snd_ad1816a ad1816a_t;
struct _snd_ad1816a {
unsigned long port;
struct resource *res_port;
int irq;
int dma1;
int dma2;
unsigned short hardware;
unsigned short version;
spinlock_t lock;
unsigned short mode;
snd_card_t *card;
snd_pcm_t *pcm;
snd_pcm_substream_t *playback_substream;
snd_pcm_substream_t *capture_substream;
unsigned int p_dma_size;
unsigned int c_dma_size;
snd_timer_t *timer;
};
#define AD1816A_HW_AUTO 0
#define AD1816A_HW_AD1816A 1
#define AD1816A_HW_AD1815 2
#define AD1816A_HW_AD18MAX10 3
#define AD1816A_MODE_PLAYBACK 0x01
#define AD1816A_MODE_CAPTURE 0x02
#define AD1816A_MODE_TIMER 0x04
#define AD1816A_MODE_OPEN (AD1816A_MODE_PLAYBACK | \
AD1816A_MODE_CAPTURE | \
AD1816A_MODE_TIMER)
extern int snd_ad1816a_create(snd_card_t *card, unsigned long port,
int irq, int dma1, int dma2,
ad1816a_t **chip);
extern int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm);
extern int snd_ad1816a_mixer(ad1816a_t *chip);
#endif /* __SOUND_AD1816A_H */
#ifndef __SOUND_AD1848_H
#define __SOUND_AD1848_H
/*
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>
* Definitions for AD1847/AD1848/CS4248 chips
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "control.h"
#include "pcm.h"
/* IO ports */
#define AD1848P( codec, x ) ( (chip) -> port + c_d_c_AD1848##x )
#define c_d_c_AD1848REGSEL 0
#define c_d_c_AD1848REG 1
#define c_d_c_AD1848STATUS 2
#define c_d_c_AD1848PIO 3
/* codec registers */
#define AD1848_LEFT_INPUT 0x00 /* left input control */
#define AD1848_RIGHT_INPUT 0x01 /* right input control */
#define AD1848_AUX1_LEFT_INPUT 0x02 /* left AUX1 input control */
#define AD1848_AUX1_RIGHT_INPUT 0x03 /* right AUX1 input control */
#define AD1848_AUX2_LEFT_INPUT 0x04 /* left AUX2 input control */
#define AD1848_AUX2_RIGHT_INPUT 0x05 /* right AUX2 input control */
#define AD1848_LEFT_OUTPUT 0x06 /* left output control register */
#define AD1848_RIGHT_OUTPUT 0x07 /* right output control register */
#define AD1848_DATA_FORMAT 0x08 /* clock and data format - playback/capture - bits 7-0 MCE */
#define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
#define AD1848_PIN_CTRL 0x0a /* pin control */
#define AD1848_TEST_INIT 0x0b /* test and initialization */
#define AD1848_MISC_INFO 0x0c /* miscellaneaous information */
#define AD1848_LOOPBACK 0x0d /* loopback control */
#define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */
#define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */
/* definitions for codec register select port - CODECP( REGSEL ) */
#define AD1848_INIT 0x80 /* CODEC is initializing */
#define AD1848_MCE 0x40 /* mode change enable */
#define AD1848_TRD 0x20 /* transfer request disable */
/* definitions for codec status register - CODECP( STATUS ) */
#define AD1848_GLOBALIRQ 0x01 /* IRQ is active */
/* definitions for AD1848_LEFT_INPUT and AD1848_RIGHT_INPUT registers */
#define AD1848_ENABLE_MIC_GAIN 0x20
#define AD1848_MIXS_LINE1 0x00
#define AD1848_MIXS_AUX1 0x40
#define AD1848_MIXS_LINE2 0x80
#define AD1848_MIXS_ALL 0xc0
/* definitions for clock and data format register - AD1848_PLAYBK_FORMAT */
#define AD1848_LINEAR_8 0x00 /* 8-bit unsigned data */
#define AD1848_ALAW_8 0x60 /* 8-bit A-law companded */
#define AD1848_ULAW_8 0x20 /* 8-bit U-law companded */
#define AD1848_LINEAR_16 0x40 /* 16-bit twos complement data - little endian */
#define AD1848_STEREO 0x10 /* stereo mode */
/* bits 3-1 define frequency divisor */
#define AD1848_XTAL1 0x00 /* 24.576 crystal */
#define AD1848_XTAL2 0x01 /* 16.9344 crystal */
/* definitions for interface control register - AD1848_IFACE_CTRL */
#define AD1848_CAPTURE_PIO 0x80 /* capture PIO enable */
#define AD1848_PLAYBACK_PIO 0x40 /* playback PIO enable */
#define AD1848_CALIB_MODE 0x18 /* calibration mode bits */
#define AD1848_AUTOCALIB 0x08 /* auto calibrate */
#define AD1848_SINGLE_DMA 0x04 /* use single DMA channel */
#define AD1848_CAPTURE_ENABLE 0x02 /* capture enable */
#define AD1848_PLAYBACK_ENABLE 0x01 /* playback enable */
/* definitions for pin control register - AD1848_PIN_CTRL */
#define AD1848_IRQ_ENABLE 0x02 /* enable IRQ */
#define AD1848_XCTL1 0x40 /* external control #1 */
#define AD1848_XCTL0 0x80 /* external control #0 */
/* definitions for test and init register - AD1848_TEST_INIT */
#define AD1848_CALIB_IN_PROGRESS 0x20 /* auto calibrate in progress */
#define AD1848_DMA_REQUEST 0x10 /* DMA request in progress */
/* defines for codec.mode */
#define AD1848_MODE_NONE 0x0000
#define AD1848_MODE_PLAY 0x0001
#define AD1848_MODE_CAPTURE 0x0002
#define AD1848_MODE_TIMER 0x0004
#define AD1848_MODE_OPEN (AD1848_MODE_PLAY|AD1848_MODE_CAPTURE|AD1848_MODE_TIMER)
#define AD1848_MODE_RUNNING 0x0010
/* defines for codec.hardware */
#define AD1848_HW_DETECT 0x0000 /* let AD1848 driver detect chip */
#define AD1848_HW_AD1847 0x0001 /* AD1847 chip */
#define AD1848_HW_AD1848 0x0002 /* AD1848 chip */
#define AD1848_HW_CS4248 0x0003 /* CS4248 chip */
#define AD1848_HW_CMI8330 0x0004 /* CMI8330 chip */
struct _snd_ad1848 {
unsigned long port; /* i/o port */
struct resource *res_port;
int irq; /* IRQ line */
int dma; /* data DMA */
unsigned short version; /* version of CODEC chip */
unsigned short mode; /* see to AD1848_MODE_XXXX */
unsigned short hardware; /* see to AD1848_HW_XXXX */
unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
snd_pcm_t *pcm;
snd_pcm_substream_t *playback_substream;
snd_pcm_substream_t *capture_substream;
snd_card_t *card;
unsigned char image[32]; /* SGalaxy needs an access to extended registers */
int mce_bit;
int calibrate_mute;
int dma_size;
spinlock_t reg_lock;
struct semaphore open_mutex;
};
typedef struct _snd_ad1848 ad1848_t;
/* exported functions */
void snd_ad1848_out(ad1848_t *chip, unsigned char reg, unsigned char value);
void snd_ad1848_dout(ad1848_t *chip, unsigned char reg, unsigned char value);
unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg);
void snd_ad1848_mce_up(ad1848_t *chip);
void snd_ad1848_mce_down(ad1848_t *chip);
int snd_ad1848_create(snd_card_t * card,
unsigned long port,
int irq, int dma,
unsigned short hardware,
ad1848_t ** chip);
int snd_ad1848_pcm(ad1848_t * chip, int device, snd_pcm_t **rpcm);
int snd_ad1848_mixer(ad1848_t * chip);
void snd_ad1848_interrupt(int irq, void *dev_id, struct pt_regs *regs);
#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \
{ iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
info: snd_ad1848_info_single, \
get: snd_ad1848_get_single, put: snd_ad1848_put_single, \
private_value: reg | (shift << 8) | (mask << 16) | (invert << 24) }
int snd_ad1848_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo);
int snd_ad1848_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
int snd_ad1848_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
{ iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \
info: snd_ad1848_info_double, \
get: snd_ad1848_get_double, put: snd_ad1848_put_double, \
private_value: left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
int snd_ad1848_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo);
int snd_ad1848_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
int snd_ad1848_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
#ifdef CONFIG_SND_DEBUG
void snd_ad1848_debug(ad1848_t *chip);
#endif
#endif /* __SOUND_AD1848_H */
/*
* Advanced Linux Sound Architecture
*
* FM (OPL2/3) Instrument Format
* Copyright (c) 2000 Uros Bizjak <uros@kss-loka.si>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_FM_H
#define __SOUND_AINSTR_FM_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define FM_SHARE_FILE 0
/*
* FM operator
*/
typedef struct fm_operator {
unsigned char am_vib;
unsigned char ksl_level;
unsigned char attack_decay;
unsigned char sustain_release;
unsigned char wave_select;
} fm_operator_t;
/*
* Instrument
*/
#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
typedef struct {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned char type; /* instrument type */
fm_operator_t op[4];
unsigned char feedback_connection[2];
unsigned char echo_delay;
unsigned char echo_atten;
unsigned char chorus_spread;
unsigned char trnsps;
unsigned char fix_dur;
unsigned char modes;
unsigned char fix_key;
} fm_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* fm_xinstrument FM_STRU_INSTR
*
*/
#define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* FM operator
*/
typedef struct fm_xoperator {
__u8 am_vib;
__u8 ksl_level;
__u8 attack_decay;
__u8 sustain_release;
__u8 wave_select;
} fm_xoperator_t;
/*
* Instrument
*/
typedef struct fm_xinstrument {
__u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */
__u8 type; /* instrument type */
fm_xoperator_t op[4]; /* fm operators */
__u8 feedback_connection[2];
__u8 echo_delay;
__u8 echo_atten;
__u8 chorus_spread;
__u8 trnsps;
__u8 fix_dur;
__u8 modes;
__u8 fix_key;
} fm_xinstrument_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_fm_id;
int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops,
snd_seq_kinstr_ops_t * next);
#endif
#endif /* __SOUND_AINSTR_FM_H */
/*
* Advanced Linux Sound Architecture
*
* GF1 (GUS) Patch Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_GF1_H
#define __SOUND_AINSTR_GF1_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define GF1_SHARE_FILE 0
/*
* wave formats
*/
#define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */
#define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */
#define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */
#define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
#define GF1_WAVE_LOOP 0x0008 /* loop mode */
#define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */
#define GF1_WAVE_STEREO 0x0100 /* stereo mode */
#define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */
/*
* Wavetable definitions
*/
typedef struct gf1_wave {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */
struct {
unsigned int number; /* some other ID for this instrument */
unsigned int memory; /* begin of waveform in onboard memory */
unsigned char *ptr; /* pointer to waveform in system memory */
} address;
unsigned int size; /* size of waveform in samples */
unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned short loop_repeat; /* loop repeat - 0 = forever */
unsigned char flags; /* GF1 patch flags */
unsigned char pad;
unsigned int sample_rate; /* sample rate in Hz */
unsigned int low_frequency; /* low frequency range */
unsigned int high_frequency; /* high frequency range */
unsigned int root_frequency; /* root frequency range */
signed short tune;
unsigned char balance;
unsigned char envelope_rate[6];
unsigned char envelope_offset[6];
unsigned char tremolo_sweep;
unsigned char tremolo_rate;
unsigned char tremolo_depth;
unsigned char vibrato_sweep;
unsigned char vibrato_rate;
unsigned char vibrato_depth;
unsigned short scale_frequency;
unsigned short scale_factor; /* 0-2048 or 0-2 */
struct gf1_wave *next;
} gf1_wave_t;
/*
* Instrument
*/
#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
#define IWFFFF_EFFECT_NONE 0
#define IWFFFF_EFFECT_REVERB 1
#define IWFFFF_EFFECT_CHORUS 2
#define IWFFFF_EFFECT_ECHO 3
typedef struct {
unsigned short exclusion;
unsigned short exclusion_group; /* 0 - none, 1-65535 */
unsigned char effect1; /* effect 1 */
unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */
gf1_wave_t *wave; /* first waveform */
} gf1_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* gf1_xinstrument IWFFFF_STRU_INSTR
* +gf1_xwave IWFFFF_STRU_WAVE
*
*/
#define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
#define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Wavetable definitions
*/
typedef struct gf1_xwave {
__u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */
__u32 format; /* wave format */
__u32 size; /* size of waveform in samples */
__u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u16 loop_repeat; /* loop repeat - 0 = forever */
__u8 flags; /* GF1 patch flags */
__u8 pad;
__u32 sample_rate; /* sample rate in Hz */
__u32 low_frequency; /* low frequency range */
__u32 high_frequency; /* high frequency range */
__u32 root_frequency; /* root frequency range */
__s16 tune;
__u8 balance;
__u8 envelope_rate[6];
__u8 envelope_offset[6];
__u8 tremolo_sweep;
__u8 tremolo_rate;
__u8 tremolo_depth;
__u8 vibrato_sweep;
__u8 vibrato_rate;
__u8 vibrato_depth;
__u16 scale_frequency;
__u16 scale_factor; /* 0-2048 or 0-2 */
} gf1_xwave_t;
/*
* Instrument
*/
typedef struct gf1_xinstrument {
__u32 stype;
__u16 exclusion;
__u16 exclusion_group; /* 0 - none, 1-65535 */
__u8 effect1; /* effect 1 */
__u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */
} gf1_xinstrument_t;
/*
* Instrument info
*/
#define GF1_INFO_ENVELOPE (1<<0)
#define GF1_INFO_TREMOLO (1<<1)
#define GF1_INFO_VIBRATO (1<<2)
typedef struct gf1_info {
unsigned char flags; /* supported wave flags */
unsigned char pad[3];
unsigned int features; /* supported features */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
} gf1_info_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_gf1_id;
typedef struct {
void *private_data;
int (*info)(void *private_data, gf1_info_t *info);
int (*put_sample)(void *private_data, gf1_wave_t *wave,
char *data, long len, int atomic);
int (*get_sample)(void *private_data, gf1_wave_t *wave,
char *data, long len, int atomic);
int (*remove_sample)(void *private_data, gf1_wave_t *wave,
int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
snd_seq_kinstr_ops_t kops;
} snd_gf1_ops_t;
int snd_seq_gf1_init(snd_gf1_ops_t *ops,
void *private_data,
snd_seq_kinstr_ops_t *next);
#endif
#endif /* __SOUND_AINSTR_GF1_H */
This diff is collapsed.
/*
* Advanced Linux Sound Architecture
*
* Simple (MOD player) Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_SIMPLE_H
#define __SOUND_AINSTR_SIMPLE_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define SIMPLE_SHARE_FILE 0
/*
* wave formats
*/
#define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */
#define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */
#define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */
#define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
#define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */
#define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */
#define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */
#define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */
/*
* instrument effects
*/
#define SIMPLE_EFFECT_NONE 0
#define SIMPLE_EFFECT_REVERB 1
#define SIMPLE_EFFECT_CHORUS 2
#define SIMPLE_EFFECT_ECHO 3
/*
* instrument info
*/
typedef struct simple_instrument_info {
unsigned int format; /* supported format bits */
unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
} simple_instrument_info_t;
/*
* Instrument
*/
typedef struct {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */
struct {
unsigned int number; /* some other ID for this instrument */
unsigned int memory; /* begin of waveform in onboard memory */
unsigned char *ptr; /* pointer to waveform in system memory */
} address;
unsigned int size; /* size of waveform in samples */
unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */
unsigned short loop_repeat; /* loop repeat - 0 = forever */
unsigned char effect1; /* effect 1 */
unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */
} simple_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* simple_xinstrument SIMPLE_STRU_INSTR
*
*/
#define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Instrument
*/
typedef struct simple_xinstrument {
__u32 stype;
__u32 share_id[4]; /* share id - zero = no sharing */
__u32 format; /* wave format */
__u32 size; /* size of waveform in samples */
__u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u16 loop_repeat; /* loop repeat - 0 = forever */
__u8 effect1; /* effect 1 */
__u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */
} simple_xinstrument_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_simple_id;
typedef struct {
void *private_data;
int (*info)(void *private_data, simple_instrument_info_t *info);
int (*put_sample)(void *private_data, simple_instrument_t *instr,
char *data, long len, int atomic);
int (*get_sample)(void *private_data, simple_instrument_t *instr,
char *data, long len, int atomic);
int (*remove_sample)(void *private_data, simple_instrument_t *instr,
int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
snd_seq_kinstr_ops_t kops;
} snd_simple_ops_t;
int snd_seq_simple_init(snd_simple_ops_t *ops,
void *private_data,
snd_seq_kinstr_ops_t *next);
#endif
#endif /* __SOUND_AINSTR_SIMPLE_H */
#ifndef __SOUND_AK4531_CODEC_H
#define __SOUND_AK4531_CODEC_H
/*
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>
* Universal interface for Audio Codec '97
*
* For more details look to AC '97 component specification revision 2.1
* by Intel Corporation (http://developer.intel.com).
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "info.h"
#include "control.h"
/*
* ASAHI KASEI - AK4531 codec
* - not really AC'97 codec, but it uses very similar interface as AC'97
*/
/*
* AK4531 codec registers
*/
#define AK4531_LMASTER 0x00 /* master volume left */
#define AK4531_RMASTER 0x01 /* master volume right */
#define AK4531_LVOICE 0x02 /* channel volume left */
#define AK4531_RVOICE 0x03 /* channel volume right */
#define AK4531_LFM 0x04 /* FM volume left */
#define AK4531_RFM 0x05 /* FM volume right */
#define AK4531_LCD 0x06 /* CD volume left */
#define AK4531_RCD 0x07 /* CD volume right */
#define AK4531_LLINE 0x08 /* LINE volume left */
#define AK4531_RLINE 0x09 /* LINE volume right */
#define AK4531_LAUXA 0x0a /* AUXA volume left */
#define AK4531_RAUXA 0x0b /* AUXA volume right */
#define AK4531_MONO1 0x0c /* MONO1 volume left */
#define AK4531_MONO2 0x0d /* MONO1 volume right */
#define AK4531_MIC 0x0e /* MIC volume */
#define AK4531_MONO_OUT 0x0f /* Mono-out volume */
#define AK4531_OUT_SW1 0x10 /* Output mixer switch 1 */
#define AK4531_OUT_SW2 0x11 /* Output mixer switch 2 */
#define AK4531_LIN_SW1 0x12 /* Input left mixer switch 1 */
#define AK4531_RIN_SW1 0x13 /* Input right mixer switch 1 */
#define AK4531_LIN_SW2 0x14 /* Input left mixer switch 2 */
#define AK4531_RIN_SW2 0x15 /* Input right mixer switch 2 */
#define AK4531_RESET 0x16 /* Reset & power down */
#define AK4531_CLOCK 0x17 /* Clock select */
#define AK4531_AD_IN 0x18 /* AD input select */
#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */
typedef struct _snd_ak4531 ak4531_t;
struct _snd_ak4531 {
void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val);
snd_info_entry_t *proc_entry;
void *private_data;
void (*private_free) (ak4531_t *ak4531);
/* --- */
unsigned char regs[0x20];
spinlock_t reg_lock;
};
int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531);
#endif /* __SOUND_AK4531_CODEC_H */
This diff is collapsed.
This diff is collapsed.
#ifndef __SOUND_ASOUND_FM_H
#define __SOUND_ASOUND_FM_H
/*
* Advanced Linux Sound Architecture - ALSA
*
* Interface file between ALSA driver & user space
* Copyright (c) 1994-98 by Jaroslav Kysela <perex@suse.cz>,
* 4Front Technologies
*
* Direct FM control
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define SNDRV_DM_FM_MODE_OPL2 0x00
#define SNDRV_DM_FM_MODE_OPL3 0x01
typedef struct snd_dm_fm_info {
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
unsigned char rhythm; /* percussion mode flag */
} snd_dm_fm_info_t;
/*
* Data structure composing an FM "note" or sound event.
*/
typedef struct snd_dm_fm_voice {
unsigned char op; /* operator cell (0 or 1) */
unsigned char voice; /* FM voice (0 to 17) */
unsigned char am; /* amplitude modulation */
unsigned char vibrato; /* vibrato effect */
unsigned char do_sustain; /* sustain phase */
unsigned char kbd_scale; /* keyboard scaling */
unsigned char harmonic; /* 4 bits: harmonic and multiplier */
unsigned char scale_level; /* 2 bits: decrease output freq rises */
unsigned char volume; /* 6 bits: volume */
unsigned char attack; /* 4 bits: attack rate */
unsigned char decay; /* 4 bits: decay rate */
unsigned char sustain; /* 4 bits: sustain level */
unsigned char release; /* 4 bits: release rate */
unsigned char feedback; /* 3 bits: feedback for op0 */
unsigned char connection; /* 0 for serial, 1 for parallel */
unsigned char left; /* stereo left */
unsigned char right; /* stereo right */
unsigned char waveform; /* 3 bits: waveform shape */
} snd_dm_fm_voice_t;
/*
* This describes an FM note by its voice, octave, frequency number (10bit)
* and key on/off.
*/
typedef struct snd_dm_fm_note {
unsigned char voice; /* 0-17 voice channel */
unsigned char octave; /* 3 bits: what octave to play */
unsigned int fnum; /* 10 bits: frequency number */
unsigned char key_on; /* set for active, clear for silent */
} snd_dm_fm_note_t;
/*
* FM parameters that apply globally to all voices, and thus are not "notes"
*/
typedef struct snd_dm_fm_params {
unsigned char am_depth; /* amplitude modulation depth (1=hi) */
unsigned char vib_depth; /* vibrato depth (1=hi) */
unsigned char kbd_split; /* keyboard split */
unsigned char rhythm; /* percussion mode select */
/* This block is the percussion instrument data */
unsigned char bass;
unsigned char snare;
unsigned char tomtom;
unsigned char cymbal;
unsigned char hihat;
} snd_dm_fm_params_t;
/*
* FM mode ioctl settings
*/
#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t)
#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t)
#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t)
#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t)
#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
/* for OPL3 only */
#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
#ifdef __SND_OSS_COMPAT__
#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
#endif
#endif /* __SOUND_ASOUND_FM_H */
This diff is collapsed.
#ifndef __SOUND_CONTROL_H
#define __SOUND_CONTROL_H
/*
* Header file for control interface
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <sound/asound.h>
typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
typedef struct sndrv_ctl_card_info snd_ctl_card_info_t;
typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t;
typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t;
typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t;
typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t;
typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
typedef struct sndrv_ctl_event snd_ctl_event_t;
#define _snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
#define snd_kcontrol_chip(kcontrol) snd_magic_cast1(chip_t, _snd_kcontrol_chip(kcontrol), return -ENXIO)
typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo);
typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol);
typedef struct _snd_kcontrol_new {
snd_ctl_elem_iface_t iface; /* interface identifier */
unsigned int device; /* device/client number */
unsigned int subdevice; /* subdevice (substream) number */
unsigned char *name; /* ASCII name of item */
unsigned int index; /* index of item */
unsigned int access; /* access rights */
snd_kcontrol_info_t *info;
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
unsigned long private_value;
} snd_kcontrol_new_t;
struct _snd_kcontrol {
struct list_head list; /* list of controls */
snd_ctl_elem_id_t id;
snd_ctl_file_t *owner; /* locked */
pid_t owner_pid;
unsigned int access; /* access rights */
snd_kcontrol_info_t *info;
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
unsigned long private_value;
void *private_data;
void (*private_free)(snd_kcontrol_t *kcontrol);
};
#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list)
typedef struct _snd_kctl_event {
struct list_head list; /* list of events */
snd_ctl_elem_id_t id;
unsigned int mask;
} snd_kctl_event_t;
#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list)
struct _snd_ctl_file {
struct list_head list; /* list of all control files */
snd_card_t *card;
pid_t pid;
int prefer_pcm_subdevice;
int prefer_rawmidi_subdevice;
wait_queue_head_t change_sleep;
spinlock_t read_lock;
struct fasync_struct *fasync;
int subscribed; /* read interface is activated */
struct list_head events; /* waiting events for read */
};
#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list)
typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card,
snd_ctl_file_t * control,
unsigned int cmd, unsigned long arg);
void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id);
snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol);
snd_kcontrol_t *snd_ctl_new1(snd_kcontrol_new_t * kcontrolnew, void * private_data);
void snd_ctl_free_one(snd_kcontrol_t * kcontrol);
int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol);
int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol);
int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id);
int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id);
snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid);
snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id);
int snd_ctl_register(snd_card_t *card);
int snd_ctl_unregister(snd_card_t *card);
int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
#endif /* __SOUND_CONTROL_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef __SOUND_CS8403_H
#define __SOUND_CS8403_H
/*
* Routines for Cirrus Logic CS8403/CS8404A IEC958 (S/PDIF) Transmitter
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>,
* Takashi Iwai <tiwai@suse.de>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifdef SND_CS8403
#ifndef SND_CS8403_DECL
#define SND_CS8403_DECL static
#endif
#ifndef SND_CS8403_DECODE
#define SND_CS8403_DECODE snd_cs8403_decode_spdif_bits
#endif
#ifndef SND_CS8403_ENCODE
#define SND_CS8403_ENCODE snd_cs8403_encode_spdif_bits
#endif
SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bits)
{
if (bits & 0x01) { /* consumer */
if (!(bits & 0x02))
diga->status[0] |= IEC958_AES0_NONAUDIO;
if (!(bits & 0x08))
diga->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
switch (bits & 0x10) {
case 0x10: diga->status[0] |= IEC958_AES0_CON_EMPHASIS_NONE; break;
case 0x00: diga->status[0] |= IEC958_AES0_CON_EMPHASIS_5015; break;
}
if (!(bits & 0x80))
diga->status[1] |= IEC958_AES1_CON_ORIGINAL;
switch (bits & 0x60) {
case 0x00: diga->status[1] |= IEC958_AES1_CON_MAGNETIC_ID; break;
case 0x20: diga->status[1] |= IEC958_AES1_CON_DIGDIGCONV_ID; break;
case 0x40: diga->status[1] |= IEC958_AES1_CON_LASEROPT_ID; break;
case 0x60: diga->status[1] |= IEC958_AES1_CON_GENERAL; break;
}
switch (bits & 0x06) {
case 0x00: diga->status[3] |= IEC958_AES3_CON_FS_44100; break;
case 0x02: diga->status[3] |= IEC958_AES3_CON_FS_48000; break;
case 0x04: diga->status[3] |= IEC958_AES3_CON_FS_32000; break;
}
} else {
diga->status[0] = IEC958_AES0_PROFESSIONAL;
switch (bits & 0x18) {
case 0x00: diga->status[0] |= IEC958_AES0_PRO_FS_32000; break;
case 0x10: diga->status[0] |= IEC958_AES0_PRO_FS_44100; break;
case 0x08: diga->status[0] |= IEC958_AES0_PRO_FS_48000; break;
case 0x18: diga->status[0] |= IEC958_AES0_PRO_FS_NOTID; break;
}
switch (bits & 0x60) {
case 0x20: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE; break;
case 0x40: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015; break;
case 0x00: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT; break;
case 0x60: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NOTID; break;
}
if (bits & 0x80)
diga->status[1] |= IEC958_AES1_PRO_MODE_STEREOPHONIC;
}
}
SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga)
{
unsigned char bits;
if (!(diga->status[0] & IEC958_AES0_PROFESSIONAL)) {
bits = 0x01; /* consumer mode */
if (diga->status[0] & IEC958_AES0_NONAUDIO)
bits &= ~0x02;
else
bits |= 0x02;
if (diga->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT)
bits &= ~0x08;
else
bits |= 0x08;
switch (diga->status[0] & IEC958_AES0_CON_EMPHASIS) {
default:
case IEC958_AES0_CON_EMPHASIS_NONE: bits |= 0x10; break;
case IEC958_AES0_CON_EMPHASIS_5015: bits |= 0x00; break;
}
if (diga->status[1] & IEC958_AES1_CON_ORIGINAL)
bits &= ~0x80;
else
bits |= 0x80;
if ((diga->status[1] & IEC958_AES1_CON_CATEGORY) == IEC958_AES1_CON_GENERAL)
bits |= 0x60;
else {
switch(diga->status[1] & IEC958_AES1_CON_MAGNETIC_MASK) {
case IEC958_AES1_CON_MAGNETIC_ID:
bits |= 0x00; break;
case IEC958_AES1_CON_DIGDIGCONV_ID:
bits |= 0x20; break;
default:
case IEC958_AES1_CON_LASEROPT_ID:
bits |= 0x40; break;
}
}
switch (diga->status[3] & IEC958_AES3_CON_FS) {
default:
case IEC958_AES3_CON_FS_44100: bits |= 0x00; break;
case IEC958_AES3_CON_FS_48000: bits |= 0x02; break;
case IEC958_AES3_CON_FS_32000: bits |= 0x04; break;
}
} else {
bits = 0x00; /* professional mode */
if (diga->status[0] & IEC958_AES0_NONAUDIO)
bits &= ~0x02;
else
bits |= 0x02;
/* CHECKME: I'm not sure about the bit order in val here */
switch (diga->status[0] & IEC958_AES0_PRO_FS) {
case IEC958_AES0_PRO_FS_32000: bits |= 0x00; break;
case IEC958_AES0_PRO_FS_44100: bits |= 0x10; break; /* 44.1kHz */
case IEC958_AES0_PRO_FS_48000: bits |= 0x08; break; /* 48kHz */
default:
case IEC958_AES0_PRO_FS_NOTID: bits |= 0x18; break;
}
switch (diga->status[0] & IEC958_AES0_PRO_EMPHASIS) {
case IEC958_AES0_PRO_EMPHASIS_NONE: bits |= 0x20; break;
case IEC958_AES0_PRO_EMPHASIS_5015: bits |= 0x40; break;
case IEC958_AES0_PRO_EMPHASIS_CCITT: bits |= 0x00; break;
default:
case IEC958_AES0_PRO_EMPHASIS_NOTID: bits |= 0x60; break;
}
switch (diga->status[1] & IEC958_AES1_PRO_MODE) {
case IEC958_AES1_PRO_MODE_TWO:
case IEC958_AES1_PRO_MODE_STEREOPHONIC: bits |= 0x00; break;
default: bits |= 0x80; break;
}
}
return bits;
}
#endif /* SND_CS8403 */
#ifdef SND_CS8404
#ifndef SND_CS8404_DECL
#define SND_CS8404_DECL static
#endif
#ifndef SND_CS8404_DECODE
#define SND_CS8404_DECODE snd_cs8404_decode_spdif_bits
#endif
#ifndef SND_CS8404_ENCODE
#define SND_CS8404_ENCODE snd_cs8404_encode_spdif_bits
#endif
SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bits)
{
if (bits & 0x10) { /* consumer */
if (!(bits & 0x20))
diga->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
if (!(bits & 0x40))
diga->status[0] |= IEC958_AES0_CON_EMPHASIS_5015;
if (!(bits & 0x80))
diga->status[1] |= IEC958_AES1_CON_ORIGINAL;
switch (bits & 0x03) {
case 0x00: diga->status[1] |= IEC958_AES1_CON_DAT; break;
case 0x03: diga->status[1] |= IEC958_AES1_CON_GENERAL; break;
}
switch (bits & 0x06) {
case 0x02: diga->status[3] |= IEC958_AES3_CON_FS_32000; break;
case 0x04: diga->status[3] |= IEC958_AES3_CON_FS_48000; break;
case 0x06: diga->status[3] |= IEC958_AES3_CON_FS_44100; break;
}
} else {
diga->status[0] = IEC958_AES0_PROFESSIONAL;
if (!(bits & 0x04))
diga->status[0] |= IEC958_AES0_NONAUDIO;
switch (bits & 0x60) {
case 0x00: diga->status[0] |= IEC958_AES0_PRO_FS_32000; break;
case 0x40: diga->status[0] |= IEC958_AES0_PRO_FS_44100; break;
case 0x20: diga->status[0] |= IEC958_AES0_PRO_FS_48000; break;
case 0x60: diga->status[0] |= IEC958_AES0_PRO_FS_NOTID; break;
}
switch (bits & 0x03) {
case 0x02: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE; break;
case 0x01: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015; break;
case 0x00: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT; break;
case 0x03: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NOTID; break;
}
if (!(bits & 0x80))
diga->status[1] |= IEC958_AES1_PRO_MODE_STEREOPHONIC;
}
}
SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(snd_aes_iec958_t *diga)
{
unsigned char bits;
if (!(diga->status[0] & IEC958_AES0_PROFESSIONAL)) {
bits = 0x10; /* consumer mode */
if (!(diga->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT))
bits |= 0x20;
if ((diga->status[0] & IEC958_AES0_CON_EMPHASIS) == IEC958_AES0_CON_EMPHASIS_NONE)
bits |= 0x40;
if (!(diga->status[1] & IEC958_AES1_CON_ORIGINAL))
bits |= 0x80;
if ((diga->status[1] & IEC958_AES1_CON_CATEGORY) == IEC958_AES1_CON_GENERAL)
bits |= 0x03;
switch (diga->status[3] & IEC958_AES3_CON_FS) {
default:
case IEC958_AES3_CON_FS_44100: bits |= 0x06; break;
case IEC958_AES3_CON_FS_48000: bits |= 0x04; break;
case IEC958_AES3_CON_FS_32000: bits |= 0x02; break;
}
} else {
bits = 0x00; /* professional mode */
if (!(diga->status[0] & IEC958_AES0_NONAUDIO))
bits |= 0x04;
switch (diga->status[0] & IEC958_AES0_PRO_FS) {
case IEC958_AES0_PRO_FS_32000: bits |= 0x00; break;
case IEC958_AES0_PRO_FS_44100: bits |= 0x40; break; /* 44.1kHz */
case IEC958_AES0_PRO_FS_48000: bits |= 0x20; break; /* 48kHz */
default:
case IEC958_AES0_PRO_FS_NOTID: bits |= 0x00; break;
}
switch (diga->status[0] & IEC958_AES0_PRO_EMPHASIS) {
case IEC958_AES0_PRO_EMPHASIS_NONE: bits |= 0x02; break;
case IEC958_AES0_PRO_EMPHASIS_5015: bits |= 0x01; break;
case IEC958_AES0_PRO_EMPHASIS_CCITT: bits |= 0x00; break;
default:
case IEC958_AES0_PRO_EMPHASIS_NOTID: bits |= 0x03; break;
}
switch (diga->status[1] & IEC958_AES1_PRO_MODE) {
case IEC958_AES1_PRO_MODE_TWO:
case IEC958_AES1_PRO_MODE_STEREOPHONIC: bits |= 0x00; break;
default: bits |= 0x80; break;
}
}
return bits;
}
#endif /* SND_CS8404 */
#endif /* __SOUND_CS8403_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Onboard memory management
*/
struct SNDRV_STRU_BANK_INFO {
unsigned int address;
unsigned int size;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.0beta10"
This diff is collapsed.
#ifndef __SOUND_WAVEFRONT_FX_H
#define __SOUND_WAVEFRONT_FX_H
extern int snd_wavefront_fx_detect (snd_wavefront_t *);
extern void snd_wavefront_fx_ioctl (snd_synth_t *sdev,
unsigned int cmd,
unsigned long arg);
#endif __SOUND_WAVEFRONT_FX_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment