/*
 * File      : drv_ac97.h
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2017, RT-Thread Development Team
 *
 *  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.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Change Logs:
 * Date           Author       Notes
 * 2018-05-25     RT-Thread    the first version
 */

#ifndef __DRV_AC97_H__
#define __DRV_AC97_H__

/* Register offsets */
#define AC97_RESET				0x00
#define AC97_MASTER				0x02
#define AC97_HEADPHONE			0x04
#define AC97_MASTER_MONO		0x06
#define AC97_MASTER_TONE		0x08
#define AC97_PC_BEEP			0x0A    //mixer volume
#define AC97_PHONE				0x0C
#define AC97_MIC				0x0E    //qwert db
#define AC97_LINE				0x10		
#define AC97_CD					0x12
#define AC97_VIDEO				0x14
#define AC97_AUX				0x16
#define AC97_PCM				0x18
#define AC97_REC_SEL			0x1A	//0 represent mic
#define AC97_REC_GAIN			0x1C
#define AC97_REC_GAIN_MIC		0x1E
#define AC97_GENERAL_PURPOSE	0x20
#define AC97_3D_CONTROL			0x22
#define AC97_INT_PAGING			0x24    //qwert
#define AC97_POWERDOWN			0x26
#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 ADC Rate */
#define AC97_PCM_MIC_ADC_RATE	0x34	/* PCM MIC ADC Rate */
#define AC97_DAC_SLOT_MAP		0x6C
#define AC97_ADC_SLOT_MAP		0x6E

void ac97_reset(void);
rt_err_t ac97_set_vol(int vol);
int ac97_get_vol(void);
rt_err_t ac97_set_rate(int rate);
int ac97_get_rate(void);

#endif
