sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <drivers/mmc.h>
|
sl@0
|
19 |
#include "stackbody.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
DMMCStack::DBody::DBody(DMMCStack& aStack) :
|
sl@0
|
22 |
iStack(aStack),
|
sl@0
|
23 |
iCurrentSelectedBusWidth( (TUint32)EBusWidthInvalid )
|
sl@0
|
24 |
{
|
sl@0
|
25 |
}
|
sl@0
|
26 |
|
sl@0
|
27 |
// Temporarily increase the idle timeout
|
sl@0
|
28 |
void DMMCStack::DBody::SetInactivityTimeout(TInt aInactivityTimeout)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
iStack.iSocket->ResetInactivity(0);
|
sl@0
|
31 |
|
sl@0
|
32 |
// save existing value - if not already saved (!)
|
sl@0
|
33 |
if (iInactivityLock++ == 0)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
iInactivityTimeout = iStack.iSocket->iVcc->iInactivityTimeout;
|
sl@0
|
36 |
if (iStack.iSocket->iVccCore)
|
sl@0
|
37 |
iVccCoreSleepTimeout = iStack.iSocket->iVccCore->iInactivityTimeout;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
// set the new inactivity timeout to the maximum of the existing value and the specified value
|
sl@0
|
41 |
TInt inactivityTimeout = Max(aInactivityTimeout, iInactivityTimeout);
|
sl@0
|
42 |
iStack.iSocket->iVcc->iInactivityTimeout = inactivityTimeout;
|
sl@0
|
43 |
if (iStack.iSocket->iVccCore)
|
sl@0
|
44 |
// Sleep timeout should always be less than Vcc Inactivity timer
|
sl@0
|
45 |
iStack.iSocket->iVccCore->iInactivityTimeout = inactivityTimeout;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
void DMMCStack::DBody::RestoreInactivityTimeout()
|
sl@0
|
49 |
{
|
sl@0
|
50 |
iStack.iSocket->ResetInactivity(0);
|
sl@0
|
51 |
|
sl@0
|
52 |
if (--iInactivityLock == 0)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
iStack.iSocket->iVcc->iInactivityTimeout = iInactivityTimeout;
|
sl@0
|
55 |
if (iStack.iSocket->iVccCore)
|
sl@0
|
56 |
iStack.iSocket->iVccCore->iInactivityTimeout = iVccCoreSleepTimeout;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|