1# Copyright (c) 2018-2019 Linaro 2# Copyright (c) 2019 Nordic Semiconductor ASA 3# 4# SPDX-License-Identifier: Apache-2.0 5 6import inspect 7import os 8import pickle 9import sys 10from pathlib import Path 11 12ZEPHYR_BASE = str(Path(__file__).resolve().parents[2]) 13sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts", "dts", 14 "python-devicetree", "src")) 15 16# Types we support 17# 'string', 'int', 'hex', 'bool' 18 19doc_mode = os.environ.get('KCONFIG_DOC_MODE') == "1" 20 21if not doc_mode: 22 EDT_PICKLE = os.environ.get("EDT_PICKLE") 23 24 # The "if" handles a missing dts. 25 if EDT_PICKLE is not None and os.path.isfile(EDT_PICKLE): 26 with open(EDT_PICKLE, 'rb') as f: 27 edt = pickle.load(f) 28 edtlib = inspect.getmodule(edt) 29 else: 30 edt = None 31 32 33def _warn(kconf, msg): 34 print("{}:{}: WARNING: {}".format(kconf.filename, kconf.linenr, msg)) 35 36 37def _dt_units_to_scale(unit): 38 if not unit: 39 return 0 40 if unit in {'k', 'K'}: 41 return 10 42 if unit in {'m', 'M'}: 43 return 20 44 if unit in {'g', 'G'}: 45 return 30 46 if unit in {'kb', 'Kb'}: 47 return 13 48 if unit in {'mb', 'Mb'}: 49 return 23 50 if unit in {'gb', 'Gb'}: 51 return 33 52 53 54def dt_chosen_label(kconf, _, chosen): 55 """ 56 This function takes a 'chosen' property and treats that property as a path 57 to an EDT node. If it finds an EDT node, it will look to see if that node 58 has a "label" property and return the value of that "label". If not, we 59 return the node's name in the devicetree. 60 """ 61 if doc_mode or edt is None: 62 return "" 63 64 node = edt.chosen_node(chosen) 65 if not node: 66 return "" 67 68 if "label" not in node.props: 69 return node.name 70 71 return node.props["label"].val 72 73 74def dt_chosen_enabled(kconf, _, chosen): 75 """ 76 This function returns "y" if /chosen contains a property named 'chosen' 77 that points to an enabled node, and "n" otherwise 78 """ 79 if doc_mode or edt is None: 80 return "n" 81 82 node = edt.chosen_node(chosen) 83 return "y" if node and node.status == "okay" else "n" 84 85 86def dt_chosen_path(kconf, _, chosen): 87 """ 88 This function takes a /chosen node property and returns the path 89 to the node in the property value, or the empty string. 90 """ 91 if doc_mode or edt is None: 92 return "n" 93 94 node = edt.chosen_node(chosen) 95 96 return node.path if node else "" 97 98def dt_chosen_has_compat(kconf, _, chosen, compat): 99 """ 100 This function takes a /chosen node property and returns 'y' if the 101 chosen node has the provided compatible string 'compat' 102 """ 103 if doc_mode or edt is None: 104 return "n" 105 106 node = edt.chosen_node(chosen) 107 108 if node is None: 109 return "n" 110 111 if compat in node.compats: 112 return "y" 113 114 return "n" 115 116def dt_node_enabled(kconf, name, node): 117 """ 118 This function is used to test if a node is enabled (has status 119 'okay') or not. 120 121 The 'node' argument is a string which is either a path or an 122 alias, or both, depending on 'name'. 123 124 If 'name' is 'dt_path_enabled', 'node' is an alias or a path. If 125 'name' is 'dt_alias_enabled, 'node' is an alias. 126 """ 127 128 if doc_mode or edt is None: 129 return "n" 130 131 if name == "dt_alias_enabled": 132 if node.startswith("/"): 133 # EDT.get_node() works with either aliases or paths. If we 134 # are specifically being asked about an alias, reject paths. 135 return "n" 136 else: 137 # Make sure this is being called appropriately. 138 assert name == "dt_path_enabled" 139 140 try: 141 node = edt.get_node(node) 142 except edtlib.EDTError: 143 return "n" 144 145 return "y" if node and node.status == "okay" else "n" 146 147 148def dt_nodelabel_enabled(kconf, _, label): 149 """ 150 This function is like dt_node_enabled(), but the 'label' argument 151 should be a node label, like "foo" is here: 152 153 foo: some-node { ... }; 154 """ 155 if doc_mode or edt is None: 156 return "n" 157 158 node = edt.label2node.get(label) 159 160 return "y" if node and node.status == "okay" else "n" 161 162 163def _node_reg_addr(node, index, unit): 164 if not node: 165 return 0 166 167 if not node.regs: 168 return 0 169 170 if int(index) >= len(node.regs): 171 return 0 172 173 if node.regs[int(index)].addr is None: 174 return 0 175 176 return node.regs[int(index)].addr >> _dt_units_to_scale(unit) 177 178 179def _node_reg_size(node, index, unit): 180 if not node: 181 return 0 182 183 if not node.regs: 184 return 0 185 186 if int(index) >= len(node.regs): 187 return 0 188 189 if node.regs[int(index)].size is None: 190 return 0 191 192 return node.regs[int(index)].size >> _dt_units_to_scale(unit) 193 194 195def _node_int_prop(node, prop, unit=None): 196 """ 197 This function takes a 'node' and will look to see if that 'node' has a 198 property called 'prop' and if that 'prop' is an integer type will return 199 the value of the property 'prop' as either a string int or string hex 200 value, if not we return 0. 201 202 The function will divide the value based on 'unit': 203 None No division 204 'k' or 'K' divide by 1024 (1 << 10) 205 'm' or 'M' divide by 1,048,576 (1 << 20) 206 'g' or 'G' divide by 1,073,741,824 (1 << 30) 207 'kb' or 'Kb' divide by 8192 (1 << 13) 208 'mb' or 'Mb' divide by 8,388,608 (1 << 23) 209 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) 210 """ 211 if not node: 212 return 0 213 214 if prop not in node.props: 215 return 0 216 217 if node.props[prop].type != "int": 218 return 0 219 220 return node.props[prop].val >> _dt_units_to_scale(unit) 221 222 223def _node_array_prop(node, prop, index=0, unit=None): 224 """ 225 This function takes a 'node' and will look to see if that 'node' has a 226 property called 'prop' and if that 'prop' is an array type will return 227 the value of the property 'prop' at the given 'index' as either a string int 228 or string hex value. If the property 'prop' is not found or the given 'index' 229 is out of range it will return 0. 230 231 The function will divide the value based on 'unit': 232 None No division 233 'k' or 'K' divide by 1024 (1 << 10) 234 'm' or 'M' divide by 1,048,576 (1 << 20) 235 'g' or 'G' divide by 1,073,741,824 (1 << 30) 236 """ 237 if not node: 238 return 0 239 240 if prop not in node.props: 241 return 0 242 if node.props[prop].type != "array": 243 return 0 244 if int(index) >= len(node.props[prop].val): 245 return 0 246 return node.props[prop].val[int(index)] >> _dt_units_to_scale(unit) 247 248 249def _dt_chosen_reg_addr(kconf, chosen, index=0, unit=None): 250 """ 251 This function takes a 'chosen' property and treats that property as a path 252 to an EDT node. If it finds an EDT node, it will look to see if that 253 node has a register at the given 'index' and return the address value of 254 that reg, if not we return 0. 255 256 The function will divide the value based on 'unit': 257 None No division 258 'k' or 'K' divide by 1024 (1 << 10) 259 'm' or 'M' divide by 1,048,576 (1 << 20) 260 'g' or 'G' divide by 1,073,741,824 (1 << 30) 261 'kb' or 'Kb' divide by 8192 (1 << 13) 262 'mb' or 'Mb' divide by 8,388,608 (1 << 23) 263 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) 264 """ 265 if doc_mode or edt is None: 266 return 0 267 268 node = edt.chosen_node(chosen) 269 270 return _node_reg_addr(node, index, unit) 271 272 273def _dt_chosen_reg_size(kconf, chosen, index=0, unit=None): 274 """ 275 This function takes a 'chosen' property and treats that property as a path 276 to an EDT node. If it finds an EDT node, it will look to see if that node 277 has a register at the given 'index' and return the size value of that reg, 278 if not we return 0. 279 280 The function will divide the value based on 'unit': 281 None No division 282 'k' or 'K' divide by 1024 (1 << 10) 283 'm' or 'M' divide by 1,048,576 (1 << 20) 284 'g' or 'G' divide by 1,073,741,824 (1 << 30) 285 'kb' or 'Kb' divide by 8192 (1 << 13) 286 'mb' or 'Mb' divide by 8,388,608 (1 << 23) 287 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) 288 """ 289 if doc_mode or edt is None: 290 return 0 291 292 node = edt.chosen_node(chosen) 293 294 return _node_reg_size(node, index, unit) 295 296 297def dt_chosen_reg(kconf, name, chosen, index=0, unit=None): 298 """ 299 This function just routes to the proper function and converts 300 the result to either a string int or string hex value. 301 """ 302 if name == "dt_chosen_reg_size_int": 303 return str(_dt_chosen_reg_size(kconf, chosen, index, unit)) 304 if name == "dt_chosen_reg_size_hex": 305 return hex(_dt_chosen_reg_size(kconf, chosen, index, unit)) 306 if name == "dt_chosen_reg_addr_int": 307 return str(_dt_chosen_reg_addr(kconf, chosen, index, unit)) 308 if name == "dt_chosen_reg_addr_hex": 309 return hex(_dt_chosen_reg_addr(kconf, chosen, index, unit)) 310 311 312def _dt_node_reg_addr(kconf, path, index=0, unit=None): 313 """ 314 This function takes a 'path' and looks for an EDT node at that path. If it 315 finds an EDT node, it will look to see if that node has a register at the 316 given 'index' and return the address value of that reg, if not we return 0. 317 318 The function will divide the value based on 'unit': 319 None No division 320 'k' or 'K' divide by 1024 (1 << 10) 321 'm' or 'M' divide by 1,048,576 (1 << 20) 322 'g' or 'G' divide by 1,073,741,824 (1 << 30) 323 'kb' or 'Kb' divide by 8192 (1 << 13) 324 'mb' or 'Mb' divide by 8,388,608 (1 << 23) 325 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) 326 """ 327 if doc_mode or edt is None: 328 return 0 329 330 try: 331 node = edt.get_node(path) 332 except edtlib.EDTError: 333 return 0 334 335 return _node_reg_addr(node, index, unit) 336 337 338def _dt_node_reg_size(kconf, path, index=0, unit=None): 339 """ 340 This function takes a 'path' and looks for an EDT node at that path. If it 341 finds an EDT node, it will look to see if that node has a register at the 342 given 'index' and return the size value of that reg, if not we return 0. 343 344 The function will divide the value based on 'unit': 345 None No division 346 'k' or 'K' divide by 1024 (1 << 10) 347 'm' or 'M' divide by 1,048,576 (1 << 20) 348 'g' or 'G' divide by 1,073,741,824 (1 << 30) 349 'kb' or 'Kb' divide by 8192 (1 << 13) 350 'mb' or 'Mb' divide by 8,388,608 (1 << 23) 351 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) 352 """ 353 if doc_mode or edt is None: 354 return 0 355 356 try: 357 node = edt.get_node(path) 358 except edtlib.EDTError: 359 return 0 360 361 return _node_reg_size(node, index, unit) 362 363 364def dt_node_reg(kconf, name, path, index=0, unit=None): 365 """ 366 This function just routes to the proper function and converts 367 the result to either a string int or string hex value. 368 """ 369 if name == "dt_node_reg_size_int": 370 return str(_dt_node_reg_size(kconf, path, index, unit)) 371 if name == "dt_node_reg_size_hex": 372 return hex(_dt_node_reg_size(kconf, path, index, unit)) 373 if name == "dt_node_reg_addr_int": 374 return str(_dt_node_reg_addr(kconf, path, index, unit)) 375 if name == "dt_node_reg_addr_hex": 376 return hex(_dt_node_reg_addr(kconf, path, index, unit)) 377 378def dt_nodelabel_reg(kconf, name, label, index=0, unit=None): 379 """ 380 This function is like dt_node_reg(), but the 'label' argument 381 should be a node label, like "foo" is here: 382 383 foo: some-node { ... }; 384 """ 385 if doc_mode or edt is None: 386 node = None 387 else: 388 node = edt.label2node.get(label) 389 390 if name == "dt_nodelabel_reg_size_int": 391 return str(_dt_node_reg_size(kconf, node.path, index, unit)) if node else "0" 392 if name == "dt_nodelabel_reg_size_hex": 393 return hex(_dt_node_reg_size(kconf, node.path, index, unit)) if node else "0x0" 394 if name == "dt_nodelabel_reg_addr_int": 395 return str(_dt_node_reg_addr(kconf, node.path, index, unit)) if node else "0" 396 if name == "dt_nodelabel_reg_addr_hex": 397 return hex(_dt_node_reg_addr(kconf, node.path, index, unit)) if node else "0x0" 398 399 400def _dt_node_bool_prop_generic(node_search_function, search_arg, prop): 401 """ 402 This function takes the 'node_search_function' and uses it to search for 403 a node with 'search_arg' and if node exists, checks if 'prop' exists 404 inside the node and is a boolean, if it is true, returns "y". 405 Otherwise, it returns "n". 406 """ 407 try: 408 node = node_search_function(search_arg) 409 except edtlib.EDTError: 410 return "n" 411 412 if node is None: 413 return "n" 414 415 if prop not in node.props: 416 return "n" 417 418 if node.props[prop].type != "boolean": 419 return "n" 420 421 if node.props[prop].val: 422 return "y" 423 424 return "n" 425 426def dt_node_bool_prop(kconf, _, path, prop): 427 """ 428 This function takes a 'path' and looks for an EDT node at that path. If it 429 finds an EDT node, it will look to see if that node has a boolean property 430 by the name of 'prop'. If the 'prop' exists it will return "y" otherwise 431 we return "n". 432 """ 433 if doc_mode or edt is None: 434 return "n" 435 436 return _dt_node_bool_prop_generic(edt.get_node, path, prop) 437 438def dt_nodelabel_bool_prop(kconf, _, label, prop): 439 """ 440 This function takes a 'label' and looks for an EDT node with that label. 441 If it finds an EDT node, it will look to see if that node has a boolean 442 property by the name of 'prop'. If the 'prop' exists it will return "y" 443 otherwise we return "n". 444 """ 445 if doc_mode or edt is None: 446 return "n" 447 448 return _dt_node_bool_prop_generic(edt.label2node.get, label, prop) 449 450def dt_chosen_bool_prop(kconf, _, chosen, prop): 451 """ 452 This function takes a /chosen node property named 'chosen', and 453 looks for the chosen node. If that node exists and has a boolean 454 property 'prop', it returns "y". Otherwise, it returns "n". 455 """ 456 if doc_mode or edt is None: 457 return "n" 458 459 return _dt_node_bool_prop_generic(edt.chosen_node, chosen, prop) 460 461def _dt_node_has_prop_generic(node_search_function, search_arg, prop): 462 """ 463 This function takes the 'node_search_function' and uses it to search for 464 a node with 'search_arg' and if node exists, then checks if 'prop' 465 exists inside the node and returns "y". Otherwise, it returns "n". 466 """ 467 try: 468 node = node_search_function(search_arg) 469 except edtlib.EDTError: 470 return "n" 471 472 if node is None: 473 return "n" 474 475 if prop in node.props: 476 return "y" 477 478 return "n" 479 480def dt_node_has_prop(kconf, _, path, prop): 481 """ 482 This function takes a 'path' and looks for an EDT node at that path. If it 483 finds an EDT node, it will look to see if that node has a property 484 by the name of 'prop'. If the 'prop' exists it will return "y" otherwise 485 it returns "n". 486 """ 487 if doc_mode or edt is None: 488 return "n" 489 490 return _dt_node_has_prop_generic(edt.get_node, path, prop) 491 492def dt_nodelabel_has_prop(kconf, _, label, prop): 493 """ 494 This function takes a 'label' and looks for an EDT node with that label. 495 If it finds an EDT node, it will look to see if that node has a property 496 by the name of 'prop'. If the 'prop' exists it will return "y" otherwise 497 it returns "n". 498 """ 499 if doc_mode or edt is None: 500 return "n" 501 502 return _dt_node_has_prop_generic(edt.label2node.get, label, prop) 503 504def dt_node_int_prop(kconf, name, path, prop, unit=None): 505 """ 506 This function takes a 'path' and property name ('prop') looks for an EDT 507 node at that path. If it finds an EDT node, it will look to see if that 508 node has a property called 'prop' and if that 'prop' is an integer type 509 will return the value of the property 'prop' as either a string int or 510 string hex value, if not we return 0. 511 512 The function will divide the value based on 'unit': 513 None No division 514 'k' or 'K' divide by 1024 (1 << 10) 515 'm' or 'M' divide by 1,048,576 (1 << 20) 516 'g' or 'G' divide by 1,073,741,824 (1 << 30) 517 'kb' or 'Kb' divide by 8192 (1 << 13) 518 'mb' or 'Mb' divide by 8,388,608 (1 << 23) 519 'gb' or 'Gb' divide by 8,589,934,592 (1 << 33) 520 """ 521 if doc_mode or edt is None: 522 return "0" 523 524 try: 525 node = edt.get_node(path) 526 except edtlib.EDTError: 527 return "0" 528 529 if name == "dt_node_int_prop_int": 530 return str(_node_int_prop(node, prop, unit)) 531 if name == "dt_node_int_prop_hex": 532 return hex(_node_int_prop(node, prop, unit)) 533 534 535def dt_node_array_prop(kconf, name, path, prop, index, unit=None): 536 """ 537 This function takes a 'path', property name ('prop') and index ('index') 538 and looks for an EDT node at that path. If it finds an EDT node, it will 539 look to see if that node has a property called 'prop' and if that 'prop' 540 is an array type will return the value of the property 'prop' at the given 541 'index' as either a string int or string hex value. If not found we return 0. 542 543 The function will divide the value based on 'unit': 544 None No division 545 'k' or 'K' divide by 1024 (1 << 10) 546 'm' or 'M' divide by 1,048,576 (1 << 20) 547 'g' or 'G' divide by 1,073,741,824 (1 << 30) 548 """ 549 if doc_mode or edt is None: 550 return "0" 551 552 try: 553 node = edt.get_node(path) 554 except edtlib.EDTError: 555 return "0" 556 if name == "dt_node_array_prop_int": 557 return str(_node_array_prop(node, prop, index, unit)) 558 if name == "dt_node_array_prop_hex": 559 return hex(_node_array_prop(node, prop, index, unit)) 560 561 562def dt_node_str_prop_equals(kconf, _, path, prop, val): 563 """ 564 This function takes a 'path' and property name ('prop') looks for an EDT 565 node at that path. If it finds an EDT node, it will look to see if that 566 node has a property 'prop' of type string. If that 'prop' is equal to 'val' 567 it will return "y" otherwise return "n". 568 """ 569 570 if doc_mode or edt is None: 571 return "n" 572 573 try: 574 node = edt.get_node(path) 575 except edtlib.EDTError: 576 return "n" 577 578 if prop not in node.props: 579 return "n" 580 581 if node.props[prop].type != "string": 582 return "n" 583 584 if node.props[prop].val == val: 585 return "y" 586 587 return "n" 588 589 590def dt_has_compat(kconf, _, compat): 591 """ 592 This function takes a 'compat' and returns "y" if any compatible node 593 can be found in the EDT, otherwise it returns "n". 594 """ 595 if doc_mode or edt is None: 596 return "n" 597 598 return "y" if compat in edt.compat2nodes else "n" 599 600 601def dt_compat_enabled(kconf, _, compat): 602 """ 603 This function takes a 'compat' and returns "y" if we find a status "okay" 604 compatible node in the EDT otherwise we return "n" 605 """ 606 if doc_mode or edt is None: 607 return "n" 608 609 return "y" if compat in edt.compat2okay else "n" 610 611 612def dt_compat_on_bus(kconf, _, compat, bus): 613 """ 614 This function takes a 'compat' and returns "y" if we find an "enabled" 615 compatible node in the EDT which is on bus 'bus'. It returns "n" otherwise. 616 """ 617 if doc_mode or edt is None: 618 return "n" 619 620 if compat in edt.compat2okay: 621 for node in edt.compat2okay[compat]: 622 if node.on_buses is not None and bus in node.on_buses: 623 return "y" 624 625 return "n" 626 627 628def dt_nodelabel_has_compat(kconf, _, label, compat): 629 """ 630 This function takes a 'label' and looks for an EDT node with that label. 631 If it finds such node, it returns "y" if this node is compatible with 632 the provided 'compat'. Otherwise, it return "n" . 633 """ 634 if doc_mode or edt is None: 635 return "n" 636 637 node = edt.label2node.get(label) 638 639 if node and compat in node.compats: 640 return "y" 641 642 return "n" 643 644def dt_node_has_compat(kconf, _, path, compat): 645 """ 646 This function takes a 'path' and looks for an EDT node at that path. If it 647 finds an EDT node, it returns "y" if this node is compatible with 648 the provided 'compat'. Otherwise, it return "n" . 649 """ 650 651 if doc_mode or edt is None: 652 return "n" 653 654 try: 655 node = edt.get_node(path) 656 except edtlib.EDTError: 657 return "n" 658 659 if node and compat in node.compats: 660 return "y" 661 662 return "n" 663 664def dt_nodelabel_enabled_with_compat(kconf, _, label, compat): 665 """ 666 This function takes a 'label' and returns "y" if an "enabled" node with 667 such label can be found in the EDT and that node is compatible with the 668 provided 'compat', otherwise it returns "n". 669 """ 670 if doc_mode or edt is None: 671 return "n" 672 673 if compat in edt.compat2okay: 674 for node in edt.compat2okay[compat]: 675 if label in node.labels: 676 return "y" 677 678 return "n" 679 680 681def dt_nodelabel_array_prop_has_val(kconf, _, label, prop, val): 682 """ 683 This function looks for a node with node label 'label'. 684 If the node exists, it checks if the node node has a property 685 'prop' with type "array". If so, and the property contains 686 an element equal to the integer 'val', it returns "y". 687 Otherwise, it returns "n". 688 """ 689 if doc_mode or edt is None: 690 return "n" 691 692 node = edt.label2node.get(label) 693 694 if not node or (prop not in node.props) or (node.props[prop].type != "array"): 695 return "n" 696 else: 697 return "y" if int(val, base=0) in node.props[prop].val else "n" 698 699 700def dt_nodelabel_path(kconf, _, label): 701 """ 702 This function takes a node label (not a label property) and 703 returns the path to the node which has that label, or an empty 704 string if there is no such node. 705 """ 706 if doc_mode or edt is None: 707 return "" 708 709 node = edt.label2node.get(label) 710 711 return node.path if node else "" 712 713def dt_node_parent(kconf, _, path): 714 """ 715 This function takes a 'path' and looks for an EDT node at that path. If it 716 finds an EDT node, it will look for the parent of that node. If the parent 717 exists, it will return the path to that parent. Otherwise, an empty string 718 will be returned. 719 """ 720 if doc_mode or edt is None: 721 return "" 722 723 try: 724 node = edt.get_node(path) 725 except edtlib.EDTError: 726 return "" 727 728 if node is None: 729 return "" 730 731 return node.parent.path if node.parent else "" 732 733def dt_gpio_hogs_enabled(kconf, _): 734 """ 735 Return "y" if any GPIO hog node is enabled. Otherwise, return "n". 736 """ 737 if doc_mode or edt is None: 738 return "n" 739 740 for node in edt.nodes: 741 if node.gpio_hogs and node.status == "okay": 742 return "y" 743 744 return "n" 745 746def shields_list_contains(kconf, _, shield): 747 """ 748 Return "n" if cmake environment variable 'SHIELD_AS_LIST' doesn't exist. 749 Return "y" if 'shield' is present list obtained after 'SHIELD_AS_LIST' 750 has been split using ";" as a separator and "n" otherwise. 751 """ 752 try: 753 list = os.environ['SHIELD_AS_LIST'] 754 except KeyError: 755 return "n" 756 757 return "y" if shield in list.split(";") else "n" 758 759 760# Keys in this dict are the function names as they appear 761# in Kconfig files. The values are tuples in this form: 762# 763# (python_function, minimum_number_of_args, maximum_number_of_args) 764# 765# Each python function is given a kconf object and its name in the 766# Kconfig file, followed by arguments from the Kconfig file. 767# 768# See the kconfiglib documentation for more details. 769functions = { 770 "dt_has_compat": (dt_has_compat, 1, 1), 771 "dt_compat_enabled": (dt_compat_enabled, 1, 1), 772 "dt_compat_on_bus": (dt_compat_on_bus, 2, 2), 773 "dt_chosen_label": (dt_chosen_label, 1, 1), 774 "dt_chosen_enabled": (dt_chosen_enabled, 1, 1), 775 "dt_chosen_path": (dt_chosen_path, 1, 1), 776 "dt_chosen_has_compat": (dt_chosen_has_compat, 2, 2), 777 "dt_path_enabled": (dt_node_enabled, 1, 1), 778 "dt_alias_enabled": (dt_node_enabled, 1, 1), 779 "dt_nodelabel_enabled": (dt_nodelabel_enabled, 1, 1), 780 "dt_nodelabel_enabled_with_compat": (dt_nodelabel_enabled_with_compat, 2, 2), 781 "dt_chosen_reg_addr_int": (dt_chosen_reg, 1, 3), 782 "dt_chosen_reg_addr_hex": (dt_chosen_reg, 1, 3), 783 "dt_chosen_reg_size_int": (dt_chosen_reg, 1, 3), 784 "dt_chosen_reg_size_hex": (dt_chosen_reg, 1, 3), 785 "dt_node_reg_addr_int": (dt_node_reg, 1, 3), 786 "dt_node_reg_addr_hex": (dt_node_reg, 1, 3), 787 "dt_node_reg_size_int": (dt_node_reg, 1, 3), 788 "dt_node_reg_size_hex": (dt_node_reg, 1, 3), 789 "dt_nodelabel_reg_addr_int": (dt_nodelabel_reg, 1, 3), 790 "dt_nodelabel_reg_addr_hex": (dt_nodelabel_reg, 1, 3), 791 "dt_nodelabel_reg_size_int": (dt_nodelabel_reg, 1, 3), 792 "dt_nodelabel_reg_size_hex": (dt_nodelabel_reg, 1, 3), 793 "dt_node_bool_prop": (dt_node_bool_prop, 2, 2), 794 "dt_nodelabel_bool_prop": (dt_nodelabel_bool_prop, 2, 2), 795 "dt_chosen_bool_prop": (dt_chosen_bool_prop, 2, 2), 796 "dt_node_has_prop": (dt_node_has_prop, 2, 2), 797 "dt_nodelabel_has_prop": (dt_nodelabel_has_prop, 2, 2), 798 "dt_node_int_prop_int": (dt_node_int_prop, 2, 3), 799 "dt_node_int_prop_hex": (dt_node_int_prop, 2, 3), 800 "dt_node_array_prop_int": (dt_node_array_prop, 3, 4), 801 "dt_node_array_prop_hex": (dt_node_array_prop, 3, 4), 802 "dt_node_str_prop_equals": (dt_node_str_prop_equals, 3, 3), 803 "dt_nodelabel_has_compat": (dt_nodelabel_has_compat, 2, 2), 804 "dt_node_has_compat": (dt_node_has_compat, 2, 2), 805 "dt_nodelabel_path": (dt_nodelabel_path, 1, 1), 806 "dt_node_parent": (dt_node_parent, 1, 1), 807 "dt_nodelabel_array_prop_has_val": (dt_nodelabel_array_prop_has_val, 3, 3), 808 "dt_gpio_hogs_enabled": (dt_gpio_hogs_enabled, 0, 0), 809 "shields_list_contains": (shields_list_contains, 1, 1), 810} 811