1 #ifndef AC97_H 2 #define AC97_H 3 4 5 #include "es1371.h" 6 #include "wait.h" 7 #include "pci_helper.h" 8 #include "sample_rate_converter.h" 9 10 11 /* 12 This function initializes the AC97 to a default mode. 13 */ 14 int AC97_init( DEV_STRUCT * pCC ); 15 16 int AC97_get_set_volume(struct volume_level *level, int flag); 17 18 19 20 /* This is a main memory cache copy of the codec's ac97 configuration 21 registers. See Intel's Audio Codec 97 standard (rev2.3) for info. */ 22 23 typedef struct ac97_struct { 24 u16_t Reset; /* 0x00 */ 25 u16_t MasterVolume; /* 0x02 */ 26 u16_t AUXOutVolume; /* 0x04 */ 27 u16_t MonoVolume; /* 0x06 */ 28 u16_t MasterTone; /* 0x08 */ 29 u16_t PCBeepVolume; /* 0x0A */ 30 u16_t PhoneVolume; /* 0x0C */ 31 u16_t MicVolume; /* 0x0E */ 32 u16_t LineInVolume; /* 0x10 */ 33 u16_t CDVolume; /* 0x12 */ 34 u16_t VideoVolume; /* 0x14 */ 35 u16_t AUXInVolume; /* 0x16 */ 36 u16_t PCMOutVolume; /* 0x18 */ 37 u16_t RecordSelect; /* 0x1A */ 38 u16_t RecordGain; /* 0x1C */ 39 u16_t RecordGainMic; /* 0x1E */ 40 u16_t GeneralPurpose; /* 0x20 */ 41 u16_t Control3D; /* 0x22 */ 42 u16_t AudioIntAndPaging; /* 0x24 */ 43 u16_t PowerdownControlAndStat; /* 0x26 */ 44 u16_t ExtendedAudio1; /* 0x28 */ 45 u16_t ExtendedAudio2; /* 0x2A */ 46 /* ... */ 47 u16_t VendorID1; /* 0x7C */ 48 u16_t VendorID2; /* 0x7E */ 49 } ac97_t; 50 51 52 53 /* Source and output volume control register defines */ 54 #define AC97_MASTER_VOLUME 0x02U /* Master out */ 55 #define AC97_AUX_OUT_VOLUME 0x04U /* Auxiliary out volume */ 56 #define AC97_MONO_VOLUME 0x06U /* Mono out volume */ 57 #define AC97_MASTER_TONE 0x08U /* high byte= bass, low byte= treble*/ 58 #define AC97_PC_BEEP_VOLUME 0x0aU /* PC speaker volume */ 59 #define AC97_PHONE_VOLUME 0x0cU /* Phone volume */ 60 #define AC97_MIC_VOLUME 0x0eU /* Mic, mono */ 61 #define AC97_LINE_IN_VOLUME 0x10U /* Line volume */ 62 #define AC97_CD_VOLUME 0x12U /* CD audio volume */ 63 #define AC97_VIDEO_VOLUME 0x14U /* Video (TV) volume */ 64 #define AC97_AUX_IN_VOLUME 0x16U /* Aux line source, left */ 65 #define AC97_PCM_OUT_VOLUME 0x18U /* The DACs - wav+synth */ 66 #define AC97_RECORD_GAIN_VOLUME 0x1cU /* Record input level */ 67 #define AC97_RECORD_GAIN_MIC_VOL 0x1eU /* Record input level */ 68 69 /* Other AC97 control register defines */ 70 #define AC97_RESET 0x00U /* any write here to reset AC97 */ 71 #define AC97_GENERAL_PURPOSE 0x20U /* */ 72 #define AC97_POWERDOWN_CONTROL_STAT 0x26U /* */ 73 #define AC97_RECORD_SELECT 0x1aU /* record mux select */ 74 #define AC97_VENDOR_ID1 0x7cU /* 1st two Vendor ID bytes */ 75 #define AC97_VENDOR_ID2 0x7eU /* last Vendor ID byte plus rev. 76 number */ 77 78 /* Record Select defines */ 79 #define AC97_RECORD_MIC 0 80 #define AC97_RECORD_CD 1 81 #define AC97_RECORD_VIDEO 2 82 #define AC97_RECORD_AUX 3 83 #define AC97_RECORD_LINE 4 84 #define AC97_RECORD_STEREO_MIX 5 85 #define AC97_RECORD_MONO_MIX 6 86 #define AC97_RECORD_PHONE 7 87 88 #define MASTER_VOL_MASK 0x1F 89 #define DAC_VOL_MASK 0x1F 90 #define AUX_IN_VOL_MASK 0x1F 91 #define MUTE_MASK 0x8000 92 93 94 95 96 97 98 #endif /* AC97_H */ 99