def _header_get_pinmap(dtbo): nodes = dtc.find_nodes_with_prop(dtbo, '/', 'nvidia,pins') pinmap = [] for node in nodes: res = re.match(r'.*/pin([0-9]*)/', node) if res is None: continue name = dtc.get_prop_value(dtbo, node, 'nvidia,pins', 0) pinmap.append(_PinMap(int(res.groups()[0]) - 1, name, node)) return pinmap
def _board_find_hw_addon_overlays(dtbos): hw_addons = {} for dtbo in dtbos: name = dtc.get_prop_value(dtbo, '/', 'overlay-name', 0) if name is None: continue if name == 'Jetson 40pin Header': continue if name in hw_addons.keys(): error = "Multiple DT overlays for '%s' found!\n" % name error = error + "Please remove duplicate(s)" error = error + "\n%s\n%s" % (dtbo, hw_addons[name]) raise RuntimeError(error) hw_addons[name] = dtbo return hw_addons
def hw_addon_load(self, name): if name not in self.hw_addons.keys(): raise RuntimeError("No overlay found for %s!" % name) overlay = self.hw_addons[name] self.header.pins_reset() nodes = dtc.find_nodes_with_prop(overlay, '/', 'nvidia,function') for node in nodes: res = re.match(r'.*/pin([0-9]*)/', node) if res is None: raise RuntimeError("Failed to get pin number for node %s!" % node) pin = int(res.groups()[0]) function = dtc.get_prop_value(overlay, node, 'nvidia,function', 0) self.header.pin_set_function(pin, function)
def _board_find_header_overlay(dtbos): header = None for dtbo in dtbos: name = dtc.get_prop_value(dtbo, '/', 'overlay-name', 0) if name is None: continue if name == 'Jetson 40pin Header': if header: error = "Multiple DT overlays for '%s' found!\n" % name error = error + "Please remove duplicate(s)" error = error + "\n%s\n%s" % (dtbo, header) raise RuntimeError(error) header = dtbo if header is None: raise RuntimeError("DT Overlay for 40pin Header not found!") return header