0
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <drivers/sdio/sdio.h>
|
|
19 |
#include "utraceepbussdio.h"
|
|
20 |
|
|
21 |
EXPORT_C DSDIOPsu::DSDIOPsu(TInt aPsuNum, TInt aMediaChangedNum)
|
|
22 |
/**
|
|
23 |
@publishedPartner
|
|
24 |
@released
|
|
25 |
|
|
26 |
Constructor for a DSDIOPsu object
|
|
27 |
param aPsuNum The power supply number
|
|
28 |
@param aMediaChangedNum The associated media change number
|
|
29 |
*/
|
|
30 |
: DMMCPsu(aPsuNum, aMediaChangedNum)
|
|
31 |
{
|
|
32 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuConstructor, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
33 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuConstructorReturning, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
34 |
}
|
|
35 |
|
|
36 |
EXPORT_C TInt DSDIOPsu::DoCreate()
|
|
37 |
/**
|
|
38 |
Creates the DSDIOPsu object
|
|
39 |
*/
|
|
40 |
{
|
|
41 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuDoCreate, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
42 |
TInt err = DMMCPsu::DoCreate();
|
|
43 |
|
|
44 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuDoCreateReturning, reinterpret_cast<TUint32>(this), err); // @SymTraceDataPublishedTvk
|
|
45 |
return(err);
|
|
46 |
}
|
|
47 |
|
|
48 |
|
|
49 |
EXPORT_C void DSDIOPsu::DoTickService()
|
|
50 |
/**
|
|
51 |
Periodic update called only while PSU is on. This checks whether it is safe
|
|
52 |
to remove power from the card or enter sleep mode.
|
|
53 |
*/
|
|
54 |
{
|
|
55 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuDoTickService, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
56 |
|
|
57 |
DSDIOSocket& theSocket = *static_cast<DSDIOSocket*>(iSocket);
|
|
58 |
|
|
59 |
if(IsLocked())
|
|
60 |
{
|
|
61 |
//
|
|
62 |
// If the card is locked, we use the inactivity timeout to determine
|
|
63 |
// whether we can enter sleep mode.
|
|
64 |
//
|
|
65 |
// Note that the power is not turned off, but the clients are notified
|
|
66 |
// to give them an opportunity to de-register themselves or enter a
|
|
67 |
// function-dependant low-power sleep mode).
|
|
68 |
//
|
|
69 |
if(iInactivityTimeout && ++iInactivityCount > iInactivityTimeout)
|
|
70 |
{
|
|
71 |
theSocket.SignalSleepMode();
|
|
72 |
iInactivityCount = 0;
|
|
73 |
}
|
|
74 |
}
|
|
75 |
else
|
|
76 |
{
|
|
77 |
//
|
|
78 |
// If the card is not locked, then we power down the card after the
|
|
79 |
// specified interval (iNotLockedTimeout). This shall perform an
|
|
80 |
// asynchronous power down and reset of the card before removing power
|
|
81 |
// to ensure that the card is in the lowest possible state of power
|
|
82 |
// consumption should the underlying hardware not support a programmable PSU.
|
|
83 |
//
|
|
84 |
if(iNotLockedTimeout)
|
|
85 |
iNotLockedCount++;
|
|
86 |
|
|
87 |
if(iInactivityTimeout)
|
|
88 |
iInactivityCount++;
|
|
89 |
|
|
90 |
if ((iNotLockedTimeout && iNotLockedCount > iNotLockedTimeout) &&
|
|
91 |
(iInactivityTimeout && iInactivityCount > iInactivityTimeout))
|
|
92 |
{
|
|
93 |
theSocket.ResetAndPowerDown();
|
|
94 |
|
|
95 |
iInactivityCount = 0;
|
|
96 |
iNotLockedCount = 0;
|
|
97 |
}
|
|
98 |
}
|
|
99 |
|
|
100 |
CheckVoltage(KPsuChkWhileOn);
|
|
101 |
|
|
102 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuDoTickServiceReturning, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
103 |
}
|
|
104 |
|
|
105 |
EXPORT_C TBool DSDIOPsu::IsLocked()
|
|
106 |
/**
|
|
107 |
Returns ETrue if a client has registered with a function.
|
|
108 |
This prevents power-down events from diabling the function while waiting for
|
|
109 |
long-term events (such as a wake on interrupt event for example)
|
|
110 |
*/
|
|
111 |
{
|
|
112 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuIsLocked, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
113 |
|
|
114 |
TBool locked = iIsLocked || DMMCPsu::IsLocked();
|
|
115 |
|
|
116 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIODSDIOPsuIsLockedReturning, reinterpret_cast<TUint32>(this), locked ? 1 : 0); // @SymTraceDataPublishedTvk
|
|
117 |
return(locked);
|
|
118 |
}
|
|
119 |
|
|
120 |
EXPORT_C void DSDIOPsu::Dummy1() {}
|
|
121 |
EXPORT_C void DSDIOPsu::Dummy2() {}
|
|
122 |
EXPORT_C void DSDIOPsu::Dummy3() {}
|
|
123 |
EXPORT_C void DSDIOPsu::Dummy4() {}
|