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