xref: /haiku/src/add-ons/kernel/drivers/audio/echo/generic/CEchoGals_power.cpp (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 // ****************************************************************************
2 //
3 //		CEchoGals_power.cpp
4 //
5 //		Power management functions for the CEchoGals driver class.
6 //		Set editor tabs to 3 for your viewing pleasure.
7 //
8 //		Copyright Echo Digital Audio Corporation (c) 1998 - 2002
9 //		All rights reserved
10 //		www.echoaudio.com
11 //
12 //		Permission is hereby granted, free of charge, to any person obtaining a
13 //		copy of this software and associated documentation files (the
14 //		"Software"), to deal with the Software without restriction, including
15 //		without limitation the rights to use, copy, modify, merge, publish,
16 //		distribute, sublicense, and/or sell copies of the Software, and to
17 //		permit persons to whom the Software is furnished to do so, subject to
18 //		the following conditions:
19 //
20 //		- Redistributions of source code must retain the above copyright
21 //		notice, this list of conditions and the following disclaimers.
22 //
23 //		- Redistributions in binary form must reproduce the above copyright
24 //		notice, this list of conditions and the following disclaimers in the
25 //		documentation and/or other materials provided with the distribution.
26 //
27 //		- Neither the name of Echo Digital Audio, nor the names of its
28 //		contributors may be used to endorse or promote products derived from
29 //		this Software without specific prior written permission.
30 //
31 //		THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 //		EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33 //		MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34 //		IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
35 //		ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36 //		TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
37 //		SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
38 //
39 // ****************************************************************************
40 
41 #include "CEchoGals.h"
42 
43 
44 //===========================================================================
45 //
46 // Tell the hardware to go into a low-power state - the converters are
47 // shut off and the DSP powers down.
48 //
49 //===========================================================================
50 
51 ECHOSTATUS CEchoGals::GoComatose()
52 {
53 	//
54 	// Pass the call through to the DSP comm object
55 	//
56 	return GetDspCommObject()->GoComatose();
57 
58 } // GoComatose
59 
60 
61 //===========================================================================
62 //
63 // Tell the hardware to wake up - go back to the full-power state
64 //
65 // You can call WakeUp() if you just want to be sure
66 // that the firmware is loaded OK
67 //
68 //===========================================================================
69 
70 ECHOSTATUS CEchoGals::WakeUp()
71 {
72 	//
73 	// Load the firmware
74 	//
75 	ECHOSTATUS Status;
76 	CDspCommObject *pDCO = GetDspCommObject();
77 
78 	Status = pDCO->LoadFirmware();
79 
80 // fixme need to not do this if the DSP was already awake
81 	if (ECHOSTATUS_OK == Status)
82 	{
83 		//
84 		// For any pipes that have daffy ducks,
85 		// reset the pointer to the first PLE in the comm page
86 		//
87 		WORD wPipeIndex;
88 
89 		for (wPipeIndex = 0; wPipeIndex < GetNumPipes(); wPipeIndex++)
90 		{
91 			if (NULL != m_DaffyDucks[wPipeIndex])
92 			{
93 				DWORD dwPhysStartAddr;
94 
95 				dwPhysStartAddr = m_DaffyDucks[wPipeIndex]->GetPhysStartAddr();
96 				pDCO->SetAudioDuckListPhys(wPipeIndex,dwPhysStartAddr);
97 
98 			}
99 		}
100 	}
101 
102 	return Status;
103 
104 
105 } // WakeUp
106 
107 
108