xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CGinaDspCommObject.cpp (revision c2ddc71cc54397447f60bda00ea1ceca5c80bead)
1 // ****************************************************************************
2 //
3 //  	CGinaDspCommObject.cpp
4 //
5 //		Implementation file Gina20 DSP interface class.
6 //
7 // ----------------------------------------------------------------------------
8 //
9 //   Copyright Echo Digital Audio Corporation (c) 1998 - 2004
10 //   All rights reserved
11 //   www.echoaudio.com
12 //
13 //   This file is part of Echo Digital Audio's generic driver library.
14 //
15 //   Echo Digital Audio's generic driver library is free software;
16 //   you can redistribute it and/or modify it under the terms of
17 //   the GNU General Public License as published by the Free Software Foundation.
18 //
19 //   This program 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
22 //   GNU General Public License for more details.
23 //
24 //   You should have received a copy of the GNU General Public License
25 //   along with this program; if not, write to the Free Software
26 //   Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 //   MA  02111-1307, USA.
28 //
29 // ****************************************************************************
30 
31 #include "CEchoGals.h"
32 #include "CGinaDspCommObject.h"
33 
34 #include "Gina20DSP.c"
35 
36 
37 /****************************************************************************
38 
39 	Construction and destruction
40 
41  ****************************************************************************/
42 
43 //===========================================================================
44 //
45 // Constructor
46 //
47 //===========================================================================
48 
49 CGinaDspCommObject::CGinaDspCommObject
50 (
51 	PDWORD		pdwRegBase,				// Virtual ptr to DSP registers
52 	PCOsSupport	pOsSupport
53 ) : CGdDspCommObject( pdwRegBase, pOsSupport )
54 {
55 	strcpy( m_szCardName, "Gina" );
56 	m_pdwDspRegBase = pdwRegBase;		// Virtual addr DSP's register base
57 
58 	m_wNumPipesOut = 10;
59 	m_wNumPipesIn = 4;
60 	m_wNumBussesOut = 10;
61 	m_wNumBussesIn = 4;
62 	m_wFirstDigitalBusOut = 8;
63 	m_wFirstDigitalBusIn = 2;
64 
65 	m_fHasVmixer = FALSE;
66 
67 	m_wNumMidiOut = 0;					// # MIDI out channels
68 	m_wNumMidiIn = 0;						// # MIDI in  channels
69 
70 	m_pwDspCodeToLoad = pwGina20DSP;
71 
72 	//
73 	// Since this card has no ASIC, mark it as loaded so everything works OK
74 	//
75 	m_bASICLoaded = TRUE;
76 
77 }	// CGinaDspCommObject::CGinaDspCommObject( DWORD dwPhysRegBase )
78 
79 
80 //===========================================================================
81 //
82 // Destructor
83 //
84 //===========================================================================
85 
86 CGinaDspCommObject::~CGinaDspCommObject()
87 {
88 }	// CGinaDspCommObject::~CGinaDspCommObject()
89 
90 
91 
92 
93 /****************************************************************************
94 
95 	Hardware config
96 
97  ****************************************************************************/
98 
99 //===========================================================================
100 //
101 // Destructor
102 //
103 //===========================================================================
104 
105 ECHOSTATUS CGinaDspCommObject::SetInputClock(WORD wClock)
106 {
107 	ECHO_DEBUGPRINTF( ( "CGinaDspCommObject::SetInputClock:\n" ) );
108 
109 	switch ( wClock )
110 	{
111 		case ECHO_CLOCK_INTERNAL :
112 
113 			// Reset the audio state to unknown (just in case)
114 			m_byGDCurrentClockState = GD_CLOCK_UNDEF;
115 			m_byGDCurrentSpdifStatus = GD_SPDIF_STATUS_UNDEF;
116 
117 			SetSampleRate();
118 
119 			m_wInputClock = wClock;
120 
121 			ECHO_DEBUGPRINTF( ( "\tSet Gina clock to INTERNAL\n" ) );
122 			break;
123 
124 		case ECHO_CLOCK_SPDIF :
125 			m_pDspCommPage->byGDClockState = GD_CLOCK_SPDIFIN;
126 			m_pDspCommPage->byGDSpdifStatus = GD_SPDIF_STATUS_NOCHANGE;
127 
128 			ClearHandshake();
129 			SendVector( DSP_VC_SET_GD_AUDIO_STATE );
130 
131 			m_byGDCurrentClockState = GD_CLOCK_SPDIFIN;
132 
133 			ECHO_DEBUGPRINTF( ( "\tSet Gina clock to SPDIF\n" ) );
134 
135 			m_wInputClock = wClock;
136 			break;
137 
138 		default :
139 			return ECHOSTATUS_CLOCK_NOT_SUPPORTED;
140 
141 	}		// switch ( wClock )
142 
143 	return ECHOSTATUS_OK;
144 
145 } 		// ECHOSTATUS CGinaDspCommObject::SetInputClock()
146 
147 
148 // **** GinaDspCommObject.cpp ****
149