|
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 "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 using System; |
|
19 using System.Collections.Generic; |
|
20 using System.Text; |
|
21 using SymbianUtils.BasicTypes; |
|
22 using SymbianETMLib.Common.Types; |
|
23 using SymbianETMLib.Common.Exception; |
|
24 |
|
25 namespace SymbianETMLib.Common.Packets |
|
26 { |
|
27 public class ETMPcktPHeaderFormat1 : ETMPcktPHeaderBase |
|
28 { |
|
29 #region Constructors |
|
30 public ETMPcktPHeaderFormat1() |
|
31 { |
|
32 // Format 1 P-header |
|
33 // |
|
34 // b1NEEEE00 None 0-15 x E, 0-1 x N |
|
35 // Bits [5:2], shown as EEEE, are the count of E atoms. |
|
36 // |
|
37 base.SetMask( "1 # #### 00" ); |
|
38 } |
|
39 #endregion |
|
40 |
|
41 #region API |
|
42 public int ConditionCount( ETMPcktPHeaderBase.TAtomType aAtomType ) |
|
43 { |
|
44 int ret = 0; |
|
45 // |
|
46 switch ( aAtomType ) |
|
47 { |
|
48 case ETMPcktPHeaderBase.TAtomType.EAtomE_Passed: |
|
49 ret = ConditionCountFailed; |
|
50 break; |
|
51 case ETMPcktPHeaderBase.TAtomType.EAtomN_Failed: |
|
52 ret = ConditionCountPassed; |
|
53 break; |
|
54 default: |
|
55 case ETMPcktPHeaderBase.TAtomType.EAtomW_CycleBoundary: |
|
56 throw new ETMException( "ERROR: cycle accurate mode is not supported" ); |
|
57 } |
|
58 // |
|
59 return ret; |
|
60 } |
|
61 #endregion |
|
62 |
|
63 #region From PcktBase |
|
64 #endregion |
|
65 |
|
66 #region Properties |
|
67 public int ConditionCountFailed |
|
68 { |
|
69 get |
|
70 { |
|
71 int ret = 0; |
|
72 // |
|
73 SymMask mask = new SymMask( "#1 #### ##" ); |
|
74 if ( mask.IsMatch( base.RawByte ) ) |
|
75 { |
|
76 ret = 1; |
|
77 } |
|
78 // |
|
79 return ret; |
|
80 } |
|
81 } |
|
82 |
|
83 public int ConditionCountPassed |
|
84 { |
|
85 get |
|
86 { |
|
87 SymMask mask = new SymMask( "## 1111 ##" ); |
|
88 byte val = (byte) mask.Apply( RawByte ); |
|
89 val >>= 2; |
|
90 int ret = System.Convert.ToInt32( val ); |
|
91 return ret; |
|
92 } |
|
93 } |
|
94 #endregion |
|
95 |
|
96 #region Internal constants |
|
97 #endregion |
|
98 |
|
99 #region From System.Object |
|
100 #endregion |
|
101 |
|
102 #region Data members |
|
103 #endregion |
|
104 } |
|
105 } |