|
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 SymbianETMLib.Common.Types; |
|
22 using SymbianStructuresLib.Arm.Exceptions; |
|
23 using SymbianStructuresLib.Arm.Registers; |
|
24 |
|
25 namespace SymbianETMLib.Common.Utilities |
|
26 { |
|
27 internal static class ETMTextToEnumConverter |
|
28 { |
|
29 public static TArmRegisterType ToRegisterType( string aText ) |
|
30 { |
|
31 TArmRegisterType ret = TArmRegisterType.EArmReg_Other; |
|
32 // |
|
33 string text = aText.ToUpper(); |
|
34 if ( text == "ETB11_IDENTIFICATION" ) |
|
35 { |
|
36 ret = TArmRegisterType.EArmReg_ETB_Id; |
|
37 } |
|
38 else if ( text == "ETB11_RAM_DEPTH" ) |
|
39 { |
|
40 ret = TArmRegisterType.EArmReg_ETB_RamDepth; |
|
41 } |
|
42 else if ( text == "ETB11_RAM_WIDTH" ) |
|
43 { |
|
44 ret = TArmRegisterType.EArmReg_ETB_RamWidth; |
|
45 } |
|
46 else if ( text == "ETB11_STATUS" ) |
|
47 { |
|
48 ret = TArmRegisterType.EArmReg_ETB_Status; |
|
49 } |
|
50 else if ( text == "ETB11_RAM_WRITE_POINTER" ) |
|
51 { |
|
52 ret = TArmRegisterType.EArmReg_ETB_RamWritePointer; |
|
53 } |
|
54 else if ( text == "ETB11_TRIGGER_COUNTER" ) |
|
55 { |
|
56 ret = TArmRegisterType.EArmReg_ETB_TriggerCounter; |
|
57 } |
|
58 else if ( text == "ETB11_CONTROL" ) |
|
59 { |
|
60 ret = TArmRegisterType.EArmReg_ETB_Control; |
|
61 } |
|
62 else if ( text == "ETM_ETM_CONTROL" ) |
|
63 { |
|
64 ret = TArmRegisterType.EArmReg_ETM_Control; |
|
65 } |
|
66 else if ( text == "ETM_ETM_ID" ) |
|
67 { |
|
68 ret = TArmRegisterType.EArmReg_ETM_Id; |
|
69 } |
|
70 // |
|
71 return ret; |
|
72 } |
|
73 |
|
74 public static TArmExceptionVector ToExceptionVector( string aText ) |
|
75 { |
|
76 TArmExceptionVector ret = TArmExceptionVector.EUndefinedInstruction; |
|
77 // |
|
78 string text = aText.ToUpper(); |
|
79 if ( text == "RST" ) |
|
80 { |
|
81 ret = TArmExceptionVector.EReset; |
|
82 } |
|
83 else if ( text == "UND" ) |
|
84 { |
|
85 ret = TArmExceptionVector.EUndefinedInstruction; |
|
86 } |
|
87 else if ( text == "SWI" ) |
|
88 { |
|
89 ret = TArmExceptionVector.ESVC; |
|
90 } |
|
91 else if ( text == "ETB11_STATUS" ) |
|
92 { |
|
93 ret = TArmExceptionVector.EPrefetchAbort; |
|
94 } |
|
95 else if ( text == "PRE" ) |
|
96 { |
|
97 ret = TArmExceptionVector.EPrefetchAbort; |
|
98 } |
|
99 else if ( text == "DAT" ) |
|
100 { |
|
101 ret = TArmExceptionVector.EDataAbort; |
|
102 } |
|
103 else if ( text == "IRQ" ) |
|
104 { |
|
105 ret = TArmExceptionVector.EIRQ; |
|
106 } |
|
107 else if ( text == "FIQ" ) |
|
108 { |
|
109 ret = TArmExceptionVector.EFIQ; |
|
110 } |
|
111 // |
|
112 return ret; |
|
113 } |
|
114 } |
|
115 } |