0
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Class definitions for SDIO Callback objects
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file callback.h
|
|
20 |
@internalTechnology
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef __CALLBACK_H__
|
|
24 |
#define __CALLBACK_H__
|
|
25 |
|
|
26 |
#include <e32cmn.h>
|
|
27 |
#include <drivers/pbus.h>
|
|
28 |
|
|
29 |
class DMMCSocket;
|
|
30 |
|
|
31 |
enum TSDIOFunctionCallbackReason
|
|
32 |
/**
|
|
33 |
@publishedPartner
|
|
34 |
@released
|
|
35 |
|
|
36 |
SDIO Function Callback reason codes
|
|
37 |
These are passed to the clients callback function
|
|
38 |
@see TSDIOFunction::RegisterClient
|
|
39 |
*/
|
|
40 |
{
|
|
41 |
/** Card has powered up */
|
|
42 |
ESdioNotifyPowerUp = 0,
|
|
43 |
/** Card requests to power down */
|
|
44 |
ESdioNotifyPowerDownPending = 1,
|
|
45 |
/** Card has powered down */
|
|
46 |
ESdioNotifyPowerDown = 2,
|
|
47 |
/** Request to enter sleep mode */
|
|
48 |
ESdioNotifyPowerSleep = 3,
|
|
49 |
/** Emergency power down */
|
|
50 |
ESdioNotifyEmergencyPowerDown = 4,
|
|
51 |
/** PSU fault */
|
|
52 |
ESdioNotifyPsuFault = 5,
|
|
53 |
/** Card has been removed */
|
|
54 |
ESdioNotifyCardRemoved = 6,
|
|
55 |
/** Card has been inserted */
|
|
56 |
ESdioNotifyCardInserted = 7,
|
|
57 |
};
|
|
58 |
|
|
59 |
typedef TInt (*TSDIOCallbackFunction)(TAny* aPtr, TSDIOFunctionCallbackReason aReason);
|
|
60 |
|
|
61 |
class TSDIOFunctionCallback
|
|
62 |
/** SDIO Function Notification Callback
|
|
63 |
Registered with TSDIOFunction::RegisterClient, and provides clients of the
|
|
64 |
function with events that occur on the bus (such as card removal, power down etc..)
|
|
65 |
@see TSDIOFunction::RegisterClient
|
|
66 |
*/
|
|
67 |
{
|
|
68 |
public:
|
|
69 |
inline TSDIOFunctionCallback();
|
|
70 |
|
|
71 |
inline ~TSDIOFunctionCallback();
|
|
72 |
|
|
73 |
inline TSDIOFunctionCallback(TSDIOCallbackFunction aCallbackFn);
|
|
74 |
|
|
75 |
inline TSDIOFunctionCallback(TSDIOCallbackFunction aCallbackFn, TAny* aPtr);
|
|
76 |
|
|
77 |
IMPORT_C void Register(DMMCSocket* aSocketP);
|
|
78 |
|
|
79 |
inline TInt CallBack(TSDIOFunctionCallbackReason aReason) const;
|
|
80 |
|
|
81 |
private:
|
|
82 |
static void NotificationCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2);
|
|
83 |
|
|
84 |
void DoStateChange(TPBusState aNewState, TInt aReasonCode);
|
|
85 |
|
|
86 |
public:
|
|
87 |
TSDIOCallbackFunction iCallbackFn; // Clients callback function
|
|
88 |
TAny* iPtr; // Clients user data
|
|
89 |
|
|
90 |
private:
|
|
91 |
TPBusCallBack iCallBack; // Master notification callback
|
|
92 |
TPBusState iBusState; // Current power/card state
|
|
93 |
|
|
94 |
private:
|
|
95 |
//
|
|
96 |
// Reserved members to maintain binary compatibility
|
|
97 |
TInt iReserved[2];
|
|
98 |
};
|
|
99 |
|
|
100 |
#include <drivers/sdio/callback.inl>
|
|
101 |
|
|
102 |
#endif // #ifndef __CALLBACK_H__
|