1 #ifndef CODEC_H 2 #define CODEC_H 3 4 #include "es1371.h" 5 #include "wait.h" 6 #include "../AC97.h" 7 #include "SRC.h" 8 9 #define CODEC_0DB_GAIN 0x0008 10 #define CODEC_MAX_ATTN 0x003f 11 #define CODEC_MUTE 0x8000U 12 13 14 /* Control function defines */ 15 #define CODEC_CTL_4SPKR 0x00U /* 4-spkr output mode enable */ 16 #define CODEC_CTL_MICBOOST 0x01U /* Mic boost (+30 dB) enable */ 17 #define CODEC_CTL_PWRDOWN 0x02U /* power-down mode */ 18 #define CODEC_CTL_DOSMODE 0x03U /* A/D sync to DAC1 */ 19 20 /* Timeout waiting for: */ 21 #define CODEC_ERR_WIP_TIMEOUT -1 /* write in progress complete */ 22 #define CODEC_ERR_DATA_TIMEOUT -2 /* data ready */ 23 #define CODEC_ERR_SRC_NOT_BUSY_TIMEOUT -3 /* SRC not busy */ 24 #define CODEC_ERR_SRC_SYNC_TIMEOUT -4 /* state #1 */ 25 26 /* Function to inform CODEC module which AC97 vendor ID to expect */ 27 void CodecSetVendorId (char *tbuf); 28 29 /* CODEC Mixer and Mode control function prototypes */ 30 31 int CodecRead (DEV_STRUCT * pCC, u16_t wAddr, u16_t *data); 32 int CodecWrite (DEV_STRUCT * pCC, u16_t wAddr, u16_t wData); 33 void CodecSetSrcSyncState (int state); 34 int CodecWriteUnsynced (DEV_STRUCT * pCC, u16_t wAddr, u16_t wData); 35 int CodecReadUnsynced (DEV_STRUCT * pCC, u16_t wAddr, u16_t *data); 36 37 /* 38 This function initializes the CODEC to a default mode. 39 */ 40 int CODECInit( DEV_STRUCT * pCC ); 41 42 43 44 #endif /* CODEC_H */ 45