Path: blob/master/thirdparty/linuxbsd_headers/alsa/sound/emu10k1.h
9917 views
#ifndef __SOUND_EMU10K1_H1#define __SOUND_EMU10K1_H23/*4* Copyright (c) by Jaroslav Kysela <[email protected]>,5* Creative Labs, Inc.6* Definitions for EMU10K1 (SB Live!) chips7*8*9* This program is free software; you can redistribute it and/or modify10* it under the terms of the GNU General Public License as published by11* the Free Software Foundation; either version 2 of the License, or12* (at your option) any later version.13*14* This program is distributed in the hope that it will be useful,15* but WITHOUT ANY WARRANTY; without even the implied warranty of16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17* GNU General Public License for more details.18*19* You should have received a copy of the GNU General Public License20* along with this program; if not, write to the Free Software21* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22*23*/2425#include <stdint.h>2627/*28* ---- FX8010 ----29*/3031#define EMU10K1_CARD_CREATIVE 0x0000000032#define EMU10K1_CARD_EMUAPS 0x000000013334#define EMU10K1_FX8010_PCM_COUNT 83536/* instruction set */37#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */38#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */39#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */40#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */41#define iMACINT0 0x04 /* R = A + X * Y ; saturation */42#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */43#define iACC3 0x06 /* R = A + X + Y ; saturation */44#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */45#define iANDXOR 0x08 /* R = (A & X) ^ Y */46#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */47#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */48#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */49#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */50#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */51#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */52#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */5354/* GPRs */55#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */56#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */57#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f */58#define C_00000000 0x4059#define C_00000001 0x4160#define C_00000002 0x4261#define C_00000003 0x4362#define C_00000004 0x4463#define C_00000008 0x4564#define C_00000010 0x4665#define C_00000020 0x4766#define C_00000100 0x4867#define C_00010000 0x4968#define C_00080000 0x4a69#define C_10000000 0x4b70#define C_20000000 0x4c71#define C_40000000 0x4d72#define C_80000000 0x4e73#define C_7fffffff 0x4f74#define C_ffffffff 0x5075#define C_fffffffe 0x5176#define C_c0000000 0x5277#define C_4f1bbcdc 0x5378#define C_5a7ef9db 0x5479#define C_00100000 0x55 /* ?? */80#define GPR_ACCU 0x56 /* ACCUM, accumulator */81#define GPR_COND 0x57 /* CCR, condition register */82#define GPR_NOISE0 0x58 /* noise source */83#define GPR_NOISE1 0x59 /* noise source */84#define GPR_IRQ 0x5a /* IRQ register */85#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */86#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */87#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */88#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */89#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */90#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */9192#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f? */93#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x1f? */94#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f? */95#define A_GPR(x) (A_FXGPREGBASE + (x))9697/* cc_reg constants */98#define CC_REG_NORMALIZED C_0000000199#define CC_REG_BORROW C_00000002100#define CC_REG_MINUS C_00000004101#define CC_REG_ZERO C_00000008102#define CC_REG_SATURATE C_00000010103#define CC_REG_NONZERO C_00000100104105/* FX buses */106#define FXBUS_PCM_LEFT 0x00107#define FXBUS_PCM_RIGHT 0x01108#define FXBUS_PCM_LEFT_REAR 0x02109#define FXBUS_PCM_RIGHT_REAR 0x03110#define FXBUS_MIDI_LEFT 0x04111#define FXBUS_MIDI_RIGHT 0x05112#define FXBUS_PCM_CENTER 0x06113#define FXBUS_PCM_LFE 0x07114#define FXBUS_PCM_LEFT_FRONT 0x08115#define FXBUS_PCM_RIGHT_FRONT 0x09116#define FXBUS_MIDI_REVERB 0x0c117#define FXBUS_MIDI_CHORUS 0x0d118#define FXBUS_PCM_LEFT_SIDE 0x0e119#define FXBUS_PCM_RIGHT_SIDE 0x0f120#define FXBUS_PT_LEFT 0x14121#define FXBUS_PT_RIGHT 0x15122123/* Inputs */124#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */125#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */126#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */127#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */128#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */129#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */130#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */131#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */132#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */133#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */134#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */135#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */136#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */137#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */138139/* Outputs */140#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */141#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */142#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */143#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */144#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */145#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */146#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */147#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */148#define EXTOUT_REAR_L 0x08 /* Rear channel - left */149#define EXTOUT_REAR_R 0x09 /* Rear channel - right */150#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */151#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */152#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */153#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */154#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */155#define EXTOUT_ACENTER 0x11 /* Analog Center */156#define EXTOUT_ALFE 0x12 /* Analog LFE */157158/* Audigy Inputs */159#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */160#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */161#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */162#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */163#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */164#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */165#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */166#define A_EXTIN_LINE2_R 0x09 /* right */167#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */168#define A_EXTIN_ADC_R 0x0b /* right */169#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */170#define A_EXTIN_AUX2_R 0x0d /* - right */171172/* Audigiy Outputs */173#define A_EXTOUT_FRONT_L 0x00 /* digital front left */174#define A_EXTOUT_FRONT_R 0x01 /* right */175#define A_EXTOUT_CENTER 0x02 /* digital front center */176#define A_EXTOUT_LFE 0x03 /* digital front lfe */177#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */178#define A_EXTOUT_HEADPHONE_R 0x05 /* right */179#define A_EXTOUT_REAR_L 0x06 /* digital rear left */180#define A_EXTOUT_REAR_R 0x07 /* right */181#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */182#define A_EXTOUT_AFRONT_R 0x09 /* right */183#define A_EXTOUT_ACENTER 0x0a /* analog center */184#define A_EXTOUT_ALFE 0x0b /* analog LFE */185#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */186#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */187#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */188#define A_EXTOUT_AREAR_R 0x0f /* right */189#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */190#define A_EXTOUT_AC97_R 0x11 /* right */191#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */192#define A_EXTOUT_ADC_CAP_R 0x17 /* right */193#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */194195/* Audigy constants */196#define A_C_00000000 0xc0197#define A_C_00000001 0xc1198#define A_C_00000002 0xc2199#define A_C_00000003 0xc3200#define A_C_00000004 0xc4201#define A_C_00000008 0xc5202#define A_C_00000010 0xc6203#define A_C_00000020 0xc7204#define A_C_00000100 0xc8205#define A_C_00010000 0xc9206#define A_C_00000800 0xca207#define A_C_10000000 0xcb208#define A_C_20000000 0xcc209#define A_C_40000000 0xcd210#define A_C_80000000 0xce211#define A_C_7fffffff 0xcf212#define A_C_ffffffff 0xd0213#define A_C_fffffffe 0xd1214#define A_C_c0000000 0xd2215#define A_C_4f1bbcdc 0xd3216#define A_C_5a7ef9db 0xd4217#define A_C_00100000 0xd5218#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */219#define A_GPR_COND 0xd7 /* CCR, condition register */220#define A_GPR_NOISE0 0xd8 /* noise source */221#define A_GPR_NOISE1 0xd9 /* noise source */222#define A_GPR_IRQ 0xda /* IRQ register */223#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */224#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */225226/* definitions for debug register */227#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */228#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */229#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */230#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */231#define EMU10K1_DBG_STEP 0x00004000 /* start single step */232#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */233#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */234235/* tank memory address line */236#ifndef __KERNEL__237#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */238#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */239#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */240#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */241#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */242#endif243244typedef struct {245unsigned int internal_tram_size; /* in samples */246unsigned int external_tram_size; /* in samples */247char fxbus_names[16][32]; /* names of FXBUSes */248char extin_names[16][32]; /* names of external inputs */249char extout_names[32][32]; /* names of external outputs */250unsigned int gpr_controls; /* count of GPR controls */251} emu10k1_fx8010_info_t;252253#define EMU10K1_GPR_TRANSLATION_NONE 0254#define EMU10K1_GPR_TRANSLATION_TABLE100 1255#define EMU10K1_GPR_TRANSLATION_BASS 2256#define EMU10K1_GPR_TRANSLATION_TREBLE 3257#define EMU10K1_GPR_TRANSLATION_ONOFF 4258259enum emu10k1_ctl_elem_iface {260EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */261EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */262};263264typedef struct {265unsigned int pad; /* don't use */266int iface; /* interface identifier */267unsigned int device; /* device/client number */268unsigned int subdevice; /* subdevice (substream) number */269unsigned char name[44]; /* ASCII name of item */270unsigned int index; /* index of item */271} emu10k1_ctl_elem_id_t;272273typedef struct {274emu10k1_ctl_elem_id_t id; /* full control ID definition */275unsigned int vcount; /* visible count */276unsigned int count; /* count of GPR (1..16) */277unsigned short gpr[32]; /* GPR number(s) */278unsigned int value[32]; /* initial values */279unsigned int min; /* minimum range */280unsigned int max; /* maximum range */281unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */282unsigned int *tlv;283} emu10k1_fx8010_control_gpr_t;284285typedef struct {286char name[128];287288unsigned long gpr_valid[0x200/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */289uint32_t *gpr_map; /* initializers */290291unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */292emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */293294unsigned int gpr_del_control_count; /* count of GPR controls to remove */295emu10k1_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */296297unsigned int gpr_list_control_count; /* count of GPR controls to list */298unsigned int gpr_list_control_total; /* total count of GPR controls */299emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */300301unsigned long tram_valid[0x100/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */302uint32_t *tram_data_map; /* data initializers */303uint32_t *tram_addr_map; /* map initializers */304305unsigned long code_valid[1024/(sizeof(unsigned long)*8)]; /* bitmask of valid instructions */306uint32_t *code; /* one instruction - 64 bits */307} emu10k1_fx8010_code_t;308309typedef struct {310unsigned int address; /* 31.bit == 1 -> external TRAM */311unsigned int size; /* size in samples (4 bytes) */312unsigned int *samples; /* pointer to samples (20-bit) */313/* NULL->clear memory */314} emu10k1_fx8010_tram_t;315316typedef struct {317unsigned int substream; /* substream number */318unsigned int res1; /* reserved */319unsigned int channels; /* 16-bit channels count, zero = remove this substream */320unsigned int tram_start; /* ring buffer position in TRAM (in samples) */321unsigned int buffer_size; /* count of buffered samples */322unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */323unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */324unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */325unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */326unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */327unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */328unsigned char pad; /* reserved */329unsigned char etram[32]; /* external TRAM address & data (one per channel) */330unsigned int res2; /* reserved */331} emu10k1_fx8010_pcm_t;332333#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t)334#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t)335#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t)336#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)337#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t)338#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t)339#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t)340#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t)341#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)342#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)343#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)344#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)345#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)346#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)347348#endif /* __SOUND_EMU10K1_H */349350351