xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CLaylaDspCommObject.h (revision d3503944f052536d75afff2b89c0a9f0fdc9e83e)
1 // ****************************************************************************
2 //
3 //		CLaylaDspCommObject.H
4 //
5 //		Include file for EchoGals generic driver Layla DSP interface class.
6 //
7 // ----------------------------------------------------------------------------
8 //
9 // This file is part of Echo Digital Audio's generic driver library.
10 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005
11 // All rights reserved
12 // www.echoaudio.com
13 //
14 // This library is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU Lesser General Public
16 // License as published by the Free Software Foundation; either
17 // version 2.1 of the License, or (at your option) any later version.
18 //
19 // This library is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 // Lesser General Public License for more details.
23 //
24 // You should have received a copy of the GNU Lesser General Public
25 // License along with this library; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27 //
28 // ****************************************************************************
29 
30 #ifndef	_LAYLADSPCOMMOBJECT_
31 #define	_LAYLADSPCOMMOBJECT_
32 
33 #include "CDspCommObject.h"
34 
35 //*****************************************************************************
36 //
37 // Layla clock numbers to send to DSP
38 //
39 //*****************************************************************************
40 
41 #define LAYLA20_CLOCK_INTERNAL			0
42 #define LAYLA20_CLOCK_SPDIF				1
43 #define LAYLA20_CLOCK_WORD					2
44 #define LAYLA20_CLOCK_SUPER				3
45 
46 
47 //*****************************************************************************
48 //
49 // CLaylaDspCommObject
50 //
51 //*****************************************************************************
52 
53 
54 class CLaylaDspCommObject : public CDspCommObject
55 {
56 protected:
57 
58 	enum
59 	{
60 		LAYLA20_INPUT_TRIMS	= 8
61 	};
62 
63 	BYTE	m_byInputTrims[LAYLA20_INPUT_TRIMS];	// Input trims for Layla20's 8 analog
64 																// inputs
65 
66 public:
67 	//
68 	//	Construction/destruction
69 	//
70 	CLaylaDspCommObject( PDWORD pdwRegBase, PCOsSupport pOsSupport );
71 	virtual ~CLaylaDspCommObject();
72 
73 	//
74 	//	Set the DSP sample rate
75 	//	Return rate that was set, -1 if error
76 	//
77 	virtual DWORD SetSampleRate( DWORD dwNewSampleRate );
78 	//
79 	//	Send current setting to DSP & return what it is
80 	//
SetSampleRate()81 	virtual DWORD SetSampleRate()
82 	{ return( SetSampleRate( GetSampleRate() ) ); }
83 
84 	//
85 	//	Card information
86 	//
GetCardType()87 	virtual WORD GetCardType()
88 		{ return( LAYLA ); }
89 
90 	//
91 	//	Set clocks
92 	//
93 	virtual ECHOSTATUS SetOutputClock(WORD wClock);
94 	virtual ECHOSTATUS SetInputClock(WORD wClock);
95 
96 	//
97 	//	Input gain
98 	//
99 	virtual ECHOSTATUS SetBusInGain(WORD wBusIn,INT32 iGain);
100 	virtual ECHOSTATUS GetBusInGain(WORD wBusIn,INT32 &iGain);
101 	virtual ECHOSTATUS SetNominalLevel( WORD wBus, BOOL bState );
102 
103 protected:
104 
105 	virtual BOOL LoadASIC();
106 	using CDspCommObject::LoadASIC;
107 
108 	//
109 	//	Check status of ASIC - loaded or not loaded
110 	//
111 	enum
112 	{
113 		NUM_ASIC_ATTEMPTS	= 5,
114 		NUM_ASIC_WINS = 3
115 	};
116 
117 	virtual BOOL CheckAsicStatus();
118 
119 };		// class CLaylaDspCommObject
120 
121 typedef CLaylaDspCommObject * PCLaylaDspCommObject;
122 
123 #endif
124 
125 // **** LaylaDspCommObject.h ****
126