28
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 "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 |
* @file
|
|
20 |
* @internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifdef OVERDUMMY_NCMCC
|
|
24 |
#include <usb/testncmcc/dummy_essock.h>
|
|
25 |
#else
|
|
26 |
#include <es_sock.h>
|
|
27 |
#endif // OVERDUMMY_NCMCC
|
|
28 |
|
|
29 |
#include "ncmclassdescriptor.h"
|
|
30 |
// For OST tracing
|
|
31 |
#include "OstTraceDefinitions.h"
|
|
32 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
33 |
#include "ncmclassdescriptorTraces.h"
|
|
34 |
#endif
|
|
35 |
|
|
36 |
|
|
37 |
/**
|
|
38 |
* This function packs the TNcmClassDescriptor class into a descriptor with
|
|
39 |
* the correct byte alignment for transmission on the USB bus.
|
|
40 |
*
|
|
41 |
* @return Correctly-aligned buffer. NB The buffer returned is a member of
|
|
42 |
* this class and has the same lifetime.
|
|
43 |
*/
|
|
44 |
TDes8& TNcmClassDescriptor::Des()
|
|
45 |
{
|
|
46 |
OstTraceFunctionEntry0( TNCMCLASSDESCRIPTOR_DES_ENTRY );
|
|
47 |
TUint index = 0;
|
|
48 |
|
|
49 |
iBuffer.SetLength(KUSBNcmClassSpecificBufferSize);
|
|
50 |
|
|
51 |
iBuffer[index++] = iHdrSize;
|
|
52 |
iBuffer[index++] = iHdrType;
|
|
53 |
iBuffer[index++] = iHdrSubType;
|
|
54 |
LittleEndian::Put16(&iBuffer[index], iHdrBcdCDC);
|
|
55 |
index += 2;
|
|
56 |
|
|
57 |
iBuffer[index++] = iUnSize;
|
|
58 |
iBuffer[index++] = iUnType;
|
|
59 |
iBuffer[index++] = iUnSubType;
|
|
60 |
iBuffer[index++] = iUnMasterInterface;
|
|
61 |
iBuffer[index++] = iUnSlaveInterface;
|
|
62 |
|
|
63 |
iBuffer[index++] = iEthFunLength;
|
|
64 |
iBuffer[index++] = iEthFunType;
|
|
65 |
iBuffer[index++] = iEthFunSubtype;
|
|
66 |
iBuffer[index++] = iMACAddress;
|
|
67 |
LittleEndian::Put32(&iBuffer[index], iEthernetStatistics);
|
|
68 |
index += 4;
|
|
69 |
LittleEndian::Put16(&iBuffer[index], iMaxSegmentSize);
|
|
70 |
index += 2;
|
|
71 |
LittleEndian::Put16(&iBuffer[index], iNumberMCFilters);
|
|
72 |
index += 2;
|
|
73 |
iBuffer[index++] = iNumberPowerFilters;
|
|
74 |
|
|
75 |
iBuffer[index++] = iNcmFunLength;
|
|
76 |
iBuffer[index++] = iNcmFunType;
|
|
77 |
iBuffer[index++] = iNcmFunSubtype;
|
|
78 |
LittleEndian::Put16(&iBuffer[index], iNcmVersion);
|
|
79 |
index += 2;
|
|
80 |
iBuffer[index++] = iNetworkCapabilities;
|
|
81 |
|
|
82 |
OstTraceFunctionExit0( TNCMCLASSDESCRIPTOR_DES_EXIT );
|
|
83 |
return iBuffer;
|
|
84 |
}
|
|
85 |
|
|
86 |
// End of file
|
|
87 |
|