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 Interrupt objects
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file interrupt.h
|
|
20 |
@internalTechnology
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef __INTERRUPT_H__
|
|
24 |
#define __INTERRUPT_H__
|
|
25 |
|
|
26 |
#include <e32cmn.h>
|
|
27 |
|
|
28 |
#include <drivers/mmc.h>
|
|
29 |
#include <drivers/sdio/callback.h>
|
|
30 |
|
|
31 |
class DSDIOStack;
|
|
32 |
class TSDIOCard;
|
|
33 |
class DSDIOSession;
|
|
34 |
|
|
35 |
typedef void (*TSDIOIsr)(TAny*);
|
|
36 |
|
|
37 |
class TSDIOInterruptController
|
|
38 |
/**
|
|
39 |
TSDIOInterruptController class
|
|
40 |
*/
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
enum TPanic
|
|
44 |
{
|
|
45 |
EBadParameter,
|
|
46 |
EParameterOutOfRange
|
|
47 |
};
|
|
48 |
public:
|
|
49 |
TSDIOInterruptController();
|
|
50 |
~TSDIOInterruptController();
|
|
51 |
|
|
52 |
TInt Create(DSDIOStack* aStackP, TSDIOCard* aCardP);
|
|
53 |
|
|
54 |
TInt EnableInterrupt(TUint8 aFunctionNumber);
|
|
55 |
TInt DisableInterrupt(TUint8 aFunctionNumber);
|
|
56 |
|
|
57 |
TInt Schedule();
|
|
58 |
void Service();
|
|
59 |
|
|
60 |
TInt Start();
|
|
61 |
TInt Stop();
|
|
62 |
|
|
63 |
private:
|
|
64 |
static void SessionEndCallBack(TAny* aSelfP);
|
|
65 |
|
|
66 |
static void Panic(TSDIOInterruptController::TPanic aPanic);
|
|
67 |
|
|
68 |
private:
|
|
69 |
TSDIOCard* iCardP;
|
|
70 |
DSDIOSession* iInterruptSessionP;
|
|
71 |
TMMCCallBack iSessionEndCallBack;
|
|
72 |
TUint8 iPending;
|
|
73 |
NFastSemaphore iShutdownSem;
|
|
74 |
|
|
75 |
friend class TSDIOInterrupt;
|
|
76 |
};
|
|
77 |
|
|
78 |
class TSDIOInterrupt
|
|
79 |
/**
|
|
80 |
TSDIOInterrupt class
|
|
81 |
|
|
82 |
Provides the client with the ability to enable, disable, bind and unbind to an SDIO Interrupt.
|
|
83 |
|
|
84 |
This class effectively exposes the functionality of the TSDIOInterruptController class to the
|
|
85 |
client on a simple per-function basis.
|
|
86 |
|
|
87 |
Note that there is no Clear() method provided as SDIO Interrupts cannot be cleared through the
|
|
88 |
common card control register interface. Hence, it is the responsibility of the client device
|
|
89 |
driver to clear the appropriate interrupt through its associated DSDIORegInterface class.
|
|
90 |
(This will typically be performed in the ISR for the function)
|
|
91 |
|
|
92 |
Also note that Enable() and Disable() involve writing to the CCCR register of Function 0, which
|
|
93 |
therefore involves the scheduling of a session on the stack (using the common register interface
|
|
94 |
contained in the TSDIOCard class). Therefore, to provide a consistent API, these functions shall
|
|
95 |
behave like the API provided by the DSDIORegInterface class and block the current thread until
|
|
96 |
the session completes, times out or returns with an error.
|
|
97 |
*/
|
|
98 |
{
|
|
99 |
public:
|
|
100 |
IMPORT_C TSDIOInterrupt(TSDIOInterruptController* aControllerP, TUint8 aFunctionNumber);
|
|
101 |
|
|
102 |
IMPORT_C ~TSDIOInterrupt();
|
|
103 |
|
|
104 |
IMPORT_C TInt Bind(TSDIOIsr aIsr, TAny* aPtr);
|
|
105 |
IMPORT_C TInt Unbind();
|
|
106 |
IMPORT_C TInt Enable();
|
|
107 |
IMPORT_C TInt Disable();
|
|
108 |
|
|
109 |
void Service();
|
|
110 |
|
|
111 |
private:
|
|
112 |
static void UnhookedIsr(TAny* aPtr);
|
|
113 |
|
|
114 |
TSDIOInterruptController* iControllerP;
|
|
115 |
TUint8 iFunctionNumber;
|
|
116 |
|
|
117 |
TSDIOIsr iIsr;
|
|
118 |
TAny* iPtr;
|
|
119 |
|
|
120 |
friend class TSDIOFunction;
|
|
121 |
|
|
122 |
//
|
|
123 |
// Reserved members to maintain binary compatibility
|
|
124 |
TInt iReserved[2];
|
|
125 |
};
|
|
126 |
|
|
127 |
#endif
|