author | bugtracker-ml@nttdocomo.com |
Sun, 04 Jul 2010 21:21:52 +0100 | |
changeset 84 | 05f4463787cf |
parent 2 | d55eb581a87c |
permissions | -rw-r--r-- |
0
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
1 |
/* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
3 |
* All rights reserved. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
8 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
9 |
* Initial Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
11 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
12 |
* Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
13 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
14 |
* Description: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
15 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
16 |
*/ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
17 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
18 |
#include <ethernet.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
19 |
#include <e32hal.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
20 |
#include <system.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
21 |
#include "ethernet_device.h" |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
22 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
23 |
#pragma diag_suppress 1441 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
24 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
25 |
_LIT(KEthPddName, "Ethernet.Syborg"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
26 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
27 |
// needs ldd version.. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
28 |
const TInt KMinimumLddMajorVersion = 1; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
29 |
const TInt KMinimumLddMinorVersion = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
30 |
const TInt KMinimumLddBuild = 122; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
31 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
32 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
33 |
// Class to identify the driver as PDD |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
34 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
35 |
class DDriverEthernet : public DPhysicalDevice |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
36 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
37 |
public: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
38 |
DDriverEthernet(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
39 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
40 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
41 |
// Functions that we must implement as we are inheriting from abstract base class |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
42 |
// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
43 |
virtual TInt Install(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
44 |
virtual void GetCaps(TDes8 &aDes) const; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
45 |
virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
46 |
virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
47 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
48 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
49 |
////////////////////////////////////////// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
50 |
// Implementation of DDriverEthernet class |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
51 |
////////////////////////////////////////// |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
52 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
53 |
DDriverEthernet::DDriverEthernet() |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
54 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
55 |
DP("** (PDD) DDriverEthernet::DDriverEthernet()"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
56 |
__KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::DDriverEthernet()")); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
57 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
58 |
iUnitsMask=0x1; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
59 |
iVersion=TVersion(KEthernetMajorVersionNumber, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
60 |
KEthernetMinorVersionNumber, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
61 |
KEthernetBuildVersionNumber); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
62 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
63 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
64 |
TInt DDriverEthernet::Install() |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
65 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
66 |
DP("** (PDD) DDriverEthernet::Install()"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
67 |
__KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Install()")); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
68 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
69 |
return SetName(&KEthPddName); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
70 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
71 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
72 |
void DDriverEthernet::GetCaps(TDes8 &aDes) const |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
73 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
74 |
DP("** (PDD) DDriverEthernet::GetCaps"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
75 |
__KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::GetCaps")); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
76 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
77 |
TEthernetCaps capsBuf; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
78 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
79 |
aDes.FillZ(aDes.MaxLength()); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
80 |
aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength())); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
81 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
82 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
83 |
TInt DDriverEthernet::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
84 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
85 |
DP("** (PDD) DDriverEthernet::Create"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
86 |
__KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Create")); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
87 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
88 |
TInt r = KErrNoMemory; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
89 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
90 |
EthernetDevice *VirtioEthernet = new EthernetDevice; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
91 |
if(VirtioEthernet) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
92 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
93 |
DP("** (PDD) DDriverEthernet:: EthernetDevice created successfully"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
94 |
r = VirtioEthernet->DoCreate(aUnit, anInfo); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
95 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
96 |
aChannel = VirtioEthernet; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
97 |
return r; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
98 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
99 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
100 |
TInt DDriverEthernet::Validate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
101 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
102 |
DP("** (PDD) DDriverEthernet::Validate"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
103 |
__KTRACE_OPT(KHARDWARE, Kern::Printf("DDriverEthernet::Validate")); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
104 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
105 |
if((!Kern::QueryVersionSupported(iVersion,aVer)) || |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
106 |
(!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
107 |
KMinimumLddMinorVersion, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
108 |
KMinimumLddBuild)))) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
109 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
110 |
return KErrNotSupported; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
111 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
112 |
if(aUnit != 0) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
113 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
114 |
return KErrNotSupported; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
115 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
116 |
return KErrNone; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
117 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
118 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
119 |
DECLARE_STANDARD_PDD() |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
120 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
121 |
DP("** (DPhysicalDevice) Ethernet PDD Factory created"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
122 |
return new DDriverEthernet; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
123 |
} |