1069 for mapping in self.GetMappings(): |
1069 for mapping in self.GetMappings(): |
1070 list.extend(FindTypeList(mapping)) |
1070 list.extend(FindTypeList(mapping)) |
1071 list.sort() |
1071 list.sort() |
1072 return ",".join(list) |
1072 return ",".join(list) |
1073 |
1073 |
|
1074 def GenerateMapName(self, name, index, subindex): |
|
1075 return "%s (0x%4.4X)" % (name, index) |
|
1076 |
1074 """ |
1077 """ |
1075 Generate the list of variables that can be mapped for the current node |
1078 Generate the list of variables that can be mapped for the current node |
1076 """ |
1079 """ |
1077 def GenerateMapList(self): |
1080 def GenerateMapList(self): |
1078 self.MapList = "None" |
1081 self.MapList = "None" |
1080 self.MapTranslation = {"00000000" : "None"} |
1083 self.MapTranslation = {"00000000" : "None"} |
1081 list = self.GetMapVariableList() |
1084 list = self.GetMapVariableList() |
1082 for index, subIndex, size, name in list: |
1085 for index, subIndex, size, name in list: |
1083 self.MapList += ",%s"%name |
1086 self.MapList += ",%s"%name |
1084 map = "%04X%02X%02X"%(index,subIndex,size) |
1087 map = "%04X%02X%02X"%(index,subIndex,size) |
1085 self.NameTranslation[name] = map |
1088 mapname = self.GenerateMapName(name, index, subIndex) |
1086 self.MapTranslation[map] = name |
1089 self.NameTranslation[mapname] = map |
|
1090 self.MapTranslation[map] = mapname |
1087 |
1091 |
1088 def GetMapValue(self, mapname): |
1092 def GetMapValue(self, mapname): |
1089 if mapname == "None": |
1093 if mapname == "None": |
1090 return 0 |
1094 return 0 |
1091 else: |
1095 else: |
1092 list = self.GetMapVariableList() |
1096 list = self.GetMapVariableList() |
1093 for index, subIndex, size, name in list: |
1097 for index, subIndex, size, name in list: |
1094 if mapname == name: |
1098 if mapname == self.GenerateMapName(name, index, subIndex): |
1095 return (index << 16) + (subIndex << 8) + size |
1099 return (index << 16) + (subIndex << 8) + size |
1096 return None |
1100 return None |
1097 |
1101 |
1098 def GetMapName(self, value): |
1102 def GetMapName(self, value): |
1099 if value != 0: |
1103 if value != 0: |
1100 index = value >> 16 |
1104 index = value >> 16 |
1101 subindex = (value >> 8) % (1 << 8) |
1105 subindex = (value >> 8) % (1 << 8) |
1102 result = self.GetSubentryInfos(index, subindex) |
1106 result = self.GetSubentryInfos(index, subindex) |
1103 if result: |
1107 if result: |
1104 return result["name"] |
1108 return self.GenerateMapName(result["name"], index, subindex) |
1105 return "None" |
1109 return "None" |
1106 |
1110 |
1107 """ |
1111 """ |
1108 Return the list of variables that can be mapped for the current node |
1112 Return the list of variables that can be mapped for the current node |
1109 """ |
1113 """ |
1110 def GetMapList(self): |
1114 def GetMapList(self): |
1111 list = ["None"] + [name for index, subIndex, size, name in self.GetMapVariableList()] |
1115 list = ["None"] + [self.GenerateMapName(name, index, subIndex) for index, subIndex, size, name in self.GetMapVariableList()] |
1112 return ",".join(list) |
1116 return ",".join(list) |
1113 |
1117 |
1114 def BE_to_LE(value): |
1118 def BE_to_LE(value): |
1115 """ |
1119 """ |
1116 Convert Big Endian to Little Endian |
1120 Convert Big Endian to Little Endian |