Add infrastructure for recognize modules supported by the selected cpu
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 16 Apr 2009 17:47:34 +0000 (17:47 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 16 Apr 2009 17:47:34 +0000 (17:47 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2522 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCpuPage.py
wizard/bertos_utils.py
wizard/const.py

index f1dbfd66f218ba87eedc04b139aeb8f34e5c61b4..e490acab29646e4dca3eb963660cf61601081647 100644 (file)
@@ -44,6 +44,13 @@ class BCpuPage(BWizardPage):
             self.setProjectInfo("CPU_INFOS", infos)
             self.setProjectInfo("CPU_NAME", unicode(self.pageContent.cpuList.currentItem().text()))
             self.setProjectInfo("SELECTED_FREQ", unicode(long(self.pageContent.frequencySpinBox.value())))
+            tag_dict = self.projectInfo("ALL_CPU_TAGS")
+            for tag in tag_dict:
+                if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["CORE_CPU"]]:
+                    tag_dict[tag] = "True"
+                else:
+                    tag_dict[tag] = "False"
+            self.setProjectInfo("ALL_CPU_TAGS", tag_dict)
             return True
         else:
             return False
@@ -119,6 +126,12 @@ class BCpuPage(BWizardPage):
         self.pageContent.cpuList.clear()
         self.pageContent.cpuList.setCurrentItem(None)
         infos = bertos_utils.loadCpuInfos(self.project())
+        tag_list = bertos_utils.getTagSet(infos)
+        # Create, fill and store the dict with the tags
+        tag_dict = {}
+        for element in tag_list:
+            tag_dict[element] = "False"
+        self.setProjectInfo("ALL_CPU_TAGS", tag_dict)
         for cpu in infos:
             item = QListWidgetItem(cpu["CPU_NAME"])
             item.setData(Qt.UserRole, qvariant_converter.convertDict(cpu))
index a9578d13c228e2f3a76bec8221f0ce9cbc7e5a13..33942e8ab15afea9a5122a1299e0ef2e103bdafd 100644 (file)
@@ -301,6 +301,15 @@ def loadCpuInfos(project):
         cpuInfos.append(getInfos(definition))
     return cpuInfos
 
+def getTagSet(cpu_info):
+    tag_set = set([])
+    for cpu in cpu_info:
+        tag_set |= set([cpu["CPU_NAME"]])
+        tag_set |= set(cpu["CPU_TAGS"])
+        tag_set |= set([cpu["CORE_CPU"]])
+    return tag_set
+        
+
 def getInfos(definition):
     D = {}
     D.update(const.CPU_DEF)
@@ -337,10 +346,11 @@ def loadModuleDefinition(first_comment):
         del module_definition[const.MODULE_DEFINITION["module_name"]]
         module_dict[module_name] = {}
         if const.MODULE_DEFINITION["module_depends"] in module_definition.keys():
-            if type(module_definition[const.MODULE_DEFINITION["module_depends"]]) == str:
-                module_definition[const.MODULE_DEFINITION["module_depends"]] = (module_definition[const.MODULE_DEFINITION["module_depends"]],)
-            module_dict[module_name]["depends"] = module_definition[const.MODULE_DEFINITION["module_depends"]]
+            depends = module_definition[const.MODULE_DEFINITION["module_depends"]]
             del module_definition[const.MODULE_DEFINITION["module_depends"]]
+            if type(depends) == str:
+                depends = (depends,)
+            module_dict[module_name]["depends"] = depends
         else:
             module_dict[module_name]["depends"] = ()
         if const.MODULE_DEFINITION["module_configuration"] in module_definition.keys():
@@ -364,6 +374,10 @@ def loadModuleDefinition(first_comment):
             module_dict[module_name]["hw"] = hw
         else:
             module_dict[module_name]["hw"] = ()
+        if const.MODULE_DEFINITION["module_supports"] in module_definition.keys():
+            supports = module_definition[const.MODULE_DEFINITION["module_supports"]]
+            del module_definition[const.MODULE_DEFINITION["module_supports"]]
+            module_dict[module_name]["supports"] = supports
         module_dict[module_name]["constants"] = module_definition
         module_dict[module_name]["enabled"] = False
     return to_be_parsed, module_dict
index f776b9772cec6d6a9a48fb79c964a3de4677d7fb..f67b0bcdbaafd63875369fd626da05428023e442 100644 (file)
@@ -70,4 +70,5 @@ MODULE_DEFINITION = {
     "module_depends": "module_depends",
     "module_harvard": "module_harvard",
     "module_hw": "module_hw",
+    "module_supports": "module_supports",
 }
\ No newline at end of file