0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 |
|
|
19 |
#include <kernel.h> // For Kern
|
|
20 |
#include "isaaccessextension.h"
|
|
21 |
#include "iadtrace.h" // For C_TRACE..
|
|
22 |
#include "router.h" // For DRouter
|
|
23 |
|
|
24 |
// CONSTS
|
|
25 |
// Priorities to DFC queues
|
|
26 |
const TInt KIADLddPrioriAdd( 0 );
|
|
27 |
const TInt KIADExtensionPrioriAdd( 0 );
|
|
28 |
|
|
29 |
DRouter* DIsaAccessExtension::iRouter = NULL;
|
|
30 |
TDfcQue* DIsaAccessExtension::iDfcQueueList[ EIADSizeOfDfcThreadList ] = { NULL, NULL };
|
|
31 |
|
|
32 |
// Internal fault codes.
|
|
33 |
enum TIADExtensionFaults
|
|
34 |
{
|
|
35 |
EIADDFCThreadCreationFailed = 1,
|
|
36 |
EIADDFCThreadGetFailed = 2,
|
|
37 |
};
|
|
38 |
|
|
39 |
DIsaAccessExtension::DIsaAccessExtension
|
|
40 |
(
|
|
41 |
// None
|
|
42 |
)
|
|
43 |
{
|
|
44 |
|
|
45 |
C_TRACE( ( _T( "DIsaAccessExtension::DIsaAccessExtension ->" ) ) );
|
|
46 |
// One above DFCQue0 (27)
|
|
47 |
TInt defaultDfcPriority( 27 ); //TODO: NOTE!!! change to use DFCQue0 priority if possible //Kern::DfcQue0()->iThread->iPriority; NOTE!! IST prios
|
|
48 |
// LDD DFC queue.
|
|
49 |
TDfcQue* lddTDfcQueue = NULL;
|
|
50 |
ASSERT_RESET_ALWAYS( KErrNone == Kern::DfcQCreate( lddTDfcQueue, defaultDfcPriority + KIADLddPrioriAdd, &KIADLddDfc ), EIADDFCThreadCreationFailed );
|
|
51 |
iDfcQueueList[ EIADLddDfcQueue ] = lddTDfcQueue;
|
|
52 |
// Extension DFC queue.
|
|
53 |
TDfcQue* extensionTDfcQueue = NULL;
|
|
54 |
ASSERT_RESET_ALWAYS( KErrNone == Kern::DfcQCreate( extensionTDfcQueue, defaultDfcPriority + KIADExtensionPrioriAdd, &KIADExtensionDfc ), EIADDFCThreadCreationFailed );
|
|
55 |
iDfcQueueList[ EIADExtensionDfcQueue ] = extensionTDfcQueue;
|
|
56 |
C_TRACE( ( _T( "DIsaAccessExtension::DIsaAccessExtension <-" ) ) );
|
|
57 |
iRouter = new DRouter();
|
|
58 |
ASSERT_RESET_ALWAYS( iRouter, EIADMemoryAllocationFailure | EIADFaultIdentifier4 << KFaultIdentifierShift );
|
|
59 |
// _LIT8( KIADCOMPONAME, "ISA ACCESS DRIVER" );
|
|
60 |
//BUILD_TRACE( KIADCOMPONAME() );
|
|
61 |
|
|
62 |
}
|
|
63 |
|
|
64 |
DIsaAccessExtension::~DIsaAccessExtension
|
|
65 |
(
|
|
66 |
// None
|
|
67 |
)
|
|
68 |
{
|
|
69 |
|
|
70 |
C_TRACE( ( _T( "DIsaAccessExtension::~DIsaAccessExtension ->" ) ) );
|
|
71 |
// Never unloaded so no actual need for these, but we could test memory allocations
|
|
72 |
// and deallocations if we destroy this extension in test code.
|
|
73 |
delete iRouter;
|
|
74 |
iRouter = NULL;
|
|
75 |
for( TInt i( 0 ); i < EIADSizeOfDfcThreadList; ++i )
|
|
76 |
{
|
|
77 |
TDfcQue* dfcQueueToBeDeleted = GetDFCThread( static_cast< TIADDfcThread >( i ) );
|
|
78 |
ASSERT_RESET_ALWAYS( dfcQueueToBeDeleted, EIADDFCThreadGetFailed | EIADFaultIdentifier1 << KFaultIdentifierShift );
|
|
79 |
delete dfcQueueToBeDeleted;
|
|
80 |
dfcQueueToBeDeleted = NULL;
|
|
81 |
}
|
|
82 |
iDfcQueueList[ EIADLddDfcQueue ] = NULL;
|
|
83 |
iDfcQueueList[ EIADExtensionDfcQueue ] = NULL;
|
|
84 |
C_TRACE( ( _T( "DIsaAccessExtension::~DIsaAccessExtension <-" ) ) );
|
|
85 |
|
|
86 |
}
|
|
87 |
|
|
88 |
|
|
89 |
EXPORT_C MChannel2IADApi* DIsaAccessExtension::GetChannel2IADApi
|
|
90 |
(
|
|
91 |
// None
|
|
92 |
)
|
|
93 |
{
|
|
94 |
|
|
95 |
C_TRACE( ( _T( "DIsaAccessExtension::::GetChannel2IADApi 0x%x <->" ), iRouter ) );
|
|
96 |
return iRouter;
|
|
97 |
|
|
98 |
}
|
|
99 |
|
|
100 |
EXPORT_C TDfcQue* DIsaAccessExtension::GetDFCThread
|
|
101 |
(
|
|
102 |
TIADDfcThread aDfcThread
|
|
103 |
)
|
|
104 |
{
|
|
105 |
|
|
106 |
C_TRACE( ( _T( "DIsaAccessExtension::GetDFCThread <->" ) ) );
|
|
107 |
ASSERT_RESET_ALWAYS( ( EIADLddDfcQueue == aDfcThread || EIADExtensionDfcQueue == aDfcThread ), EIADDFCThreadGetFailed | EIADFaultIdentifier2 << KFaultIdentifierShift );
|
|
108 |
// Ownership not given to caller.
|
|
109 |
return iDfcQueueList[ aDfcThread ];
|
|
110 |
|
|
111 |
}
|
|
112 |
|
|
113 |
DECLARE_STANDARD_EXTENSION()
|
|
114 |
{
|
|
115 |
|
|
116 |
Kern::Printf( "ISA Access Extension" );
|
|
117 |
C_TRACE( ( _T( "DIsaAccessExtension EntryPoint ->" ) ) );
|
|
118 |
// Create a container extension
|
|
119 |
DIsaAccessExtension* extension = new DIsaAccessExtension();
|
|
120 |
TRACE_ASSERT( extension );
|
|
121 |
C_TRACE( ( _T( "DIsaAccessExtension EntryPoint <-" ) ) );
|
|
122 |
return extension ? KErrNone : KErrNoMemory;
|
|
123 |
|
|
124 |
}
|