|
1 /* |
|
2 * This component and the accompanying materials are made available |
|
3 * under the terms of the License "Eclipse Public License v1.0" |
|
4 * which accompanies this distribution, and is available |
|
5 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
6 * |
|
7 * Initial Contributors: |
|
8 * Accenture Ltd |
|
9 * |
|
10 * Contributors: |
|
11 * |
|
12 * Description: This file is a part of sound driver for Syborg adaptation. |
|
13 * |
|
14 */ |
|
15 |
|
16 #ifndef VIRTIO_IOHANDLER_H |
|
17 #define VIRTIO_IOHANDLER_H |
|
18 |
|
19 #include "virtio.h" |
|
20 #include <e32def.h> |
|
21 |
|
22 namespace VirtIo |
|
23 { |
|
24 |
|
25 class DQueue; |
|
26 |
|
27 class DIo; |
|
28 |
|
29 |
|
30 class DIoHandler : public DBase, public MIoHandler |
|
31 { |
|
32 static const TUint KMaxClients = 4; |
|
33 public: |
|
34 DIoHandler( TAny* aVirtIoBase, TUint aIntNum, TDfcQue* aDfcQue ); |
|
35 |
|
36 virtual void RegisterClient( MIoCallback* aClient ) |
|
37 { |
|
38 ASSERT( iClientCount < KMaxClients ); |
|
39 iClients[iClientCount++] = aClient; |
|
40 } |
|
41 |
|
42 virtual void UnregisterClient( MIoCallback* aClient ); |
|
43 |
|
44 TInt Construct(); |
|
45 |
|
46 |
|
47 virtual ~DIoHandler(); |
|
48 |
|
49 virtual MQueue& Queue( TUint id ); |
|
50 |
|
51 private: |
|
52 void ScheduleCallback(); |
|
53 |
|
54 void WaitForCompletion(); |
|
55 |
|
56 void Wipe(); |
|
57 |
|
58 static TBool CheckProcessing( TAny* aSelf ); |
|
59 |
|
60 void InstallIsr(); |
|
61 |
|
62 void UninstallIsr(); |
|
63 |
|
64 static void ServeIsr( TAny* aSelf ); |
|
65 |
|
66 static void ServeDfc( TAny* aSelf ); |
|
67 |
|
68 TBool NotifyClients( MQueue& aQueue, Token aToken, TUint aBytesTransferred ); |
|
69 |
|
70 void InterruptHandler(); |
|
71 |
|
72 TAny* iVirtIoBase; |
|
73 TUint iIntNum; |
|
74 |
|
75 TDfcQue* iDfcQue; |
|
76 TDfc iDfc; |
|
77 |
|
78 //managed |
|
79 DIo* iVirtIo; |
|
80 |
|
81 TUint iQueueCount; |
|
82 //double managed |
|
83 DQueue** iQueue; |
|
84 |
|
85 TUint iClientCount; |
|
86 MIoCallback* iClients[KMaxClients]; |
|
87 |
|
88 }; |
|
89 |
|
90 |
|
91 } // namespace VirtIo |
|
92 |
|
93 #endif |