xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CGinaDspCommObject.cpp (revision 626bc4bee107897c38c596c3440cf0a74b4b9c40)
1 // ****************************************************************************
2 //
3 //  	CGinaDspCommObject.cpp
4 //
5 //		Implementation file Gina20 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 #include "CEchoGals.h"
31 #include "CGinaDspCommObject.h"
32 
33 #include "Gina20DSP.c"
34 
35 
36 /****************************************************************************
37 
38 	Construction and destruction
39 
40  ****************************************************************************/
41 
42 //===========================================================================
43 //
44 // Constructor
45 //
46 //===========================================================================
47 
CGinaDspCommObject(PDWORD pdwRegBase,PCOsSupport pOsSupport)48 CGinaDspCommObject::CGinaDspCommObject
49 (
50 	PDWORD		pdwRegBase,				// Virtual ptr to DSP registers
51 	PCOsSupport	pOsSupport
52 ) : CGdDspCommObject( pdwRegBase, pOsSupport )
53 {
54 	strcpy( m_szCardName, "Gina" );
55 	m_pdwDspRegBase = pdwRegBase;		// Virtual addr DSP's register base
56 
57 	m_wNumPipesOut = 10;
58 	m_wNumPipesIn = 4;
59 	m_wNumBussesOut = 10;
60 	m_wNumBussesIn = 4;
61 	m_wFirstDigitalBusOut = 8;
62 	m_wFirstDigitalBusIn = 2;
63 
64 	m_fHasVmixer = FALSE;
65 
66 	m_wNumMidiOut = 0;					// # MIDI out channels
67 	m_wNumMidiIn = 0;						// # MIDI in  channels
68 
69 	m_pwDspCodeToLoad = pwGina20DSP;
70 
71 	//
72 	// Since this card has no ASIC, mark it as loaded so everything works OK
73 	//
74 	m_bASICLoaded = TRUE;
75 
76 }	// CGinaDspCommObject::CGinaDspCommObject( DWORD dwPhysRegBase )
77 
78 
79 //===========================================================================
80 //
81 // Destructor
82 //
83 //===========================================================================
84 
~CGinaDspCommObject()85 CGinaDspCommObject::~CGinaDspCommObject()
86 {
87 }	// CGinaDspCommObject::~CGinaDspCommObject()
88 
89 
90 
91 
92 /****************************************************************************
93 
94 	Hardware config
95 
96  ****************************************************************************/
97 
98 //===========================================================================
99 //
100 // Destructor
101 //
102 //===========================================================================
103 
SetInputClock(WORD wClock)104 ECHOSTATUS CGinaDspCommObject::SetInputClock(WORD wClock)
105 {
106 	ECHO_DEBUGPRINTF( ( "CGinaDspCommObject::SetInputClock:\n" ) );
107 
108 	switch ( wClock )
109 	{
110 		case ECHO_CLOCK_INTERNAL :
111 
112 			// Reset the audio state to unknown (just in case)
113 			m_byGDCurrentClockState = GD_CLOCK_UNDEF;
114 			m_byGDCurrentSpdifStatus = GD_SPDIF_STATUS_UNDEF;
115 
116 			SetSampleRate();
117 
118 			m_wInputClock = wClock;
119 
120 			ECHO_DEBUGPRINTF( ( "\tSet Gina clock to INTERNAL\n" ) );
121 			break;
122 
123 		case ECHO_CLOCK_SPDIF :
124 			m_pDspCommPage->byGDClockState = GD_CLOCK_SPDIFIN;
125 			m_pDspCommPage->byGDSpdifStatus = GD_SPDIF_STATUS_NOCHANGE;
126 
127 			ClearHandshake();
128 			SendVector( DSP_VC_SET_GD_AUDIO_STATE );
129 
130 			m_byGDCurrentClockState = GD_CLOCK_SPDIFIN;
131 
132 			ECHO_DEBUGPRINTF( ( "\tSet Gina clock to SPDIF\n" ) );
133 
134 			m_wInputClock = wClock;
135 			break;
136 
137 		default :
138 			return ECHOSTATUS_CLOCK_NOT_SUPPORTED;
139 
140 	}		// switch ( wClock )
141 
142 	return ECHOSTATUS_OK;
143 
144 } 		// ECHOSTATUS CGinaDspCommObject::SetInputClock()
145 
146 
147 // **** GinaDspCommObject.cpp ****
148