|
1 /* |
|
2 * Copyright (c) 2006-2008 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/mmc.h> |
|
19 #include "stackbody.h" |
|
20 |
|
21 DMMCStack::DBody::DBody(DMMCStack& aStack) : |
|
22 iStack(aStack), |
|
23 iCurrentSelectedBusWidth( (TUint32)EBusWidthInvalid ) |
|
24 { |
|
25 } |
|
26 |
|
27 // Temporarily increase the idle timeout |
|
28 void DMMCStack::DBody::SetInactivityTimeout(TInt aInactivityTimeout) |
|
29 { |
|
30 iStack.iSocket->ResetInactivity(0); |
|
31 |
|
32 // save existing value - if not already saved (!) |
|
33 if (iInactivityLock++ == 0) |
|
34 { |
|
35 iInactivityTimeout = iStack.iSocket->iVcc->iInactivityTimeout; |
|
36 if (iStack.iSocket->iVccCore) |
|
37 iVccCoreSleepTimeout = iStack.iSocket->iVccCore->iInactivityTimeout; |
|
38 } |
|
39 |
|
40 // set the new inactivity timeout to the maximum of the existing value and the specified value |
|
41 TInt inactivityTimeout = Max(aInactivityTimeout, iInactivityTimeout); |
|
42 iStack.iSocket->iVcc->iInactivityTimeout = inactivityTimeout; |
|
43 if (iStack.iSocket->iVccCore) |
|
44 // Sleep timeout should always be less than Vcc Inactivity timer |
|
45 iStack.iSocket->iVccCore->iInactivityTimeout = inactivityTimeout; |
|
46 } |
|
47 |
|
48 void DMMCStack::DBody::RestoreInactivityTimeout() |
|
49 { |
|
50 iStack.iSocket->ResetInactivity(0); |
|
51 |
|
52 if (--iInactivityLock == 0) |
|
53 { |
|
54 iStack.iSocket->iVcc->iInactivityTimeout = iInactivityTimeout; |
|
55 if (iStack.iSocket->iVccCore) |
|
56 iStack.iSocket->iVccCore->iInactivityTimeout = iVccCoreSleepTimeout; |
|
57 } |
|
58 } |
|
59 |