118334Speter/*
218334Speter * BeOS Driver for Intel ICH AC'97 Link interface
390075Sobrien *
4132718Skan * Copyright (c) 2002 - 2004, Marcus Overhagen <marcus@overhagen.de>
518334Speter *
6132718Skan * All rights reserved.
718334Speter * Redistribution and use in source and binary forms, with or without modification,
8132718Skan * are permitted provided that the following conditions are met:
918334Speter *
1018334Speter * - Redistributions of source code must retain the above copyright notice,
1118334Speter *   this list of conditions and the following disclaimer.
1218334Speter * - Redistributions in binary form must reproduce the above copyright notice,
13132718Skan *   this list of conditions and the following disclaimer in the documentation
1418334Speter *   and/or other materials provided with the distribution.
1518334Speter *
1618334Speter * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1718334Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1818334Speter * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19132718Skan * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2018334Speter * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2118334Speter * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2218334Speter * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2318334Speter * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2418334Speter * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2550397Sobrien * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26132718Skan *
27132718Skan */
2818334Speter#ifndef _ICH_H_
2918334Speter#define _ICH_H_
3018334Speter
3118334Speter#include "debug.h"
3218334Speter#include "hardware.h"
3350397Sobrien
3490075Sobrien#define VERSION_NUMBER "1.8"
3590075Sobrien
3618334Speter#if DEBUG
3752284Sobrien	#define VERSION_DEBUG " (DEBUG)"
3852284Sobrien#else
3952284Sobrien	#define VERSION_DEBUG ""
4090075Sobrien#endif
41132718Skan
4252284Sobrien#define INFO "Version " VERSION_NUMBER VERSION_DEBUG ", written by Marcus Overhagen. Build " __DATE__ " " __TIME__
4352284Sobrien#define DRIVER_NAME "ich_ac97"
4452284Sobrien
4552284Sobrien#define BUFFER_SIZE		2048
4652284Sobrien#define BUFFER_COUNT	2
4752284Sobrien#define BUFFER_FRAMES_COUNT (BUFFER_SIZE / 4)
4852284Sobrien
4952284Sobrien/* the software channel descriptor */
5052284Sobrientypedef struct {
5152284Sobrien	uint32	regbase;
5252284Sobrien
5352284Sobrien	volatile int32	lastindex;
5452284Sobrien	volatile int64	played_frames_count;
5552284Sobrien	volatile bigtime_t played_real_time;
56132718Skan	volatile bool running;
57132718Skan	volatile void *backbuffer;
58132718Skan	sem_id buffer_ready_sem;
59132718Skan
60132718Skan	void	*buffer_log_base;
61132718Skan	void	*buffer_phy_base;
62132718Skan	void 	*buffer[ICH_BD_COUNT];
63132718Skan	void	*bd_phy_base;
64132718Skan	void	*bd_log_base;
65132718Skan	ich_bd 	*bd[ICH_BD_COUNT];
66132718Skan
67132718Skan	/*
6852284Sobrien	 * a second set of buffers, exported to the multiaudio api (bad idea)
6952284Sobrien	 */
7052284Sobrien	void	*userbuffer[BUFFER_COUNT];
7152284Sobrien	void	*userbuffer_base;
7252284Sobrien
7352284Sobrien	area_id buffer_area;
7490075Sobrien	area_id userbuffer_area;
7590075Sobrien	area_id bd_area;
7652284Sobrien} ich_chan;
7752284Sobrien
7852284Sobrienextern ich_chan * chan_pi;
7952284Sobrienextern ich_chan * chan_po;
8052284Sobrienextern ich_chan * chan_mc;
8152284Sobrien
8252284Sobrienvoid start_chan(ich_chan *chan);
8352284Sobrien
8452284Sobrien#endif
8552284Sobrien