示例#1
0
文件: x86.py 项目: tcsantini/dosek
    def generate_dataobjects_tcbs(self):
        self.generator.source_file.includes.add(Include("tcb.h"))

        tcb_arr = DataObjectArray("const TCB * const", "OS_tcbs", "")
        tcb_arr.add_static_initializer("0")

        for subtask in self.system_graph.get_subtasks():
            # Ignore the Idle thread
            if not subtask.is_real_thread():
                continue
            initializer = "(&%s, %s, %s, %s)" % (
                self.objects[subtask]["entry_function"].name,
                self.objects[subtask]["stack"].name,
                self.objects[subtask]["stackptr"].name,
                self.objects[subtask]["stacksize"]
            )

            desc = DataObject("const arch::TCB", "OS_" + subtask.name + "_tcb",
                              initializer)
            desc.allocation_prefix = "constexpr "
            self.generator.source_file.data_manager.add(desc, namespace = ("arch",))
            self.objects[subtask].update({"tcb_descriptor": desc})
            tcb_arr.add_static_initializer("&" + desc.name)

        self.generator.source_file.data_manager.add(tcb_arr, namespace = ("arch",))
示例#2
0
    def generate_dataobjects(self, generator):
        generator.source_file.includes.add(Include("os/cfg-regions.h"))

        # Generate DataObject that holds the curren region mask
        self.marker_dataobject = DataObject("uint32_t", "OS_CFG_REGION_MASK")
        generator.source_file.data_manager.add(self.marker_dataobject)

        for region in self.regions:
            const = DataObject("const uint32_t", region, str(self.region_mask[region]))
            const.allocation_prefix = "constexpr "
            generator.source_file.data_manager.add(const)
示例#3
0
文件: x86.py 项目: tcsantini/dosek
    def generate_isr(self, isr):
        self.generator.source_file.includes.add(Include("machine.h"))
        isr_desc = self.generator.system_graph.get_subtask(isr.name)
        handler = FunctionDefinitionBlock('ISR', [str(isr_desc.isr_device)])
        self.generator.source_file.function_manager.add(handler)

        # Forward declaration for the user defined function
        forward = FunctionDeclaration(isr.function_name, "void", [], extern_c=True)
        self.generator.source_file.function_manager.add(forward)

        # Call the user defined function
        self.call_function(handler, isr.function_name, "void", [])

        # Call the end of interrupt function
        self.call_function(handler, "LAPIC::send_eoi", "void", [])
示例#4
0
    def generate_isr(self, isr):
        # Forward declaration for the user defined function
        self.generator.source_file.includes.add(Include("irq.h"))

        isr_desc = self.generator.system_graph.get_subtask(isr.name)

        forward = FunctionDeclaration(isr.function_name,
                                      "void", ["int"],
                                      extern_c=True)
        self.generator.source_file.function_manager.add(forward)

        self.call_function(self.objects["StartOS"],
                           "arch::irq.enable",
                           "void", [str(isr_desc.isr_device)],
                           prepend=True)
        self.call_function(self.objects["StartOS"],
                           "arch::irq.set_handler",
                           "void",
                           [str(isr_desc.isr_device), isr.function_name],
                           prepend=True)