Пример #1
0
    def generate_code_pins(self, block):
        for p in self.__pins:
            p.generate_code_pre(block)

        pin_code = block.create_array(block, 'struct bga_pins',
                                      'pins_%s' % self.get_code_id(),
                                      '%u * %u' % (int(self.__cols),
                                                   int(self.__rows)))

        for p in self.__pins:
            tmp = pin_code.add_element_block(pin_code,
                                             p.get_index(self.get_pin_idx),
                                             p.get_id())

            p.generate_code(tmp)
Пример #2
0
    def generate_code_pre(self, block):
        if self.__power and not block.add_and_test_existing(self.__power.identifier()):
            block.add_forward("struct power_domain", "%s" % self.__power.identifier())

        if self.__mux_field:
            m = block.create_array(block, "struct pin_mux", "pin_mux_%s" % self.__id.lower(), "")

            for (idx, fns) in self.__mux_fn.items():
                for f in fns:
                    fn = m.add_element_block(m, None)
                    fn.add_attribute_simple("af", idx),
                    fn.add_attribute_simple("unit", f.get_unit_ptr())

                    tmp = f.get_fn()
                    if tmp:
                        fn.add_attribute_simple("fn", tmp)

                    fn.add_attribute_simple("fn_idx", f.get_fn_idx())
                    fn.add_attribute_flags("fn_flags", f.get_flag_identifiers())