Showing preview only (931K chars total). Download the full file or copy to clipboard to get everything.
Repository: crust-firmware/crust
Branch: master
Commit: 499a362645e6
Files: 313
Total size: 856.5 KB
Directory structure:
gitextract_cf7sbcuk/
├── .gitignore
├── .travis.yml
├── .uncrustify
├── 3rdparty/
│ ├── Makefile
│ └── kconfig/
│ ├── Makefile
│ ├── conf.c
│ ├── confdata.c
│ ├── expr.c
│ ├── expr.h
│ ├── lexer.l
│ ├── list.h
│ ├── lkc.h
│ ├── lkc_proto.h
│ ├── menu.c
│ ├── nconf-cfg.sh
│ ├── nconf.c
│ ├── nconf.gui.c
│ ├── nconf.h
│ ├── parser.y
│ ├── preprocess.c
│ ├── symbol.c
│ └── util.c
├── CONTRIBUTING.md
├── Doxyfile
├── Kconfig
├── LICENSE.md
├── Makefile
├── README.md
├── arch/
│ ├── Kconfig
│ ├── Makefile
│ └── or1k/
│ ├── Makefile
│ ├── counter.c
│ ├── exception.c
│ ├── include/
│ │ ├── asm/
│ │ │ ├── exception.h
│ │ │ └── spr.h
│ │ ├── exception.h
│ │ ├── spr.h
│ │ └── trap.h
│ ├── math.S
│ ├── runtime.S
│ ├── scp.ld.S
│ └── start.S
├── common/
│ ├── Kconfig
│ ├── Makefile
│ ├── debug/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── battery.c
│ │ ├── dram.c
│ │ ├── latency.c
│ │ ├── monitor.c
│ │ ├── sprs.c
│ │ └── steps.c
│ ├── debug.c
│ ├── delay.c
│ ├── device.c
│ ├── regulator_list.c
│ ├── scpi.c
│ ├── scpi_cmds.c
│ ├── simple_device.c
│ ├── system.c
│ └── timeout.c
├── configs/
│ ├── a64-olinuxino-emmc_defconfig
│ ├── a64-olinuxino_defconfig
│ ├── bananapi_m2_plus_h3_defconfig
│ ├── beelink_gs1_defconfig
│ ├── beelink_x2_defconfig
│ ├── defconfig
│ ├── libretech_all_h3_cc_h3_defconfig
│ ├── libretech_all_h3_cc_h5_defconfig
│ ├── nanopi_a64_defconfig
│ ├── nanopi_m1_defconfig
│ ├── nanopi_m1_plus_defconfig
│ ├── orangepi_2_defconfig
│ ├── orangepi_3_defconfig
│ ├── orangepi_lite_defconfig
│ ├── orangepi_one_defconfig
│ ├── orangepi_pc2_defconfig
│ ├── orangepi_pc_defconfig
│ ├── orangepi_pc_plus_defconfig
│ ├── orangepi_plus2e_defconfig
│ ├── orangepi_plus_defconfig
│ ├── orangepi_win_defconfig
│ ├── orangepi_zero_defconfig
│ ├── orangepi_zero_plus_defconfig
│ ├── pine64-lts_defconfig
│ ├── pine64_plus_defconfig
│ ├── pine_h64_defconfig
│ ├── pinebook_defconfig
│ ├── pinephone_defconfig
│ ├── pinetab_defconfig
│ ├── tanix_tx6_defconfig
│ ├── tbs_a711_defconfig
│ └── teres_i_defconfig
├── docs/
│ ├── abi.md
│ ├── code_of_conduct.md
│ ├── issue_template.md
│ └── pull_request_template.md
├── drivers/
│ ├── Kconfig
│ ├── Makefile
│ ├── cec/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── cec.c
│ │ └── dw-hdmi-cec.c
│ ├── cir/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── cir.c
│ │ ├── cir.h
│ │ ├── nec.c
│ │ ├── rc6.c
│ │ └── sunxi-cir.c
│ ├── clock/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── ccu.c
│ │ ├── ccu.h
│ │ ├── ccu_helpers.c
│ │ ├── clock.c
│ │ ├── clock.h
│ │ ├── r_ccu_common.c
│ │ ├── sun50i-a64-ccu.c
│ │ ├── sun50i-h6-ccu.c
│ │ ├── sun50i-h6-r-ccu.c
│ │ ├── sun8i-a23-ccu.c
│ │ ├── sun8i-a83t-ccu.c
│ │ ├── sun8i-h3-ccu.c
│ │ └── sun8i-r-ccu.c
│ ├── counter/
│ │ ├── Makefile
│ │ ├── sun6i-a31-cnt64.c
│ │ └── sun9i-a80-timestamp.c
│ ├── css/
│ │ ├── Makefile
│ │ ├── css.c
│ │ ├── css.h
│ │ ├── css_default.c
│ │ ├── css_helpers.c
│ │ ├── css_power_state.c
│ │ ├── sun50i-a64-css.c
│ │ ├── sun50i-h6-css.c
│ │ └── sun6i-a31-css.c
│ ├── dram/
│ │ ├── Makefile
│ │ ├── dram.c
│ │ ├── sun50i-h6-dram.c
│ │ └── sun8i-h3-dram.c
│ ├── gpio/
│ │ ├── Makefile
│ │ ├── gpio.c
│ │ ├── gpio.h
│ │ └── sunxi-gpio.c
│ ├── irq/
│ │ ├── Makefile
│ │ ├── irq.c
│ │ └── sun6i-a31-r-intc.c
│ ├── mfd/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ └── axp20x.c
│ ├── msgbox/
│ │ ├── Makefile
│ │ ├── msgbox.c
│ │ ├── msgbox.h
│ │ └── sunxi-msgbox.c
│ ├── pmic/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── axp20x.c
│ │ ├── axp20x.h
│ │ ├── axp223.c
│ │ ├── axp803.c
│ │ ├── axp805.c
│ │ ├── pmic.c
│ │ └── pmic.h
│ ├── regmap/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── regmap-i2c.c
│ │ ├── regmap-i2c.h
│ │ ├── regmap.c
│ │ ├── regmap.h
│ │ ├── sun6i-i2c.c
│ │ └── sunxi-rsb.c
│ ├── regulator/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── axp20x.c
│ │ ├── axp20x.h
│ │ ├── axp221.c
│ │ ├── axp803.c
│ │ ├── axp805.c
│ │ ├── gpio.c
│ │ ├── regulator.c
│ │ ├── regulator.h
│ │ └── sy8106a.c
│ ├── serial/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── serial.c
│ │ ├── sun50i-a64-uart.c
│ │ ├── sun50i-h6-uart.c
│ │ ├── sun8i-a23-uart.c
│ │ ├── sun8i-a83t-uart.c
│ │ ├── sun8i-h3-uart.c
│ │ ├── uart.c
│ │ └── uart.h
│ └── watchdog/
│ ├── Kconfig
│ ├── Makefile
│ ├── sun6i-a31-wdt.c
│ ├── sun9i-a80-twd.c
│ ├── watchdog.c
│ └── watchdog.h
├── include/
│ ├── common/
│ │ ├── debug.h
│ │ ├── delay.h
│ │ ├── device.h
│ │ ├── regulator_list.h
│ │ ├── scpi.h
│ │ ├── simple_device.h
│ │ ├── steps.h
│ │ ├── system.h
│ │ └── timeout.h
│ ├── drivers/
│ │ ├── cec/
│ │ │ └── dw-hdmi-cec.h
│ │ ├── cec.h
│ │ ├── cir/
│ │ │ └── sunxi-cir.h
│ │ ├── cir.h
│ │ ├── clock/
│ │ │ ├── ccu.h
│ │ │ ├── sun50i-a64-ccu.h
│ │ │ ├── sun50i-h6-ccu.h
│ │ │ ├── sun50i-h6-r-ccu.h
│ │ │ ├── sun8i-a23-ccu.h
│ │ │ ├── sun8i-a83t-ccu.h
│ │ │ ├── sun8i-h3-ccu.h
│ │ │ └── sun8i-r-ccu.h
│ │ ├── clock.h
│ │ ├── counter.h
│ │ ├── css.h
│ │ ├── dram.h
│ │ ├── gpio/
│ │ │ └── sunxi-gpio.h
│ │ ├── gpio.h
│ │ ├── irq.h
│ │ ├── mfd/
│ │ │ └── axp20x.h
│ │ ├── msgbox/
│ │ │ └── sunxi-msgbox.h
│ │ ├── msgbox.h
│ │ ├── pmic/
│ │ │ ├── axp20x.h
│ │ │ ├── axp223.h
│ │ │ ├── axp803.h
│ │ │ └── axp805.h
│ │ ├── pmic.h
│ │ ├── regmap/
│ │ │ ├── sun6i-i2c.h
│ │ │ └── sunxi-rsb.h
│ │ ├── regmap.h
│ │ ├── regulator/
│ │ │ ├── axp20x.h
│ │ │ ├── axp221.h
│ │ │ ├── axp803.h
│ │ │ ├── axp805.h
│ │ │ ├── gpio.h
│ │ │ └── sy8106a.h
│ │ ├── regulator.h
│ │ ├── serial.h
│ │ ├── watchdog/
│ │ │ ├── sun6i-a31-wdt.h
│ │ │ └── sun9i-a80-twd.h
│ │ └── watchdog.h
│ ├── lib/
│ │ ├── bitfield.h
│ │ ├── bitmap.h
│ │ ├── byteswap.h
│ │ ├── compiler.h
│ │ ├── division.h
│ │ ├── error.h
│ │ ├── intrusive.h
│ │ ├── kconfig.h
│ │ ├── macros.S
│ │ ├── mmio.h
│ │ ├── scpi_protocol.h
│ │ └── util.h
│ └── stdlib/
│ ├── ctype.h
│ ├── limits.h
│ ├── stdarg.h
│ ├── stdbool.h
│ ├── stddef.h
│ └── stdint.h
├── lib/
│ ├── Makefile
│ └── bitfield.c
├── platform/
│ ├── Kconfig
│ ├── a23/
│ │ ├── Kconfig
│ │ └── include/
│ │ └── platform/
│ │ ├── cpucfg.h
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ ├── a64/
│ │ ├── Kconfig
│ │ └── include/
│ │ └── platform/
│ │ ├── cpucfg.h
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ ├── a83t/
│ │ └── include/
│ │ └── platform/
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ ├── h3/
│ │ └── include/
│ │ └── platform/
│ │ ├── cpucfg.h
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ └── h6/
│ └── include/
│ └── platform/
│ ├── cpucfg.h
│ ├── css.h
│ ├── devices.h
│ ├── irq.h
│ ├── memory.h
│ ├── prcm.h
│ └── time.h
├── scripts/
│ ├── Makefile.format
│ ├── Makefile.kbuild
│ ├── test.sh
│ └── version.sh
└── tools/
├── Makefile
├── load.c
└── test.c
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
/..config*
/.config*
/build/
/defconfig
================================================
FILE: .travis.yml
================================================
---
dist: bionic
language: c
matrix:
include:
- addons:
apt:
packages:
- codespell
env:
- MAKEFLAGS=-j$(nproc)
install:
- git clone --depth 1 -b uncrustify-0.72.0
https://github.com/uncrustify/uncrustify
- mkdir -p uncrustify/build
- (cd uncrustify/build && cmake -DCMAKE_INSTALL_PREFIX=$PWD
-DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7 ..)
- make -C uncrustify/build
- export PATH=$PATH:$PWD/uncrustify/build
- uncrustify --version
name: Run source code checks
script:
- make check-format
- codespell -i 0 -q 4 $(git ls-files)
- addons:
apt:
packages:
- doxygen
- gcc-aarch64-linux-gnu
- graphviz
- libc6-dev-arm64-cross
env:
- CONFIGS="allnoconfig allyesconfig defconfig
bananapi_m2_plus_h3_defconfig
beelink_x2_defconfig
libretech_all_h3_cc_h3_defconfig
libretech_all_h3_cc_h5_defconfig
orangepi_3_defconfig
orangepi_one_defconfig
orangepi_pc2_defconfig
orangepi_plus2e_defconfig
orangepi_win_defconfig
orangepi_zero_plus_defconfig
pine64_plus_defconfig
pine_h64_defconfig
pinebook_defconfig
pinephone_defconfig
tanix_tx6_defconfig
tbs_a711_defconfig
randconfig randconfig randconfig"
- GCC_VER=9.1.1-20190507
- HOST_COMPILE=aarch64-linux-gnu-
- MAKEFLAGS=-j$(nproc)
install:
- curl -LSs https://github.com/stffrdhrn/gcc/releases/download/or1k-$GCC_VER/or1k-linux-musl-$GCC_VER.tar.xz |
tar xJf -
- export PATH=$PATH:$PWD/or1k-linux-musl/bin
name: Build all configs
script:
- |-
set -e
cd /tmp
ln -s $TRAVIS_BUILD_DIR/Makefile .
cat > all.config << 'EOF'
CONFIG_COMPILE_TEST=y
EOF
for config in ${CONFIGS}; do
echo ========== begin $config ==========
make SRC=$TRAVIS_BUILD_DIR KCONFIG_ALLCONFIG=1 V=1 "$config"
make SRC=$TRAVIS_BUILD_DIR TGT="\$(OBJ)/$config" V=1 all check
or1k-linux-musl-size build/$config/scp.elf
grep __bss_end build/$config/scp.map
sha256sum -b build/$config/scp.bin
echo =========== end $config ===========
done
make SRC=$TRAVIS_BUILD_DIR V=1 html tools
...
================================================
FILE: .uncrustify
================================================
align_asm_colon = false
align_assign_span = 1
align_assign_thresh = 8
align_enum_equ_span = 3
align_enum_equ_thresh = 0
align_func_params = false
align_func_params_gap = 0
align_func_params_span = 0
align_func_params_thresh = 0
align_func_proto_gap = 0
align_func_proto_span = 0
align_keep_extra_space = true
align_keep_tabs = false
align_left_shift = true
align_mix_var_proto = false
align_nl_cont = false
align_number_right = false
align_oc_decl_colon = false
align_oc_msg_colon_first = false
align_oc_msg_colon_span = 0
align_oc_msg_spec_span = 0
align_on_operator = false
align_on_tabstop = false
align_pp_define_gap = 0
align_pp_define_span = 3
align_pp_define_together = true
align_right_cmt_at_col = 0
align_right_cmt_gap = 0
align_right_cmt_mix = false
align_right_cmt_span = 2
align_same_func_call_params = false
align_single_line_brace = false
align_single_line_brace_gap = 0
align_single_line_func = false
align_struct_init_span = 0
align_typedef_amp_style = 2
align_typedef_func = 2
align_typedef_gap = 0
align_typedef_span = 3
align_typedef_star_style = 2
align_var_class_gap = 0
align_var_class_span = 0
align_var_class_thresh = 0
align_var_def_amp_style = 2
align_var_def_attribute = true
align_var_def_colon = false
align_var_def_colon_gap = 0
align_var_def_gap = 0
align_var_def_inline = true
align_var_def_span = 1
align_var_def_star_style = 2
align_var_def_thresh = 1
align_var_struct_gap = 0
align_var_struct_span = 3
align_var_struct_thresh = 0
align_with_tabs = false
cmt_c_group = false
cmt_c_nl_end = false
cmt_c_nl_start = false
cmt_convert_tab_to_spaces = false
cmt_cpp_group = false
cmt_cpp_nl_end = false
cmt_cpp_nl_start = false
cmt_cpp_to_c = true
cmt_indent_multi = true
cmt_insert_before_ctor_dtor = false
cmt_insert_before_inlines = true
cmt_insert_before_preproc = false
cmt_insert_class_header = ""
cmt_insert_file_footer = ""
cmt_insert_file_header = ""
cmt_insert_func_header = ""
cmt_insert_oc_msg_header = ""
cmt_multi_check_last = true
cmt_multi_first_len_minimum = 4
cmt_reflow_mode = 0
cmt_sp_after_star_cont = 0
cmt_sp_before_star_cont = 0
cmt_star_cont = true
cmt_width = 79
code_width = 79
disable_processing_cmt = "format off"
eat_blanks_after_open_brace = true
eat_blanks_before_close_brace = true
enable_digraphs = false
enable_processing_cmt = "format on"
force_tab_after_define = false
include_category_0 = "<[^/]*>"
include_category_1 = "<(?!platform/).*/.*>"
include_category_2 = "<.*>"
indent_access_spec = 1
indent_access_spec_body = false
indent_align_assign = true
indent_align_string = true
indent_bool_paren = 0
indent_brace = 0
indent_brace_parent = false
indent_braces = false
indent_braces_no_class = false
indent_braces_no_func = false
indent_braces_no_struct = false
indent_case_brace = 0
indent_case_shift = 0
indent_class = false
indent_class_colon = false
indent_class_on_colon = false
indent_cmt_with_tabs = false
indent_col1_comment = false
indent_columns = 8
indent_comma_paren = 0
indent_constr_colon = false
indent_continue = 0
indent_cpp_lambda_body = false
indent_cs_delegate_brace = false
indent_ctor_init = 0
indent_ctor_init_leading = 2
indent_else_if = false
indent_extern = false
indent_first_bool_expr = false
indent_func_call_param = false
indent_func_class_param = false
indent_func_const = 0
indent_func_ctor_var_param = false
indent_func_def_force_col1 = false
indent_func_def_param = false
indent_func_param_double = false
indent_func_proto_param = false
indent_func_throw = 0
indent_ignore_asm_block = true
indent_label = 1
indent_member = 0
indent_min_vbrace_open = 0
indent_namespace = false
indent_namespace_level = 0
indent_namespace_limit = 0
indent_namespace_single_indent = false
indent_oc_block = false
indent_oc_block_msg = 0
indent_oc_block_msg_from_brace = false
indent_oc_block_msg_from_caret = false
indent_oc_block_msg_from_colon = false
indent_oc_block_msg_from_keyword = false
indent_oc_block_msg_xcode_style = false
indent_oc_msg_colon = 0
indent_oc_msg_prioritize_first_colon = true
indent_param = 0
indent_paren_after_func_call = false
indent_paren_after_func_decl = false
indent_paren_after_func_def = false
indent_paren_close = 2
indent_paren_nl = false
indent_paren_open_brace = false
indent_preserve_sql = false
indent_relative_single_line_comments = false
indent_shift = 0
indent_single_line_comments_before = 0
indent_square_nl = false
indent_switch_case = 0
indent_switch_pp = true
indent_template_param = false
indent_ternary_operator = 2
indent_token_after_brace = true
indent_using_block = true
indent_var_def_blk = 0
indent_var_def_cont = false
indent_vbrace_open_on_tabstop = false
indent_with_tabs = 1
indent_xml_string = 0
input_tab_size = 8
ls_code_width = false
ls_for_split_full = false
ls_func_split_full = false
mod_add_long_class_closebrace_comment = 0
mod_add_long_function_closebrace_comment = 0
mod_add_long_ifdef_else_comment = 0
mod_add_long_ifdef_endif_comment = 0
mod_add_long_namespace_closebrace_comment = 0
mod_add_long_switch_closebrace_comment = 0
mod_case_brace = remove
mod_full_brace_do = force
mod_full_brace_for = remove
mod_full_brace_function = ignore
mod_full_brace_if = remove
mod_full_brace_if_chain = 1
mod_full_brace_if_chain_only = false
mod_full_brace_nl = 2
mod_full_brace_nl_block_rem_mlcond = false
mod_full_brace_using = ignore
mod_full_brace_while = remove
mod_full_paren_if_bool = false
mod_move_case_break = false
mod_paren_on_return = remove
mod_pawn_semicolon = false
mod_remove_empty_return = false
mod_remove_extra_semicolon = true
mod_sort_import = false
mod_sort_include = true
mod_sort_oc_properties = false
mod_sort_oc_property_class_weight = 0
mod_sort_oc_property_getter_weight = 0
mod_sort_oc_property_nullability_weight = 0
mod_sort_oc_property_readwrite_weight = 0
mod_sort_oc_property_reference_weight = 0
mod_sort_oc_property_setter_weight = 0
mod_sort_oc_property_thread_safe_weight = 0
mod_sort_using = false
newlines = lf
nl_after_access_spec = 0
nl_after_annotation = ignore
nl_after_brace_close = true
nl_after_brace_open = true
nl_after_brace_open_cmt = false
nl_after_case = true
nl_after_class = 0
nl_after_do = ignore
nl_after_for = ignore
nl_after_func_body = 2
nl_after_func_body_class = 0
nl_after_func_body_one_liner = 2
nl_after_func_class_proto = 0
nl_after_func_class_proto_group = 0
nl_after_func_proto = 0
nl_after_func_proto_group = 2
nl_after_if = ignore
nl_after_label_colon = true
nl_after_multiline_comment = true
nl_after_return = false
nl_after_semicolon = true
nl_after_square_assign = ignore
nl_after_struct = 2
nl_after_switch = ignore
nl_after_synchronized = ignore
nl_after_try_catch_finally = 0
nl_after_vbrace_close = false
nl_after_vbrace_open = true
nl_after_vbrace_open_empty = true
nl_after_while = ignore
nl_around_cs_property = 0
nl_assign_brace = remove
nl_assign_leave_one_liners = true
nl_assign_square = ignore
nl_before_access_spec = 0
nl_before_block_comment = 0
nl_before_c_comment = 0
nl_before_case = false
nl_before_class = 0
nl_before_cpp_comment = 0
nl_before_do = ignore
nl_before_for = ignore
nl_before_func_body_def = 0
nl_before_func_body_proto = 0
nl_before_func_class_def = 0
nl_before_func_class_proto = 0
nl_before_if = ignore
nl_before_if_closing_paren = remove
nl_before_return = false
nl_before_switch = ignore
nl_before_synchronized = ignore
nl_before_throw = ignore
nl_before_while = ignore
nl_between_annotation = ignore
nl_between_get_set = 0
nl_brace_brace = ignore
nl_brace_catch = ignore
nl_brace_else = remove
nl_brace_finally = ignore
nl_brace_fparen = remove
nl_brace_square = ignore
nl_brace_struct_var = remove
nl_brace_while = remove
nl_case_colon_brace = remove
nl_catch_brace = ignore
nl_class_brace = ignore
nl_class_colon = ignore
nl_class_init_args = ignore
nl_class_leave_one_liners = false
nl_collapse_empty_body = false
nl_comment_func_def = 1
nl_constr_colon = ignore
nl_constr_init_args = ignore
nl_cpp_lambda_leave_one_liners = false
nl_cpp_ldef_brace = ignore
nl_create_for_one_liner = false
nl_create_if_one_liner = false
nl_create_while_one_liner = false
nl_define_macro = true
nl_do_brace = remove
nl_ds_struct_enum_close_brace = true
nl_ds_struct_enum_cmt = false
nl_else_brace = remove
nl_else_if = remove
nl_elseif_brace = ignore
nl_end_of_file = force
nl_end_of_file_min = 1
nl_enum_brace = remove
nl_enum_class = ignore
nl_enum_class_identifier = ignore
nl_enum_colon_type = ignore
nl_enum_identifier_colon = ignore
nl_enum_leave_one_liners = false
nl_enum_own_lines = ignore
nl_fcall_brace = remove
nl_fdef_brace = force
nl_finally_brace = ignore
nl_for_brace = remove
nl_func_call_args_multi_line = false
nl_func_call_empty = remove
nl_func_call_end_multi_line = false
nl_func_call_paren = remove
nl_func_call_paren_empty = ignore
nl_func_call_start_multi_line = false
nl_func_class_scope = ignore
nl_func_decl_args = ignore
nl_func_decl_args_multi_line = false
nl_func_decl_empty = remove
nl_func_decl_end = remove
nl_func_decl_end_multi_line = false
nl_func_decl_end_single = ignore
nl_func_decl_start = remove
nl_func_decl_start_multi_line = false
nl_func_decl_start_single = ignore
nl_func_def_args = ignore
nl_func_def_args_multi_line = false
nl_func_def_empty = remove
nl_func_def_end = remove
nl_func_def_end_multi_line = false
nl_func_def_end_single = ignore
nl_func_def_paren = remove
nl_func_def_paren_empty = ignore
nl_func_def_start = remove
nl_func_def_start_multi_line = false
nl_func_def_start_single = ignore
nl_func_leave_one_liners = false
nl_func_paren = remove
nl_func_paren_empty = ignore
nl_func_proto_type_name = remove
nl_func_scope_name = ignore
nl_func_type_name = force
nl_func_type_name_class = ignore
nl_func_var_def_blk = 1
nl_getset_brace = ignore
nl_getset_leave_one_liners = false
nl_if_brace = remove
nl_if_leave_one_liners = false
nl_max = 2
nl_max_blank_in_func = 2
nl_multi_line_cond = false
nl_multi_line_define = false
nl_namespace_brace = ignore
nl_oc_block_brace = ignore
nl_oc_msg_args = false
nl_oc_msg_leave_one_liner = false
nl_paren_dbrace_open = ignore
nl_property_brace = ignore
nl_remove_extra_newlines = 0
nl_return_expr = remove
nl_scope_brace = ignore
nl_split_for_one_liner = true
nl_split_if_one_liner = true
nl_split_while_one_liner = true
nl_squeeze_ifdef = false
nl_squeeze_ifdef_top_level = false
nl_start_of_file = remove
nl_start_of_file_min = 0
nl_struct_brace = remove
nl_switch_brace = remove
nl_synchronized_brace = ignore
nl_template_class = ignore
nl_try_brace = ignore
nl_type_brace_init_lst = ignore
nl_type_brace_init_lst_close = ignore
nl_type_brace_init_lst_open = ignore
nl_typedef_blk_end = 0
nl_typedef_blk_in = 0
nl_typedef_blk_start = 0
nl_union_brace = remove
nl_unittest_brace = ignore
nl_using_brace = ignore
nl_var_def_blk_end = 0
nl_var_def_blk_in = 2
nl_var_def_blk_start = 0
nl_version_brace = ignore
nl_while_brace = remove
nl_while_leave_one_liners = false
output_tab_size = 8
pos_arith = trail
pos_assign = trail
pos_bool = trail
pos_class_colon = ignore
pos_class_comma = ignore
pos_comma = trail
pos_compare = trail
pos_conditional = ignore
pos_constr_colon = ignore
pos_constr_comma = ignore
pos_enum_comma = ignore
pp_define_at_level = false
pp_if_indent_code = false
pp_ignore_define_body = false
pp_indent = remove
pp_indent_at_level = false
pp_indent_brace = 1
pp_indent_case = true
pp_indent_count = 1
pp_indent_extern = true
pp_indent_func_def = true
pp_indent_if = 0
pp_indent_region = 0
pp_region_indent_code = false
pp_space = remove
pp_space_count = 0
sp_addr = remove
sp_after_angle = ignore
sp_after_assign = ignore
sp_after_byref = ignore
sp_after_byref_func = ignore
sp_after_cast = remove
sp_after_class_colon = ignore
sp_after_comma = force
sp_after_constr_colon = ignore
sp_after_dc = ignore
sp_after_for_colon = ignore
sp_after_invariant_paren = ignore
sp_after_mdatype_commas = ignore
sp_after_new = ignore
sp_after_newop_paren = ignore
sp_after_oc_at_sel = ignore
sp_after_oc_at_sel_parens = ignore
sp_after_oc_block_caret = ignore
sp_after_oc_colon = ignore
sp_after_oc_dict_colon = ignore
sp_after_oc_msg_receiver = ignore
sp_after_oc_property = ignore
sp_after_oc_return_type = ignore
sp_after_oc_scope = ignore
sp_after_oc_type = ignore
sp_after_operator = ignore
sp_after_operator_sym = ignore
sp_after_operator_sym_empty = ignore
sp_after_ptr_star = remove
sp_after_ptr_star_func = remove
sp_after_ptr_star_qualifier = remove
sp_after_semi = remove
sp_after_semi_for = force
sp_after_semi_for_empty = remove
sp_after_send_oc_colon = ignore
sp_after_sparen = force
sp_after_tag = ignore
sp_after_throw = ignore
sp_after_tparen_close = remove
sp_after_type = force
sp_after_type_brace_init_lst_open = ignore
sp_angle_colon = ignore
sp_angle_paren = ignore
sp_angle_paren_empty = ignore
sp_angle_shift = add
sp_angle_word = ignore
sp_annotation_paren = ignore
sp_arith = force
sp_arith_additive = ignore
sp_assign = force
sp_assign_default = ignore
sp_attribute_paren = remove
sp_balance_nested_parens = false
sp_before_angle = ignore
sp_before_assign = ignore
sp_before_byref = ignore
sp_before_byref_func = ignore
sp_before_case_colon = remove
sp_before_class_colon = ignore
sp_before_comma = remove
sp_before_constr_colon = ignore
sp_before_dc = ignore
sp_before_ellipsis = ignore
sp_before_for_colon = ignore
sp_before_mdatype_commas = ignore
sp_before_nl_cont = force
sp_before_oc_block_caret = ignore
sp_before_oc_colon = ignore
sp_before_oc_dict_colon = ignore
sp_before_pp_stringify = ignore
sp_before_ptr_star = force
sp_before_ptr_star_func = force
sp_before_semi = remove
sp_before_semi_for = remove
sp_before_semi_for_empty = remove
sp_before_send_oc_colon = ignore
sp_before_sparen = force
sp_before_square = remove
sp_before_squares = remove
sp_before_template_paren = ignore
sp_before_tr_cmt = force
sp_before_type_brace_init_lst_close = ignore
sp_before_unnamed_byref = ignore
sp_before_unnamed_ptr_star = force
sp_between_mdatype_commas = ignore
sp_between_new_paren = ignore
sp_between_ptr_star = remove
sp_bool = force
sp_brace_catch = ignore
sp_brace_else = force
sp_brace_finally = ignore
sp_brace_typedef = force
sp_case_label = force
sp_catch_brace = ignore
sp_catch_paren = ignore
sp_cmt_cpp_doxygen = true
sp_cmt_cpp_qttr = true
sp_cmt_cpp_start = force
sp_compare = force
sp_cond_colon = force
sp_cond_colon_after = ignore
sp_cond_colon_before = ignore
sp_cond_question = force
sp_cond_question_after = ignore
sp_cond_question_before = ignore
sp_cond_ternary_short = remove
sp_cparen_oparen = remove
sp_cpp_cast_paren = ignore
sp_cpp_lambda_assign = ignore
sp_d_array_colon = ignore
sp_defined_paren = remove
sp_deref = remove
sp_else_brace = force
sp_endif_cmt = force
sp_enum_after_assign = force
sp_enum_assign = ignore
sp_enum_before_assign = ignore
sp_enum_colon = ignore
sp_enum_paren = ignore
sp_extern_paren = ignore
sp_finally_brace = ignore
sp_fparen_brace = force
sp_fparen_dbrace = ignore
sp_func_call_paren = remove
sp_func_call_paren_empty = ignore
sp_func_call_user_paren = ignore
sp_func_class_paren = ignore
sp_func_class_paren_empty = ignore
sp_func_def_paren = remove
sp_func_def_paren_empty = remove
sp_func_proto_paren = remove
sp_func_proto_paren_empty = remove
sp_getset_brace = ignore
sp_incdec = remove
sp_inside_angle = ignore
sp_inside_braces = force
sp_inside_braces_empty = remove
sp_inside_braces_enum = force
sp_inside_braces_struct = force
sp_inside_fparen = remove
sp_inside_fparens = remove
sp_inside_newop_paren = ignore
sp_inside_newop_paren_close = ignore
sp_inside_newop_paren_open = ignore
sp_inside_oc_at_sel_parens = ignore
sp_inside_paren = remove
sp_inside_paren_cast = remove
sp_inside_sparen = remove
sp_inside_sparen_close = ignore
sp_inside_sparen_open = ignore
sp_inside_square = remove
sp_inside_tparen = remove
sp_inside_type_brace_init_lst = ignore
sp_inv = remove
sp_invariant_paren = ignore
sp_macro = force
sp_macro_func = force
sp_member = remove
sp_not = remove
sp_num_before_tr_cmt = 1
sp_paren_brace = force
sp_paren_comma = force
sp_paren_paren = remove
sp_permit_cpp11_shift = false
sp_pp_concat = add
sp_pp_stringify = remove
sp_ptr_star_paren = remove
sp_range = ignore
sp_return_paren = force
sp_scope_paren = ignore
sp_sign = remove
sp_sizeof_paren = remove
sp_skip_vbrace_tokens = false
sp_sparen_brace = force
sp_special_semi = remove
sp_square_fparen = remove
sp_super_paren = remove
sp_template_angle = ignore
sp_this_paren = remove
sp_throw_paren = ignore
sp_try_brace = ignore
sp_type_brace_init_lst = ignore
sp_type_func = force
sp_version_paren = ignore
sp_word_brace_ns = add
string_escape_char = 92
string_escape_char2 = 0
string_replace_tab_chars = true
tok_split_gte = false
use_indent_continue_only_once = false
use_indent_func_call_param = true
use_options_overriding_for_qt_macros = true
utf8_bom = remove
utf8_byte = true
utf8_force = true
================================================
FILE: 3rdparty/Makefile
================================================
#
# Copyright © 2017-2022 The Crust Firmware Authors.
# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only
#
hostprogs-y += kconfig/
================================================
FILE: 3rdparty/kconfig/Makefile
================================================
#
# Copyright © 2017-2022 The Crust Firmware Authors.
# SPDX-License-Identifier: GPL-2.0-only
#
# Based in part on scripts/kconfig/Makefile from Linux v4.19.
#
ccflags-y += -D_GNU_SOURCE \
-std=gnu11 \
-Wno-implicit-fallthrough \
-Wno-pedantic \
-Wno-sign-compare \
-Wno-unused-parameter \
-Wno-vla
cppflags-y += -I$(src)
BUILDCFLAGS_nconf := $(shell \
pkg-config --cflags menuw panelw ncursesw 2>/dev/null \
|| pkg-config --cflags menu panel ncurses 2>/dev/null \
|| echo "-D_GNU_SOURCE -I/usr/include/ncurses")
BUILDLDLIBS_nconf := $(shell \
pkg-config --libs menuw panelw ncursesw 2>/dev/null \
|| pkg-config --libs menu panel ncurses 2>/dev/null \
|| echo "-lmenu -lpanel -lncurses")
buildprogs-y += conf nconf
common-objs := confdata.o expr.o lexer.lex.o parser.tab.o \
preprocess.o symbol.o util.o
conf-objs := $(common-objs) conf.o
nconf-objs := $(common-objs) nconf.o nconf.gui.o
silent := $(if $(filter-out 0,$(V)),,-s)
# These targets map 1:1 to the command line options of 'conf'.
simple-targets := \
alldefconfig allnoconfig allyesconfig helpnewconfig listnewconfig \
oldconfig olddefconfig randconfig syncconfig
$(simple-targets): $(obj)/conf
$(Q) $< $(silent) --$@ $(SRC)/Kconfig
config: $(obj)/conf
$(Q) $< $(silent) --oldaskconfig $(SRC)/Kconfig
defconfig: $(obj)/conf
$(Q) $< $(silent) --defconfig=$(SRC)/configs/$@ $(SRC)/Kconfig
%_defconfig: $(obj)/conf
$(Q) $< $(silent) --defconfig=$(SRC)/configs/$@ $(SRC)/Kconfig
nconfig: $(obj)/nconf
$(Q) $< $(silent) $(SRC)/Kconfig
savedefconfig: $(obj)/conf
$(Q) $< $(silent) --$@=defconfig $(SRC)/Kconfig
$(obj)/lexer.lex.c: | $(obj)/.
$(obj)/lexer.lex.o: $(obj)/parser.tab.c
$(obj)/parser.tab.c: | $(obj)/.
.PHONY: $(simple-targets) config defconfig %_defconfig nconfig savedefconfig
================================================
FILE: 3rdparty/kconfig/conf.c
================================================
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#include "lkc.h"
static void conf(struct menu *menu);
static void check_conf(struct menu *menu);
enum input_mode {
oldaskconfig,
syncconfig,
oldconfig,
allnoconfig,
allyesconfig,
allmodconfig,
alldefconfig,
randconfig,
defconfig,
savedefconfig,
listnewconfig,
helpnewconfig,
olddefconfig,
yes2modconfig,
mod2yesconfig,
};
static enum input_mode input_mode = oldaskconfig;
static int indent = 1;
static int tty_stdio;
static int sync_kconfig;
static int conf_cnt;
static char line[PATH_MAX];
static struct menu *rootEntry;
static void print_help(struct menu *menu)
{
struct gstr help = str_new();
menu_get_ext_help(menu, &help);
printf("\n%s\n", str_get(&help));
str_free(&help);
}
static void strip(char *str)
{
char *p = str;
int l;
while ((isspace(*p)))
p++;
l = strlen(p);
if (p != str)
memmove(str, p, l + 1);
if (!l)
return;
p = str + l - 1;
while ((isspace(*p)))
*p-- = 0;
}
/* Helper function to facilitate fgets() by Jean Sacren. */
static void xfgets(char *str, int size, FILE *in)
{
if (!fgets(str, size, in))
fprintf(stderr, "\nError in reading or end of file.\n");
if (!tty_stdio)
printf("%s", str);
}
static int conf_askvalue(struct symbol *sym, const char *def)
{
enum symbol_type type = sym_get_type(sym);
if (!sym_has_value(sym))
printf("(NEW) ");
line[0] = '\n';
line[1] = 0;
if (!sym_is_changeable(sym)) {
printf("%s\n", def);
line[0] = '\n';
line[1] = 0;
return 0;
}
switch (input_mode) {
case oldconfig:
case syncconfig:
if (sym_has_value(sym)) {
printf("%s\n", def);
return 0;
}
/* fall through */
case oldaskconfig:
fflush(stdout);
xfgets(line, sizeof(line), stdin);
return 1;
default:
break;
}
switch (type) {
case S_INT:
case S_HEX:
case S_STRING:
printf("%s\n", def);
return 1;
default:
;
}
printf("%s", line);
return 1;
}
static int conf_string(struct menu *menu)
{
struct symbol *sym = menu->sym;
const char *def;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
printf("(%s) ", sym->name);
def = sym_get_string_value(sym);
if (sym_get_string_value(sym))
printf("[%s] ", def);
if (!conf_askvalue(sym, def))
return 0;
switch (line[0]) {
case '\n':
break;
case '?':
/* print help */
if (line[1] == '\n') {
print_help(menu);
def = NULL;
break;
}
/* fall through */
default:
line[strlen(line)-1] = 0;
def = line;
}
if (def && sym_set_string_value(sym, def))
return 0;
}
}
static int conf_sym(struct menu *menu)
{
struct symbol *sym = menu->sym;
tristate oldval, newval;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
if (sym->name)
printf("(%s) ", sym->name);
putchar('[');
oldval = sym_get_tristate_value(sym);
switch (oldval) {
case no:
putchar('N');
break;
case mod:
putchar('M');
break;
case yes:
putchar('Y');
break;
}
if (oldval != no && sym_tristate_within_range(sym, no))
printf("/n");
if (oldval != mod && sym_tristate_within_range(sym, mod))
printf("/m");
if (oldval != yes && sym_tristate_within_range(sym, yes))
printf("/y");
printf("/?] ");
if (!conf_askvalue(sym, sym_get_string_value(sym)))
return 0;
strip(line);
switch (line[0]) {
case 'n':
case 'N':
newval = no;
if (!line[1] || !strcmp(&line[1], "o"))
break;
continue;
case 'm':
case 'M':
newval = mod;
if (!line[1])
break;
continue;
case 'y':
case 'Y':
newval = yes;
if (!line[1] || !strcmp(&line[1], "es"))
break;
continue;
case 0:
newval = oldval;
break;
case '?':
goto help;
default:
continue;
}
if (sym_set_tristate_value(sym, newval))
return 0;
help:
print_help(menu);
}
}
static int conf_choice(struct menu *menu)
{
struct symbol *sym, *def_sym;
struct menu *child;
bool is_new;
sym = menu->sym;
is_new = !sym_has_value(sym);
if (sym_is_changeable(sym)) {
conf_sym(menu);
sym_calc_value(sym);
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
return 0;
case yes:
break;
}
} else {
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
return 0;
case yes:
break;
}
}
while (1) {
int cnt, def;
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
def_sym = sym_get_choice_value(sym);
cnt = def = 0;
line[0] = 0;
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
if (!child->sym) {
printf("%*c %s\n", indent, '*', menu_get_prompt(child));
continue;
}
cnt++;
if (child->sym == def_sym) {
def = cnt;
printf("%*c", indent, '>');
} else
printf("%*c", indent, ' ');
printf(" %d. %s", cnt, menu_get_prompt(child));
if (child->sym->name)
printf(" (%s)", child->sym->name);
if (!sym_has_value(child->sym))
printf(" (NEW)");
printf("\n");
}
printf("%*schoice", indent - 1, "");
if (cnt == 1) {
printf("[1]: 1\n");
goto conf_childs;
}
printf("[1-%d?]: ", cnt);
switch (input_mode) {
case oldconfig:
case syncconfig:
if (!is_new) {
cnt = def;
printf("%d\n", cnt);
break;
}
/* fall through */
case oldaskconfig:
fflush(stdout);
xfgets(line, sizeof(line), stdin);
strip(line);
if (line[0] == '?') {
print_help(menu);
continue;
}
if (!line[0])
cnt = def;
else if (isdigit(line[0]))
cnt = atoi(line);
else
continue;
break;
default:
break;
}
conf_childs:
for (child = menu->list; child; child = child->next) {
if (!child->sym || !menu_is_visible(child))
continue;
if (!--cnt)
break;
}
if (!child)
continue;
if (line[0] && line[strlen(line) - 1] == '?') {
print_help(child);
continue;
}
sym_set_choice_value(sym, child->sym);
for (child = child->list; child; child = child->next) {
indent += 2;
conf(child);
indent -= 2;
}
return 1;
}
}
static void conf(struct menu *menu)
{
struct symbol *sym;
struct property *prop;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
prop = menu->prompt;
if (prop) {
const char *prompt;
switch (prop->type) {
case P_MENU:
/*
* Except in oldaskconfig mode, we show only menus that
* contain new symbols.
*/
if (input_mode != oldaskconfig && rootEntry != menu) {
check_conf(menu);
return;
}
/* fall through */
case P_COMMENT:
prompt = menu_get_prompt(menu);
if (prompt)
printf("%*c\n%*c %s\n%*c\n",
indent, '*',
indent, '*', prompt,
indent, '*');
default:
;
}
}
if (!sym)
goto conf_childs;
if (sym_is_choice(sym)) {
conf_choice(menu);
if (sym->curr.tri != mod)
return;
goto conf_childs;
}
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
conf_string(menu);
break;
default:
conf_sym(menu);
break;
}
conf_childs:
if (sym)
indent += 2;
for (child = menu->list; child; child = child->next)
conf(child);
if (sym)
indent -= 2;
}
static void check_conf(struct menu *menu)
{
struct symbol *sym;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
if (sym && !sym_has_value(sym)) {
if (sym_is_changeable(sym) ||
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
if (input_mode == listnewconfig) {
if (sym->name) {
const char *str;
if (sym->type == S_STRING) {
str = sym_get_string_value(sym);
str = sym_escape_string_value(str);
printf("%s%s=%s\n", CONFIG_, sym->name, str);
free((void *)str);
} else {
str = sym_get_string_value(sym);
printf("%s%s=%s\n", CONFIG_, sym->name, str);
}
}
} else if (input_mode == helpnewconfig) {
printf("-----\n");
print_help(menu);
printf("-----\n");
} else {
if (!conf_cnt++)
printf("*\n* Restart config...\n*\n");
rootEntry = menu_get_parent_menu(menu);
conf(rootEntry);
}
}
}
for (child = menu->list; child; child = child->next)
check_conf(child);
}
static struct option long_opts[] = {
{"oldaskconfig", no_argument, NULL, oldaskconfig},
{"oldconfig", no_argument, NULL, oldconfig},
{"syncconfig", no_argument, NULL, syncconfig},
{"defconfig", required_argument, NULL, defconfig},
{"savedefconfig", required_argument, NULL, savedefconfig},
{"allnoconfig", no_argument, NULL, allnoconfig},
{"allyesconfig", no_argument, NULL, allyesconfig},
{"allmodconfig", no_argument, NULL, allmodconfig},
{"alldefconfig", no_argument, NULL, alldefconfig},
{"randconfig", no_argument, NULL, randconfig},
{"listnewconfig", no_argument, NULL, listnewconfig},
{"helpnewconfig", no_argument, NULL, helpnewconfig},
{"olddefconfig", no_argument, NULL, olddefconfig},
{"yes2modconfig", no_argument, NULL, yes2modconfig},
{"mod2yesconfig", no_argument, NULL, mod2yesconfig},
{NULL, 0, NULL, 0}
};
static void conf_usage(const char *progname)
{
printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
printf("[option] is _one_ of the following:\n");
printf(" --listnewconfig List new options\n");
printf(" --helpnewconfig List new options and help text\n");
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
printf(" --oldconfig Update a configuration using a provided .config as base\n");
printf(" --syncconfig Similar to oldconfig but generates configuration in\n"
" include/{generated/,config/}\n");
printf(" --olddefconfig Same as oldconfig but sets new symbols to their default value\n");
printf(" --defconfig <file> New config with default defined in <file>\n");
printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
printf(" --allnoconfig New config where all options are answered with no\n");
printf(" --allyesconfig New config where all options are answered with yes\n");
printf(" --allmodconfig New config where all options are answered with mod\n");
printf(" --alldefconfig New config with all symbols set to default\n");
printf(" --randconfig New config with random answer to all options\n");
printf(" --yes2modconfig Change answers from yes to mod if possible\n");
printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
}
int main(int ac, char **av)
{
const char *progname = av[0];
int opt;
const char *name, *defconfig_file = NULL /* gcc uninit */;
int no_conf_write = 0;
tty_stdio = isatty(0) && isatty(1);
while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
if (opt == 's') {
conf_set_message_callback(NULL);
continue;
}
input_mode = (enum input_mode)opt;
switch (opt) {
case syncconfig:
/*
* syncconfig is invoked during the build stage.
* Suppress distracting "configuration written to ..."
*/
conf_set_message_callback(NULL);
sync_kconfig = 1;
break;
case defconfig:
case savedefconfig:
defconfig_file = optarg;
break;
case randconfig:
{
struct timeval now;
unsigned int seed;
char *seed_env;
/*
* Use microseconds derived seed,
* compensate for systems where it may be zero
*/
gettimeofday(&now, NULL);
seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
seed_env = getenv("KCONFIG_SEED");
if( seed_env && *seed_env ) {
char *endp;
int tmp = (int)strtol(seed_env, &endp, 0);
if (*endp == '\0') {
seed = tmp;
}
}
fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed );
srand(seed);
break;
}
case oldaskconfig:
case oldconfig:
case allnoconfig:
case allyesconfig:
case allmodconfig:
case alldefconfig:
case listnewconfig:
case helpnewconfig:
case olddefconfig:
case yes2modconfig:
case mod2yesconfig:
break;
case '?':
conf_usage(progname);
exit(1);
break;
}
}
if (ac == optind) {
fprintf(stderr, "%s: Kconfig file missing\n", av[0]);
conf_usage(progname);
exit(1);
}
name = av[optind];
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
case defconfig:
if (conf_read(defconfig_file)) {
fprintf(stderr,
"***\n"
"*** Can't find default configuration \"%s\"!\n"
"***\n",
defconfig_file);
exit(1);
}
break;
case savedefconfig:
case syncconfig:
case oldaskconfig:
case oldconfig:
case listnewconfig:
case helpnewconfig:
case olddefconfig:
case yes2modconfig:
case mod2yesconfig:
conf_read(NULL);
break;
case allnoconfig:
case allyesconfig:
case allmodconfig:
case alldefconfig:
case randconfig:
name = getenv("KCONFIG_ALLCONFIG");
if (!name)
break;
if ((strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) {
if (conf_read_simple(name, S_DEF_USER)) {
fprintf(stderr,
"*** Can't read seed configuration \"%s\"!\n",
name);
exit(1);
}
break;
}
switch (input_mode) {
case allnoconfig: name = "allno.config"; break;
case allyesconfig: name = "allyes.config"; break;
case allmodconfig: name = "allmod.config"; break;
case alldefconfig: name = "alldef.config"; break;
case randconfig: name = "allrandom.config"; break;
default: break;
}
if (conf_read_simple(name, S_DEF_USER) &&
conf_read_simple("all.config", S_DEF_USER)) {
fprintf(stderr,
"*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n",
name);
exit(1);
}
break;
default:
break;
}
if (sync_kconfig) {
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
if (conf_get_changed()) {
fprintf(stderr,
"\n*** The configuration requires explicit update.\n\n");
return 1;
}
no_conf_write = 1;
}
}
switch (input_mode) {
case allnoconfig:
conf_set_all_new_symbols(def_no);
break;
case allyesconfig:
conf_set_all_new_symbols(def_yes);
break;
case allmodconfig:
conf_set_all_new_symbols(def_mod);
break;
case alldefconfig:
conf_set_all_new_symbols(def_default);
break;
case randconfig:
/* Really nothing to do in this loop */
while (conf_set_all_new_symbols(def_random)) ;
break;
case defconfig:
conf_set_all_new_symbols(def_default);
break;
case savedefconfig:
break;
case yes2modconfig:
conf_rewrite_mod_or_yes(def_y2m);
break;
case mod2yesconfig:
conf_rewrite_mod_or_yes(def_m2y);
break;
case oldaskconfig:
rootEntry = &rootmenu;
conf(&rootmenu);
input_mode = oldconfig;
/* fall through */
case oldconfig:
case listnewconfig:
case helpnewconfig:
case syncconfig:
/* Update until a loop caused no more changes */
do {
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
break;
case olddefconfig:
default:
break;
}
if (input_mode == savedefconfig) {
if (conf_write_defconfig(defconfig_file)) {
fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",
defconfig_file);
return 1;
}
} else if (input_mode != listnewconfig && input_mode != helpnewconfig) {
if (!no_conf_write && conf_write(NULL)) {
fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
exit(1);
}
/*
* Create auto.conf if it does not exist.
* This prevents GNU Make 4.1 or older from emitting
* "include/config/auto.conf: No such file or directory"
* in the top-level Makefile
*
* syncconfig always creates or updates auto.conf because it is
* used during the build.
*/
if (conf_write_autoconf(sync_kconfig) && sync_kconfig) {
fprintf(stderr,
"\n*** Error during sync of the configuration.\n\n");
return 1;
}
}
return 0;
}
================================================
FILE: 3rdparty/kconfig/confdata.c
================================================
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#include <sys/mman.h>
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "lkc.h"
/* return true if 'path' exists, false otherwise */
static bool is_present(const char *path)
{
struct stat st;
return !stat(path, &st);
}
/* return true if 'path' exists and it is a directory, false otherwise */
static bool is_dir(const char *path)
{
struct stat st;
if (stat(path, &st))
return 0;
return S_ISDIR(st.st_mode);
}
/* return true if the given two files are the same, false otherwise */
static bool is_same(const char *file1, const char *file2)
{
int fd1, fd2;
struct stat st1, st2;
void *map1, *map2;
bool ret = false;
fd1 = open(file1, O_RDONLY);
if (fd1 < 0)
return ret;
fd2 = open(file2, O_RDONLY);
if (fd2 < 0)
goto close1;
ret = fstat(fd1, &st1);
if (ret)
goto close2;
ret = fstat(fd2, &st2);
if (ret)
goto close2;
if (st1.st_size != st2.st_size)
goto close2;
map1 = mmap(NULL, st1.st_size, PROT_READ, MAP_PRIVATE, fd1, 0);
if (map1 == MAP_FAILED)
goto close2;
map2 = mmap(NULL, st2.st_size, PROT_READ, MAP_PRIVATE, fd2, 0);
if (map2 == MAP_FAILED)
goto close2;
if (bcmp(map1, map2, st1.st_size))
goto close2;
ret = true;
close2:
close(fd2);
close1:
close(fd1);
return ret;
}
/*
* Create the parent directory of the given path.
*
* For example, if 'include/config/auto.conf' is given, create 'include/config'.
*/
static int make_parent_dir(const char *path)
{
char tmp[PATH_MAX + 1];
char *p;
strncpy(tmp, path, sizeof(tmp));
tmp[sizeof(tmp) - 1] = 0;
/* Remove the base name. Just return if nothing is left */
p = strrchr(tmp, '/');
if (!p)
return 0;
*(p + 1) = 0;
/* Just in case it is an absolute path */
p = tmp;
while (*p == '/')
p++;
while ((p = strchr(p, '/'))) {
*p = 0;
/* skip if the directory exists */
if (!is_dir(tmp) && mkdir(tmp, 0755))
return -1;
*p = '/';
while (*p == '/')
p++;
}
return 0;
}
static char depfile_path[PATH_MAX];
static size_t depfile_prefix_len;
/* touch depfile for symbol 'name' */
static int conf_touch_dep(const char *name)
{
int fd, ret;
const char *s;
char *d, c;
/* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */
if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path))
return -1;
d = depfile_path + depfile_prefix_len;
s = name;
while ((c = *s++))
*d++ = (c == '_') ? '/' : tolower(c);
strcpy(d, ".h");
/* Assume directory path already exists. */
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
if (errno != ENOENT)
return -1;
ret = make_parent_dir(depfile_path);
if (ret)
return ret;
/* Try it again. */
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1)
return -1;
}
close(fd);
return 0;
}
struct conf_printer {
void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
void (*print_comment)(FILE *, const char *, void *);
};
static void conf_warning(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static void conf_message(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static const char *conf_filename;
static int conf_lineno, conf_warnings;
static void conf_warning(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
conf_warnings++;
}
static void conf_default_message_callback(const char *s)
{
printf("#\n# ");
printf("%s", s);
printf("\n#\n");
}
static void (*conf_message_callback)(const char *s) =
conf_default_message_callback;
void conf_set_message_callback(void (*fn)(const char *s))
{
conf_message_callback = fn;
}
static void conf_message(const char *fmt, ...)
{
va_list ap;
char buf[4096];
if (!conf_message_callback)
return;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
conf_message_callback(buf);
va_end(ap);
}
const char *conf_get_configname(void)
{
char *name = getenv("KCONFIG_CONFIG");
return name ? name : ".config";
}
static const char *conf_get_autoconfig_name(void)
{
char *name = getenv("KCONFIG_AUTOCONFIG");
return name ? name : "include/config/auto.conf";
}
static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
{
char *p2;
switch (sym->type) {
case S_TRISTATE:
if (p[0] == 'm') {
sym->def[def].tri = mod;
sym->flags |= def_flags;
break;
}
/* fall through */
case S_BOOLEAN:
if (p[0] == 'y') {
sym->def[def].tri = yes;
sym->flags |= def_flags;
break;
}
if (p[0] == 'n') {
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
}
if (def != S_DEF_AUTO)
conf_warning("symbol value '%s' invalid for %s",
p, sym->name);
return 1;
case S_STRING:
if (*p++ != '"')
break;
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
if (*p2 == '"') {
*p2 = 0;
break;
}
memmove(p2, p2 + 1, strlen(p2));
}
if (!p2) {
if (def != S_DEF_AUTO)
conf_warning("invalid string found");
return 1;
}
/* fall through */
case S_INT:
case S_HEX:
if (sym_string_valid(sym, p)) {
sym->def[def].val = xstrdup(p);
sym->flags |= def_flags;
} else {
if (def != S_DEF_AUTO)
conf_warning("symbol value '%s' invalid for %s",
p, sym->name);
return 1;
}
break;
default:
;
}
return 0;
}
#define LINE_GROWTH 16
static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
{
char *nline;
size_t new_size = slen + 1;
if (new_size > *n) {
new_size += LINE_GROWTH - 1;
new_size *= 2;
nline = xrealloc(*lineptr, new_size);
if (!nline)
return -1;
*lineptr = nline;
*n = new_size;
}
(*lineptr)[slen] = c;
return 0;
}
static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream)
{
char *line = *lineptr;
size_t slen = 0;
for (;;) {
int c = getc(stream);
switch (c) {
case '\n':
if (add_byte(c, &line, slen, n) < 0)
goto e_out;
slen++;
/* fall through */
case EOF:
if (add_byte('\0', &line, slen, n) < 0)
goto e_out;
*lineptr = line;
if (slen == 0)
return -1;
return slen;
default:
if (add_byte(c, &line, slen, n) < 0)
goto e_out;
slen++;
}
}
e_out:
line[slen-1] = '\0';
*lineptr = line;
return -1;
}
int conf_read_simple(const char *name, int def)
{
FILE *in = NULL;
char *line = NULL;
size_t line_asize = 0;
char *p, *p2;
struct symbol *sym;
int i, def_flags;
if (name) {
in = zconf_fopen(name);
} else {
struct property *prop;
name = conf_get_configname();
in = zconf_fopen(name);
if (in)
goto load;
sym_add_change_count(1);
if (!sym_defconfig_list)
return 1;
for_all_defaults(sym_defconfig_list, prop) {
if (expr_calc_value(prop->visible.expr) == no ||
prop->expr->type != E_SYMBOL)
continue;
sym_calc_value(prop->expr->left.sym);
name = sym_get_string_value(prop->expr->left.sym);
in = zconf_fopen(name);
if (in) {
conf_message("using defaults found in %s",
name);
goto load;
}
}
}
if (!in)
return 1;
load:
conf_filename = name;
conf_lineno = 0;
conf_warnings = 0;
def_flags = SYMBOL_DEF << def;
for_all_symbols(i, sym) {
sym->flags |= SYMBOL_CHANGED;
sym->flags &= ~(def_flags|SYMBOL_VALID);
if (sym_is_choice(sym))
sym->flags |= def_flags;
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
if (sym->def[def].val)
free(sym->def[def].val);
/* fall through */
default:
sym->def[def].val = NULL;
sym->def[def].tri = no;
}
}
while (compat_getline(&line, &line_asize, in) != -1) {
conf_lineno++;
sym = NULL;
if (line[0] == '#') {
if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
continue;
p = strchr(line + 2 + strlen(CONFIG_), ' ');
if (!p)
continue;
*p++ = 0;
if (strncmp(p, "is not set", 10))
continue;
if (def == S_DEF_USER) {
sym = sym_find(line + 2 + strlen(CONFIG_));
if (!sym) {
sym_add_change_count(1);
continue;
}
} else {
sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
if (sym->type == S_UNKNOWN)
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
conf_warning("override: reassigning to symbol %s", sym->name);
}
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
default:
;
}
} else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
p = strchr(line + strlen(CONFIG_), '=');
if (!p)
continue;
*p++ = 0;
p2 = strchr(p, '\n');
if (p2) {
*p2-- = 0;
if (*p2 == '\r')
*p2 = 0;
}
sym = sym_find(line + strlen(CONFIG_));
if (!sym) {
if (def == S_DEF_AUTO)
/*
* Reading from include/config/auto.conf
* If CONFIG_FOO previously existed in
* auto.conf but it is missing now,
* include/config/foo.h must be touched.
*/
conf_touch_dep(line + strlen(CONFIG_));
else
sym_add_change_count(1);
continue;
}
if (sym->flags & def_flags) {
conf_warning("override: reassigning to symbol %s", sym->name);
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
} else {
if (line[0] != '\r' && line[0] != '\n')
conf_warning("unexpected data: %.*s",
(int)strcspn(line, "\r\n"), line);
continue;
}
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->def[def].tri) {
case no:
break;
case mod:
if (cs->def[def].tri == yes) {
conf_warning("%s creates inconsistent choice state", sym->name);
cs->flags &= ~def_flags;
}
break;
case yes:
if (cs->def[def].tri != no)
conf_warning("override: %s changes choice state", sym->name);
cs->def[def].val = sym;
break;
}
cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
}
}
free(line);
fclose(in);
return 0;
}
int conf_read(const char *name)
{
struct symbol *sym;
int conf_unsaved = 0;
int i;
sym_set_change_count(0);
if (conf_read_simple(name, S_DEF_USER)) {
sym_calc_value(modules_sym);
return 1;
}
sym_calc_value(modules_sym);
for_all_symbols(i, sym) {
sym_calc_value(sym);
if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
continue;
if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
/* check that calculated value agrees with saved value */
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym))
continue;
break;
default:
if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
continue;
break;
}
} else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE))
/* no previous value and not saved */
continue;
conf_unsaved++;
/* maybe print value in verbose mode... */
}
for_all_symbols(i, sym) {
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
/* Reset values of generates values, so they'll appear
* as new, if they should become visible, but that
* doesn't quite work if the Kconfig and the saved
* configuration disagree.
*/
if (sym->visible == no && !conf_unsaved)
sym->flags &= ~SYMBOL_DEF_USER;
switch (sym->type) {
case S_STRING:
case S_INT:
case S_HEX:
/* Reset a string value if it's out of range */
if (sym_string_within_range(sym, sym->def[S_DEF_USER].val))
break;
sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
conf_unsaved++;
break;
default:
break;
}
}
}
sym_add_change_count(conf_warnings || conf_unsaved);
return 0;
}
/*
* Kconfig configuration printer
*
* This printer is used when generating the resulting configuration after
* kconfig invocation and `defconfig' files. Unset symbol might be omitted by
* passing a non-NULL argument to the printer.
*
*/
static void
kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
{
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (*value == 'n') {
bool skip_unset = (arg != NULL);
if (!skip_unset)
fprintf(fp, "# %s%s is not set\n",
CONFIG_, sym->name);
return;
}
break;
default:
break;
}
fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value);
}
static void
kconfig_print_comment(FILE *fp, const char *value, void *arg)
{
const char *p = value;
size_t l;
for (;;) {
l = strcspn(p, "\n");
fprintf(fp, "#");
if (l) {
fprintf(fp, " ");
xfwrite(p, l, 1, fp);
p += l;
}
fprintf(fp, "\n");
if (*p++ == '\0')
break;
}
}
static struct conf_printer kconfig_printer_cb =
{
.print_symbol = kconfig_print_symbol,
.print_comment = kconfig_print_comment,
};
/*
* Header printer
*
* This printer is used when generating the `include/generated/autoconf.h' file.
*/
static void
header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
{
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE: {
const char *suffix = "";
switch (*value) {
case 'n':
break;
case 'm':
suffix = "_MODULE";
/* fall through */
default:
fprintf(fp, "#define %s%s%s 1\n",
CONFIG_, sym->name, suffix);
}
break;
}
case S_HEX: {
const char *prefix = "";
if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
prefix = "0x";
fprintf(fp, "#define %s%s %s%s\n",
CONFIG_, sym->name, prefix, value);
break;
}
case S_STRING:
case S_INT:
fprintf(fp, "#define %s%s %s\n",
CONFIG_, sym->name, value);
break;
default:
break;
}
}
static void
header_print_comment(FILE *fp, const char *value, void *arg)
{
const char *p = value;
size_t l;
fprintf(fp, "/*\n");
for (;;) {
l = strcspn(p, "\n");
fprintf(fp, " *");
if (l) {
fprintf(fp, " ");
xfwrite(p, l, 1, fp);
p += l;
}
fprintf(fp, "\n");
if (*p++ == '\0')
break;
}
fprintf(fp, " */\n");
}
static struct conf_printer header_printer_cb =
{
.print_symbol = header_print_symbol,
.print_comment = header_print_comment,
};
static void conf_write_symbol(FILE *fp, struct symbol *sym,
struct conf_printer *printer, void *printer_arg)
{
const char *str;
switch (sym->type) {
case S_UNKNOWN:
break;
case S_STRING:
str = sym_get_string_value(sym);
str = sym_escape_string_value(str);
printer->print_symbol(fp, sym, str, printer_arg);
free((void *)str);
break;
default:
str = sym_get_string_value(sym);
printer->print_symbol(fp, sym, str, printer_arg);
}
}
static void
conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg)
{
char buf[256];
snprintf(buf, sizeof(buf),
"\n"
"Automatically generated file; DO NOT EDIT.\n"
"%s\n",
rootmenu.prompt->text);
printer->print_comment(fp, buf, printer_arg);
}
/*
* Write out a minimal config.
* All values that has default values are skipped as this is redundant.
*/
int conf_write_defconfig(const char *filename)
{
struct symbol *sym;
struct menu *menu;
FILE *out;
out = fopen(filename, "w");
if (!out)
return 1;
sym_clear_all_valid();
/* Traverse all menus to find all relevant symbols */
menu = rootmenu.list;
while (menu != NULL)
{
sym = menu->sym;
if (sym == NULL) {
if (!menu_is_visible(menu))
goto next_menu;
} else if (!sym_is_choice(sym)) {
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE))
goto next_menu;
sym->flags &= ~SYMBOL_WRITE;
/* If we cannot change the symbol - skip */
if (!sym_is_changeable(sym))
goto next_menu;
/* If symbol equals to default value - skip */
if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
goto next_menu;
/*
* If symbol is a choice value and equals to the
* default for a choice - skip.
* But only if value is bool and equal to "y" and
* choice is not "optional".
* (If choice is "optional" then all values can be "n")
*/
if (sym_is_choice_value(sym)) {
struct symbol *cs;
struct symbol *ds;
cs = prop_get_symbol(sym_get_choice_prop(sym));
ds = sym_choice_default(cs);
if (!sym_is_optional(cs) && sym == ds) {
if ((sym->type == S_BOOLEAN) &&
sym_get_tristate_value(sym) == yes)
goto next_menu;
}
}
conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
}
next_menu:
if (menu->list != NULL) {
menu = menu->list;
}
else if (menu->next != NULL) {
menu = menu->next;
} else {
while ((menu = menu->parent)) {
if (menu->next != NULL) {
menu = menu->next;
break;
}
}
}
}
fclose(out);
return 0;
}
int conf_write(const char *name)
{
FILE *out;
struct symbol *sym;
struct menu *menu;
const char *str;
char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1];
char *env;
int i;
bool need_newline = false;
if (!name)
name = conf_get_configname();
if (!*name) {
fprintf(stderr, "config name is empty\n");
return -1;
}
if (is_dir(name)) {
fprintf(stderr, "%s: Is a directory\n", name);
return -1;
}
if (make_parent_dir(name))
return -1;
env = getenv("KCONFIG_OVERWRITECONFIG");
if (env && *env) {
*tmpname = 0;
out = fopen(name, "w");
} else {
snprintf(tmpname, sizeof(tmpname), "%s.%d.tmp",
name, (int)getpid());
out = fopen(tmpname, "w");
}
if (!out)
return 1;
conf_write_heading(out, &kconfig_printer_cb, NULL);
if (!conf_get_changed())
sym_clear_all_valid();
menu = rootmenu.list;
while (menu) {
sym = menu->sym;
if (!sym) {
if (!menu_is_visible(menu))
goto next;
str = menu_get_prompt(menu);
fprintf(out, "\n"
"#\n"
"# %s\n"
"#\n", str);
need_newline = false;
} else if (!(sym->flags & SYMBOL_CHOICE) &&
!(sym->flags & SYMBOL_WRITTEN)) {
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE))
goto next;
if (need_newline) {
fprintf(out, "\n");
need_newline = false;
}
sym->flags |= SYMBOL_WRITTEN;
conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
}
next:
if (menu->list) {
menu = menu->list;
continue;
}
if (menu->next)
menu = menu->next;
else while ((menu = menu->parent)) {
if (!menu->sym && menu_is_visible(menu) &&
menu != &rootmenu) {
str = menu_get_prompt(menu);
fprintf(out, "# end of %s\n", str);
need_newline = true;
}
if (menu->next) {
menu = menu->next;
break;
}
}
}
fclose(out);
for_all_symbols(i, sym)
sym->flags &= ~SYMBOL_WRITTEN;
if (*tmpname) {
if (is_same(name, tmpname)) {
conf_message("No change to %s", name);
unlink(tmpname);
sym_set_change_count(0);
return 0;
}
snprintf(oldname, sizeof(oldname), "%s.old", name);
rename(name, oldname);
if (rename(tmpname, name))
return 1;
}
conf_message("configuration written to %s", name);
sym_set_change_count(0);
return 0;
}
/* write a dependency file as used by kbuild to track dependencies */
static int conf_write_dep(const char *name)
{
struct file *file;
FILE *out;
out = fopen("..config.tmp", "w");
if (!out)
return 1;
fprintf(out, "deps_config := \\\n");
for (file = file_list; file; file = file->next) {
if (file->next)
fprintf(out, "\t%s \\\n", file->name);
else
fprintf(out, "\t%s\n", file->name);
}
fprintf(out, "\n%s: \\\n"
"\t$(deps_config)\n\n", conf_get_autoconfig_name());
env_write_dep(out, conf_get_autoconfig_name());
fprintf(out, "\n$(deps_config): ;\n");
fclose(out);
if (make_parent_dir(name))
return 1;
rename("..config.tmp", name);
return 0;
}
static int conf_touch_deps(void)
{
const char *name;
struct symbol *sym;
int res, i;
char *s;
strcpy(depfile_path, conf_get_autoconfig_name());
if ((s = strrchr(depfile_path, '/')))
*s = '\0';
depfile_prefix_len = strlen(depfile_path);
name = conf_get_autoconfig_name();
conf_read_simple(name, S_DEF_AUTO);
sym_calc_value(modules_sym);
for_all_symbols(i, sym) {
sym_calc_value(sym);
if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
continue;
if (sym->flags & SYMBOL_WRITE) {
if (sym->flags & SYMBOL_DEF_AUTO) {
/*
* symbol has old and new value,
* so compare them...
*/
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym_get_tristate_value(sym) ==
sym->def[S_DEF_AUTO].tri)
continue;
break;
case S_STRING:
case S_HEX:
case S_INT:
if (!strcmp(sym_get_string_value(sym),
sym->def[S_DEF_AUTO].val))
continue;
break;
default:
break;
}
} else {
/*
* If there is no old value, only 'no' (unset)
* is allowed as new value.
*/
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym_get_tristate_value(sym) == no)
continue;
break;
default:
break;
}
}
} else if (!(sym->flags & SYMBOL_DEF_AUTO))
/* There is neither an old nor a new value. */
continue;
/* else
* There is an old value, but no new value ('no' (unset)
* isn't saved in auto.conf, so the old value is always
* different from 'no').
*/
res = conf_touch_dep(sym->name);
if (res)
return res;
}
return 0;
}
int conf_write_autoconf(int overwrite)
{
struct symbol *sym;
const char *name;
const char *autoconf_name = conf_get_autoconfig_name();
char path[PATH_MAX];
FILE *out, *out_h;
int i;
if (!overwrite && is_present(autoconf_name))
return 0;
snprintf(path, sizeof(path), "%s.cmd", autoconf_name);
conf_write_dep(path);
if (conf_touch_deps())
return 1;
out = fopen(".tmpconfig", "w");
if (!out)
return 1;
out_h = fopen(".tmpconfig.h", "w");
if (!out_h) {
fclose(out);
return 1;
}
conf_write_heading(out, &kconfig_printer_cb, NULL);
conf_write_heading(out_h, &header_printer_cb, NULL);
for_all_symbols(i, sym) {
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
continue;
/* write symbols to auto.conf and autoconf.h */
conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
}
fclose(out);
fclose(out_h);
name = getenv("KCONFIG_AUTOHEADER");
if (!name)
name = "include/generated/autoconf.h";
if (make_parent_dir(name))
return 1;
if (rename(".tmpconfig.h", name))
return 1;
if (make_parent_dir(autoconf_name))
return 1;
/*
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
if (rename(".tmpconfig", autoconf_name))
return 1;
return 0;
}
static int sym_change_count;
static void (*conf_changed_callback)(void);
void sym_set_change_count(int count)
{
int _sym_change_count = sym_change_count;
sym_change_count = count;
if (conf_changed_callback &&
(bool)_sym_change_count != (bool)count)
conf_changed_callback();
}
void sym_add_change_count(int count)
{
sym_set_change_count(count + sym_change_count);
}
bool conf_get_changed(void)
{
return sym_change_count;
}
void conf_set_changed_callback(void (*fn)(void))
{
conf_changed_callback = fn;
}
static bool randomize_choice_values(struct symbol *csym)
{
struct property *prop;
struct symbol *sym;
struct expr *e;
int cnt, def;
/*
* If choice is mod then we may have more items selected
* and if no then no-one.
* In both cases stop.
*/
if (csym->curr.tri != yes)
return false;
prop = sym_get_choice_prop(csym);
/* count entries in choice block */
cnt = 0;
expr_list_for_each_sym(prop->expr, e, sym)
cnt++;
/*
* find a random value and set it to yes,
* set the rest to no so we have only one set
*/
def = (rand() % cnt);
cnt = 0;
expr_list_for_each_sym(prop->expr, e, sym) {
if (def == cnt++) {
sym->def[S_DEF_USER].tri = yes;
csym->def[S_DEF_USER].val = sym;
}
else {
sym->def[S_DEF_USER].tri = no;
}
sym->flags |= SYMBOL_DEF_USER;
/* clear VALID to get value calculated */
sym->flags &= ~SYMBOL_VALID;
}
csym->flags |= SYMBOL_DEF_USER;
/* clear VALID to get value calculated */
csym->flags &= ~(SYMBOL_VALID);
return true;
}
void set_all_choice_values(struct symbol *csym)
{
struct property *prop;
struct symbol *sym;
struct expr *e;
prop = sym_get_choice_prop(csym);
/*
* Set all non-assinged choice values to no
*/
expr_list_for_each_sym(prop->expr, e, sym) {
if (!sym_has_value(sym))
sym->def[S_DEF_USER].tri = no;
}
csym->flags |= SYMBOL_DEF_USER;
/* clear VALID to get value calculated */
csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES);
}
bool conf_set_all_new_symbols(enum conf_def_mode mode)
{
struct symbol *sym, *csym;
int i, cnt, pby, pty, ptm; /* pby: probability of bool = y
* pty: probability of tristate = y
* ptm: probability of tristate = m
*/
pby = 50; pty = ptm = 33; /* can't go as the default in switch-case
* below, otherwise gcc whines about
* -Wmaybe-uninitialized */
if (mode == def_random) {
int n, p[3];
char *env = getenv("KCONFIG_PROBABILITY");
n = 0;
while( env && *env ) {
char *endp;
int tmp = strtol( env, &endp, 10 );
if( tmp >= 0 && tmp <= 100 ) {
p[n++] = tmp;
} else {
errno = ERANGE;
perror( "KCONFIG_PROBABILITY" );
exit( 1 );
}
env = (*endp == ':') ? endp+1 : endp;
if( n >=3 ) {
break;
}
}
switch( n ) {
case 1:
pby = p[0]; ptm = pby/2; pty = pby-ptm;
break;
case 2:
pty = p[0]; ptm = p[1]; pby = pty + ptm;
break;
case 3:
pby = p[0]; pty = p[1]; ptm = p[2];
break;
}
if( pty+ptm > 100 ) {
errno = ERANGE;
perror( "KCONFIG_PROBABILITY" );
exit( 1 );
}
}
bool has_changed = false;
for_all_symbols(i, sym) {
if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
continue;
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
has_changed = true;
switch (mode) {
case def_yes:
sym->def[S_DEF_USER].tri = yes;
break;
case def_mod:
sym->def[S_DEF_USER].tri = mod;
break;
case def_no:
if (sym->flags & SYMBOL_ALLNOCONFIG_Y)
sym->def[S_DEF_USER].tri = yes;
else
sym->def[S_DEF_USER].tri = no;
break;
case def_random:
sym->def[S_DEF_USER].tri = no;
cnt = rand() % 100;
if (sym->type == S_TRISTATE) {
if (cnt < pty)
sym->def[S_DEF_USER].tri = yes;
else if (cnt < (pty+ptm))
sym->def[S_DEF_USER].tri = mod;
} else if (cnt < pby)
sym->def[S_DEF_USER].tri = yes;
break;
default:
continue;
}
if (!(sym_is_choice(sym) && mode == def_random))
sym->flags |= SYMBOL_DEF_USER;
break;
default:
break;
}
}
sym_clear_all_valid();
/*
* We have different type of choice blocks.
* If curr.tri equals to mod then we can select several
* choice symbols in one block.
* In this case we do nothing.
* If curr.tri equals yes then only one symbol can be
* selected in a choice block and we set it to yes,
* and the rest to no.
*/
if (mode != def_random) {
for_all_symbols(i, csym) {
if ((sym_is_choice(csym) && !sym_has_value(csym)) ||
sym_is_choice_value(csym))
csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES;
}
}
for_all_symbols(i, csym) {
if (sym_has_value(csym) || !sym_is_choice(csym))
continue;
sym_calc_value(csym);
if (mode == def_random)
has_changed |= randomize_choice_values(csym);
else {
set_all_choice_values(csym);
has_changed = true;
}
}
return has_changed;
}
void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
{
struct symbol *sym;
int i;
tristate old_val = (mode == def_y2m) ? yes : mod;
tristate new_val = (mode == def_y2m) ? mod : yes;
for_all_symbols(i, sym) {
if (sym_get_type(sym) == S_TRISTATE &&
sym->def[S_DEF_USER].tri == old_val)
sym->def[S_DEF_USER].tri = new_val;
}
sym_clear_all_valid();
}
================================================
FILE: 3rdparty/kconfig/expr.c
================================================
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lkc.h"
#define DEBUG_EXPR 0
static struct expr *expr_eliminate_yn(struct expr *e);
struct expr *expr_alloc_symbol(struct symbol *sym)
{
struct expr *e = xcalloc(1, sizeof(*e));
e->type = E_SYMBOL;
e->left.sym = sym;
return e;
}
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
{
struct expr *e = xcalloc(1, sizeof(*e));
e->type = type;
e->left.expr = ce;
return e;
}
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
{
struct expr *e = xcalloc(1, sizeof(*e));
e->type = type;
e->left.expr = e1;
e->right.expr = e2;
return e;
}
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
{
struct expr *e = xcalloc(1, sizeof(*e));
e->type = type;
e->left.sym = s1;
e->right.sym = s2;
return e;
}
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2)
{
if (!e1)
return e2;
return e2 ? expr_alloc_two(E_AND, e1, e2) : e1;
}
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
{
if (!e1)
return e2;
return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
}
struct expr *expr_copy(const struct expr *org)
{
struct expr *e;
if (!org)
return NULL;
e = xmalloc(sizeof(*org));
memcpy(e, org, sizeof(*org));
switch (org->type) {
case E_SYMBOL:
e->left = org->left;
break;
case E_NOT:
e->left.expr = expr_copy(org->left.expr);
break;
case E_EQUAL:
case E_GEQ:
case E_GTH:
case E_LEQ:
case E_LTH:
case E_UNEQUAL:
e->left.sym = org->left.sym;
e->right.sym = org->right.sym;
break;
case E_AND:
case E_OR:
case E_LIST:
e->left.expr = expr_copy(org->left.expr);
e->right.expr = expr_copy(org->right.expr);
break;
default:
fprintf(stderr, "can't copy type %d\n", e->type);
free(e);
e = NULL;
break;
}
return e;
}
void expr_free(struct expr *e)
{
if (!e)
return;
switch (e->type) {
case E_SYMBOL:
break;
case E_NOT:
expr_free(e->left.expr);
break;
case E_EQUAL:
case E_GEQ:
case E_GTH:
case E_LEQ:
case E_LTH:
case E_UNEQUAL:
break;
case E_OR:
case E_AND:
expr_free(e->left.expr);
expr_free(e->right.expr);
break;
default:
fprintf(stderr, "how to free type %d?\n", e->type);
break;
}
free(e);
}
static int trans_count;
#define e1 (*ep1)
#define e2 (*ep2)
/*
* expr_eliminate_eq() helper.
*
* Walks the two expression trees given in 'ep1' and 'ep2'. Any node that does
* not have type 'type' (E_OR/E_AND) is considered a leaf, and is compared
* against all other leaves. Two equal leaves are both replaced with either 'y'
* or 'n' as appropriate for 'type', to be eliminated later.
*/
static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2)
{
/* Recurse down to leaves */
if (e1->type == type) {
__expr_eliminate_eq(type, &e1->left.expr, &e2);
__expr_eliminate_eq(type, &e1->right.expr, &e2);
return;
}
if (e2->type == type) {
__expr_eliminate_eq(type, &e1, &e2->left.expr);
__expr_eliminate_eq(type, &e1, &e2->right.expr);
return;
}
/* e1 and e2 are leaves. Compare them. */
if (e1->type == E_SYMBOL && e2->type == E_SYMBOL &&
e1->left.sym == e2->left.sym &&
(e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no))
return;
if (!expr_eq(e1, e2))
return;
/* e1 and e2 are equal leaves. Prepare them for elimination. */
trans_count++;
expr_free(e1); expr_free(e2);
switch (type) {
case E_OR:
e1 = expr_alloc_symbol(&symbol_no);
e2 = expr_alloc_symbol(&symbol_no);
break;
case E_AND:
e1 = expr_alloc_symbol(&symbol_yes);
e2 = expr_alloc_symbol(&symbol_yes);
break;
default:
;
}
}
/*
* Rewrites the expressions 'ep1' and 'ep2' to remove operands common to both.
* Example reductions:
*
* ep1: A && B -> ep1: y
* ep2: A && B && C -> ep2: C
*
* ep1: A || B -> ep1: n
* ep2: A || B || C -> ep2: C
*
* ep1: A && (B && FOO) -> ep1: FOO
* ep2: (BAR && B) && A -> ep2: BAR
*
* ep1: A && (B || C) -> ep1: y
* ep2: (C || B) && A -> ep2: y
*
* Comparisons are done between all operands at the same "level" of && or ||.
* For example, in the expression 'e1 && (e2 || e3) && (e4 || e5)', the
* following operands will be compared:
*
* - 'e1', 'e2 || e3', and 'e4 || e5', against each other
* - e2 against e3
* - e4 against e5
*
* Parentheses are irrelevant within a single level. 'e1 && (e2 && e3)' and
* '(e1 && e2) && e3' are both a single level.
*
* See __expr_eliminate_eq() as well.
*/
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
{
if (!e1 || !e2)
return;
switch (e1->type) {
case E_OR:
case E_AND:
__expr_eliminate_eq(e1->type, ep1, ep2);
default:
;
}
if (e1->type != e2->type) switch (e2->type) {
case E_OR:
case E_AND:
__expr_eliminate_eq(e2->type, ep1, ep2);
default:
;
}
e1 = expr_eliminate_yn(e1);
e2 = expr_eliminate_yn(e2);
}
#undef e1
#undef e2
/*
* Returns true if 'e1' and 'e2' are equal, after minor simplification. Two
* &&/|| expressions are considered equal if every operand in one expression
* equals some operand in the other (operands do not need to appear in the same
* order), recursively.
*/
int expr_eq(struct expr *e1, struct expr *e2)
{
int res, old_count;
/*
* A NULL expr is taken to be yes, but there's also a different way to
* represent yes. expr_is_yes() checks for either representation.
*/
if (!e1 || !e2)
return expr_is_yes(e1) && expr_is_yes(e2);
if (e1->type != e2->type)
return 0;
switch (e1->type) {
case E_EQUAL:
case E_GEQ:
case E_GTH:
case E_LEQ:
case E_LTH:
case E_UNEQUAL:
return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym;
case E_SYMBOL:
return e1->left.sym == e2->left.sym;
case E_NOT:
return expr_eq(e1->left.expr, e2->left.expr);
case E_AND:
case E_OR:
e1 = expr_copy(e1);
e2 = expr_copy(e2);
old_count = trans_count;
expr_eliminate_eq(&e1, &e2);
res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL &&
e1->left.sym == e2->left.sym);
expr_free(e1);
expr_free(e2);
trans_count = old_count;
return res;
case E_LIST:
case E_RANGE:
case E_NONE:
/* panic */;
}
if (DEBUG_EXPR) {
expr_fprint(e1, stdout);
printf(" = ");
expr_fprint(e2, stdout);
printf(" ?\n");
}
return 0;
}
/*
* Recursively performs the following simplifications in-place (as well as the
* corresponding simplifications with swapped operands):
*
* expr && n -> n
* expr && y -> expr
* expr || n -> expr
* expr || y -> y
*
* Returns the optimized expression.
*/
static struct expr *expr_eliminate_yn(struct expr *e)
{
struct expr *tmp;
if (e) switch (e->type) {
case E_AND:
e->left.expr = expr_eliminate_yn(e->left.expr);
e->right.expr = expr_eliminate_yn(e->right.expr);
if (e->left.expr->type == E_SYMBOL) {
if (e->left.expr->left.sym == &symbol_no) {
expr_free(e->left.expr);
expr_free(e->right.expr);
e->type = E_SYMBOL;
e->left.sym = &symbol_no;
e->right.expr = NULL;
return e;
} else if (e->left.expr->left.sym == &symbol_yes) {
free(e->left.expr);
tmp = e->right.expr;
*e = *(e->right.expr);
free(tmp);
return e;
}
}
if (e->right.expr->type == E_SYMBOL) {
if (e->right.expr->left.sym == &symbol_no) {
expr_free(e->left.expr);
expr_free(e->right.expr);
e->type = E_SYMBOL;
e->left.sym = &symbol_no;
e->right.expr = NULL;
return e;
} else if (e->right.expr->left.sym == &symbol_yes) {
free(e->right.expr);
tmp = e->left.expr;
*e = *(e->left.expr);
free(tmp);
return e;
}
}
break;
case E_OR:
e->left.expr = expr_eliminate_yn(e->left.expr);
e->right.expr = expr_eliminate_yn(e->right.expr);
if (e->left.expr->type == E_SYMBOL) {
if (e->left.expr->left.sym == &symbol_no) {
free(e->left.expr);
tmp = e->right.expr;
*e = *(e->right.expr);
free(tmp);
return e;
} else if (e->left.expr->left.sym == &symbol_yes) {
expr_free(e->left.expr);
expr_free(e->right.expr);
e->type = E_SYMBOL;
e->left.sym = &symbol_yes;
e->right.expr = NULL;
return e;
}
}
if (e->right.expr->type == E_SYMBOL) {
if (e->right.expr->left.sym == &symbol_no) {
free(e->right.expr);
tmp = e->left.expr;
*e = *(e->left.expr);
free(tmp);
return e;
} else if (e->right.expr->left.sym == &symbol_yes) {
expr_free(e->left.expr);
expr_free(e->right.expr);
e->type = E_SYMBOL;
e->left.sym = &symbol_yes;
e->right.expr = NULL;
return e;
}
}
break;
default:
;
}
return e;
}
/*
* bool FOO!=n => FOO
*/
struct expr *expr_trans_bool(struct expr *e)
{
if (!e)
return NULL;
switch (e->type) {
case E_AND:
case E_OR:
case E_NOT:
e->left.expr = expr_trans_bool(e->left.expr);
e->right.expr = expr_trans_bool(e->right.expr);
break;
case E_UNEQUAL:
// FOO!=n -> FOO
if (e->left.sym->type == S_TRISTATE) {
if (e->right.sym == &symbol_no) {
e->type = E_SYMBOL;
e->right.sym = NULL;
}
}
break;
default:
;
}
return e;
}
/*
* e1 || e2 -> ?
*/
static struct expr *expr_join_or(struct expr *e1, struct expr *e2)
{
struct expr *tmp;
struct symbol *sym1, *sym2;
if (expr_eq(e1, e2))
return expr_copy(e1);
if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT)
return NULL;
if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT)
return NULL;
if (e1->type == E_NOT) {
tmp = e1->left.expr;
if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL)
return NULL;
sym1 = tmp->left.sym;
} else
sym1 = e1->left.sym;
if (e2->type == E_NOT) {
if (e2->left.expr->type != E_SYMBOL)
return NULL;
sym2 = e2->left.expr->left.sym;
} else
sym2 = e2->left.sym;
if (sym1 != sym2)
return NULL;
if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE)
return NULL;
if (sym1->type == S_TRISTATE) {
if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) ||
(e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) {
// (a='y') || (a='m') -> (a!='n')
return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no);
}
if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) ||
(e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) {
// (a='y') || (a='n') -> (a!='m')
return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod);
}
if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) ||
(e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) {
// (a='m') || (a='n') -> (a!='y')
return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes);
}
}
if (sym1->type == S_BOOLEAN && sym1 == sym2) {
if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) ||
(e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL))
return expr_alloc_symbol(&symbol_yes);
}
if (DEBUG_EXPR) {
printf("optimize (");
expr_fprint(e1, stdout);
printf(") || (");
expr_fprint(e2, stdout);
printf(")?\n");
}
return NULL;
}
static struct expr *expr_join_and(struct expr *e1, struct expr *e2)
{
struct expr *tmp;
struct symbol *sym1, *sym2;
if (expr_eq(e1, e2))
return expr_copy(e1);
if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT)
return NULL;
if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT)
return NULL;
if (e1->type == E_NOT) {
tmp = e1->left.expr;
if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL)
return NULL;
sym1 = tmp->left.sym;
} else
sym1 = e1->left.sym;
if (e2->type == E_NOT) {
if (e2->left.expr->type != E_SYMBOL)
return NULL;
sym2 = e2->left.expr->left.sym;
} else
sym2 = e2->left.sym;
if (sym1 != sym2)
return NULL;
if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE)
return NULL;
if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) ||
(e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes))
// (a) && (a='y') -> (a='y')
return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) ||
(e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no))
// (a) && (a!='n') -> (a)
return expr_alloc_symbol(sym1);
if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) ||
(e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod))
// (a) && (a!='m') -> (a='y')
return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
if (sym1->type == S_TRISTATE) {
if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) {
// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
sym2 = e1->right.sym;
if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
: expr_alloc_symbol(&symbol_no);
}
if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) {
// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
sym2 = e2->right.sym;
if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
: expr_alloc_symbol(&symbol_no);
}
if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) ||
(e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes)))
// (a!='y') && (a!='n') -> (a='m')
return expr_alloc_comp(E_EQUAL, sym1, &symbol_mod);
if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) ||
(e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes)))
// (a!='y') && (a!='m') -> (a='n')
return expr_alloc_comp(E_EQUAL, sym1, &symbol_no);
if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) ||
(e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod)))
// (a!='m') && (a!='n') -> (a='m')
return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) ||
(e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) ||
(e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) ||
(e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes))
return NULL;
}
if (DEBUG_EXPR) {
printf("optimize (");
expr_fprint(e1, stdout);
printf(") && (");
expr_fprint(e2, stdout);
printf(")?\n");
}
return NULL;
}
/*
* expr_eliminate_dups() helper.
*
* Walks the two expression trees given in 'ep1' and 'ep2'. Any node that does
* not have type 'type' (E_OR/E_AND) is considered a leaf, and is compared
* against all other leaves to look for simplifications.
*/
static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2)
{
#define e1 (*ep1)
#define e2 (*ep2)
struct expr *tmp;
/* Recurse down to leaves */
if (e1->type == type) {
expr_eliminate_dups1(type, &e1->left.expr, &e2);
expr_eliminate_dups1(type, &e1->right.expr, &e2);
return;
}
if (e2->type == type) {
expr_eliminate_dups1(type, &e1, &e2->left.expr);
expr_eliminate_dups1(type, &e1, &e2->right.expr);
return;
}
/* e1 and e2 are leaves. Compare and process them. */
if (e1 == e2)
return;
switch (e1->type) {
case E_OR: case E_AND:
expr_eliminate_dups1(e1->type, &e1, &e1);
default:
;
}
switch (type) {
case E_OR:
tmp = expr_join_or(e1, e2);
if (tmp) {
expr_free(e1); expr_free(e2);
e1 = expr_alloc_symbol(&symbol_no);
e2 = tmp;
trans_count++;
}
break;
case E_AND:
tmp = expr_join_and(e1, e2);
if (tmp) {
expr_free(e1); expr_free(e2);
e1 = expr_alloc_symbol(&symbol_yes);
e2 = tmp;
trans_count++;
}
break;
default:
;
}
#undef e1
#undef e2
}
/*
* Rewrites 'e' in-place to remove ("join") duplicate and other redundant
* operands.
*
* Example simplifications:
*
* A || B || A -> A || B
* A && B && A=y -> A=y && B
*
* Returns the deduplicated expression.
*/
struct expr *expr_eliminate_dups(struct expr *e)
{
int oldcount;
if (!e)
return e;
oldcount = trans_count;
while (1) {
trans_count = 0;
switch (e->type) {
case E_OR: case E_AND:
expr_eliminate_dups1(e->type, &e, &e);
default:
;
}
if (!trans_count)
/* No simplifications done in this pass. We're done */
break;
e = expr_eliminate_yn(e);
}
trans_count = oldcount;
return e;
}
/*
* Performs various simplifications involving logical operators and
* comparisons.
*
* Allocates and returns a new expression.
*/
struct expr *expr_transform(struct expr *e)
{
struct expr *tmp;
if (!e)
return NULL;
switch (e->type) {
case E_EQUAL:
case E_GEQ:
case E_GTH:
case E_LEQ:
case E_LTH:
case E_UNEQUAL:
case E_SYMBOL:
case E_LIST:
break;
default:
e->left.expr = expr_transform(e->left.expr);
e->right.expr = expr_transform(e->right.expr);
}
switch (e->type) {
case E_EQUAL:
if (e->left.sym->type != S_BOOLEAN)
break;
if (e->right.sym == &symbol_no) {
e->type = E_NOT;
e->left.expr = expr_alloc_symbol(e->left.sym);
e->right.sym = NULL;
break;
}
if (e->right.sym == &symbol_mod) {
printf("boolean symbol %s tested for 'm'? test forced to 'n'\n", e->left.sym->name);
e->type = E_SYMBOL;
e->left.sym = &symbol_no;
e->right.sym = NULL;
break;
}
if (e->right.sym == &symbol_yes) {
e->type = E_SYMBOL;
e->right.sym = NULL;
break;
}
break;
case E_UNEQUAL:
if (e->left.sym->type != S_BOOLEAN)
break;
if (e->right.sym == &symbol_no) {
e->type = E_SYMBOL;
e->right.sym = NULL;
break;
}
if (e->right.sym == &symbol_mod) {
printf("boolean symbol %s tested for 'm'? test forced to 'y'\n", e->left.sym->name);
e->type = E_SYMBOL;
e->left.sym = &symbol_yes;
e->right.sym = NULL;
break;
}
if (e->right.sym == &symbol_yes) {
e->type = E_NOT;
e->left.expr = expr_alloc_symbol(e->left.sym);
e->right.sym = NULL;
break;
}
break;
case E_NOT:
switch (e->left.expr->type) {
case E_NOT:
// !!a -> a
tmp = e->left.expr->left.expr;
free(e->left.expr);
free(e);
e = tmp;
e = expr_transform(e);
break;
case E_EQUAL:
case E_UNEQUAL:
// !a='x' -> a!='x'
tmp = e->left.expr;
free(e);
e = tmp;
e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL;
break;
case E_LEQ:
case E_GEQ:
// !a<='x' -> a>'x'
tmp = e->left.expr;
free(e);
e = tmp;
e->type = e->type == E_LEQ ? E_GTH : E_LTH;
break;
case E_LTH:
case E_GTH:
// !a<'x' -> a>='x'
tmp = e->left.expr;
free(e);
e = tmp;
e->type = e->type == E_LTH ? E_GEQ : E_LEQ;
break;
case E_OR:
// !(a || b) -> !a && !b
tmp = e->left.expr;
e->type = E_AND;
e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr);
tmp->type = E_NOT;
tmp->right.expr = NULL;
e = expr_transform(e);
break;
case E_AND:
// !(a && b) -> !a || !b
tmp = e->left.expr;
e->type = E_OR;
e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr);
tmp->type = E_NOT;
tmp->right.expr = NULL;
e = expr_transform(e);
break;
case E_SYMBOL:
if (e->left.expr->left.sym == &symbol_yes) {
// !'y' -> 'n'
tmp = e->left.expr;
free(e);
e = tmp;
e->type = E_SYMBOL;
e->left.sym = &symbol_no;
break;
}
if (e->left.expr->left.sym == &symbol_mod) {
// !'m' -> 'm'
tmp = e->left.expr;
free(e);
e = tmp;
e->type = E_SYMBOL;
e->left.sym = &symbol_mod;
break;
}
if (e->left.expr->left.sym == &symbol_no) {
// !'n' -> 'y'
tmp = e->left.expr;
free(e);
e = tmp;
e->type = E_SYMBOL;
e->left.sym = &symbol_yes;
break;
}
break;
default:
;
}
break;
default:
;
}
return e;
}
int expr_contains_symbol(struct expr *dep, struct symbol *sym)
{
if (!dep)
return 0;
switch (dep->type) {
case E_AND:
case E_OR:
return expr_contains_symbol(dep->left.expr, sym) ||
expr_contains_symbol(dep->right.expr, sym);
case E_SYMBOL:
return dep->left.sym == sym;
case E_EQUAL:
case E_GEQ:
case E_GTH:
case E_LEQ:
case E_LTH:
case E_UNEQUAL:
return dep->left.sym == sym ||
dep->right.sym == sym;
case E_NOT:
return expr_contains_symbol(dep->left.expr, sym);
default:
;
}
return 0;
}
bool expr_depends_symbol(struct expr *dep, struct symbol *sym)
{
if (!dep)
return false;
switch (dep->type) {
case E_AND:
return expr_depends_symbol(dep->left.expr, sym) ||
expr_depends_symbol(dep->right.expr, sym);
case E_SYMBOL:
return dep->left.sym == sym;
case E_EQUAL:
if (dep->left.sym == sym) {
if (dep->right.sym == &symbol_yes || dep->right.sym == &symbol_mod)
return true;
}
break;
case E_UNEQUAL:
if (dep->left.sym == sym) {
if (dep->right.sym == &symbol_no)
return true;
}
break;
default:
;
}
return false;
}
/*
* Inserts explicit comparisons of type 'type' to symbol 'sym' into the
* expression 'e'.
*
* Examples transformations for type == E_UNEQUAL, sym == &symbol_no:
*
* A -> A!=n
* !A -> A=n
* A && B -> !(A=n || B=n)
* A || B -> !(A=n && B=n)
* A && (B || C) -> !(A=n || (B=n && C=n))
*
* Allocates and returns a new expression.
*/
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym)
{
struct expr *e1, *e2;
if (!e) {
e = expr_alloc_symbol(sym);
if (type == E_UNEQUAL)
e = expr_alloc_one(E_NOT, e);
return e;
}
switch (e->type) {
case E_AND:
e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym);
e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym);
if (sym == &symbol_yes)
e = expr_alloc_two(E_AND, e1, e2);
if (sym == &symbol_no)
e = expr_alloc_two(E_OR, e1, e2);
if (type == E_UNEQUAL)
e = expr_alloc_one(E_NOT, e);
return e;
case E_OR:
e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym);
e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym);
if (sym == &symbol_yes)
e = expr_alloc_two(E_OR, e1, e2);
if (sym == &symbol_no)
e = expr_alloc_two(E_AND, e1, e2);
if (type == E_UNEQUAL)
e = expr_alloc_one(E_NOT, e);
return e;
case E_NOT:
return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym);
case E_UNEQUAL:
case E_LTH:
case E_LEQ:
case E_GTH:
case E_GEQ:
case E_EQUAL:
if (type == E_EQUAL) {
if (sym == &symbol_yes)
return expr_copy(e);
if (sym == &symbol_mod)
return expr_alloc_symbol(&symbol_no);
if (sym == &symbol_no)
return expr_alloc_one(E_NOT, expr_copy(e));
} else {
if (sym == &symbol_yes)
return expr_alloc_one(E_NOT, expr_copy(e));
if (sym == &symbol_mod)
return expr_alloc_symbol(&symbol_yes);
if (sym == &symbol_no)
return expr_copy(e);
}
break;
case E_SYMBOL:
return expr_alloc_comp(type, e->left.sym, sym);
case E_LIST:
case E_RANGE:
case E_NONE:
/* panic */;
}
return NULL;
}
enum string_value_kind {
k_string,
k_signed,
k_unsigned,
};
union string_value {
unsigned long long u;
signed long long s;
};
static enum string_value_kind expr_parse_string(const char *str,
enum symbol_type type,
union string_value *val)
{
char *tail;
enum string_value_kind kind;
errno = 0;
switch (type) {
case S_BOOLEAN:
case S_TRISTATE:
val->s = !strcmp(str, "n") ? 0 :
!strcmp(str, "m") ? 1 :
!strcmp(str, "y") ? 2 : -1;
return k_signed;
case S_INT:
val->s = strtoll(str, &tail, 10);
kind = k_signed;
break;
case S_HEX:
val->u = strtoull(str, &tail, 16);
kind = k_unsigned;
break;
default:
val->s = strtoll(str, &tail, 0);
kind = k_signed;
break;
}
return !errno && !*tail && tail > str && isxdigit(tail[-1])
? kind : k_string;
}
tristate expr_calc_value(struct expr *e)
{
tristate val1, val2;
const char *str1, *str2;
enum string_value_kind k1 = k_string, k2 = k_string;
union string_value lval = {}, rval = {};
int res;
if (!e)
return yes;
switch (e->type) {
case E_SYMBOL:
sym_calc_value(e->left.sym);
return e->left.sym->curr.tri;
case E_AND:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
return EXPR_AND(val1, val2);
case E_OR:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
return EXPR_OR(val1, val2);
case E_NOT:
val1 = expr_calc_value(e->left.expr);
return EXPR_NOT(val1);
case E_EQUAL:
case E_GEQ:
case E_GTH:
case E_LEQ:
case E_LTH:
case E_UNEQUAL:
break;
default:
printf("expr_calc_value: %d?\n", e->type);
return no;
}
sym_calc_value(e->left.sym);
sym_calc_value(e->right.sym);
str1 = sym_get_string_value(e->left.sym);
str2 = sym_get_string_value(e->right.sym);
if (e->left.sym->type != S_STRING || e->right.sym->type != S_STRING) {
k1 = expr_parse_string(str1, e->left.sym->type, &lval);
k2 = expr_parse_string(str2, e->right.sym->type, &rval);
}
if (k1 == k_string || k2 == k_string)
res = strcmp(str1, str2);
else if (k1 == k_unsigned || k2 == k_unsigned)
res = (lval.u > rval.u) - (lval.u < rval.u);
else /* if (k1 == k_signed && k2 == k_signed) */
res = (lval.s > rval.s) - (lval.s < rval.s);
switch(e->type) {
case E_EQUAL:
return res ? no : yes;
case E_GEQ:
return res >= 0 ? yes : no;
case E_GTH:
return res > 0 ? yes : no;
case E_LEQ:
return res <= 0 ? yes : no;
case E_LTH:
return res < 0 ? yes : no;
case E_UNEQUAL:
return res ? yes : no;
default:
printf("expr_calc_value: relation %d?\n", e->type);
return no;
}
}
static int expr_compare_type(enum expr_type t1, enum expr_type t2)
{
if (t1 == t2)
return 0;
switch (t1) {
case E_LEQ:
case E_LTH:
case E_GEQ:
case E_GTH:
if (t2 == E_EQUAL || t2 == E_UNEQUAL)
return 1;
case E_EQUAL:
case E_UNEQUAL:
if (t2 == E_NOT)
return 1;
case E_NOT:
if (t2 == E_AND)
return 1;
case E_AND:
if (t2 == E_OR)
return 1;
case E_OR:
if (t2 == E_LIST)
return 1;
case E_LIST:
if (t2 == 0)
return 1;
default:
return -1;
}
printf("[%dgt%d?]", t1, t2);
return 0;
}
void expr_print(struct expr *e,
void (*fn)(void *, struct symbol *, const char *),
void *data, int prevtoken)
{
if (!e) {
fn(data, NULL, "y");
return;
}
if (expr_compare_type(prevtoken, e->type) > 0)
fn(data, NULL, "(");
switch (e->type) {
case E_SYMBOL:
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
break;
case E_NOT:
fn(data, NULL, "!");
expr_print(e->left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
fn(data, NULL, "=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_LEQ:
case E_LTH:
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
fn(data, NULL, e->type == E_LEQ ? "<=" : "<");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_GEQ:
case E_GTH:
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
fn(data, NULL, e->type == E_GEQ ? ">=" : ">");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_UNEQUAL:
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
fn(data, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_OR:
expr_print(e->left.expr, fn, data, E_OR);
fn(data, NULL, " || ");
expr_print(e->right.expr, fn, data, E_OR);
break;
case E_AND:
expr_print(e->left.expr, fn, data, E_AND);
fn(data, NULL, " && ");
expr_print(e->right.expr, fn, data, E_AND);
break;
case E_LIST:
fn(data, e->right.sym, e->right.sym->name);
if (e->left.expr) {
fn(data, NULL, " ^ ");
expr_print(e->left.expr, fn, data, E_LIST);
}
break;
case E_RANGE:
fn(data, NULL, "[");
fn(data, e->left.sym, e->left.sym->name);
fn(data, NULL, " ");
fn(data, e->right.sym, e->right.sym->name);
fn(data, NULL, "]");
break;
default:
{
char buf[32];
sprintf(buf, "<unknown type %d>", e->type);
fn(data, NULL, buf);
break;
}
}
if (expr_compare_type(prevtoken, e->type) > 0)
fn(data, NULL, ")");
}
static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
{
xfwrite(str, strlen(str), 1, data);
}
void expr_fprint(struct expr *e, FILE *out)
{
expr_print(e, expr_print_file_helper, out, E_NONE);
}
static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
{
struct gstr *gs = (struct gstr*)data;
const char *sym_str = NULL;
if (sym)
sym_str = sym_get_string_value(sym);
if (gs->max_width) {
unsigned extra_length = strlen(str);
const char *last_cr = strrchr(gs->s, '\n');
unsigned last_line_length;
if (sym_str)
extra_length += 4 + strlen(sym_str);
if (!last_cr)
last_cr = gs->s;
last_line_length = strlen(gs->s) - (last_cr - gs->s);
if ((last_line_length + extra_length) > gs->max_width)
str_append(gs, "\\\n");
}
str_append(gs, str);
if (sym && sym->type != S_UNKNOWN)
str_printf(gs, " [=%s]", sym_str);
}
void expr_gstr_print(struct expr *e, struct gstr *gs)
{
expr_print(e, expr_print_gstr_helper, gs, E_NONE);
}
/*
* Transform the top level "||" tokens into newlines and prepend each
* line with a minus. This makes expressions much easier to read.
* Suitable for reverse dependency expressions.
*/
static void expr_print_revdep(struct expr *e,
void (*fn)(void *, struct symbol *, const char *),
void *data, tristate pr_type, const char **title)
{
if (e->type == E_OR) {
expr_print_revdep(e->left.expr, fn, data, pr_type, title);
expr_print_revdep(e->right.expr, fn, data, pr_type, title);
} else if (expr_calc_value(e) == pr_type) {
if (*title) {
fn(data, NULL, *title);
*title = NULL;
}
fn(data, NULL, " - ");
expr_print(e, fn, data, E_NONE);
fn(data, NULL, "\n");
}
}
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
tristate pr_type, const char *title)
{
expr_print_revdep(e, expr_print_gstr_helper, gs, pr_type, &title);
}
================================================
FILE: 3rdparty/kconfig/expr.h
================================================
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#ifndef EXPR_H
#define EXPR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h>
#include <stdio.h>
#include "list.h"
#ifndef __cplusplus
#include <stdbool.h>
#endif
struct file {
struct file *next;
struct file *parent;
const char *name;
int lineno;
};
typedef enum tristate {
no, mod, yes
} tristate;
enum expr_type {
E_NONE, E_OR, E_AND, E_NOT,
E_EQUAL, E_UNEQUAL, E_LTH, E_LEQ, E_GTH, E_GEQ,
E_LIST, E_SYMBOL, E_RANGE
};
union expr_data {
struct expr *expr;
struct symbol *sym;
};
struct expr {
enum expr_type type;
union expr_data left, right;
};
#define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define EXPR_NOT(dep) (2-(dep))
#define expr_list_for_each_sym(l, e, s) \
for (e = (l); e && (s = e->right.sym); e = e->left.expr)
struct expr_value {
struct expr *expr;
tristate tri;
};
struct symbol_value {
void *val;
tristate tri;
};
enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING
};
/* enum values are used as index to symbol.def[] */
enum {
S_DEF_USER, /* main user value */
S_DEF_AUTO, /* values read from auto.conf */
S_DEF_DEF3, /* Reserved for UI usage */
S_DEF_DEF4, /* Reserved for UI usage */
S_DEF_COUNT
};
/*
* Represents a configuration symbol.
*
* Choices are represented as a special kind of symbol and have the
* SYMBOL_CHOICE bit set in 'flags'.
*/
struct symbol {
/* The next symbol in the same bucket in the symbol hash table */
struct symbol *next;
/* The name of the symbol, e.g. "FOO" for 'config FOO' */
char *name;
/* S_BOOLEAN, S_TRISTATE, ... */
enum symbol_type type;
/*
* The calculated value of the symbol. The SYMBOL_VALID bit is set in
* 'flags' when this is up to date. Note that this value might differ
* from the user value set in e.g. a .config file, due to visibility.
*/
struct symbol_value curr;
/*
* Values for the symbol provided from outside. def[S_DEF_USER] holds
* the .config value.
*/
struct symbol_value def[S_DEF_COUNT];
/*
* An upper bound on the tristate value the user can set for the symbol
* if it is a boolean or tristate. Calculated from prompt dependencies,
* which also inherit dependencies from enclosing menus, choices, and
* ifs. If 'n', the user value will be ignored.
*
* Symbols lacking prompts always have visibility 'n'.
*/
tristate visible;
/* SYMBOL_* flags */
int flags;
/* List of properties. See prop_type. */
struct property *prop;
/* Dependencies from enclosing menus, choices, and ifs */
struct expr_value dir_dep;
/* Reverse dependencies through being selected by other symbols */
struct expr_value rev_dep;
/*
* "Weak" reverse dependencies through being implied by other symbols
*/
struct expr_value implied;
};
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
#define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */
#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
#define SYMBOL_CHANGED 0x0400 /* ? */
#define SYMBOL_WRITTEN 0x0800 /* track info to avoid double-write to .config */
#define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */
#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
#define SYMBOL_WARNED 0x8000 /* warning has been issued */
/* Set when symbol.def[] is used */
#define SYMBOL_DEF 0x10000 /* First bit of SYMBOL_DEF */
#define SYMBOL_DEF_USER 0x10000 /* symbol.def[S_DEF_USER] is valid */
#define SYMBOL_DEF_AUTO 0x20000 /* symbol.def[S_DEF_AUTO] is valid */
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
/* choice values need to be set before calculating this symbol value */
#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
/* Set symbol to y if allnoconfig; used for symbols that hide others */
#define SYMBOL_ALLNOCONFIG_Y 0x200000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 9973
/* A property represent the config options that can be associated
* with a config "symbol".
* Sample:
* config FOO
* default y
* prompt "foo prompt"
* select BAR
* config BAZ
* int "BAZ Value"
* range 1..255
*
* Please, also check parser.y:print_symbol() when modifying the
* list of property types!
*/
enum prop_type {
P_UNKNOWN,
P_PROMPT, /* prompt "foo prompt" or "BAZ Value" */
P_COMMENT, /* text associated with a comment */
P_MENU, /* prompt associated with a menu or menuconfig symbol */
P_DEFAULT, /* default y */
P_CHOICE, /* choice value */
P_SELECT, /* select BAR */
P_IMPLY, /* imply BAR */
P_RANGE, /* range 7..100 (for a symbol) */
P_SYMBOL, /* where a symbol is defined */
};
struct property {
struct property *next; /* next property - null if last */
enum prop_type type; /* type of property */
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
struct expr_value visible;
struct expr *expr; /* the optional conditional part of the property */
struct menu *menu; /* the menu the property are associated with
* valid for: P_SELECT, P_RANGE, P_CHOICE,
* P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */
struct file *file; /* what file was this property defined */
int lineno; /* what lineno was this property defined */
};
#define for_all_properties(sym, st, tok) \
for (st = sym->prop; st; st = st->next) \
if (st->type == (tok))
#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
#define for_all_prompts(sym, st) \
for (st = sym->prop; st; st = st->next) \
if (st->text)
/*
* Represents a node in the menu tree, as seen in e.g. menuconfig (though used
* for all front ends). Each symbol, menu, etc. defined in the Kconfig files
* gets a node. A symbol defined in multiple locations gets one node at each
* location.
*/
struct menu {
/* The next menu node at the same level */
struct menu *next;
/* The parent menu node, corresponding to e.g. a menu or choice */
struct menu *parent;
/* The first child menu node, for e.g. menus and choices */
struct menu *list;
/*
* The symbol associated with the menu node. Choices are implemented as
* a special kind of symbol. NULL for menus, comments, and ifs.
*/
struct symbol *sym;
/*
* The prompt associated with the node. This holds the prompt for a
* symbol as well as the text for a menu or comment, along with the
* type (P_PROMPT, P_MENU, etc.)
*/
struct property *prompt;
/*
* 'visible if' dependencies. If more than one is given, they will be
* ANDed together.
*/
struct expr *visibility;
/*
* Ordinary dependencies from e.g. 'depends on' and 'if', ANDed
* together
*/
struct expr *dep;
/* MENU_* flags */
unsigned int flags;
/* Any help text associated with the node */
char *help;
/* The location where the menu node appears in the Kconfig files */
struct file *file;
int lineno;
/* For use by front ends that need to store auxiliary data */
void *data;
};
/*
* Set on a menu node when the corresponding symbol changes state in some way.
* Can be checked by front ends.
*/
#define MENU_CHANGED 0x0001
#define MENU_ROOT 0x0002
struct jump_key {
struct list_head entries;
size_t offset;
struct menu *target;
int index;
};
#define JUMP_NB 9
extern struct file *file_list;
extern struct file *current_file;
struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern struct symbol *sym_defconfig_list;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
int expr_eq(struct expr *e1, struct expr *e2);
tristate expr_calc_value(struct expr *e);
struct expr *expr_trans_bool(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e);
struct expr *expr_transform(struct expr *e);
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
void expr_gstr_print(struct expr *e, struct gstr *gs);
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
tristate pr_type, const char *title);
static inline int expr_is_yes(struct expr *e)
{
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
}
static inline int expr_is_no(struct expr *e)
{
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}
#ifdef __cplusplus
}
#endif
#endif /* EXPR_H */
================================================
FILE: 3rdparty/kconfig/lexer.l
================================================
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
%option nostdinit noyywrap never-interactive full ecs
%option 8bit nodefault yylineno
%x ASSIGN_VAL HELP STRING
%{
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "lkc.h"
#include "parser.tab.h"
#define YY_DECL static int yylex1(void)
#define START_STRSIZE 16
static struct {
struct file *file;
int lineno;
} current_pos;
static int prev_prev_token = T_EOL;
static int prev_token = T_EOL;
static char *text;
static int text_size, text_asize;
struct buffer {
struct buffer *parent;
YY_BUFFER_STATE state;
};
static struct buffer *current_buf;
static int last_ts, first_ts;
static char *expand_token(const char *in, size_t n);
static void append_expanded_string(const char *in);
static void zconf_endhelp(void);
static void zconf_endfile(void);
static void new_string(void)
{
text = xmalloc(START_STRSIZE);
text_asize = START_STRSIZE;
text_size = 0;
*text = 0;
}
static void append_string(const char *str, int size)
{
int new_size = text_size + size + 1;
if (new_size > text_asize) {
new_size += START_STRSIZE - 1;
new_size &= -START_STRSIZE;
text = xrealloc(text, new_size);
text_asize = new_size;
}
memcpy(text + text_size, str, size);
text_size += size;
text[text_size] = 0;
}
static void alloc_string(const char *str, int size)
{
text = xmalloc(size + 1);
memcpy(text, str, size);
text[size] = 0;
}
static void warn_ignored_character(char chr)
{
fprintf(stderr,
"%s:%d:warning: ignoring unsupported character '%c'\n",
current_file->name, yylineno, chr);
}
%}
n [A-Za-z0-9_-]
%%
int str = 0;
int ts, i;
#.* /* ignore comment */
[ \t]* /* whitespaces */
\\\n /* escaped new line */
\n return T_EOL;
"allnoconfig_y" return T_ALLNOCONFIG_Y;
"bool" return T_BOOL;
"choice" return T_CHOICE;
"comment" return T_COMMENT;
"config" return T_CONFIG;
"def_bool" return T_DEF_BOOL;
"def_tristate" return T_DEF_TRISTATE;
"default" return T_DEFAULT;
"defconfig_list" return T_DEFCONFIG_LIST;
"depends" return T_DEPENDS;
"endchoice" return T_ENDCHOICE;
"endif" return T_ENDIF;
"endmenu" return T_ENDMENU;
"help" return T_HELP;
"hex" return T_HEX;
"if" return T_IF;
"imply" return T_IMPLY;
"int" return T_INT;
"mainmenu" return T_MAINMENU;
"menu" return T_MENU;
"menuconfig" return T_MENUCONFIG;
"modules" return T_MODULES;
"on" return T_ON;
"option" return T_OPTION;
"optional" return T_OPTIONAL;
"prompt" return T_PROMPT;
"range" return T_RANGE;
"select" return T_SELECT;
"source" return T_SOURCE;
"string" return T_STRING;
"tristate" return T_TRISTATE;
"visible" return T_VISIBLE;
"||" return T_OR;
"&&" return T_AND;
"=" return T_EQUAL;
"!=" return T_UNEQUAL;
"<" return T_LESS;
"<=" return T_LESS_EQUAL;
">" return T_GREATER;
">=" return T_GREATER_EQUAL;
"!" return T_NOT;
"(" return T_OPEN_PAREN;
")" return T_CLOSE_PAREN;
":=" return T_COLON_EQUAL;
"+=" return T_PLUS_EQUAL;
\"|\' {
str = yytext[0];
new_string();
BEGIN(STRING);
}
{n}+ {
alloc_string(yytext, yyleng);
yylval.string = text;
return T_WORD;
}
({n}|$)+ {
/* this token includes at least one '$' */
yylval.string = expand_token(yytext, yyleng);
if (strlen(yylval.string))
return T_WORD;
free(yylval.string);
}
. warn_ignored_character(*yytext);
<ASSIGN_VAL>{
[^[:blank:]\n]+.* {
alloc_string(yytext, yyleng);
yylval.string = text;
return T_ASSIGN_VAL;
}
\n { BEGIN(INITIAL); return T_EOL; }
.
}
<STRING>{
"$".* append_expanded_string(yytext);
[^$'"\\\n]+ {
append_string(yytext, yyleng);
}
\\.? {
append_string(yytext + 1, yyleng - 1);
}
\'|\" {
if (str == yytext[0]) {
BEGIN(INITIAL);
yylval.string = text;
return T_WORD_QUOTE;
} else
append_string(yytext, 1);
}
\n {
fprintf(stderr,
"%s:%d:warning: multi-line strings not supported\n",
zconf_curname(), zconf_lineno());
unput('\n');
BEGIN(INITIAL);
yylval.string = text;
return T_WORD_QUOTE;
}
<<EOF>> {
BEGIN(INITIAL);
yylval.string = text;
return T_WORD_QUOTE;
}
}
<HELP>{
[ \t]+ {
ts = 0;
for (i = 0; i < yyleng; i++) {
if (yytext[i] == '\t')
ts = (ts & ~7) + 8;
else
ts++;
}
last_ts = ts;
if (first_ts) {
if (ts < first_ts) {
zconf_endhelp();
return T_HELPTEXT;
}
ts -= first_ts;
while (ts > 8) {
append_string(" ", 8);
ts -= 8;
}
append_string(" ", ts);
}
}
[ \t]*\n/[^ \t\n] {
zconf_endhelp();
return T_HELPTEXT;
}
[ \t]*\n {
append_string("\n", 1);
}
[^ \t\n].* {
while (yyleng) {
if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t'))
break;
yyleng--;
}
append_string(yytext, yyleng);
if (!first_ts)
first_ts = last_ts;
}
<<EOF>> {
zconf_endhelp();
return T_HELPTEXT;
}
}
<<EOF>> {
BEGIN(INITIAL);
if (prev_token != T_EOL && prev_token != T_HELPTEXT)
fprintf(stderr, "%s:%d:warning: no new line at end of file\n",
current_file->name, yylineno);
if (current_file) {
zconf_endfile();
return T_EOL;
}
fclose(yyin);
yyterminate();
}
%%
/* second stage lexer */
int yylex(void)
{
int token;
repeat:
token = yylex1();
if (prev_token == T_EOL || prev_token == T_HELPTEXT) {
if (token == T_EOL) {
/* Do not pass unneeded T_EOL to the parser. */
goto repeat;
} else {
/*
* For the parser, update file/lineno at the first token
* of each statement. Generally, \n is a statement
* terminator in Kconfig, but it is not always true
* because \n could be escaped by a backslash.
*/
current_pos.file = current_file;
current_pos.lineno = yylineno;
}
}
if (prev_prev_token == T_EOL && prev_token == T_WORD &&
(token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL))
BEGIN(ASSIGN_VAL);
prev_prev_token = prev_token;
prev_token = token;
return token;
}
static char *expand_token(const char *in, size_t n)
{
char *out;
int c;
char c2;
const char *rest, *end;
new_string();
append_string(in, n);
/* get the whole line because we do not know the end of token. */
while ((c = input()) != EOF) {
if (c == '\n') {
unput(c);
break;
}
c2 = c;
append_string(&c2, 1);
}
rest = text;
out = expand_one_token(&rest);
/* push back unused characters to the input stream */
end = rest + strlen(rest);
while (end > rest)
unput(*--end);
free(text);
return out;
}
static void append_expanded_string(const char *str)
{
const char *end;
char *res;
str++;
res = expand_dollar(&str);
/* push back unused characters to the input stream */
end = str + strlen(str);
while (end > str)
unput(*--end);
append_string(res, strlen(res));
free(res);
}
void zconf_starthelp(void)
{
new_string();
last_ts = first_ts = 0;
BEGIN(HELP);
}
static void zconf_endhelp(void)
{
yylval.string = text;
BEGIN(INITIAL);
}
/*
* Try to open specified file with following names:
* ./name
* $(srctree)/name
* The latter is used when srctree is separate from objtree
* when compiling the kernel.
* Return NULL if file is not found.
*/
FILE *zconf_fopen(const char *name)
{
char *env, fullname[PATH_MAX+1];
FILE *f;
f = fopen(name, "r");
if (!f && name != NULL && name[0] != '/') {
env = getenv(SRCTREE);
if (env) {
snprintf(fullname, sizeof(fullname),
"%s/%s", env, name);
f = fopen(fullname, "r");
}
}
return f;
}
void zconf_initscan(const char *name)
{
yyin = zconf_fopen(name);
if (!yyin) {
fprintf(stderr, "can't find file %s\n", name);
exit(1);
}
current_buf = xmalloc(sizeof(*current_buf));
memset(current_buf, 0, sizeof(*current_buf));
current_file = file_lookup(name);
yylineno = 1;
}
void zconf_nextfile(const char *name)
{
char path[PATH_MAX], *slash;
if (strlen(current_file->name) >= PATH_MAX) {
fprintf(stderr, "can't source %s: path too long\n", name);
exit(1);
}
strcpy(path, current_file->name);
slash = strrchr(path, '/');
if (!slash || strlen(name) >= PATH_MAX - (slash - path) - 1) {
fprintf(stderr, "can't source %s: path too long\n", name);
exit(1);
}
strcpy(slash + 1, name);
struct file *iter;
struct file *file = file_lookup(path);
struct buffer *buf = xmalloc(sizeof(*buf));
memset(buf, 0, sizeof(*buf));
current_buf->state = YY_CURRENT_BUFFER;
yyin = zconf_fopen(file->name);
if (!yyin) {
fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
zconf_curname(), zconf_lineno(), file->name);
exit(1);
}
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
buf->parent = current_buf;
current_buf = buf;
current_file->lineno = yylineno;
file->parent = current_file;
for (iter = current_file; iter; iter = iter->parent) {
if (!strcmp(iter->name, file->name)) {
fprintf(stderr,
"Recursive inclusion detected.\n"
"Inclusion path:\n"
" current file : %s\n", file->name);
iter = file;
do {
iter = iter->parent;
fprintf(stderr, " included from: %s:%d\n",
iter->name, iter->lineno - 1);
} while (strcmp(iter->name, file->name));
exit(1);
}
}
yylineno = 1;
current_file = file;
}
static void zconf_endfile(void)
{
struct buffer *parent;
current_file = current_file->parent;
if (current_file)
yylineno = current_file->lineno;
parent = current_buf->parent;
if (parent) {
fclose(yyin);
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(parent->state);
}
free(current_buf);
current_buf = parent;
}
int zconf_lineno(void)
{
return current_pos.lineno;
}
const char *zconf_curname(void)
{
return current_pos.file ? current_pos.file->name : "<none>";
}
================================================
FILE: 3rdparty/kconfig/list.h
================================================
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef LIST_H
#define LIST_H
/*
* Copied from include/linux/...
*/
#undef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_head within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_head within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_head within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_add(struct list_head *_new,
struct list_head *prev,
struct list_head *next)
{
next->prev = _new;
_new->next = next;
_new->prev = prev;
prev->next = _new;
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static inline void list_add_tail(struct list_head *_new, struct list_head *head)
{
__list_add(_new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
}
#define LIST_POISON1 ((void *) 0x00100100)
#define LIST_POISON2 ((void *) 0x00200200)
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state.
*/
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (struct list_head*)LIST_POISON1;
entry->prev = (struct list_head*)LIST_POISON2;
}
#endif
================================================
FILE: 3rdparty/kconfig/lkc.h
================================================
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#ifndef LKC_H
#define LKC_H
#include "expr.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "lkc_proto.h"
#define SRCTREE "srctree"
#ifndef PACKAGE
#define PACKAGE "linux"
#endif
#ifndef CONFIG_
#define CONFIG_ "CONFIG_"
#endif
static inline const char *CONFIG_prefix(void)
{
return getenv( "CONFIG_" ) ?: CONFIG_;
}
#undef CONFIG_
#define CONFIG_ CONFIG_prefix()
enum conf_def_mode {
def_default,
def_yes,
def_mod,
def_y2m,
def_m2y,
def_no,
def_random
};
extern int yylineno;
void zconfdump(FILE *out);
void zconf_starthelp(void);
FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name);
void zconf_nextfile(const char *name);
int zconf_lineno(void);
const char *zconf_curname(void);
/* confdata.c */
const char *conf_get_configname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
bool conf_set_all_new_symbols(enum conf_def_mode mode);
void conf_rewrite_mod_or_yes(enum conf_def_mode mode);
void set_all_choice_values(struct symbol *csym);
/* confdata.c and expr.c */
static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
{
assert(len != 0);
if (fwrite(str, len, count, out) != count)
fprintf(stderr, "Error in writing or end of file.\n");
}
/* util.c */
struct file *file_lookup(const char *name);
void *xmalloc(size_t size);
void *xcalloc(size_t nmemb, size_t size);
void *xrealloc(void *p, size_t size);
char *xstrdup(const char *s);
char *xstrndup(const char *s, size_t n);
/* lexer.l */
int yylex(void);
struct gstr {
size_t len;
char *s;
/*
* when max_width is not zero long lines in string s (if any) get
* wrapped not to exceed the max_width value
*/
int max_width;
};
struct gstr str_new(void);
void str_free(struct gstr *gs);
void str_append(struct gstr *gs, const char *s);
void str_printf(struct gstr *gs, const char *fmt, ...);
const char *str_get(struct gstr *gs);
/* menu.c */
void _menu_init(void);
void menu_warn(struct menu *menu, const char *fmt, ...);
struct menu *menu_add_menu(void);
void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
void menu_add_dep(struct expr *dep);
void menu_add_visibility(struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
void menu_add_option_modules(void);
void menu_add_option_defconfig_list(void);
void menu_add_option_allnoconfig_y(void);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
extern struct menu rootmenu;
bool menu_is_empty(struct menu *menu);
bool menu_is_visible(struct menu *menu);
bool menu_has_prompt(struct menu *menu);
const char *menu_get_prompt(struct menu *menu);
struct menu *menu_get_root_menu(struct menu *menu);
struct menu *menu_get_parent_menu(struct menu *menu);
bool menu_has_help(struct menu *menu);
const char *menu_get_help(struct menu *menu);
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
void menu_get_ext_help(struct menu *menu, struct gstr *help);
/* symbol.c */
void sym_clear_all_valid(void);
struct symbol *sym_choice_default(struct symbol *sym);
struct property *sym_get_range_prop(struct symbol *sym);
const char *sym_get_string_default(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);
static inline tristate sym_get_tristate_value(struct symbol *sym)
{
return sym->curr.tri;
}
static inline struct symbol *sym_get_choice_value(struct symbol *sym)
{
return (struct symbol *)sym->curr.val;
}
static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
{
return sym_set_tristate_value(chval, yes);
}
static inline bool sym_is_choice(struct symbol *sym)
{
return sym->flags & SYMBOL_CHOICE ? true : false;
}
static inline bool sym_is_choice_value(struct symbol *sym)
{
return sym->flags & SYMBOL_CHOICEVAL ? true : false;
}
static inline bool sym_is_optional(struct symbol *sym)
{
return sym->flags & SYMBOL_OPTIONAL ? true : false;
}
static inline bool sym_has_value(struct symbol *sym)
{
return sym->flags & SYMBOL_DEF_USER ? true : false;
}
#ifdef __cplusplus
}
#endif
#endif /* LKC_H */
================================================
FILE: 3rdparty/kconfig/lkc_proto.h
================================================
/* SPDX-License-Identifier: GPL-2.0 */
#include <stdarg.h>
/* confdata.c */
void conf_parse(const char *name);
int conf_read(const char *name);
int conf_read_simple(const char *name, int);
int conf_write_defconfig(const char *name);
int conf_write(const char *name);
int conf_write_autoconf(int overwrite);
bool conf_get_changed(void);
void conf_set_changed_callback(void (*fn)(void));
void conf_set_message_callback(void (*fn)(const char *s));
/* symbol.c */
extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
struct symbol * sym_lookup(const char *name, int flags);
struct symbol * sym_find(const char *name);
const char * sym_escape_string_value(const char *in);
struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type);
void sym_calc_value(struct symbol *sym);
enum symbol_type sym_get_type(struct symbol *sym);
bool sym_tristate_within_range(struct symbol *sym,tristate tri);
bool sym_set_tristate_value(struct symbol *sym,tristate tri);
tristate sym_toggle_tristate_value(struct symbol *sym);
bool sym_string_valid(struct symbol *sym, const char *newval);
bool sym_string_within_range(struct symbol *sym, const char *str);
bool sym_set_string_value(struct symbol *sym, const char *newval);
bool sym_is_changeable(struct symbol *sym);
struct property * sym_get_choice_prop(struct symbol *sym);
const char * sym_get_string_value(struct symbol *sym);
const char * prop_get_type_name(enum prop_type type);
/* preprocess.c */
enum variable_flavor {
VAR_SIMPLE,
VAR_RECURSIVE,
VAR_APPEND,
};
void env_write_dep(FILE *f, const char *auto_conf_name);
void variable_add(const char *name, const char *value,
enum variable_flavor flavor);
void variable_all_del(void);
char *expand_dollar(const char **str);
char *expand_one_token(const char **str);
/* expr.c */
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);
================================================
FILE: 3rdparty/kconfig/menu.c
================================================
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "lkc.h"
static const char nohelp_text[] = "There is no help available for this option.";
struct menu rootmenu;
static struct menu **last_entry_ptr;
struct file *file_list;
struct file *current_file;
void menu_warn(struct menu *menu, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
static void prop_warn(struct property *prop, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
void _menu_init(void)
{
current_entry = current_menu = &rootmenu;
last_entry_ptr = &rootmenu.list;
}
void menu_add_entry(struct symbol *sym)
{
struct menu *menu;
menu = xmalloc(sizeof(*menu));
memset(menu, 0, sizeof(*menu));
menu->sym = sym;
menu->parent = current_menu;
menu->file = current_file;
menu->lineno = zconf_lineno();
*last_entry_ptr = menu;
last_entry_ptr = &menu->next;
current_entry = menu;
if (sym)
menu_add_symbol(P_SYMBOL, sym, NULL);
}
struct menu *menu_add_menu(void)
{
last_entry_ptr = ¤t_entry->list;
current_menu = current_entry;
return current_menu;
}
void menu_end_menu(void)
{
last_entry_ptr = ¤t_menu->next;
current_menu = current_menu->parent;
}
/*
* Rewrites 'm' to 'm' && MODULES, so that it evaluates to 'n' when running
* without modules
*/
static struct expr *rewrite_m(struct expr *e)
{
if (!e)
return e;
switch (e->type) {
case E_NOT:
e->left.expr = rewrite_m(e->left.expr);
break;
case E_OR:
case E_AND:
e->left.expr = rewrite_m(e->left.expr);
e->right.expr = rewrite_m(e->right.expr);
break;
case E_SYMBOL:
/* change 'm' into 'm' && MODULES */
if (e->left.sym == &symbol_mod)
return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
break;
default:
break;
}
return e;
}
void menu_add_dep(struct expr *dep)
{
current_entry->dep = expr_alloc_and(current_entry->dep, dep);
}
void menu_set_type(int type)
{
struct symbol *sym = current_entry->sym;
if (sym->type == type)
return;
if (sym->type == S_UNKNOWN) {
sym->type = type;
return;
}
menu_warn(current_entry,
"ignoring type redefinition of '%s' from '%s' to '%s'",
sym->name ? sym->name : "<choice>",
sym_type_name(sym->type), sym_type_name(type));
}
static struct property *menu_add_prop(enum prop_type type, struct expr *expr,
struct expr *dep)
{
struct property *prop;
prop = xmalloc(sizeof(*prop));
memset(prop, 0, sizeof(*prop));
prop->type = type;
prop->file = current_file;
prop->lineno = zconf_lineno();
prop->menu = current_entry;
prop->expr = expr;
prop->visible.expr = dep;
/* append property to the prop list of symbol */
if (current_entry->sym) {
struct property **propp;
for (propp = ¤t_entry->sym->prop;
*propp;
propp = &(*propp)->next)
;
*propp = prop;
}
return prop;
}
struct property *menu_add_prompt(enum prop_type type, char *prompt,
struct expr *dep)
{
struct property *prop = menu_add_prop(type, NULL, dep);
if (isspace(*prompt)) {
prop_warn(prop, "leading whitespace ignored");
while (isspace(*prompt))
prompt++;
}
if (current_entry->prompt)
prop_warn(prop, "prompt redefined");
/* Apply all upper menus' visibilities to actual prompts. */
if (type == P_PROMPT) {
struct menu *menu = current_entry;
while ((menu = menu->parent) != NULL) {
struct expr *dup_expr;
if (!menu->visibility)
continue;
/*
* Do not add a reference to the menu's visibility
* expression but use a copy of it. Otherwise the
* expression reduction functions will modify
* expressions that have multiple references which
* can cause unwanted side effects.
*/
dup_expr = expr_copy(menu->visibility);
prop->visible.expr = expr_alloc_and(prop->visible.expr,
dup_expr);
}
}
current_entry->prompt = prop;
prop->text = prompt;
return prop;
}
void menu_add_visibility(struct expr *expr)
{
current_entry->visibility = expr_alloc_and(current_entry->visibility,
expr);
}
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
{
menu_add_prop(type, expr, dep);
}
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
{
menu_add_prop(type, expr_alloc_symbol(sym), dep);
}
void menu_add_option_modules(void)
{
if (modules_sym)
zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'",
current_entry->sym->name, modules_sym->name);
modules_sym = current_entry->sym;
}
void menu_add_option_defconfig_list(void)
{
if (!sym_defconfig_list)
sym_defconfig_list = current_entry->sym;
else if (sym_defconfig_list != current_entry->sym)
zconf_error("trying to redefine defconfig symbol");
sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
}
void menu_add_option_allnoconfig_y(void)
{
current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
}
static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
{
return sym2->type == S_INT || sym2->type == S_HEX ||
(sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
}
static void sym_check_prop(struct symbol *sym)
{
struct property *prop;
struct symbol *sym2;
char *use;
for (prop = sym->prop; prop; prop = prop->next) {
switch (prop->type) {
case P_DEFAULT:
if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
prop->expr->type != E_SYMBOL)
prop_warn(prop,
"default for config symbol '%s'"
" must be a single symbol", sym->name);
if (prop->expr->type != E_SYMBOL)
break;
sym2 = prop_get_symbol(prop);
if (sym->type == S_HEX || sym->type == S_INT) {
if (!menu_validate_number(sym, sym2))
prop_warn(prop,
"'%s': number is invalid",
sym->name);
}
if (sym_is_choice(sym)) {
struct property *choice_prop =
sym_get_choice_prop(sym2);
if (!choice_prop ||
prop_get_symbol(choice_prop) != sym)
prop_warn(prop,
"choice default symbol '%s' is not contained in the choice",
sym2->name);
}
break;
case P_SELECT:
case P_IMPLY:
use = prop->type == P_SELECT ? "select" : "imply";
sym2 = prop_get_symbol(prop);
if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
prop_warn(prop,
"config symbol '%s' uses %s, but is "
"not bool or tristate", sym->name, use);
else if (sym2->type != S_UNKNOWN &&
sym2->type != S_BOOLEAN &&
sym2->type != S_TRISTATE)
prop_warn(prop,
"'%s' has wrong type. '%s' only "
"accept arguments of bool and "
"tristate type", sym2->name, use);
break;
case P_RANGE:
if (sym->type != S_INT && sym->type != S_HEX)
prop_warn(prop, "range is only allowed "
"for int or hex symbols");
if (!menu_validate_number(sym, prop->expr->left.sym) ||
!menu_validate_number(sym, prop->expr->right.sym))
prop_warn(prop, "range is invalid");
break;
default:
;
}
}
}
void menu_finalize(struct menu *parent)
{
struct menu *menu, *last_menu;
struct symbol *sym;
struct property *prop;
struct expr *parentdep, *basedep, *dep, *dep2, **ep;
sym = parent->sym;
if (parent->list) {
/*
* This menu node has children. We (recursively) process them
* and propagate parent dependencies before moving on.
*/
if (sym && sym_is_choice(sym)) {
if (sym->type == S_UNKNOWN) {
/* find the first choice value to find out choice type */
current_entry = parent;
for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym && menu->sym->type != S_UNKNOWN) {
menu_set_type(menu->sym->type);
break;
}
}
}
/* set the type of the remaining choice values */
for (menu = parent->list; menu; menu = menu->next) {
current_entry = menu;
if (menu->sym && menu->sym->type == S_UNKNOWN)
menu_set_type(sym->type);
}
/*
* Use the choice itself as the parent dependency of
* the contained items. This turns the mode of the
* choice into an upper bound on the visibility of the
* choice value symbols.
*/
parentdep = expr_alloc_symbol(sym);
} else {
/* Menu node for 'menu', 'if' */
parentdep = parent->dep;
}
/* For each child menu node... */
for (menu = parent->list; menu; menu = menu->next) {
/*
* Propagate parent dependencies to the child menu
* node, also rewriting and simplifying expressions
*/
basedep = rewrite_m(menu->dep);
basedep = expr_transform(basedep);
basedep = expr_alloc_and(expr_copy(parentdep), basedep);
basedep = expr_eliminate_dups(basedep);
menu->dep = basedep;
if (menu->sym)
/*
* Note: For symbols, all prompts are included
* too in the symbol's own property list
*/
prop = menu->sym->prop;
else
/*
* For non-symbol menu nodes, we just need to
* handle the prompt
*/
prop = menu->prompt;
/* For each property... */
for (; prop; prop = prop->next) {
if (prop->menu != menu)
/*
* Two possibilities:
*
* 1. The property lacks dependencies
* and so isn't location-specific,
* e.g. an 'option'
*
* 2. The property belongs to a symbol
* defined in multiple locations and
* is from some other location. It
* will be handled there in that
* case.
*
* Skip the property.
*/
continue;
/*
* Propagate parent dependencies to the
* property's condition, rewriting and
* simplifying expressions at the same time
*/
dep = rewrite_m(prop->visible.expr);
dep = expr_transform(dep);
dep = expr_alloc_and(expr_copy(basedep), dep);
dep = expr_eliminate_dups(dep);
if (menu->sym && menu->sym->type != S_TRISTATE)
dep = expr_trans_bool(dep);
prop->visible.expr = dep;
/*
* Handle selects and implies, which modify the
* dependencies of the selected/implied symbol
*/
if (prop->type == P_SELECT) {
struct symbol *es = prop_get_symbol(prop);
es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
} else if (prop->type == P_IMPLY) {
struct symbol *es = prop_get_symbol(prop);
es->implied.expr = expr_alloc_or(es->implied.expr,
expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
}
}
}
if (sym && sym_is_choice(sym))
expr_free(parentdep);
/*
* Recursively process children in the same fashion before
* moving on
*/
for (menu = parent->list; menu; menu = menu->next)
menu_finalize(menu);
} else if (sym) {
/*
* Automatic submenu creation. If sym is a symbol and A, B, C,
* ... are consecutive items (symbols, menus, ifs, etc.) that
* all depend on sym, then the following menu structure is
* created:
*
* sym
* +-A
* +-B
* +-C
* ...
*
* This also works recursively, giving the following structure
* if A is a symbol and B depends on A:
*
* sym
* +-A
* | +-B
* +-C
* ...
*/
basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
basedep = expr_eliminate_dups(expr_transform(basedep));
/* Examine consecutive elements after sym */
last_menu = NULL;
for (menu = parent->next; menu; menu = menu->next) {
dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
if (!expr_contains_symbol(dep, sym))
/* No dependency, quit */
break;
if (expr_depends_symbol(dep, sym))
/* Absolute dependency, put in submenu */
goto next;
/*
* Also consider it a dependency on sym if our
* dependencies contain sym and are a "superset" of
* sym's dependencies, e.g. '(sym || Q) && R' when sym
* depends on R.
*
* Note that 'R' might be from an enclosing menu or if,
* making this a more common case than it might seem.
*/
dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no);
dep = expr_eliminate_dups(expr_transform(dep));
dep2 = expr_copy(basedep);
expr_eliminate_eq(&dep, &dep2);
expr_free(dep);
if (!expr_is_yes(dep2)) {
/* Not superset, quit */
expr_free(dep2);
break;
}
/* Superset, put in submenu */
expr_free(dep2);
next:
menu_finalize(menu);
menu->parent = parent;
last_menu = menu;
}
expr_free(basedep);
if (last_menu) {
parent->list = parent->next;
parent->next = last_menu->next;
last_menu->next = NULL;
}
sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);
}
for (menu = parent->list; menu; menu = menu->next) {
if (sym && sym_is_choice(sym) &&
menu->sym && !sym_is_choice_value(menu->sym)) {
current_entry = menu;
menu->sym->flags |= SYMBOL_CHOICEVAL;
if (!menu->prompt)
menu_warn(menu, "choice value must have a prompt");
for (prop = menu->sym->prop; prop; prop = prop->next) {
if (prop->type == P_DEFAULT)
prop_warn(prop, "defaults for choice "
"values not supported");
if (prop->menu == menu)
continue;
if (prop->type == P_PROMPT &&
prop->menu->parent->sym != sym)
prop_warn(prop, "choice value used outside its choice group");
}
/* Non-tristate choice values of tristate choices must
* depend on the choice being set to Y. The choice
* values' dependencies were propagated to their
* properties above, so the change here must be re-
* propagated.
*/
if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
menu->dep = expr_alloc_and(basedep, menu->dep);
for (prop = menu->sym->prop; prop; prop = prop->next) {
if (prop->menu != menu)
continue;
prop->visible.expr = expr_alloc_and(expr_copy(basedep),
prop->visible.expr);
}
}
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
;
*ep = expr_alloc_one(E_LIST, NULL);
(*ep)->right.sym = menu->sym;
}
/*
* This code serves two purposes:
*
* (1) Flattening 'if' blocks, which do not specify a submenu
* and only add dependencies.
*
* (Automatic submenu creation might still create a submenu
* from an 'if' before this code runs.)
*
* (2) "Undoing" any automatic submenus created earlier below
* promptless symbols.
*
* Before:
*
* A
* if ... (or promptless symbol)
* +-B
* +-C
* D
*
* After:
*
* A
* if ... (or promptless symbol)
* B
* C
* D
*/
if (menu->list && (!menu->prompt || !menu->prompt->text)) {
for (last_menu = menu->list; ; last_menu = last_menu->next) {
last_menu->parent = parent;
if (!last_menu->next)
break;
}
last_menu->next = menu->next;
menu->next = menu->list;
menu->list = NULL;
}
}
if (sym && !(sym->flags & SYMBOL_WARNED)) {
if (sym->type == S_UNKNOWN)
menu_warn(parent, "config symbol defined without type");
if (sym_is_choice(sym) && !parent->prompt)
menu_warn(parent, "choice must have a prompt");
/* Check properties connected to this symbol */
sym_check_prop(sym);
sym->flags |= SYMBOL_WARNED;
}
/*
* For non-optional choices, add a reverse dependency (corresponding to
* a select) of '<visibility> && m'. This prevents the user from
* setting the choice mode to 'n' when the choice is visible.
*
* This would also work for non-choice symbols, but only non-optional
* choices clear SYMBOL_OPTIONAL as of writing. Choices are implemented
* as a type of symbol.
*/
if (sym && !sym_is_optional(sym) && parent->prompt) {
sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
expr_alloc_and(parent->prompt->visible.expr,
expr_alloc_symbol(&symbol_mod)));
}
}
bool menu_has_prompt(struct menu *menu)
{
if (!menu->prompt)
return false;
return true;
}
/*
* Determine if a menu is empty.
* A menu is considered empty if it contains no or only
* invisible entries.
*/
bool menu_is_empty(struct menu *menu)
{
struct menu *child;
for (child = menu->list; child; child = child->next) {
if (menu_is_visible(child))
return(false);
}
return(true);
}
bool menu_is_visible(struct menu *menu)
{
struct menu *child;
struct symbol *sym;
tristate visible;
if (!menu->prompt)
return false;
if (menu->visibility) {
if (expr_calc_value(menu->visibility) == no)
return false;
}
sym = menu->sym;
if (sym) {
sym_calc_value(sym);
visible = menu->prompt->visible.tri;
} else
visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
if (visible != no)
return true;
if (!sym || sym_get_tristate_value(menu->sym) == no)
return false;
for (child = menu->list; child; child = child->next) {
if (menu_is_visible(child)) {
if (sym)
sym->flags |= SYMBOL_DEF_USER;
return true;
}
}
return false;
}
const char *menu_get_prompt(struct menu *menu)
{
if (menu->prompt)
return menu->prompt->text;
else if (menu->sym)
return menu->sym->name;
return NULL;
}
struct menu *menu_get_root_menu(struct menu *menu)
{
return &rootmenu;
}
struct menu *menu_get_parent_menu(struct menu *menu)
{
enum prop_type type;
for (; menu != &rootmenu; menu = menu->parent) {
type = menu->prompt ? menu->prompt->type : 0;
if (type == P_MENU)
break;
}
return menu;
}
bool menu_has_help(struct menu *menu)
{
return menu->help != NULL;
}
const char *menu_get_help(struct menu *menu)
{
if (menu->help)
return menu->help;
else
return "";
}
static void get_def_str(struct gstr *r, struct menu *menu)
{
str_printf(r, "Defined at %s:%d\n",
menu->file->name, menu->lineno);
}
static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix)
{
if (!expr_is_yes(expr)) {
str_append(r, prefix);
expr_gstr_print(expr, r);
str_append(r, "\n");
}
}
static void get_prompt_str(struct gstr *r, struct property *prop,
struct list_head *head)
{
int i, j;
struct menu *submenu[8], *menu, *location = NULL;
struct jump_key *jump = NULL;
str_printf(r, " Prompt: %s\n", prop->text);
get_dep_str(r, prop->menu->dep, " Depends on: ");
/*
* Most prompts in Linux have visibility that exactly matches their
* dependencies. For these, we print only the dependencies to improve
* readability. However, prompts with inline "if" expressions and
* prompts with a parent that has a "visible if" expression have
* differing dependencies and visibility. In these rare cases, we
* print both.
*/
if (!expr_eq(prop->menu->dep, prop->visible.expr))
get_dep_str(r, prop->visible.expr, " Visible if: ");
menu = prop->menu->parent;
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
bool accessible = menu_is_visible(menu);
submenu[i++] = menu;
if (location == NULL && accessible)
location = menu;
}
if (head && location) {
jump = xmalloc(sizeof(struct jump_key));
if (menu_is_visible(prop->menu)) {
/*
* There is not enough room to put the hint at the
* beginning of the "Prompt" line. Put the hint on the
* last "Location" line even when it would belong on
* the former.
*/
jump->target = prop->menu;
} else
jump->target = location;
if (list_empty(head))
jump->index = 0;
else
jump->index = list_entry(head->prev, struct jump_key,
entries)->index + 1;
list_add_tail(&jump->entries, head);
}
if (i > 0) {
str_printf(r, " Location:\n");
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
if (jump && menu == location)
jump->offset = strlen(r->s);
str_printf(r, "%*c-> %s", j, ' ',
menu_get_prompt(menu));
if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : "<choice>",
sym_get_string_value(menu->sym));
}
str_append(r, "\n");
}
}
}
static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
enum prop_type tok, const char *prefix)
{
bool hit = false;
struct property *prop;
for_all_properties(sym, prop, tok) {
if (!hit) {
str_append(r, prefix);
hit = true;
} else
str_printf(r, " && ");
expr_gstr_print(prop->expr, r);
}
if (hit)
str_append(r, "\n");
}
/*
* head is optional and may be NULL
*/
static void get_symbol_str(struct gstr *r, struct symbol *sym,
struct list_head *head)
{
struct property *prop;
if (sym && sym->name) {
str_printf(r, "Symbol: %s [=%s]\n", sym->name,
sym_get_string_value(sym));
str_printf(r, "Type : %s\n", sym_type_name(sym->type));
if (sym->type == S_INT || sym->type == S_HEX) {
prop = sym_get_range_prop(sym);
if (prop) {
str_printf(r, "Range : ");
expr_gstr_print(prop->expr, r);
str_append(r, "\n");
}
}
}
/* Print the definitions with prompts before the ones without */
for_all_properties(sym, prop, P_SYMBOL) {
if (prop->menu->prompt) {
get_def_str(r, prop->menu);
get_prompt_str(r, prop->menu->prompt, head);
}
}
for_all_properties(sym, prop, P_SYMBOL) {
if (!prop->menu->prompt) {
get_def_str(r, prop->menu);
get_dep_str(r, prop->menu->dep, " Depends on: ");
}
}
get_symbol_props_str(r, sym, P_SELECT, "Selects: ");
if (sym->rev_dep.expr) {
expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, "Selected by [y]:\n");
expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, "Selected by [m]:\n");
expr_gstr_print_revdep(sym->rev_dep.expr, r, no, "Selected by [n]:\n");
}
get_symbol_props_str(r, sym, P_IMPLY, "Implies: ");
if (sym->implied.expr) {
expr_gstr_print_revdep(sym->implied.expr, r, yes, "Implied by [y]:\n");
expr_gstr_print_revdep(sym->implied.expr, r, mod, "Implied by [m]:\n");
expr_gstr_print_revdep(sym->implied.expr, r, no, "Implied by [n]:\n");
}
str_append(r, "\n\n");
}
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)
{
struct symbol *sym;
struct gstr res = str_new();
int i;
for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym, head);
if (!i)
str_append(&res, "No matches found.\n");
return res;
}
void menu_get_ext_help(struct menu *menu, struct gstr *help)
{
struct symbol *sym = menu->sym;
const char *help_text = nohelp_text;
if (menu_has_help(menu)) {
if (sym->name)
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
help_text = menu_get_help(menu);
}
str_printf(help, "%s\n", help_text);
if (sym)
get_symbol_str(help, sym, NULL);
}
================================================
FILE: 3rdparty/kconfig/nconf-cfg.sh
================================================
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
PKG="ncursesw menuw panelw"
PKG2="ncurses menu panel"
if [ -n "$(command -v pkg-config)" ]; then
if pkg-config --exists $PKG; then
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi
if pkg-config --exists $PKG2; then
echo cflags=\"$(pkg-config --cflags $PKG2)\"
echo libs=\"$(pkg-config --libs $PKG2)\"
exit 0
fi
fi
# Check the default paths in case pkg-config is not installed.
# (Even if it is installed, some distributions such as openSUSE cannot
# find ncurses by pkg-config.)
if [ -f /usr/include/ncursesw/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
echo libs=\"-lncursesw -lmenuw -lpanelw\"
exit 0
fi
if [ -f /usr/include/ncurses/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\"
echo libs=\"-lncurses -lmenu -lpanel\"
exit 0
fi
if [ -f /usr/include/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE\"
echo libs=\"-lncurses -lmenu -lpanel\"
exit 0
fi
echo >&2 "*"
echo >&2 "* Unable to find the ncurses package."
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
echo >&2 "* depending on your distribution)."
echo >&2 "*"
echo >&2 "* You may also need to install pkg-config to find the"
echo >&2 "* ncurses installed in a non-default location."
echo >&2 "*"
exit 1
================================================
FILE: 3rdparty/kconfig/nconf.c
================================================
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
*
* Derived from menuconfig.
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include "lkc.h"
#include "nconf.h"
#include <ctype.h>
static const char nconf_global_help[] =
"Help windows\n"
"------------\n"
"o Global help: Unless in a data entry window, pressing <F1> will give \n"
" you the global help window, which you are just reading.\n"
"\n"
"o A short version of the global help is available by pressing <F3>.\n"
"\n"
"o Local help: To get help related to the current menu entry, use any\n"
" of <?> <h>, or if in a data entry window then press <F1>.\n"
"\n"
"\n"
"Menu entries\n"
"------------\n"
"This interface lets you select features and parameters for the kernel\n"
"build. Kernel features can either be built-in, modularized, or removed.\n"
"Parameters must be entered as text or decimal or hexadecimal numbers.\n"
"\n"
"Menu entries beginning with following braces represent features that\n"
" [ ] can be built in or removed\n"
" < > can be built in, modularized or removed\n"
" { } can be built in or modularized, are selected by another feature\n"
" - - are selected by another feature\n"
" XXX cannot be selected. Symbol Info <F2> tells you why.\n"
"*, M or whitespace inside braces means to build in, build as a module\n"
"or to exclude the feature respectively.\n"
"\n"
"To change any of these features, highlight it with the movement keys\n"
"listed below and press <y> to build it in, <m> to make it a module or\n"
"<n> to remove it. You may press the <Space> key to cycle through the\n"
"available options.\n"
"\n"
"A trailing \"--->\" designates a submenu, a trailing \"----\" an\n"
"empty submenu.\n"
"\n"
"Menu navigation keys\n"
"----------------------------------------------------------------------\n"
"Linewise up <Up>\n"
"Linewise down <Down>\n"
"Pagewise up <Page Up>\n"
"Pagewise down <Page Down>\n"
"First entry <Home>\n"
"Last entry <End>\n"
"Enter a submenu <Right> <Enter>\n"
"Go back to parent menu <Left> <Esc> <F5>\n"
"Close a help window <Enter> <Esc> <F5>\n"
"Close entry window, apply <Enter>\n"
"Close entry window, forget <Esc> <F5>\n"
"Start incremental, case-insensitive search for STRING in menu entries,\n"
" no regex support, STRING is displayed in upper left corner\n"
" </>STRING\n"
" Remove last character <Backspace>\n"
" Jump to next hit <Down>\n"
" Jump to previous hit <Up>\n"
"Exit menu search mode </> <Esc>\n"
"Search for configuration variables with or without leading CONFIG_\n"
" <F8>RegExpr<Enter>\n"
"Verbose search help <F8><F1>\n"
"----------------------------------------------------------------------\n"
"\n"
"Unless in a data entry window, key <1> may be used instead of <F1>,\n"
"<2> instead of <F2>, etc.\n"
"\n"
"\n"
"Radiolist (Choice list)\n"
"-----------------------\n"
"Use the movement keys listed above to select the option you wish to set\n"
"and press <Space>.\n"
"\n"
"\n"
"Data entry\n"
"----------\n"
"Enter the requested information and press <Enter>. Hexadecimal values\n"
"may be entered without the \"0x\" prefix.\n"
"\n"
"\n"
"Text Box (Help Window)\n"
"----------------------\n"
"Use movement keys as listed in table above.\n"
"\n"
"Press any of <Enter> <Esc> <q> <F5> <F9> to exit.\n"
"\n"
"\n"
"Alternate configuration files\n"
"-----------------------------\n"
"nconfig supports switching between different configurations.\n"
"Press <F6> to save your current configuration. Press <F7> and enter\n"
"a file name to load a previously saved configuration.\n"
"\n"
"\n"
"Terminal configuration\n"
"----------------------\n"
"If you use nconfig in a xterm window, make sure your TERM environment\n"
"variable specifies a terminal configuration which supports at least\n"
"16 colors. Otherwise nconfig will look rather bad.\n"
"\n"
"If the \"stty size\" command reports the current terminalsize correctly,\n"
"nconfig will adapt to sizes larger than the traditional 80x25 \"standard\"\n"
"and display longer menus properly.\n"
"\n"
"\n"
"Single menu mode\n"
"----------------\n"
"If you prefer to have all of the menu entries listed in a single menu,\n"
"rather than the default multimenu hierarchy, run nconfig with\n"
"NCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n"
"make NCONFIG_MODE=single_menu nconfig\n"
"\n"
"<Enter> will then unfold the appropriate category, or fold it if it\n"
"is already unfolded. Folded menu entries will be designated by a\n"
"leading \"++>\" and unfolded entries by a leading \"-->\".\n"
"\n"
"Note that this mode can eventually be a little more CPU expensive than\n"
"the default mode, especially with a larger number of unfolded submenus.\n"
"\n",
menu_no_f_instructions[] =
"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n"
"\n"
"Use the following keys to navigate the menus:\n"
"Move up or down with <Up> and <Down>.\n"
"Enter a submenu with <Enter> or <Right>.\n"
"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
"Pressing <Space> cycles through the available options.\n"
"To search for menu entries press </>.\n"
"<Esc> always leaves the current window.\n"
"\n"
"You do not have function keys support.\n"
"Press <1> instead of <F1>, <2> instead of <F2>, etc.\n"
"For verbose global help use key <1>.\n"
"For help related to the current menu entry press <?> or <h>.\n",
menu_instructions[] =
"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n"
"\n"
"Use the following keys to navigate the menus:\n"
"Move up or down with <Up> or <Down>.\n"
"Enter a submenu with <Enter> or <Right>.\n"
"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
"Pressing <Space> cycles through the available options.\n"
"To search for menu entries press </>.\n"
"<Esc> always leaves the current window.\n"
"\n"
"Pressing <1> may be used instead of <F1>, <2> instead of <F2>, etc.\n"
"For verbose global help press <F1>.\n"
"For help related to the current menu entry press <?> or <h>.\n",
radiolist_instructions[] =
"Press <Up>, <Down>, <Home> or <End> to navigate a radiolist, select\n"
"with <Space>.\n"
"For help related to the current entry press <?> or <h>.\n"
"For global help press <F1>.\n",
inputbox_instructions_int[] =
"Please enter a decimal value.\n"
"Fractions will not be accepted.\n"
"Press <Enter> to apply, <Esc> to cancel.",
inputbox_instructions_hex[] =
"Please enter a hexadecimal value.\n"
"Press <Enter> to apply, <Esc> to cancel.",
inputbox_instructions_string[] =
"Please enter a string value.\n"
"Press <Enter> to apply, <Esc> to cancel.",
setmod_text[] =
"This feature depends on another feature which has been configured as a\n"
"module. As a result, the current feature will be built as a module too.",
load_config_text[] =
"Enter the name of the configuration file you wish to load.\n"
"Accept the name shown to restore the configuration you last\n"
"retrieved. Leave empty to abort.",
load_config_help[] =
"For various reasons, one may wish to keep several different\n"
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
"default one, entering its name here will allow you to load and modify\n"
"that configuration.\n"
"\n"
"Leave empty to abort.\n",
save_config_text[] =
"Enter a filename to which this configuration should be saved\n"
"as an alternate. Leave empty to abort.",
save_config_help[] =
"For various reasons, one may wish to keep several different\n"
"configurations available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
"and use the current configuration as an alternate to whatever\n"
"configuration options you have selected at that time.\n"
"\n"
"Leave empty to abort.\n",
search_help[] =
"Search for symbols (configuration variable names CONFIG_*) and display\n"
"their relations. Regular expressions are supported.\n"
"Example: Search for \"^FOO\".\n"
"Result:\n"
"-----------------------------------------------------------------\n"
"Symbol: FOO [ = m]\n"
"Prompt: Foo bus is used to drive the bar HW\n"
"Defined at drivers/pci/Kconfig:47\n"
"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
"Location:\n"
" -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
" -> PCI support (PCI [ = y])\n"
" -> PCI access mode (<choice> [ = y])\n"
"Selects: LIBCRC32\n"
"Selected by: BAR\n"
"-----------------------------------------------------------------\n"
"o The line 'Prompt:' shows the text displayed for this symbol in\n"
" the menu hierarchy.\n"
"o The 'Defined at' line tells at what file / line number the symbol is\n"
" defined.\n"
"o The 'Depends on:' line lists symbols that need to be defined for\n"
" this symbol to be visible and selectable in the menu.\n"
"o The 'Location:' lines tell, where in the menu structure this symbol\n"
" is located. A location followed by a [ = y] indicates that this is\n"
" a selectable menu item, and the current value is displayed inside\n"
" brackets.\n"
"o The 'Selects:' line tells, what symbol will be automatically selected\n"
" if this symbol is selected (y or m).\n"
"o The 'Selected by' line tells what symbol has selected this symbol.\n"
"\n"
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
"USB => find all symbols containing USB\n"
"^USB => find all symbols starting with USB\n"
"USB$ => find all symbols ending with USB\n"
"\n";
struct mitem {
char str[256];
char tag;
void *usrptr;
int is_visible;
};
#define MAX_MENU_ITEMS 4096
static int show_all_items;
static int indent;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
/* the window in which all information appears */
static WINDOW *main_window;
/* the largest size of the menu window */
static int mwin_max_lines;
static int mwin_max_cols;
/* the window in which we show option buttons */
static MENU *curses_menu;
static ITEM *curses_menu_items[MAX_MENU_ITEMS];
static struct mitem k_menu_items[MAX_MENU_ITEMS];
static int items_num;
static int global_exit;
/* the currently selected button */
static const char *current_instructions = menu_instructions;
static char *dialog_input_result;
static int dialog_input_result_len;
static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
static void conf_string(struct menu *menu);
static void conf_load(void);
static void conf_save(void);
static void show_help(struct menu *menu);
static int do_exit(void);
static void setup_windows(void);
static void search_conf(void);
typedef void (*function_key_handler_t)(int *key, struct menu *menu);
static void handle_f1(int *key, struct menu *current_item);
static void handle_f2(int *key, struct menu *current_item);
static void handle_f3(int *key, struct menu *current_item);
static void handle_f4(int *key, struct menu *current_item);
static void handle_f5(int *key, struct menu *current_item);
static void handle_f6(int *key, struct menu *current_item);
static void handle_f7(int *key, struct menu *current_item);
static void handle_f8(int *key, struct menu *current_item);
static void handle_f9(int *key, struct menu *current_item);
struct function_keys {
const char *key_str;
const char *func;
function_key key;
function_key_handler_t handler;
};
static const int function_keys_num = 9;
static struct function_keys function_keys[] = {
{
.key_str = "F1",
.func = "Help",
.key = F_HELP,
.handler = handle_f1,
},
{
.key_str = "F2",
.func = "SymInfo",
.key = F_SYMBOL,
.handler = handle_f2,
},
{
.key_str = "F3",
.func = "Help 2",
.key = F_INSTS,
.handler = handle_f3,
},
{
.key_str = "F4",
.func = "ShowAll",
.key = F_CONF,
.handler = handle_f4,
},
{
.key_str = "F5",
.func = "Back",
.key = F_BACK,
.handler = handle_f5,
},
{
.key_str = "F6",
.func = "Save",
.key = F_SAVE,
.handler = handle_f6,
},
{
.key_str = "F7",
.func = "Load",
.key = F_LOAD,
.handler = handle_f7,
},
{
.key_str = "F8",
.func = "SymSearch",
.key = F_SEARCH,
.handler = handle_f8,
},
{
.key_str = "F9",
.func = "Exit",
.key = F_EXIT,
.handler = handle_f9,
},
};
static void print_function_line(void)
{
int i;
int offset = 1;
const int skip = 1;
int lines = getmaxy(stdscr);
for (i = 0; i < function_keys_num; i++) {
(void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
mvwprintw(main_window, lines-3, offset,
"%s",
function_keys[i].key_str);
(void) wattrset(main_window, attributes[FUNCTION_TEXT]);
offset += strlen(function_keys[i].key_str);
mvwprintw(main_window, lines-3,
offset, "%s",
function_keys[i].func);
offset += strlen(function_keys[i].func) + skip;
}
(void) wattrset(main_window, attributes[NORMAL]);
}
/* help */
static void handle_f1(int *key, struct menu *current_item)
{
show_scroll_win(main_window,
"Global help", nconf_global_help);
return;
}
/* symbole help */
static void handle_f2(int *key, struct menu *current_item)
{
show_help(current_item);
return;
}
/* instructions */
static void handle_f3(int *key, struct menu *current_item)
{
show_scroll_win(main_window,
"Short help",
current_instructions);
return;
}
/* config */
static void handle_f4(int *key, struct menu *current_item)
{
int res = btn_dialog(main_window,
"Show all symbols?",
2,
" <Show All> ",
"<Don't show all>");
if (res == 0)
show_all_items = 1;
else if (res == 1)
show_all_items = 0;
return;
}
/* back */
static void handle_f5(int *key, struct menu *current_item)
{
*key = KEY_LEFT;
return;
}
/* save */
static void handle_f6(int *key, struct menu *current_item)
{
conf_save();
return;
}
/* load */
static void handle_f7(int *key, struct menu *current_item)
{
conf_load();
return;
}
/* search */
static void handle_f8(int *key, struct menu *current_item)
{
search_conf();
return;
}
/* exit */
static void handle_f9(int *key, struct menu *current_item)
{
do_exit();
return;
}
/* return != 0 to indicate the key was handles */
static int process_special_keys(int *key, struct menu *menu)
{
int i;
if (*key == KEY_RESIZE) {
setup_windows();
return 1;
}
for (i = 0; i < function_keys_num; i++) {
if (*key == KEY_F(function_keys[i].key) ||
*key == '0' + function_keys[i].key){
function_keys[i].handler(key, menu);
return 1;
}
}
return 0;
}
static void clean_items(void)
{
int i;
for (i = 0; curses_menu_items[i]; i++)
free_item(curses_menu_items[i]);
bzero(curses_menu_items, sizeof(curses_menu_items));
bzero(k_menu_items, sizeof(k_menu_items));
items_num = 0;
}
typedef enum {MATCH_TINKER_PATTERN_UP, MATCH_TINKER_PATTERN_DOWN,
FIND_NEXT_MATCH_DOWN, FIND_NEXT_MATCH_UP} match_f;
/* return the index of the matched item, or -1 if no such item exists */
static int get_mext_match(const char *match_str, match_f flag)
{
int match_start = item_index(current_item(curses_menu));
int index;
if (flag == FIND_NEXT_MATCH_DOWN)
++match_start;
else if (flag == FIND_NEXT_MATCH_UP)
--match_start;
index = match_start;
index = (index + items_num) % items_num;
while (true) {
char *str = k_menu_items[index].str;
if (strcasestr(str, match_str) != NULL)
return index;
if (flag == FIND_NEXT_MATCH_UP ||
flag == MATCH_TINKER_PATTERN_UP)
--index;
else
++index;
index = (index + items_num) % items_num;
if (index == match_start)
return -1;
}
}
/* Make a new item. */
static void item_make(struct menu *menu, char tag, const char *fmt, ...)
{
va_list ap;
if (items_num > MAX_MENU_ITEMS-1)
return;
bzero(&k_menu_items[items_num], sizeof(k_menu_items[0]));
k_menu_items[items_num].tag = tag;
k_menu_items[items_num].usrptr = menu;
if (menu != NULL)
k_menu_items[items_num].is_visible =
menu_is_visible(menu);
else
k_menu_items[items_num].is_visible = 1;
va_start(ap, fmt);
vsnprintf(k_menu_items[items_num].str,
sizeof(k_menu_items[items_num].str),
fmt, ap);
va_end(ap);
if (!k_menu_items[items_num].is_visible)
memcpy(k_menu_items[items_num].str, "XXX", 3);
curses_menu_items[items_num] = new_item(
k_menu_items[items_num].str,
k_menu_items[items_num].str);
set_item_userptr(curses_menu_items[items_num],
&k_menu_items[items_num]);
/*
if (!k_menu_items[items_num].is_visible)
item_opts_off(curses_menu_items[items_num], O_SELECTABLE);
*/
items_num++;
curses_menu_items[items_num] = NULL;
}
/* very hackish. adds a string to the last item added */
static void item_add_str(const char *fmt, ...)
{
va_list ap;
int index = items_num-1;
char new_str[256];
char tmp_str[256];
if (index < 0)
return;
va_start(ap, fmt);
vsnprintf(new_str, sizeof(new_str), fmt, ap);
va_end(ap);
snprintf(tmp_str, sizeof(tmp_str), "%s%s",
k_menu_items[index].str, new_str);
strncpy(k_menu_items[index].str,
tmp_str,
sizeof(k_menu_items[index].str));
free_item(curses_menu_items[index]);
curses_menu_items[index] = new_item(
k_menu_items[index].str,
k_menu_items[index].str);
set_item_userptr(curses_menu_items[index],
&k_menu_items[index]);
}
/* get the tag of the currently selected item */
static char item_tag(void)
{
ITEM *cur;
struct mitem *mcur;
cur = current_item(curses_menu);
if (cur == NULL)
return 0;
mcur = (struct mitem *) item_userptr(cur);
return mcur->tag;
}
static int curses_item_index(void)
{
return item_index(current_item(curses_menu));
}
static void *item_data(void)
{
ITEM *cur;
struct mitem *mcur;
cur = current_item(curses_menu);
if (!cur)
return NULL;
mcur = (struct mitem *) item_userptr(cur);
return mcur->usrptr;
}
static int item_is_tag(char tag)
{
return item_tag() == tag;
}
static char filename[PATH_MAX+1];
static char menu_backtitle[PATH_MAX+128];
static const char *set_config_filename(const char *config_filename)
{
int size;
size = snprintf(menu_backtitle, sizeof(menu_backtitle),
"%s - %s", config_filename, rootmenu.prompt->text);
if (size >= sizeof(menu_backtitle))
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
size = snprintf(filename, sizeof(filename), "%s", config_filename);
if (size >= sizeof(filename))
filename[sizeof(filename)-1] = '\0';
return menu_backtitle;
}
/* return = 0 means we are successful.
* -1 means go on doing what you were doing
*/
static int do_exit(void)
{
int res;
if (!conf_get_changed()) {
global_exit = 1;
return 0;
}
res = btn_dialog(main_window,
"Do you wish to save your new configuration?\n"
"<ESC> to cancel and resume nconfig.",
2,
" <save> ",
"<don't save>");
if (res == KEY_EXIT) {
global_exit = 0;
return -1;
}
/* if we got here, the user really wants to exit */
switch (res) {
case 0:
res = conf_write(filename);
if (res)
btn_dialog(
main_window,
"Error during writing of configuration.\n"
"Your configuration changes were NOT saved.",
1,
"<OK>");
conf_write_autoconf(0);
break;
default:
btn_dialog(
main_window,
"Your configuration changes were NOT saved.",
1,
"<OK>");
break;
}
global_exit = 1;
return 0;
}
static void search_conf(void)
{
struct symbol **sym_arr;
struct gstr res;
struct gstr title;
char *dialog_input;
int dres;
title = str_new();
str_printf( &title, "Enter (sub)string or regexp to search for "
"(with or without \"%s\")", CONFIG_);
again:
dres = dialog_inputbox(main_window,
"Search Configuration Parameter",
str_get(&title),
"", &dialog_input_result, &dialog_input_result_len);
switch (dres) {
case 0:
break;
case 1:
show_scroll_win(main_window,
"Search Configuration", search_help);
goto again;
default:
str_free(&title);
return;
}
/* strip the prefix if necessary */
dialog_input = dialog_input_result;
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
dialog_input += strlen(CONFIG_);
sym_arr = sym_re_search(dialog_input);
res = get_relations_str(sym_arr, NULL);
free(sym_arr);
show_scroll_win(main_window,
"Search Results", str_get(&res));
str_free(&res);
str_free(&title);
}
static void build_conf(struct menu *menu)
{
struct symbol *sym;
struct property *prop;
struct menu *child;
int type, tmp, doint = 2;
tristate val;
char ch;
if (!menu || (!show_all_items && !menu_is_visible(menu)))
return;
sym = menu->sym;
prop = menu->prompt;
if (!sym) {
if (prop && menu != current_menu) {
const char *prompt = menu_get_prompt(menu);
enum prop_type ptype;
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
switch (ptype) {
case P_MENU:
child_count++;
if (single_menu_mode) {
item_make(menu, 'm',
"%s%*c%s",
menu->data ? "-->" : "++>",
indent + 1, ' ', prompt);
} else
item_make(menu, 'm',
" %*c%s %s",
indent + 1, ' ', prompt,
menu_is_empty(menu) ? "----" : "--->");
if (single_menu_mode && menu->data)
goto conf_childs;
return;
case P_COMMENT:
if (prompt) {
child_count++;
item_make(menu, ':',
" %*c*** %s ***",
indent + 1, ' ',
prompt);
}
break;
default:
if (prompt) {
child_count++;
item_make(menu, ':', "---%*c%s",
indent + 1, ' ',
prompt);
}
}
} else
doint = 0;
goto conf_childs;
}
type = sym_get_type(sym);
if (sym_is_choice(sym)) {
struct symbol *def_sym = sym_get_choice_value(sym);
struct menu *def_menu = NULL;
child_count++;
for (child = menu->list; child; child = child->next) {
if (menu_is_visible(child) && child->sym == def_sym)
def_menu = child;
}
val = sym_get_tristate_value(sym);
if (sym_is_changeable(sym)) {
switch (type) {
case S_BOOLEAN:
item_make(menu, 't', "[%c]",
val == no ? ' ' : '*');
break;
case S_TRISTATE:
switch (val) {
case yes:
ch = '*';
break;
case mod:
ch = 'M';
break;
default:
ch = ' ';
break;
}
item_make(menu, 't', "<%c>", ch);
break;
}
} else {
item_make(menu, def_menu ? 't' : ':', " ");
}
item_add_str("%*c%s", indent + 1,
' ', menu_get_prompt(menu));
if (val == yes) {
if (def_menu) {
item_add_str(" (%s)",
menu_get_prompt(def_menu));
item_add_str(" --->");
if (def_menu->list) {
indent += 2;
build_conf(def_menu);
indent -= 2;
}
}
return;
}
} else {
if (menu == current_menu) {
item_make(menu, ':',
"---%*c%s", indent + 1,
' ', menu_get_prompt(menu));
goto conf_childs;
}
child_count++;
val = sym_get_tristate_value(sym);
if (sym_is_choice_value(sym) && val == yes) {
item_make(menu, ':', " ");
} else {
switch (type) {
case S_BOOLEAN:
if (sym_is_changeable(sym))
item_make(menu, 't', "[%c]",
val == no ? ' ' : '*');
else
item_make(menu, 't', "-%c-",
val == no ? ' ' : '*');
break;
case S_TRISTATE:
switch (val) {
case yes:
ch = '*';
break;
case mod:
ch = 'M';
break;
default:
ch = ' ';
break;
}
if (sym_is_changeable(sym)) {
if (sym->rev_dep.tri == mod)
item_make(menu,
't', "{%c}", ch);
else
item_make(menu,
't', "<%c>", ch);
} else
item_make(menu, 't', "-%c-", ch);
break;
default:
tmp = 2 + strlen(sym_get_string_value(sym));
item_make(menu, 's', " (%s)",
sym_get_string_value(sym));
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ',
menu_get_prompt(menu),
(sym_has_value(sym) ||
!sym_is_changeable(sym)) ? "" :
" (NEW)");
goto conf_childs;
}
}
item_add_str("%*c%s%s", indent + 1, ' ',
menu_get_prompt(menu),
(sym_has_value(sym) || !sym_is_changeable(sym)) ?
"" : " (NEW)");
if (menu->prompt && menu->prompt->type == P_MENU) {
item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->");
return;
}
}
conf_childs:
indent += doint;
for (child = menu->list; child; child = child->next)
build_conf(child);
indent -= doint;
}
static void reset_menu(void)
{
unpost_menu(curses_menu);
clean_items();
}
/* adjust the menu to show this item.
* prefer not to scroll the menu if possible*/
static void center_item(int selected_index, int *last_top_row)
{
int toprow;
set_top_row(curses_menu, *last_top_row);
toprow = top_row(curses_menu);
if (selected_index < toprow ||
selected_index >= toprow+mwin_max_lines) {
toprow = max(selected_index-mwin_max_lines/2, 0);
if (toprow >= item_count(curses_menu)-mwin_max_lines)
toprow = item_count(curses_menu)-mwin_max_lines;
set_top_row(curses_menu, toprow);
}
set_current_item(curses_menu,
curses_menu_items[selected_index]);
*last_top_row = toprow;
post_menu(curses_menu);
refresh_all_windows(main_window);
}
/* this function assumes reset_menu has been called before */
static void show_menu(const char *prompt, const char *instructions,
int selected_index, int *last_top_row)
{
int maxx, maxy;
WINDOW *menu_window;
current_instructions = instructions;
clear();
(void) wattrset(main_window, attributes[NORMAL]);
print_in_middle(stdscr, 1, 0, getmaxx(stdscr),
menu_backtitle,
attributes[MAIN_HEADING]);
(void) wattrset(main_window, attributes[MAIN_MENU_BOX]);
box(main_window, 0, 0);
(void) wattrset(main_window, attributes[MAIN_MENU_HEADING]);
mvwprintw(main_window, 0, 3, " %s ", prompt);
(void) wattrset(main_window, attributes[NORMAL]);
set_menu_items(curses_menu, curses_menu_items);
/* position the menu at the middle of the screen */
scale_menu(curses_menu, &maxy, &maxx);
maxx = min(maxx, mwin_max_cols-2);
maxy = mwin_max_lines;
menu_window = derwin(main_window,
maxy,
maxx,
2,
(mwin_max_cols-maxx)/2);
keypad(menu_window, TRUE);
set_menu_win(curses_menu, menu_window);
set_menu_sub(curses_menu, menu_window);
/* must reassert this after changing items, otherwise returns to a
* default of 16
*/
set_menu_format(curses_menu, maxy, 1);
center_item(selected_index, last_top_row);
set_menu_format(curses_menu, maxy, 1);
print_function_line();
/* Post the menu */
post_menu(curses_menu);
refresh_all_windows(main_window);
}
static void adj_match_dir(match_f *match_direction)
{
if (*match_direction == FIND_NEXT_MATCH_DOWN)
*match_direction =
MATCH_TINKER_PATTERN_DOWN;
else if (*match_direction == FIND_NEXT_MATCH_UP)
*match_direction =
MATCH_TINKER_PATTERN_UP;
/* else, do no change.. */
}
struct match_state
{
int in_search;
match_f match_direction;
char pattern[256];
};
/* Return 0 means I have handled the key. In such a case, ans should hold the
* item to center, or -1 otherwise.
* Else return -1 .
*/
static int do_match(int key, struct match_state *state, int *ans)
{
char c = (char) key;
int terminate_search = 0;
*ans = -1;
if (key == '/' || (state->in_search && key == 27)) {
move(0, 0);
refresh();
clrtoeol();
state->in_search = 1-state->in_search;
bzero(state->pattern, sizeof(state->pattern));
state->match_direction = MATCH_TINKER_PATTERN_DOWN;
return 0;
} else if (!state->in_search)
return 1;
if (isalnum(c) || isgraph(c) || c == ' ') {
state->pattern[strlen(state->pattern)] = c;
state->pattern[strlen(state->pattern)] = '\0';
adj_match_dir(&state->match_direction);
*ans = get_mext_match(state->pattern,
state->match_direction);
} else if (key == KEY_DOWN) {
state->match_direction = FIND_NEXT_MATCH_DOWN;
*ans = get_mext_match(state->pattern,
state->match_direction);
} else if (key == KEY_UP) {
state->match_direction = FIND_NEXT_MATCH_UP;
*ans = get_mext_match(state->pattern,
state->match_direction);
} else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
state->pattern[strlen(state->pattern)-1] = '\0';
adj_match_dir(&state->match_direction);
} else
terminate_search = 1;
if (terminate_search) {
state->in_search = 0;
bzero(state->pattern, sizeof(state->pattern));
move(0, 0);
refresh();
clrtoeol();
return -1;
}
return 0;
}
static void conf(struct menu *menu)
{
struct menu *submenu = NULL;
const char *prompt = menu_get_prompt(menu);
struct symbol *sym;
int res;
int current_index = 0;
int last_top_row = 0;
struct match_state match_state = {
.in_search = 0,
.match_direction = MATCH_TINKER_PATTERN_DOWN,
.pattern = "",
};
while (!global_exit) {
reset_menu();
current_menu = menu;
build_conf(menu);
if (!child_count)
break;
show_menu(prompt ? prompt : "Main Menu",
menu_instructions,
current_index, &last_top_row);
keypad((menu_win(curses_menu)), TRUE);
while (!global_exit) {
if (match_state.in_search) {
mvprintw(0, 0,
"searching: %s", match_state.pattern);
clrtoeol();
}
refresh_all_windows(main_window);
res = wgetch(menu_win(curses_menu));
if (!res)
break;
if (do_match(res, &match_state, ¤t_index) == 0) {
if (current_index != -1)
center_item(current_index,
&last_top_row);
continue;
}
if (process_special_keys(&res,
(struct menu *) item_data()))
break;
switch (res) {
case KEY_DOWN:
menu_driver(curses_menu, REQ_DOWN_ITEM);
break;
case KEY_UP:
menu_driver(curses_menu, REQ_UP_ITEM);
break;
case KEY_NPAGE:
menu_driver(curses_menu, REQ_SCR_DPAGE);
break;
case KEY_PPAGE:
menu_driver(curses_menu, REQ_SCR_UPAGE);
break;
case KEY_HOME:
menu_driver(curses_menu, REQ_FIRST_ITEM);
break;
case KEY_END:
menu_driver(curses_menu, REQ_LAST_ITEM);
break;
case 'h':
case '?':
show_help((struct menu *) item_data());
break;
}
if (res == 10 || res == 27 ||
res == 32 || res == 'n' || res == 'y' ||
res == KEY_LEFT || res == KEY_RIGHT ||
res == 'm')
break;
refresh_all_windows(main_window);
}
refresh_all_windows(main_window);
/* if ESC or left*/
if (res == 27 || (menu != &rootmenu && res == KEY_LEFT))
break;
/* remember location in the menu */
last_top_row = top_row(curses_menu);
current_index = curses_item_index();
if (!item_tag())
continue;
submenu = (struct menu *) item_data();
if (!submenu || !menu_is_visible(submenu))
continue;
sym = submenu->sym;
switch (res) {
case ' ':
if (item_is_tag('t'))
sym_toggle_tristate_value(sym);
else if (item_is_tag('m'))
conf(submenu);
break;
case KEY_RIGHT:
case 10: /* ENTER WAS PRESSED */
switch (item_tag()) {
case 'm':
if (single_menu_mode)
submenu->data =
(void *) (long) !submenu->data;
else
conf(submenu);
break;
case 't':
if (sym_is_choice(sym) &&
sym_get_tristate_value(sym) == yes)
conf_choice(submenu);
else if (submenu->prompt &&
submenu->prompt->type == P_MENU)
conf(submenu);
else if (res == 10)
sym_toggle_tristate_value(sym);
break;
case 's':
conf_string(submenu);
break;
}
break;
case 'y':
if (item_is_tag('t')) {
if (sym_set_tristate_value(sym, yes))
break;
if (sym_set_tristate_value(sym, mod))
btn_dialog(main_window, setmod_text, 0);
}
break;
case 'n':
if (item_is_tag('t'))
sym_set_tristate_value(sym, no);
break;
case 'm':
if (item_is_tag('t'))
sym_set_tristate_value(sym, mod);
break;
}
}
}
static void conf_message_callback(const char *s)
{
btn_dialog(main_window, s, 1, "<OK>");
}
static void show_help(struct menu *menu)
{
struct gstr help;
if (!menu)
return;
help = str_new();
menu_get_ext_help(menu, &help);
show_scroll_win(main_window, menu_get_prompt(menu), str_get(&help));
str_free(&help);
}
static void conf_choice(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
struct menu *child = NULL;
struct symbol *active;
int selected_index = 0;
int last_top_row = 0;
int res, i = 0;
struct match_state match_state = {
.in_search = 0,
.match_direction = MATCH_TINKER_PATTERN_DOWN,
.pattern = "",
};
active = sym_get_choice_value(menu->sym);
/* this is mostly duplicated from the conf() function. */
while (!global_exit) {
reset_menu();
for (i = 0, child = menu->list; child; child = child->next) {
if (!show_all_items && !menu_is_visible(child))
continue;
if (child->sym == sym_get_choice_value(menu->sym))
item_make(child, ':', "<X> %s",
menu_get_prompt(child));
else if (child->sym)
item_make(child, ':', " %s",
menu_get_prompt(child));
else
item_make(child, ':', "*** %s ***",
menu_get_prompt(child));
if (child->sym == active){
last_top_row = top_row(curses_menu);
selected_index = i;
}
i++;
}
show_menu(prompt ? prompt : "Choice Menu",
radiolist_instructions,
selected_index,
&last_top_row);
while (!global_exit) {
if (match_state.in_search) {
mvprintw(0, 0, "searching: %s",
match_state.pattern);
clrtoeol();
}
refresh_all_windows(main_window);
res = wgetch(menu_win(curses_menu));
if (!res)
break;
if (do_match(res, &match_state, &selected_index) == 0) {
if (selected_index != -1)
center_item(selected_index,
&last_top_row);
continue;
}
if (process_special_keys(
&res,
(struct menu *) item_data()))
break;
switch (res) {
case KEY_DOWN:
menu_driver(curses_menu, REQ_DOWN_ITEM);
break;
case KEY_UP:
menu_driver(curses_menu, REQ_UP_ITEM);
break;
case KEY_NPAGE:
menu_driver(curses_menu, REQ_SCR_DPAGE);
break;
case KEY_PPAGE:
menu_driver(curses_menu, REQ_SCR_UPAGE);
break;
case KEY_HOME:
menu_driver(curses_menu, REQ_FIRST_ITEM);
break;
case KEY_END:
menu_driver(curses_menu, REQ_LAST_ITEM);
break;
case 'h':
case '?':
show_help((struct menu *) item_data());
break;
}
if (res == 10 || res == 27 || res == ' ' ||
res == KEY_LEFT){
break;
}
refresh_all_windows(main_window);
}
/* if ESC or left */
if (res == 27 || res == KEY_LEFT)
break;
child = item_data();
if (!child || !menu_is_visible(child) || !child->sym)
continue;
switch (res) {
case ' ':
case 10:
case KEY_RIGHT:
sym_set_tristate_value(child->sym, yes);
return;
case 'h':
case '?':
show_help(child);
active = child->sym;
break;
case KEY_EXIT:
return;
}
}
}
static void conf_string(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
while (1) {
int res;
const char *heading;
switch (sym_get_type(menu->sym)) {
case S_INT:
heading = inputbox_instructions_int;
break;
case S_HEX:
heading = inputbox_instructions_hex;
break;
case S_STRING:
heading = inputbox_instructions_string;
break;
default:
heading = "Internal nconf error!";
}
res = dialog_inputbox(main_window,
prompt ? prompt : "Main Menu",
heading,
sym_get_string_value(menu->sym),
&dialog_input_result,
&dialog_input_result_len);
switch (res) {
case 0:
if (sym_set_string_value(menu->sym,
dialog_input_result))
return;
btn_dialog(main_window,
"You have made an invalid entry.", 0);
break;
case 1:
show_help(menu);
break;
case KEY_EXIT:
return;
}
}
}
static void conf_load(void)
{
while (1) {
int res;
res = dialog_inputbox(main_window,
NULL, load_config_text,
filename,
&dialog_input_result,
&dialog_input_result_len);
switch (res) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_read(dialog_input_result)) {
set_config_filename(dialog_input_result);
sym_set_change_count(1);
return;
}
btn_dialog(main_window, "File does not exist!", 0);
break;
case 1:
show_scroll_win(main_window,
"Load Alternate Configuration",
load_config_help);
break;
case KEY_EXIT:
return;
}
}
}
static void conf_save(void)
{
while (1) {
int res;
res = dialog_inputbox(main_window,
NULL, save_config_text,
filename,
&dialog_input_result,
&dialog_input_result_len);
switch (res) {
case 0:
if (!dialog_input_result[0])
return;
res = conf_write(dialog_input_result);
if (!res) {
set_config_filename(dialog_input_result);
return;
}
btn_dialog(main_window, "Can't create file!",
1, "<OK>");
break;
case 1:
show_scroll_win(main_window,
"Save Alternate Configuration",
save_config_help);
break;
case KEY_EXIT:
return;
}
}
}
static void setup_windows(void)
{
int lines, columns;
getmaxyx(stdscr, lines, columns);
if (main_window != NULL)
delwin(main_window);
/* set up the menu and menu window */
main_window = newwin(lines-2, columns-2, 2, 1);
keypad(main_window, TRUE);
mwin_max_lines = lines-7;
mwin_max_cols = columns-6;
/* panels order is from bottom to top */
new_panel(main_window);
}
int main(int ac, char **av)
{
int lines, columns;
char *mode;
if (ac > 1 && strcmp(av[1], "-s") == 0) {
/* Silence conf_read() until the real callback is set up */
conf_set_message_callback(NULL);
av++;
}
conf_parse(av[1]);
conf_read(NULL);
mode = getenv("NCONFIG_MODE");
if (mode) {
if (!strcasecmp(mode, "single_menu"))
single_menu_mode = 1;
}
/* Initialize curses */
initscr();
/* set color theme */
set_colors();
cbreak();
noecho();
keypad(stdscr, TRUE);
curs_set(0);
getmaxyx(stdscr, lines, columns);
if (columns < 75 || lines < 20) {
endwin();
printf("Your terminal should have at "
"least 20 lines and 75 columns\n");
return 1;
}
notimeout(stdscr, FALSE);
#if NCURSES_REENTRANT
set_escdelay(1);
#else
ESCDELAY = 1;
#endif
/* set btns menu */
curses_menu = new_menu(curses_menu_items);
menu_opts_off(curses_menu, O_SHOWDESC);
menu_opts_on(curses_menu, O_SHOWMATCH);
menu_opts_on(curses_menu, O_ONEVALUE);
menu_opts_on(curses_menu, O_NONCYCLIC);
menu_opts_on(curses_menu, O_IGNORECASE);
set_menu_mark(curses_menu, " ");
set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]);
set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]);
set_menu_grey(curses_menu, attributes[MAIN_MENU_GREY]);
set_config_filename(conf_get_configname());
setup_windows();
/* check for KEY_FUNC(1) */
if (has_key(KEY_F(1)) == FALSE) {
show_scroll_win(main_window,
"Instructions",
menu_no_f_instructions);
}
conf_set_message_callback(conf_message_callback);
/* do the work */
while (!global_exit) {
conf(&rootmenu);
if (!global_exit && do_exit() == 0)
break;
}
/* ok, we are done */
unpost_menu(curses_menu);
free_menu(curses_menu);
delwin(main_window);
clear();
refresh();
endwin();
return 0;
}
================================================
FILE: 3rdparty/kconfig/nconf.gui.c
================================================
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
*
* Derived from menuconfig.
*/
#include "nconf.h"
#include "lkc.h"
/* a list of all the different widgets we use */
attributes_t attributes[ATTR_MAX+1] = {0};
/* available colors:
COLOR_BLACK 0
COLOR_RED 1
COLOR_GREEN 2
COLOR_YELLOW 3
COLOR_BLUE 4
COLOR_MAGENTA 5
COLOR_CYAN 6
COLOR_WHITE 7
*/
static void set_normal_colors(void)
{
init_pair(NORMAL, -1, -1);
init_pair(MAIN_HEADING, COLOR_MAGENTA, -1);
/* FORE is for the selected item */
init_pair(MAIN_MENU_FORE, -1, -1);
/* BACK for all the rest */
init_pair(MAIN_MENU_BACK, -1, -1);
init_pair(MAIN_MENU_GREY, -1, -1);
init_pair(MAIN_MENU_HEADING, COLOR_GREEN, -1);
init_pair(MAIN_MENU_BOX, COLOR_YELLOW, -1);
init_pair(SCROLLWIN_TEXT, -1, -1);
init_pair(SCROLLWIN_HEADING, COLOR_GREEN, -1);
init_pair(SCROLLWIN_BOX, COLOR_YELLOW, -1);
init_pair(DIALOG_TEXT, -1, -1);
init_pair(DIALOG_BOX, COLOR_YELLOW, -1);
init_pair(DIALOG_MENU_BACK, COLOR_YELLOW, -1);
init_pair(DIALOG_MENU_FORE, COLOR_RED, -1);
init_pair(INPUT_BOX, COLOR_YELLOW, -1);
init_pair(INPUT_HEADING, COLOR_GREEN, -1);
init_pair(INPUT_TEXT, -1, -1);
init_pair(INPUT_FIELD, -1, -1);
init_pair(FUNCTION_HIGHLIGHT, -1, -1);
init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
}
/* available attributes:
A_NORMAL Normal display (no highlight)
A_STANDOUT
gitextract_cf7sbcuk/
├── .gitignore
├── .travis.yml
├── .uncrustify
├── 3rdparty/
│ ├── Makefile
│ └── kconfig/
│ ├── Makefile
│ ├── conf.c
│ ├── confdata.c
│ ├── expr.c
│ ├── expr.h
│ ├── lexer.l
│ ├── list.h
│ ├── lkc.h
│ ├── lkc_proto.h
│ ├── menu.c
│ ├── nconf-cfg.sh
│ ├── nconf.c
│ ├── nconf.gui.c
│ ├── nconf.h
│ ├── parser.y
│ ├── preprocess.c
│ ├── symbol.c
│ └── util.c
├── CONTRIBUTING.md
├── Doxyfile
├── Kconfig
├── LICENSE.md
├── Makefile
├── README.md
├── arch/
│ ├── Kconfig
│ ├── Makefile
│ └── or1k/
│ ├── Makefile
│ ├── counter.c
│ ├── exception.c
│ ├── include/
│ │ ├── asm/
│ │ │ ├── exception.h
│ │ │ └── spr.h
│ │ ├── exception.h
│ │ ├── spr.h
│ │ └── trap.h
│ ├── math.S
│ ├── runtime.S
│ ├── scp.ld.S
│ └── start.S
├── common/
│ ├── Kconfig
│ ├── Makefile
│ ├── debug/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── battery.c
│ │ ├── dram.c
│ │ ├── latency.c
│ │ ├── monitor.c
│ │ ├── sprs.c
│ │ └── steps.c
│ ├── debug.c
│ ├── delay.c
│ ├── device.c
│ ├── regulator_list.c
│ ├── scpi.c
│ ├── scpi_cmds.c
│ ├── simple_device.c
│ ├── system.c
│ └── timeout.c
├── configs/
│ ├── a64-olinuxino-emmc_defconfig
│ ├── a64-olinuxino_defconfig
│ ├── bananapi_m2_plus_h3_defconfig
│ ├── beelink_gs1_defconfig
│ ├── beelink_x2_defconfig
│ ├── defconfig
│ ├── libretech_all_h3_cc_h3_defconfig
│ ├── libretech_all_h3_cc_h5_defconfig
│ ├── nanopi_a64_defconfig
│ ├── nanopi_m1_defconfig
│ ├── nanopi_m1_plus_defconfig
│ ├── orangepi_2_defconfig
│ ├── orangepi_3_defconfig
│ ├── orangepi_lite_defconfig
│ ├── orangepi_one_defconfig
│ ├── orangepi_pc2_defconfig
│ ├── orangepi_pc_defconfig
│ ├── orangepi_pc_plus_defconfig
│ ├── orangepi_plus2e_defconfig
│ ├── orangepi_plus_defconfig
│ ├── orangepi_win_defconfig
│ ├── orangepi_zero_defconfig
│ ├── orangepi_zero_plus_defconfig
│ ├── pine64-lts_defconfig
│ ├── pine64_plus_defconfig
│ ├── pine_h64_defconfig
│ ├── pinebook_defconfig
│ ├── pinephone_defconfig
│ ├── pinetab_defconfig
│ ├── tanix_tx6_defconfig
│ ├── tbs_a711_defconfig
│ └── teres_i_defconfig
├── docs/
│ ├── abi.md
│ ├── code_of_conduct.md
│ ├── issue_template.md
│ └── pull_request_template.md
├── drivers/
│ ├── Kconfig
│ ├── Makefile
│ ├── cec/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── cec.c
│ │ └── dw-hdmi-cec.c
│ ├── cir/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── cir.c
│ │ ├── cir.h
│ │ ├── nec.c
│ │ ├── rc6.c
│ │ └── sunxi-cir.c
│ ├── clock/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── ccu.c
│ │ ├── ccu.h
│ │ ├── ccu_helpers.c
│ │ ├── clock.c
│ │ ├── clock.h
│ │ ├── r_ccu_common.c
│ │ ├── sun50i-a64-ccu.c
│ │ ├── sun50i-h6-ccu.c
│ │ ├── sun50i-h6-r-ccu.c
│ │ ├── sun8i-a23-ccu.c
│ │ ├── sun8i-a83t-ccu.c
│ │ ├── sun8i-h3-ccu.c
│ │ └── sun8i-r-ccu.c
│ ├── counter/
│ │ ├── Makefile
│ │ ├── sun6i-a31-cnt64.c
│ │ └── sun9i-a80-timestamp.c
│ ├── css/
│ │ ├── Makefile
│ │ ├── css.c
│ │ ├── css.h
│ │ ├── css_default.c
│ │ ├── css_helpers.c
│ │ ├── css_power_state.c
│ │ ├── sun50i-a64-css.c
│ │ ├── sun50i-h6-css.c
│ │ └── sun6i-a31-css.c
│ ├── dram/
│ │ ├── Makefile
│ │ ├── dram.c
│ │ ├── sun50i-h6-dram.c
│ │ └── sun8i-h3-dram.c
│ ├── gpio/
│ │ ├── Makefile
│ │ ├── gpio.c
│ │ ├── gpio.h
│ │ └── sunxi-gpio.c
│ ├── irq/
│ │ ├── Makefile
│ │ ├── irq.c
│ │ └── sun6i-a31-r-intc.c
│ ├── mfd/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ └── axp20x.c
│ ├── msgbox/
│ │ ├── Makefile
│ │ ├── msgbox.c
│ │ ├── msgbox.h
│ │ └── sunxi-msgbox.c
│ ├── pmic/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── axp20x.c
│ │ ├── axp20x.h
│ │ ├── axp223.c
│ │ ├── axp803.c
│ │ ├── axp805.c
│ │ ├── pmic.c
│ │ └── pmic.h
│ ├── regmap/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── regmap-i2c.c
│ │ ├── regmap-i2c.h
│ │ ├── regmap.c
│ │ ├── regmap.h
│ │ ├── sun6i-i2c.c
│ │ └── sunxi-rsb.c
│ ├── regulator/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── axp20x.c
│ │ ├── axp20x.h
│ │ ├── axp221.c
│ │ ├── axp803.c
│ │ ├── axp805.c
│ │ ├── gpio.c
│ │ ├── regulator.c
│ │ ├── regulator.h
│ │ └── sy8106a.c
│ ├── serial/
│ │ ├── Kconfig
│ │ ├── Makefile
│ │ ├── serial.c
│ │ ├── sun50i-a64-uart.c
│ │ ├── sun50i-h6-uart.c
│ │ ├── sun8i-a23-uart.c
│ │ ├── sun8i-a83t-uart.c
│ │ ├── sun8i-h3-uart.c
│ │ ├── uart.c
│ │ └── uart.h
│ └── watchdog/
│ ├── Kconfig
│ ├── Makefile
│ ├── sun6i-a31-wdt.c
│ ├── sun9i-a80-twd.c
│ ├── watchdog.c
│ └── watchdog.h
├── include/
│ ├── common/
│ │ ├── debug.h
│ │ ├── delay.h
│ │ ├── device.h
│ │ ├── regulator_list.h
│ │ ├── scpi.h
│ │ ├── simple_device.h
│ │ ├── steps.h
│ │ ├── system.h
│ │ └── timeout.h
│ ├── drivers/
│ │ ├── cec/
│ │ │ └── dw-hdmi-cec.h
│ │ ├── cec.h
│ │ ├── cir/
│ │ │ └── sunxi-cir.h
│ │ ├── cir.h
│ │ ├── clock/
│ │ │ ├── ccu.h
│ │ │ ├── sun50i-a64-ccu.h
│ │ │ ├── sun50i-h6-ccu.h
│ │ │ ├── sun50i-h6-r-ccu.h
│ │ │ ├── sun8i-a23-ccu.h
│ │ │ ├── sun8i-a83t-ccu.h
│ │ │ ├── sun8i-h3-ccu.h
│ │ │ └── sun8i-r-ccu.h
│ │ ├── clock.h
│ │ ├── counter.h
│ │ ├── css.h
│ │ ├── dram.h
│ │ ├── gpio/
│ │ │ └── sunxi-gpio.h
│ │ ├── gpio.h
│ │ ├── irq.h
│ │ ├── mfd/
│ │ │ └── axp20x.h
│ │ ├── msgbox/
│ │ │ └── sunxi-msgbox.h
│ │ ├── msgbox.h
│ │ ├── pmic/
│ │ │ ├── axp20x.h
│ │ │ ├── axp223.h
│ │ │ ├── axp803.h
│ │ │ └── axp805.h
│ │ ├── pmic.h
│ │ ├── regmap/
│ │ │ ├── sun6i-i2c.h
│ │ │ └── sunxi-rsb.h
│ │ ├── regmap.h
│ │ ├── regulator/
│ │ │ ├── axp20x.h
│ │ │ ├── axp221.h
│ │ │ ├── axp803.h
│ │ │ ├── axp805.h
│ │ │ ├── gpio.h
│ │ │ └── sy8106a.h
│ │ ├── regulator.h
│ │ ├── serial.h
│ │ ├── watchdog/
│ │ │ ├── sun6i-a31-wdt.h
│ │ │ └── sun9i-a80-twd.h
│ │ └── watchdog.h
│ ├── lib/
│ │ ├── bitfield.h
│ │ ├── bitmap.h
│ │ ├── byteswap.h
│ │ ├── compiler.h
│ │ ├── division.h
│ │ ├── error.h
│ │ ├── intrusive.h
│ │ ├── kconfig.h
│ │ ├── macros.S
│ │ ├── mmio.h
│ │ ├── scpi_protocol.h
│ │ └── util.h
│ └── stdlib/
│ ├── ctype.h
│ ├── limits.h
│ ├── stdarg.h
│ ├── stdbool.h
│ ├── stddef.h
│ └── stdint.h
├── lib/
│ ├── Makefile
│ └── bitfield.c
├── platform/
│ ├── Kconfig
│ ├── a23/
│ │ ├── Kconfig
│ │ └── include/
│ │ └── platform/
│ │ ├── cpucfg.h
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ ├── a64/
│ │ ├── Kconfig
│ │ └── include/
│ │ └── platform/
│ │ ├── cpucfg.h
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ ├── a83t/
│ │ └── include/
│ │ └── platform/
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ ├── h3/
│ │ └── include/
│ │ └── platform/
│ │ ├── cpucfg.h
│ │ ├── css.h
│ │ ├── devices.h
│ │ ├── irq.h
│ │ ├── memory.h
│ │ ├── prcm.h
│ │ └── time.h
│ └── h6/
│ └── include/
│ └── platform/
│ ├── cpucfg.h
│ ├── css.h
│ ├── devices.h
│ ├── irq.h
│ ├── memory.h
│ ├── prcm.h
│ └── time.h
├── scripts/
│ ├── Makefile.format
│ ├── Makefile.kbuild
│ ├── test.sh
│ └── version.sh
└── tools/
├── Makefile
├── load.c
└── test.c
SYMBOL INDEX (1179 symbols across 156 files)
FILE: 3rdparty/kconfig/conf.c
type menu (line 20) | struct menu
type menu (line 21) | struct menu
type input_mode (line 23) | enum input_mode {
type input_mode (line 40) | enum input_mode
type menu (line 47) | struct menu
function print_help (line 49) | static void print_help(struct menu *menu)
function strip (line 59) | static void strip(char *str)
function xfgets (line 77) | static void xfgets(char *str, int size, FILE *in)
function conf_askvalue (line 86) | static int conf_askvalue(struct symbol *sym, const char *def)
function conf_string (line 132) | static int conf_string(struct menu *menu)
function conf_sym (line 165) | static int conf_sym(struct menu *menu)
function conf_choice (line 232) | static int conf_choice(struct menu *menu)
function conf (line 347) | static void conf(struct menu *menu)
function check_conf (line 414) | static void check_conf(struct menu *menu)
type option (line 458) | struct option
function conf_usage (line 477) | static void conf_usage(const char *progname)
function main (line 500) | int main(int ac, char **av)
FILE: 3rdparty/kconfig/confdata.c
function is_present (line 22) | static bool is_present(const char *path)
function is_dir (line 30) | static bool is_dir(const char *path)
function is_same (line 41) | static bool is_same(const char *file1, const char *file2)
function make_parent_dir (line 91) | static int make_parent_dir(const char *path)
function conf_touch_dep (line 129) | static int conf_touch_dep(const char *name)
type conf_printer (line 166) | struct conf_printer {
function conf_warning (line 180) | static void conf_warning(const char *fmt, ...)
function conf_default_message_callback (line 191) | static void conf_default_message_callback(const char *s)
function conf_set_message_callback (line 200) | void conf_set_message_callback(void (*fn)(const char *s))
function conf_message (line 205) | static void conf_message(const char *fmt, ...)
function conf_set_sym_val (line 234) | static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, ...
function add_byte (line 296) | static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
function compat_getline (line 316) | static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream)
function conf_read_simple (line 350) | int conf_read_simple(const char *name, int def)
function conf_read (line 513) | int conf_read(const char *name)
function kconfig_print_symbol (line 590) | static void
function kconfig_print_comment (line 613) | static void
type conf_printer (line 633) | struct conf_printer
function header_print_symbol (line 644) | static void
function header_print_comment (line 685) | static void
type conf_printer (line 707) | struct conf_printer
function conf_write_symbol (line 713) | static void conf_write_symbol(FILE *fp, struct symbol *sym,
function conf_write_heading (line 733) | static void
function conf_write_defconfig (line 751) | int conf_write_defconfig(const char *filename)
function conf_write (line 824) | int conf_write(const char *name)
function conf_write_dep (line 940) | static int conf_write_dep(const char *name)
function conf_touch_deps (line 969) | static int conf_touch_deps(void)
function conf_write_autoconf (line 1044) | int conf_write_autoconf(int overwrite)
function sym_set_change_count (line 1110) | void sym_set_change_count(int count)
function sym_add_change_count (line 1119) | void sym_add_change_count(int count)
function conf_get_changed (line 1124) | bool conf_get_changed(void)
function conf_set_changed_callback (line 1129) | void conf_set_changed_callback(void (*fn)(void))
function randomize_choice_values (line 1134) | static bool randomize_choice_values(struct symbol *csym)
function set_all_choice_values (line 1182) | void set_all_choice_values(struct symbol *csym)
function conf_set_all_new_symbols (line 1202) | bool conf_set_all_new_symbols(enum conf_def_mode mode)
function conf_rewrite_mod_or_yes (line 1330) | void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
FILE: 3rdparty/kconfig/expr.c
type expr (line 16) | struct expr
type expr (line 16) | struct expr
type expr (line 18) | struct expr
type symbol (line 18) | struct symbol
type expr (line 20) | struct expr
type expr (line 26) | struct expr
type expr_type (line 26) | enum expr_type
type expr (line 26) | struct expr
type expr (line 28) | struct expr
type expr (line 34) | struct expr
type expr_type (line 34) | enum expr_type
type expr (line 34) | struct expr
type expr (line 34) | struct expr
type expr (line 36) | struct expr
type expr (line 43) | struct expr
type expr_type (line 43) | enum expr_type
type symbol (line 43) | struct symbol
type symbol (line 43) | struct symbol
type expr (line 45) | struct expr
type expr (line 52) | struct expr
type expr (line 52) | struct expr
type expr (line 52) | struct expr
type expr (line 59) | struct expr
type expr (line 59) | struct expr
type expr (line 59) | struct expr
type expr (line 66) | struct expr
type expr (line 66) | struct expr
type expr (line 68) | struct expr
function expr_free (line 107) | void expr_free(struct expr *e)
function __expr_eliminate_eq (line 150) | static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, ...
function expr_eliminate_eq (line 221) | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
function expr_eq (line 252) | int expr_eq(struct expr *e1, struct expr *e2)
type expr (line 316) | struct expr
type expr (line 316) | struct expr
type expr (line 318) | struct expr
type expr (line 402) | struct expr
type expr (line 402) | struct expr
type expr (line 431) | struct expr
type expr (line 431) | struct expr
type expr (line 431) | struct expr
type expr (line 433) | struct expr
type symbol (line 434) | struct symbol
type expr (line 495) | struct expr
type expr (line 495) | struct expr
type expr (line 495) | struct expr
type expr (line 497) | struct expr
type symbol (line 498) | struct symbol
function expr_eliminate_dups1 (line 596) | static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1,...
type expr (line 664) | struct expr
type expr (line 664) | struct expr
type expr (line 694) | struct expr
type expr (line 694) | struct expr
type expr (line 696) | struct expr
function expr_contains_symbol (line 851) | int expr_contains_symbol(struct expr *dep, struct symbol *sym)
function expr_depends_symbol (line 879) | bool expr_depends_symbol(struct expr *dep, struct symbol *sym)
type expr (line 922) | struct expr
type expr (line 922) | struct expr
type expr_type (line 922) | enum expr_type
type symbol (line 922) | struct symbol
type expr (line 924) | struct expr
type string_value_kind (line 987) | enum string_value_kind {
function expr_parse_string (line 998) | static enum string_value_kind expr_parse_string(const char *str,
function tristate (line 1030) | tristate expr_calc_value(struct expr *e)
function expr_compare_type (line 1104) | static int expr_compare_type(enum expr_type t1, enum expr_type t2)
function expr_print (line 1138) | void expr_print(struct expr *e,
function expr_print_file_helper (line 1230) | static void expr_print_file_helper(void *data, struct symbol *sym, const...
function expr_fprint (line 1235) | void expr_fprint(struct expr *e, FILE *out)
function expr_print_gstr_helper (line 1240) | static void expr_print_gstr_helper(void *data, struct symbol *sym, const...
function expr_gstr_print (line 1270) | void expr_gstr_print(struct expr *e, struct gstr *gs)
function expr_print_revdep (line 1280) | static void expr_print_revdep(struct expr *e,
function expr_gstr_print_revdep (line 1299) | void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
FILE: 3rdparty/kconfig/expr.h
type file (line 20) | struct file {
type tristate (line 27) | typedef enum tristate {
type expr_type (line 31) | enum expr_type {
type expr (line 38) | struct expr
type symbol (line 39) | struct symbol
type expr (line 42) | struct expr {
type expr_value (line 54) | struct expr_value {
type symbol_value (line 59) | struct symbol_value {
type symbol_type (line 64) | enum symbol_type {
type symbol (line 83) | struct symbol {
type prop_type (line 179) | enum prop_type {
type property (line 192) | struct property {
type menu (line 220) | struct menu {
type jump_key (line 277) | struct jump_key {
type file (line 286) | struct file
type file (line 287) | struct file
type file (line 288) | struct file
type symbol (line 290) | struct symbol
type symbol (line 291) | struct symbol
type symbol (line 292) | struct symbol
type expr (line 294) | struct expr
type symbol (line 294) | struct symbol
type expr (line 295) | struct expr
type expr_type (line 295) | enum expr_type
type expr (line 295) | struct expr
type expr (line 296) | struct expr
type expr_type (line 296) | enum expr_type
type expr (line 296) | struct expr
type expr (line 296) | struct expr
type expr (line 297) | struct expr
type expr_type (line 297) | enum expr_type
type symbol (line 297) | struct symbol
type symbol (line 297) | struct symbol
type expr (line 298) | struct expr
type expr (line 298) | struct expr
type expr (line 298) | struct expr
type expr (line 299) | struct expr
type expr (line 299) | struct expr
type expr (line 299) | struct expr
type expr (line 300) | struct expr
type expr (line 300) | struct expr
type expr (line 301) | struct expr
type expr (line 302) | struct expr
type expr (line 302) | struct expr
type expr (line 303) | struct expr
type expr (line 303) | struct expr
type expr (line 304) | struct expr
type expr (line 305) | struct expr
type expr (line 305) | struct expr
type expr (line 306) | struct expr
type expr (line 306) | struct expr
type expr (line 307) | struct expr
type expr (line 307) | struct expr
type expr (line 308) | struct expr
type symbol (line 308) | struct symbol
type expr (line 309) | struct expr
type symbol (line 309) | struct symbol
type expr (line 310) | struct expr
type expr (line 310) | struct expr
type expr_type (line 310) | enum expr_type
type symbol (line 310) | struct symbol
type expr (line 312) | struct expr
type gstr (line 313) | struct gstr
type expr (line 314) | struct expr
type gstr (line 314) | struct gstr
type expr (line 315) | struct expr
type gstr (line 315) | struct gstr
function expr_is_yes (line 318) | static inline int expr_is_yes(struct expr *e)
function expr_is_no (line 323) | static inline int expr_is_no(struct expr *e)
FILE: 3rdparty/kconfig/list.h
type list_head (line 24) | struct list_head {
function list_empty (line 71) | static inline int list_empty(const struct list_head *head)
function __list_add (line 82) | static inline void __list_add(struct list_head *_new,
function list_add_tail (line 100) | static inline void list_add_tail(struct list_head *_new, struct list_hea...
function __list_del (line 112) | static inline void __list_del(struct list_head *prev, struct list_head *...
function list_del (line 126) | static inline void list_del(struct list_head *entry)
FILE: 3rdparty/kconfig/lkc.h
type conf_def_mode (line 33) | enum conf_def_mode {
type conf_def_mode (line 56) | enum conf_def_mode
type conf_def_mode (line 57) | enum conf_def_mode
type symbol (line 58) | struct symbol
function xfwrite (line 61) | static inline void xfwrite(const void *str, size_t len, size_t count, FI...
type file (line 70) | struct file
type gstr (line 80) | struct gstr {
type gstr (line 89) | struct gstr
type gstr (line 90) | struct gstr
type gstr (line 91) | struct gstr
type gstr (line 92) | struct gstr
type gstr (line 93) | struct gstr
type menu (line 97) | struct menu
type menu (line 98) | struct menu
type symbol (line 100) | struct symbol
type expr (line 101) | struct expr
type expr (line 102) | struct expr
type property (line 103) | struct property
type prop_type (line 103) | enum prop_type
type expr (line 103) | struct expr
type prop_type (line 104) | enum prop_type
type expr (line 104) | struct expr
type expr (line 104) | struct expr
type prop_type (line 105) | enum prop_type
type symbol (line 105) | struct symbol
type expr (line 105) | struct expr
type menu (line 109) | struct menu
type menu (line 112) | struct menu
type menu (line 114) | struct menu
type menu (line 115) | struct menu
type menu (line 116) | struct menu
type menu (line 117) | struct menu
type menu (line 118) | struct menu
type menu (line 118) | struct menu
type menu (line 119) | struct menu
type menu (line 119) | struct menu
type menu (line 120) | struct menu
type menu (line 121) | struct menu
type gstr (line 122) | struct gstr
type symbol (line 122) | struct symbol
type list_head (line 122) | struct list_head
type menu (line 123) | struct menu
type gstr (line 123) | struct gstr
type symbol (line 127) | struct symbol
type symbol (line 127) | struct symbol
type property (line 128) | struct property
type symbol (line 128) | struct symbol
type symbol (line 129) | struct symbol
type symbol (line 130) | struct symbol
type symbol (line 130) | struct symbol
type symbol (line 131) | struct symbol
type property (line 131) | struct property
function tristate (line 133) | static inline tristate sym_get_tristate_value(struct symbol *sym)
type symbol (line 139) | struct symbol
type symbol (line 139) | struct symbol
type symbol (line 141) | struct symbol
function sym_set_choice_value (line 144) | static inline bool sym_set_choice_value(struct symbol *ch, struct symbol...
function sym_is_choice (line 149) | static inline bool sym_is_choice(struct symbol *sym)
function sym_is_choice_value (line 154) | static inline bool sym_is_choice_value(struct symbol *sym)
function sym_is_optional (line 159) | static inline bool sym_is_optional(struct symbol *sym)
function sym_has_value (line 164) | static inline bool sym_has_value(struct symbol *sym)
FILE: 3rdparty/kconfig/lkc_proto.h
type symbol (line 16) | struct symbol
type symbol (line 18) | struct symbol
type symbol (line 19) | struct symbol
type symbol (line 21) | struct symbol
type symbol_type (line 22) | enum symbol_type
type symbol (line 23) | struct symbol
type symbol_type (line 24) | enum symbol_type
type symbol (line 24) | struct symbol
type symbol (line 25) | struct symbol
type symbol (line 26) | struct symbol
type symbol (line 27) | struct symbol
type symbol (line 28) | struct symbol
type symbol (line 29) | struct symbol
type symbol (line 30) | struct symbol
type symbol (line 31) | struct symbol
type property (line 32) | struct property
type symbol (line 32) | struct symbol
type symbol (line 33) | struct symbol
type prop_type (line 35) | enum prop_type
type variable_flavor (line 38) | enum variable_flavor {
type variable_flavor (line 45) | enum variable_flavor
type expr (line 51) | struct expr
type symbol (line 51) | struct symbol
FILE: 3rdparty/kconfig/menu.c
type menu (line 15) | struct menu
type menu (line 16) | struct menu
type file (line 18) | struct file
type file (line 19) | struct file
function menu_warn (line 21) | void menu_warn(struct menu *menu, const char *fmt, ...)
function prop_warn (line 31) | static void prop_warn(struct property *prop, const char *fmt, ...)
function _menu_init (line 41) | void _menu_init(void)
function menu_add_entry (line 47) | void menu_add_entry(struct symbol *sym)
type menu (line 65) | struct menu
function menu_end_menu (line 72) | void menu_end_menu(void)
type expr (line 82) | struct expr
type expr (line 82) | struct expr
function menu_add_dep (line 107) | void menu_add_dep(struct expr *dep)
function menu_set_type (line 112) | void menu_set_type(int type)
type property (line 128) | struct property
type prop_type (line 128) | enum prop_type
type expr (line 128) | struct expr
type expr (line 129) | struct expr
type property (line 131) | struct property
type property (line 144) | struct property
type property (line 156) | struct property
type prop_type (line 156) | enum prop_type
type expr (line 157) | struct expr
type property (line 159) | struct property
type menu (line 171) | struct menu
type expr (line 174) | struct expr
function menu_add_visibility (line 198) | void menu_add_visibility(struct expr *expr)
function menu_add_expr (line 204) | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *...
function menu_add_symbol (line 209) | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct exp...
function menu_add_option_modules (line 214) | void menu_add_option_modules(void)
function menu_add_option_defconfig_list (line 222) | void menu_add_option_defconfig_list(void)
function menu_add_option_allnoconfig_y (line 231) | void menu_add_option_allnoconfig_y(void)
function menu_validate_number (line 236) | static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
function sym_check_prop (line 242) | static void sym_check_prop(struct symbol *sym)
function menu_finalize (line 306) | void menu_finalize(struct menu *parent)
function menu_has_prompt (line 615) | bool menu_has_prompt(struct menu *menu)
function menu_is_empty (line 627) | bool menu_is_empty(struct menu *menu)
function menu_is_visible (line 638) | bool menu_is_visible(struct menu *menu)
type menu (line 676) | struct menu
type menu (line 685) | struct menu
type menu (line 685) | struct menu
type menu (line 690) | struct menu
type menu (line 690) | struct menu
type prop_type (line 692) | enum prop_type
function menu_has_help (line 702) | bool menu_has_help(struct menu *menu)
type menu (line 707) | struct menu
function get_def_str (line 715) | static void get_def_str(struct gstr *r, struct menu *menu)
function get_dep_str (line 721) | static void get_dep_str(struct gstr *r, struct expr *expr, const char *p...
function get_prompt_str (line 730) | static void get_prompt_str(struct gstr *r, struct property *prop,
function get_symbol_props_str (line 800) | static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
function get_symbol_str (line 821) | static void get_symbol_str(struct gstr *r, struct symbol *sym,
function get_relations_str (line 872) | struct gstr get_relations_str(struct symbol **sym_arr, struct list_head ...
function menu_get_ext_help (line 886) | void menu_get_ext_help(struct menu *menu, struct gstr *help)
FILE: 3rdparty/kconfig/nconf.c
type mitem (line 249) | struct mitem {
type menu (line 259) | struct menu
type mitem (line 270) | struct mitem
type menu (line 279) | struct menu
type menu (line 280) | struct menu
type menu (line 281) | struct menu
type menu (line 284) | struct menu
type menu (line 289) | struct menu
type menu (line 290) | struct menu
type menu (line 291) | struct menu
type menu (line 292) | struct menu
type menu (line 293) | struct menu
type menu (line 294) | struct menu
type menu (line 295) | struct menu
type menu (line 296) | struct menu
type menu (line 297) | struct menu
type menu (line 298) | struct menu
type function_keys (line 300) | struct function_keys {
type function_keys (line 308) | struct function_keys
function print_function_line (line 365) | static void print_function_line(void)
function handle_f1 (line 388) | static void handle_f1(int *key, struct menu *current_item)
function handle_f2 (line 396) | static void handle_f2(int *key, struct menu *current_item)
function handle_f3 (line 403) | static void handle_f3(int *key, struct menu *current_item)
function handle_f4 (line 412) | static void handle_f4(int *key, struct menu *current_item)
function handle_f5 (line 428) | static void handle_f5(int *key, struct menu *current_item)
function handle_f6 (line 435) | static void handle_f6(int *key, struct menu *current_item)
function handle_f7 (line 442) | static void handle_f7(int *key, struct menu *current_item)
function handle_f8 (line 449) | static void handle_f8(int *key, struct menu *current_item)
function handle_f9 (line 456) | static void handle_f9(int *key, struct menu *current_item)
function process_special_keys (line 463) | static int process_special_keys(int *key, struct menu *menu)
function clean_items (line 483) | static void clean_items(void)
type match_f (line 493) | typedef enum {MATCH_TINKER_PATTERN_UP, MATCH_TINKER_PATTERN_DOWN,
function get_mext_match (line 497) | static int get_mext_match(const char *match_str, match_f flag)
function item_make (line 525) | static void item_make(struct menu *menu, char tag, const char *fmt, ...)
function item_add_str (line 565) | static void item_add_str(const char *fmt, ...)
function item_tag (line 593) | static char item_tag(void)
function curses_item_index (line 605) | static int curses_item_index(void)
type mitem (line 613) | struct mitem
type mitem (line 618) | struct mitem
function item_is_tag (line 623) | static int item_is_tag(char tag)
function do_exit (line 648) | static int do_exit(void)
function search_conf (line 692) | static void search_conf(void)
function build_conf (line 736) | static void build_conf(struct menu *menu)
function reset_menu (line 921) | static void reset_menu(void)
function center_item (line 929) | static void center_item(int selected_index, int *last_top_row)
function show_menu (line 950) | static void show_menu(const char *prompt, const char *instructions,
function adj_match_dir (line 999) | static void adj_match_dir(match_f *match_direction)
type match_state (line 1010) | struct match_state
function do_match (line 1021) | static int do_match(int key, struct match_state *state, int *ans)
function conf (line 1068) | static void conf(struct menu *menu)
function conf_message_callback (line 1213) | static void conf_message_callback(const char *s)
function show_help (line 1218) | static void show_help(struct menu *menu)
function conf_choice (line 1231) | static void conf_choice(struct menu *menu)
function conf_string (line 1348) | static void conf_string(struct menu *menu)
function conf_load (line 1392) | static void conf_load(void)
function conf_save (line 1423) | static void conf_save(void)
function setup_windows (line 1455) | static void setup_windows(void)
function main (line 1474) | int main(int ac, char **av)
FILE: 3rdparty/kconfig/nconf.gui.c
function set_normal_colors (line 23) | static void set_normal_colors(void)
function normal_color_theme (line 68) | static void normal_color_theme(void)
function no_colors_theme (line 100) | static void no_colors_theme(void)
function set_colors (line 132) | void set_colors(void)
function print_in_middle (line 147) | void print_in_middle(WINDOW *win,
function get_line_no (line 175) | int get_line_no(const char *text)
function get_line_length (line 203) | int get_line_length(const char *line)
function fill_window (line 214) | void fill_window(WINDOW *win, const char *text)
function btn_dialog (line 241) | int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
function dialog_inputbox (line 357) | int dialog_inputbox(WINDOW *main_window,
function refresh_all_windows (line 542) | void refresh_all_windows(WINDOW *main_window)
function show_scroll_win (line 550) | void show_scroll_win(WINDOW *main_window,
FILE: 3rdparty/kconfig/nconf.h
type attributes_t (line 35) | typedef enum {
type function_key (line 60) | typedef enum {
FILE: 3rdparty/kconfig/preprocess.c
function pperror (line 20) | static void __attribute__((noreturn)) pperror(const char *format, ...)
type env (line 38) | struct env {
function env_add (line 44) | static void env_add(const char *name, const char *value)
function env_del (line 55) | static void env_del(struct env *e)
type env (line 66) | struct env
function env_write_dep (line 90) | void env_write_dep(FILE *f, const char *autoconfig_name)
type function (line 105) | struct function {
type function (line 190) | struct function
type function (line 204) | struct function
type variable (line 231) | struct variable {
type variable (line 239) | struct variable
type variable (line 241) | struct variable
type variable (line 253) | struct variable
function variable_add (line 279) | void variable_add(const char *name, const char *value,
function variable_del (line 324) | static void variable_del(struct variable *v)
function variable_all_del (line 332) | void variable_all_del(void)
function is_end_of_str (line 539) | static bool is_end_of_str(char c)
function is_end_of_token (line 559) | static bool is_end_of_token(char c)
FILE: 3rdparty/kconfig/symbol.c
type symbol (line 14) | struct symbol
type symbol (line 20) | struct symbol
type symbol (line 26) | struct symbol
type symbol (line 32) | struct symbol
type symbol (line 38) | struct symbol
type symbol (line 39) | struct symbol
function sym_get_type (line 42) | enum symbol_type sym_get_type(struct symbol *sym)
type symbol_type (line 55) | enum symbol_type
type property (line 74) | struct property
type symbol (line 74) | struct symbol
type property (line 76) | struct property
type property (line 83) | struct property
type symbol (line 83) | struct symbol
type property (line 85) | struct property
type property (line 95) | struct property
type symbol (line 95) | struct symbol
type property (line 97) | struct property
function sym_get_range_val (line 107) | static long long sym_get_range_val(struct symbol *sym, int base)
function sym_validate_range (line 123) | static void sym_validate_range(struct symbol *sym)
function sym_set_changed (line 157) | static void sym_set_changed(struct symbol *sym)
function sym_set_all_changed (line 168) | static void sym_set_all_changed(void)
function sym_calc_visibility (line 177) | static void sym_calc_visibility(struct symbol *sym)
type symbol (line 246) | struct symbol
type symbol (line 246) | struct symbol
type symbol (line 248) | struct symbol
type property (line 249) | struct property
type expr (line 250) | struct expr
type symbol (line 272) | struct symbol
type symbol (line 272) | struct symbol
type symbol (line 274) | struct symbol
type property (line 275) | struct property
type expr (line 276) | struct expr
function sym_warn_unmet_dep (line 304) | static void sym_warn_unmet_dep(struct symbol *sym)
function sym_calc_value (line 325) | void sym_calc_value(struct symbol *sym)
function sym_clear_all_valid (line 469) | void sym_clear_all_valid(void)
function sym_tristate_within_range (line 480) | bool sym_tristate_within_range(struct symbol *sym, tristate val)
function sym_set_tristate_value (line 499) | bool sym_set_tristate_value(struct symbol *sym, tristate val)
function tristate (line 535) | tristate sym_toggle_tristate_value(struct symbol *sym)
function sym_string_valid (line 558) | bool sym_string_valid(struct symbol *sym, const char *str)
function sym_string_within_range (line 601) | bool sym_string_within_range(struct symbol *sym, const char *str)
function sym_set_string_value (line 643) | bool sym_set_string_value(struct symbol *sym, const char *newval)
type symbol (line 699) | struct symbol
type property (line 701) | struct property
type symbol (line 702) | struct symbol
type symbol (line 769) | struct symbol
function sym_is_changeable (line 793) | bool sym_is_changeable(struct symbol *sym)
function strhash (line 798) | static unsigned strhash(const char *s)
type symbol (line 807) | struct symbol
type symbol (line 809) | struct symbol
type symbol (line 848) | struct symbol
type symbol (line 850) | struct symbol
type sym_match (line 918) | struct sym_match {
function sym_rel_comp (line 927) | static int sym_rel_comp(const void *sym1, const void *sym2)
type symbol (line 953) | struct symbol
type symbol (line 955) | struct symbol
type sym_match (line 956) | struct sym_match
type sym_match (line 976) | struct sym_match
type sym_match (line 990) | struct sym_match
type symbol (line 991) | struct symbol
type dep_stack (line 1012) | struct dep_stack {
function dep_stack_insert (line 1019) | static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
function dep_stack_remove (line 1029) | static void dep_stack_remove(void)
function sym_check_print_recursive (line 1041) | static void sym_check_print_recursive(struct symbol *last_sym)
type symbol (line 1130) | struct symbol
type expr (line 1130) | struct expr
type symbol (line 1132) | struct symbol
type symbol (line 1165) | struct symbol
type symbol (line 1165) | struct symbol
type symbol (line 1167) | struct symbol
type property (line 1168) | struct property
type dep_stack (line 1169) | struct dep_stack
type symbol (line 1213) | struct symbol
type symbol (line 1213) | struct symbol
type symbol (line 1215) | struct symbol
type property (line 1216) | struct property
type expr (line 1217) | struct expr
type dep_stack (line 1218) | struct dep_stack
type symbol (line 1250) | struct symbol
type symbol (line 1250) | struct symbol
type symbol (line 1252) | struct symbol
type property (line 1253) | struct property
type dep_stack (line 1263) | struct dep_stack
type symbol (line 1281) | struct symbol
type property (line 1281) | struct property
type prop_type (line 1289) | enum prop_type
FILE: 3rdparty/kconfig/util.c
type file (line 13) | struct file
type file (line 15) | struct file
function str_new (line 32) | struct gstr str_new(void)
function str_free (line 43) | void str_free(struct gstr *gs)
function str_append (line 52) | void str_append(struct gstr *gs, const char *s)
function str_printf (line 66) | void str_printf(struct gstr *gs, const char *fmt, ...)
type gstr (line 77) | struct gstr
FILE: arch/or1k/counter.c
function cycle_counter_init (line 9) | void
function cycle_counter_read (line 16) | uint32_t
FILE: arch/or1k/exception.c
function report_exception (line 11) | void
FILE: arch/or1k/include/spr.h
function mfspr (line 12) | static inline uint32_t
function mtspr (line 21) | static inline void
FILE: arch/or1k/include/trap.h
function trap (line 9) | static inline noreturn void
FILE: common/debug.c
function hexdump (line 27) | void
function log (line 53) | void
function print_number (line 124) | static void
function print_signed (line 140) | static void
FILE: common/debug/battery.c
function debug_print_battery (line 18) | void
FILE: common/debug/dram.c
function dram_calc_checksum (line 18) | static uint32_t
function dram_save_checksum (line 33) | void
function dram_verify_checksum (line 39) | void
FILE: common/debug/latency.c
function debug_print_latency (line 17) | void
FILE: common/debug/monitor.c
function parse_hex (line 21) | static bool
function run_command (line 59) | static void
function debug_monitor (line 109) | void
FILE: common/debug/sprs.c
function debug_print_sprs (line 13) | void
FILE: common/debug/steps.c
function record_exception (line 15) | void
function record_step (line 21) | void
function report_last_step (line 27) | void
FILE: common/delay.c
function udelay (line 10) | void
FILE: common/device.c
function device_active (line 11) | bool
function device_get (line 17) | int
type device (line 39) | struct device
type device (line 40) | struct device
function device_put (line 45) | void
function dummy_probe (line 55) | int
function dummy_release (line 61) | void
FILE: common/regulator_list.c
type regulator_handle (line 13) | struct regulator_handle
type regulator_handle (line 29) | struct regulator_handle
type regulator_handle (line 43) | struct regulator_handle
type regulator_handle (line 57) | struct regulator_handle
FILE: common/scpi.c
type scpi_state (line 22) | struct scpi_state {
type scpi_mem (line 28) | struct scpi_mem
type scpi_state (line 31) | struct scpi_state
function scpi_send_message (line 37) | static void
function scpi_create_message (line 57) | void
function scpi_poll_one_client (line 85) | static void
function scpi_poll (line 129) | void
FILE: common/scpi_cmds.c
type scpi_cmd (line 26) | struct scpi_cmd {
function scpi_cmd_scp_ready_handler (line 39) | static int
function scpi_cmd_get_scp_cap_handler (line 54) | static int
function scpi_cmd_set_css_power_handler (line 90) | static int
function scpi_cmd_get_css_power_handler (line 119) | static int
function scpi_cmd_set_sys_power_handler (line 149) | static int
type scpi_cmd (line 174) | struct scpi_cmd
function scpi_handle_cmd (line 200) | bool
FILE: common/simple_device.c
function simple_device_probe (line 9) | int
function simple_device_release (line 32) | void
function simple_device_sync (line 44) | void
FILE: common/system.c
function select_suspend_depth (line 66) | static uint8_t
function system_state_machine (line 82) | noreturn void
function system_reboot (line 327) | void
function system_reset (line 336) | void
function system_shutdown (line 345) | void
function system_suspend (line 354) | void
function system_wake (line 363) | void
FILE: common/timeout.c
function timeout_expired (line 11) | bool
function timeout_set (line 20) | uint32_t
FILE: drivers/cec/cec.c
type device (line 10) | struct device
function cec_poll (line 16) | uint32_t
FILE: drivers/cec/dw-hdmi-cec.c
type dw_hdmi_cec_state (line 60) | struct dw_hdmi_cec_state {
type dw_hdmi_cec (line 65) | struct dw_hdmi_cec
type device (line 66) | struct device
type dw_hdmi_cec_state (line 71) | struct dw_hdmi_cec_state
type device (line 72) | struct device
function dw_hdmi_cec_poll (line 77) | uint32_t
function dw_hdmi_cec_probe (line 89) | static int
function dw_hdmi_cec_release (line 131) | static void
type driver (line 163) | struct driver
type dw_hdmi_cec (line 168) | struct dw_hdmi_cec
type dw_hdmi_cec_state (line 172) | struct dw_hdmi_cec_state
FILE: drivers/cir/cir.c
type device (line 10) | struct device
function cir_poll (line 16) | uint32_t
FILE: drivers/cir/cir.h
type cir_dec_ctx (line 22) | struct cir_dec_ctx {
type cir_dec_ctx (line 42) | struct cir_dec_ctx
FILE: drivers/cir/nec.c
function cir_decode (line 50) | uint32_t
FILE: drivers/cir/rc6.c
function cir_decode (line 53) | uint32_t
FILE: drivers/cir/sunxi-cir.c
type sunxi_cir_state (line 24) | struct sunxi_cir_state {
type sunxi_cir (line 30) | struct sunxi_cir
type device (line 31) | struct device
type sunxi_cir_state (line 36) | struct sunxi_cir_state
type device (line 37) | struct device
function sunxi_cir_poll (line 42) | uint32_t
function sunxi_cir_probe (line 63) | static int
function sunxi_cir_release (line 90) | static void
type driver (line 102) | struct driver
type sunxi_cir (line 107) | struct sunxi_cir
type sunxi_cir_state (line 111) | struct sunxi_cir_state
FILE: drivers/clock/ccu.c
type ccu (line 16) | struct ccu
type device (line 17) | struct device
type clock_handle (line 22) | struct clock_handle
type ccu (line 23) | struct ccu
type ccu_clock (line 24) | struct ccu_clock
type clock_handle (line 29) | struct clock_handle
type clock_handle (line 30) | struct clock_handle
type ccu (line 32) | struct ccu
type ccu_clock (line 33) | struct ccu_clock
function ccu_get_parent_rate (line 38) | uint32_t
function ccu_get_rate (line 45) | static uint32_t
function ccu_get_state (line 55) | static uint32_t
function ccu_set_state (line 73) | static void
type clock_driver (line 100) | struct clock_driver
FILE: drivers/clock/ccu.h
type ccu_clock (line 34) | struct ccu_clock {
type clock_driver (line 59) | struct clock_driver
type clock_handle (line 64) | struct clock_handle
type ccu (line 64) | struct ccu
type ccu_clock (line 65) | struct ccu_clock
type ccu (line 70) | struct ccu
type ccu_clock (line 71) | struct ccu_clock
type ccu (line 78) | struct ccu
type ccu_clock (line 79) | struct ccu_clock
type ccu (line 81) | struct ccu
type ccu_clock (line 82) | struct ccu_clock
type ccu (line 85) | struct ccu
type ccu_clock (line 86) | struct ccu_clock
type ccu (line 94) | struct ccu
type ccu_clock (line 95) | struct ccu_clock
FILE: drivers/clock/ccu_helpers.c
function ccu_helper_get_rate_m (line 12) | uint32_t
function ccu_helper_get_rate_mp (line 24) | uint32_t
function ccu_helper_get_rate_p (line 38) | uint32_t
FILE: drivers/clock/clock.c
type clock_driver_ops (line 18) | struct clock_driver_ops
type clock_handle (line 19) | struct clock_handle
type clock_driver (line 21) | struct clock_driver
type clock_state (line 30) | struct clock_state
type clock_handle (line 31) | struct clock_handle
type clock_device_state (line 33) | struct clock_device_state
function clock_active (line 39) | bool
function clock_disable (line 45) | void
function clock_enable (line 54) | void
function clock_get (line 70) | void
function clock_get_rate (line 100) | uint32_t
function clock_get_state (line 115) | uint32_t
function clock_put (line 135) | void
FILE: drivers/clock/clock.h
type clock_state (line 17) | struct clock_state {
type clock_device_state (line 21) | struct clock_device_state {
type clock_driver_ops (line 26) | struct clock_driver_ops {
type clock_driver (line 35) | struct clock_driver {
FILE: drivers/clock/r_ccu_common.c
function write_pll_ctrl_reg1 (line 29) | static void
function r_ccu_common_suspend (line 40) | void
function r_ccu_common_resume (line 67) | void
function r_ccu_common_init (line 90) | void
FILE: drivers/clock/sun50i-a64-ccu.c
type clock_handle (line 64) | struct clock_handle
type ccu (line 65) | struct ccu
type ccu_clock (line 65) | struct ccu_clock
type ccu_clock (line 72) | struct ccu_clock
type ccu (line 177) | struct ccu
type clock_handle (line 187) | struct clock_handle
function ccu_suspend (line 192) | void
function ccu_suspend_cluster (line 209) | void
function ccu_resume (line 219) | void
function ccu_resume_cluster (line 236) | void
function ccu_init (line 246) | void
FILE: drivers/clock/sun50i-h6-ccu.c
type ccu (line 128) | struct ccu
function ccu_suspend (line 138) | void
function ccu_suspend_cluster (line 160) | void
function ccu_resume (line 170) | void
function ccu_resume_cluster (line 192) | void
function ccu_init (line 202) | void
FILE: drivers/clock/sun50i-h6-r-ccu.c
type clock_handle (line 42) | struct clock_handle
type ccu (line 43) | struct ccu
type ccu_clock (line 44) | struct ccu_clock
function r_ccu_get_mp_rate (line 51) | static uint32_t
function DEFINE_FIXED_PARENT (line 60) | static DEFINE_FIXED_PARENT(r_ccu_get_ar100, r_ccu, CLK_AR100)
FILE: drivers/clock/sun8i-a23-ccu.c
type clock_handle (line 53) | struct clock_handle
type ccu (line 54) | struct ccu
type ccu_clock (line 54) | struct ccu_clock
type ccu_clock (line 61) | struct ccu_clock
type ccu (line 161) | struct ccu
type clock_handle (line 171) | struct clock_handle
function ccu_suspend (line 176) | void
function ccu_suspend_cluster (line 189) | void
function ccu_resume (line 199) | void
function ccu_resume_cluster (line 212) | void
function ccu_init (line 222) | void
FILE: drivers/clock/sun8i-a83t-ccu.c
type ccu (line 88) | struct ccu
function ccu_suspend (line 98) | void
function ccu_suspend_cluster (line 103) | void
function ccu_resume (line 108) | void
function ccu_resume_cluster (line 113) | void
function ccu_init (line 118) | void
FILE: drivers/clock/sun8i-h3-ccu.c
type clock_handle (line 57) | struct clock_handle
type ccu (line 58) | struct ccu
type ccu_clock (line 59) | struct ccu_clock
type ccu_clock (line 66) | struct ccu_clock
type ccu (line 151) | struct ccu
type clock_handle (line 161) | struct clock_handle
function ccu_suspend (line 166) | void
function ccu_suspend_cluster (line 183) | void
function ccu_resume (line 193) | void
function ccu_resume_cluster (line 210) | void
function ccu_init (line 220) | void
FILE: drivers/clock/sun8i-r-ccu.c
type clock_handle (line 42) | struct clock_handle
type ccu (line 43) | struct ccu
type ccu_clock (line 44) | struct ccu_clock
function r_ccu_get_ar100_rate (line 51) | static uint32_t
function DEFINE_FIXED_PARENT (line 60) | static DEFINE_FIXED_PARENT(r_ccu_get_ar100, r_ccu, CLK_AR100)
type ccu_clock (line 99) | struct ccu_clock
type ccu (line 181) | struct ccu
function r_ccu_init (line 191) | void
FILE: drivers/counter/sun6i-a31-cnt64.c
function system_counter_read (line 10) | uint32_t
FILE: drivers/counter/sun9i-a80-timestamp.c
function system_counter_read (line 13) | uint32_t
FILE: drivers/css/css.c
function css_get_power_state (line 22) | int
function css_set_power_state (line 42) | int
function css_wake_one_cpu (line 117) | static void
function css_resume (line 124) | void
function css_poll (line 130) | void
FILE: drivers/css/css.h
type power_state (line 13) | struct power_state {
type power_state (line 19) | struct power_state
FILE: drivers/css/css_default.c
function css_get_cluster_count (line 13) | uint32_t WEAK
function css_get_core_count (line 19) | uint32_t WEAK
function css_get_irq_status (line 29) | uint32_t WEAK
function css_suspend_css (line 38) | void WEAK
function css_resume_css (line 43) | void WEAK
function css_suspend_cluster (line 48) | void WEAK
function css_resume_cluster (line 53) | void WEAK
function css_suspend_core (line 58) | void WEAK
function css_resume_core (line 64) | void WEAK
function css_init (line 70) | void WEAK
FILE: drivers/css/css_helpers.c
function css_set_power_switch (line 18) | void
FILE: drivers/css/css_power_state.c
type power_state (line 25) | struct power_state
FILE: drivers/css/sun50i-a64-css.c
function css_get_irq_status (line 18) | uint32_t
function css_suspend_css (line 24) | void
function css_resume_css (line 34) | void
function css_suspend_cluster (line 44) | void
function css_resume_cluster (line 69) | void
function css_suspend_core (line 96) | void
function css_resume_core (line 121) | void
function css_init (line 147) | void
FILE: drivers/css/sun50i-h6-css.c
function css_get_irq_status (line 17) | uint32_t
function css_suspend_css (line 23) | void
function css_resume_css (line 33) | void
function css_suspend_cluster (line 43) | void
function css_resume_cluster (line 68) | void
function css_suspend_core (line 99) | void
function css_resume_core (line 115) | void
function css_init (line 137) | void
FILE: drivers/css/sun6i-a31-css.c
function css_get_irq_status (line 22) | uint32_t
function css_suspend_css (line 30) | void
function css_resume_css (line 40) | void
function css_suspend_cluster (line 50) | void
function css_resume_cluster (line 60) | void
function css_suspend_core (line 70) | void
function css_resume_core (line 92) | void
function css_init (line 135) | void
FILE: drivers/dram/dram.c
function dram_suspend (line 8) | void WEAK
function dram_resume (line 13) | void WEAK
function dram_init (line 18) | void WEAK
FILE: drivers/dram/sun50i-h6-dram.c
type clock_handle (line 48) | struct clock_handle
function dram_suspend (line 63) | void
function dram_resume (line 94) | void
function dram_init (line 127) | void
FILE: drivers/dram/sun8i-h3-dram.c
type clock_handle (line 132) | struct clock_handle
function dram_suspend (line 149) | void
function dram_resume (line 208) | void
function dram_init (line 263) | void
FILE: drivers/gpio/gpio.c
type gpio_driver_ops (line 17) | struct gpio_driver_ops
type gpio_handle (line 18) | struct gpio_handle
type gpio_driver (line 20) | struct gpio_driver
function gpio_get (line 26) | int
function gpio_get_value (line 47) | int
function gpio_put (line 53) | void
function gpio_set_value (line 59) | int
FILE: drivers/gpio/gpio.h
type gpio_driver_ops (line 13) | struct gpio_driver_ops {
type gpio_driver (line 19) | struct gpio_driver {
FILE: drivers/gpio/sunxi-gpio.c
function sunxi_gpio_get_value (line 42) | static int
function sunxi_gpio_init_pin (line 56) | static int
function sunxi_gpio_set_value (line 78) | static int
type gpio_driver (line 94) | struct gpio_driver
type simple_device (line 106) | struct simple_device
type simple_device (line 116) | struct simple_device
FILE: drivers/irq/irq.c
function irq_needs_avcc (line 9) | uint32_t WEAK
function irq_needs_vdd_sys (line 15) | uint32_t WEAK
function irq_poll (line 21) | uint32_t WEAK
FILE: drivers/irq/sun6i-a31-r-intc.c
function irq_needs_avcc (line 62) | uint32_t
function irq_needs_vdd_sys (line 79) | uint32_t
function irq_poll (line 96) | uint32_t
FILE: drivers/mfd/axp20x.c
function axp20x_probe (line 31) | static int
type driver (line 55) | struct driver
type regmap_device (line 60) | struct regmap_device
FILE: drivers/msgbox/msgbox.c
type msgbox_driver_ops (line 17) | struct msgbox_driver_ops
type device (line 18) | struct device
type msgbox_driver (line 20) | struct msgbox_driver
function msgbox_ack_rx (line 26) | void
function msgbox_last_tx_done (line 32) | bool
function msgbox_receive (line 38) | int
function msgbox_send (line 44) | int
FILE: drivers/msgbox/msgbox.h
type msgbox_driver_ops (line 13) | struct msgbox_driver_ops {
type msgbox_driver (line 22) | struct msgbox_driver {
FILE: drivers/msgbox/sunxi-msgbox.c
function sunxi_msgbox_peek_data (line 39) | static bool
function sunxi_msgbox_ack_rx (line 47) | static void
function sunxi_msgbox_last_tx_done (line 55) | static bool
function sunxi_msgbox_receive (line 66) | static int
function sunxi_msgbox_send (line 81) | static int
function sunxi_msgbox_probe (line 96) | static int
type msgbox_driver (line 122) | struct msgbox_driver
type simple_device (line 135) | struct simple_device
FILE: drivers/pmic/axp20x.c
function axp20x_pmic_reset (line 11) | int
function axp20x_pmic_resume (line 20) | int
function axp20x_pmic_shutdown (line 29) | int
function axp20x_pmic_probe (line 38) | int
function axp20x_pmic_release (line 46) | void
FILE: drivers/pmic/axp20x.h
type axp20x_pmic (line 17) | struct axp20x_pmic
type device (line 18) | struct device
type device (line 24) | struct device
type device (line 27) | struct device
type device (line 30) | struct device
type device (line 32) | struct device
type device (line 33) | struct device
FILE: drivers/pmic/axp223.c
function axp223_pmic_suspend (line 13) | static int
type pmic_driver (line 22) | struct pmic_driver
type axp20x_pmic (line 35) | struct axp20x_pmic
FILE: drivers/pmic/axp803.c
function axp803_pmic_suspend (line 15) | static int
type pmic_driver (line 29) | struct pmic_driver
type axp20x_pmic (line 42) | struct axp20x_pmic
FILE: drivers/pmic/axp805.c
function axp805_pmic_reset (line 13) | static int
function axp805_pmic_suspend (line 22) | static int
type pmic_driver (line 32) | struct pmic_driver
type axp20x_pmic (line 45) | struct axp20x_pmic
FILE: drivers/pmic/pmic.c
type pmic_driver_ops (line 18) | struct pmic_driver_ops
type device (line 19) | struct device
type pmic_driver (line 21) | struct pmic_driver
type device (line 27) | struct device
type device (line 30) | struct device
function pmic_reset (line 42) | int
function pmic_resume (line 48) | int
function pmic_shutdown (line 54) | int
function pmic_suspend (line 60) | int
FILE: drivers/pmic/pmic.h
type pmic_driver_ops (line 12) | struct pmic_driver_ops {
type pmic_driver (line 19) | struct pmic_driver {
FILE: drivers/regmap/regmap-i2c.c
type regmap_i2c_driver_ops (line 16) | struct regmap_i2c_driver_ops
type regmap (line 17) | struct regmap
type regmap_i2c_driver (line 19) | struct regmap_i2c_driver
function regmap_i2c_prepare (line 26) | int
function regmap_i2c_read (line 48) | int
function regmap_i2c_write (line 77) | int
FILE: drivers/regmap/regmap-i2c.h
type regmap_i2c_driver_ops (line 16) | struct regmap_i2c_driver_ops {
type regmap_i2c_driver (line 23) | struct regmap_i2c_driver {
type regmap (line 28) | struct regmap
type regmap (line 30) | struct regmap
type regmap (line 32) | struct regmap
FILE: drivers/regmap/regmap.c
type regmap_driver_ops (line 17) | struct regmap_driver_ops
type regmap (line 18) | struct regmap
type regmap_driver (line 20) | struct regmap_driver
function regmap_get (line 26) | int
function regmap_put (line 46) | void
function regmap_read (line 52) | int
function regmap_write (line 58) | int
function regmap_update_bits (line 64) | int
function regmap_device_probe (line 78) | int
function regmap_device_release (line 86) | void
type device (line 94) | struct device
type regmap (line 95) | struct regmap
function regmap_user_probe (line 100) | int
function regmap_user_release (line 106) | void
FILE: drivers/regmap/regmap.h
type regmap_driver_ops (line 13) | struct regmap_driver_ops {
type regmap_driver (line 19) | struct regmap_driver {
FILE: drivers/regmap/sun6i-i2c.c
function sun6i_i2c_wait_idle (line 43) | static int
function sun6i_i2c_wait_start (line 62) | static int
function sun6i_i2c_wait_state (line 78) | static int
function sun6i_i2c_read (line 97) | static int
function sun6i_i2c_start (line 116) | static int
function sun6i_i2c_stop (line 149) | static void
function sun6i_i2c_write (line 161) | static int
function sun6i_i2c_probe (line 178) | static int
type regmap_i2c_driver (line 213) | struct regmap_i2c_driver
type simple_device (line 233) | struct simple_device
FILE: drivers/regmap/sunxi-rsb.c
function sunxi_rsb_do_command (line 43) | static int
function sunxi_rsb_prepare (line 58) | static int
function sunxi_rsb_read (line 65) | static int
function sunxi_rsb_write (line 81) | static int
function sunxi_rsb_set_rate (line 92) | static void
function sunxi_rsb_probe (line 105) | static int
type regmap_driver (line 129) | struct regmap_driver
type simple_device (line 141) | struct simple_device
FILE: drivers/regulator/axp20x.c
function axp20x_regulator_get_state (line 11) | static int
function axp20x_regulator_set_state (line 29) | static int
function axp20x_regulator_probe (line 39) | static int
function axp20x_regulator_release (line 47) | static void
type regulator_driver (line 55) | struct regulator_driver
FILE: drivers/regulator/axp20x.h
type axp20x_regulator_info (line 15) | struct axp20x_regulator_info {
type regulator_driver (line 20) | struct regulator_driver
type axp20x_regulator (line 22) | struct axp20x_regulator
type device (line 23) | struct device
FILE: drivers/regulator/axp221.c
type axp20x_regulator_info (line 17) | struct axp20x_regulator_info
type axp20x_regulator (line 88) | struct axp20x_regulator
FILE: drivers/regulator/axp803.c
type axp20x_regulator_info (line 17) | struct axp20x_regulator_info
type axp20x_regulator (line 96) | struct axp20x_regulator
FILE: drivers/regulator/axp805.c
type axp20x_regulator_info (line 16) | struct axp20x_regulator_info
type axp20x_regulator (line 83) | struct axp20x_regulator
FILE: drivers/regulator/gpio.c
type gpio_regulator (line 11) | struct gpio_regulator
type device (line 12) | struct device
function gpio_regulator_get_state (line 17) | static int
function gpio_regulator_set_state (line 25) | static int
function gpio_regulator_probe (line 33) | static int
function gpio_regulator_release (line 41) | static void
type regulator_driver (line 49) | struct regulator_driver
type gpio_regulator (line 61) | struct gpio_regulator
type gpio_regulator (line 78) | struct gpio_regulator
type gpio_regulator (line 95) | struct gpio_regulator
type gpio_regulator (line 112) | struct gpio_regulator
FILE: drivers/regulator/regulator.c
type regulator_driver_ops (line 18) | struct regulator_driver_ops
type device (line 19) | struct device
type regulator_driver (line 21) | struct regulator_driver
function regulator_set_state (line 27) | static int
function regulator_disable (line 42) | int
function regulator_enable (line 48) | int
function regulator_get_state (line 54) | int
FILE: drivers/regulator/regulator.h
type regulator_driver_ops (line 13) | struct regulator_driver_ops {
type regulator_driver (line 18) | struct regulator_driver {
FILE: drivers/regulator/sy8106a.c
function sy8106a_get_state (line 19) | static int
function sy8106a_set_state (line 34) | static int
type regulator_driver (line 47) | struct regulator_driver
type regmap_device (line 58) | struct regmap_device
FILE: drivers/serial/serial.c
function serial_getc (line 11) | char
function serial_putc (line 20) | void
function serial_puts (line 29) | void
function serial_init (line 38) | void
function serial_ready (line 44) | bool
FILE: drivers/serial/sun50i-a64-uart.c
type simple_device (line 14) | struct simple_device
type simple_device (line 42) | struct simple_device
type simple_device (line 70) | struct simple_device
type simple_device (line 98) | struct simple_device
type simple_device (line 126) | struct simple_device
type simple_device (line 154) | struct simple_device
FILE: drivers/serial/sun50i-h6-uart.c
type simple_device (line 14) | struct simple_device
type simple_device (line 42) | struct simple_device
type simple_device (line 70) | struct simple_device
type simple_device (line 98) | struct simple_device
type simple_device (line 126) | struct simple_device
FILE: drivers/serial/sun8i-a23-uart.c
type simple_device (line 14) | struct simple_device
type simple_device (line 42) | struct simple_device
type simple_device (line 70) | struct simple_device
type simple_device (line 98) | struct simple_device
type simple_device (line 126) | struct simple_device
type simple_device (line 154) | struct simple_device
FILE: drivers/serial/sun8i-a83t-uart.c
type simple_device (line 14) | struct simple_device
type simple_device (line 42) | struct simple_device
type simple_device (line 70) | struct simple_device
type simple_device (line 98) | struct simple_device
type simple_device (line 126) | struct simple_device
type simple_device (line 154) | struct simple_device
FILE: drivers/serial/sun8i-h3-uart.c
type simple_device (line 14) | struct simple_device
type simple_device (line 42) | struct simple_device
type simple_device (line 70) | struct simple_device
type simple_device (line 98) | struct simple_device
type simple_device (line 126) | struct simple_device
FILE: drivers/serial/uart.c
function uart_probe (line 12) | static int
type driver (line 41) | struct driver
FILE: drivers/serial/uart.h
type driver (line 36) | struct driver
type simple_device (line 37) | struct simple_device
FILE: drivers/watchdog/sun6i-a31-wdt.c
type sun6i_a31_wdt (line 25) | struct sun6i_a31_wdt
type device (line 26) | struct device
function sun6i_a31_wdt_reset_system (line 31) | static void
function sun6i_a31_wdt_restart (line 41) | static void
function sun6i_a31_wdt_probe (line 49) | static int
function sun6i_a31_wdt_release (line 63) | static void
type watchdog_driver (line 72) | struct watchdog_driver
type sun6i_a31_wdt (line 83) | struct sun6i_a31_wdt
FILE: drivers/watchdog/sun9i-a80-twd.c
function sun9i_a80_twd_reset_system (line 27) | static void
function sun9i_a80_twd_restart (line 38) | static void
function sun9i_a80_twd_probe (line 46) | static int
function sun9i_a80_twd_release (line 75) | static void
type watchdog_driver (line 86) | struct watchdog_driver
type simple_device (line 97) | struct simple_device
FILE: drivers/watchdog/watchdog.c
type watchdog_driver_ops (line 18) | struct watchdog_driver_ops
type device (line 19) | struct device
type watchdog_driver (line 21) | struct watchdog_driver
type device (line 27) | struct device
type device (line 30) | struct device
function watchdog_reset_system (line 40) | void
function watchdog_restart (line 46) | void
FILE: drivers/watchdog/watchdog.h
type watchdog_driver_ops (line 12) | struct watchdog_driver_ops {
type watchdog_driver (line 17) | struct watchdog_driver {
FILE: include/common/debug.h
function debug_monitor (line 55) | static inline void
function debug_print_battery (line 68) | static inline void
function debug_print_latency (line 81) | static inline void
function debug_print_sprs (line 94) | static inline void
function dram_save_checksum (line 108) | static inline void
function dram_verify_checksum (line 113) | static inline void
FILE: include/common/device.h
type device_state (line 21) | struct device_state
type driver (line 22) | struct driver
type device (line 24) | struct device {
type device_state (line 33) | struct device_state {
type driver (line 38) | struct driver {
type device (line 51) | struct device
type device (line 68) | struct device
type device (line 75) | struct device
type device (line 75) | struct device
type device (line 82) | struct device
type device (line 87) | struct device
type device (line 92) | struct device
FILE: include/common/regulator_list.h
type regulator_handle (line 14) | struct regulator_handle
type regulator_handle (line 19) | struct regulator_handle
type regulator_handle (line 24) | struct regulator_handle
type regulator_handle (line 29) | struct regulator_handle
FILE: include/common/scpi.h
type device (line 33) | struct device
type scpi_mem (line 44) | struct scpi_mem
type device (line 49) | struct device
FILE: include/common/simple_device.h
type simple_device (line 17) | struct simple_device {
type simple_device (line 27) | struct simple_device
type device (line 28) | struct device
type device (line 38) | struct device
type device (line 45) | struct device
type simple_device (line 59) | struct simple_device
FILE: include/common/steps.h
function record_exception (line 47) | static inline void
function record_step (line 52) | static inline void
function report_last_step (line 57) | static inline void
FILE: include/drivers/cec.h
type device (line 22) | struct device
type device (line 30) | struct device
type device (line 34) | struct device
function cec_poll (line 40) | static inline uint32_t
FILE: include/drivers/cec/dw-hdmi-cec.h
type dw_hdmi_cec (line 13) | struct dw_hdmi_cec {
type dw_hdmi_cec (line 19) | struct dw_hdmi_cec
type device (line 21) | struct device
FILE: include/drivers/cir.h
type device (line 22) | struct device
type device (line 30) | struct device
type device (line 34) | struct device
function cir_poll (line 40) | static inline uint32_t
FILE: include/drivers/cir/sunxi-cir.h
type sunxi_cir (line 14) | struct sunxi_cir {
type sunxi_cir (line 22) | struct sunxi_cir
type device (line 24) | struct device
FILE: include/drivers/clock.h
type clock_handle (line 18) | struct clock_handle {
type clock_handle (line 32) | struct clock_handle
type clock_handle (line 42) | struct clock_handle
type clock_handle (line 52) | struct clock_handle
type clock_handle (line 62) | struct clock_handle
type clock_handle (line 73) | struct clock_handle
type clock_handle (line 81) | struct clock_handle
type clock_handle (line 91) | struct clock_handle
FILE: include/drivers/clock/ccu.h
type ccu (line 28) | struct ccu {
type ccu (line 34) | struct ccu
type ccu (line 35) | struct ccu
FILE: include/drivers/gpio.h
type gpio_handle (line 13) | struct gpio_handle {
type gpio_handle (line 30) | struct gpio_handle
type gpio_handle (line 41) | struct gpio_handle
type gpio_handle (line 50) | struct gpio_handle
type gpio_handle (line 61) | struct gpio_handle
FILE: include/drivers/gpio/sunxi-gpio.h
type simple_device (line 33) | struct simple_device
type simple_device (line 34) | struct simple_device
FILE: include/drivers/mfd/axp20x.h
type regmap_device (line 11) | struct regmap_device
FILE: include/drivers/msgbox.h
type device (line 19) | struct device
type device (line 29) | struct device
type device (line 38) | struct device
type device (line 47) | struct device
FILE: include/drivers/msgbox/sunxi-msgbox.h
type simple_device (line 15) | struct simple_device
FILE: include/drivers/pmic.h
type device (line 16) | struct device
type device (line 23) | struct device
type device (line 30) | struct device
type device (line 37) | struct device
type device (line 44) | struct device
FILE: include/drivers/pmic/axp20x.h
type axp20x_pmic (line 13) | struct axp20x_pmic {
FILE: include/drivers/pmic/axp223.h
type axp20x_pmic (line 11) | struct axp20x_pmic
FILE: include/drivers/pmic/axp803.h
type axp20x_pmic (line 11) | struct axp20x_pmic
FILE: include/drivers/pmic/axp805.h
type axp20x_pmic (line 11) | struct axp20x_pmic
FILE: include/drivers/regmap.h
type regmap (line 13) | struct regmap {
type regmap_device (line 18) | struct regmap_device {
type regmap_device (line 26) | struct regmap_device
type device (line 27) | struct device
type regmap (line 44) | struct regmap
type regmap (line 51) | struct regmap
type regmap (line 64) | struct regmap
type regmap (line 77) | struct regmap
type regmap (line 91) | struct regmap
function regmap_clr_bits (line 105) | static inline int
function regmap_set_bits (line 122) | static inline int
type device (line 133) | struct device
type device (line 140) | struct device
type regmap (line 149) | struct regmap
type regmap (line 158) | struct regmap
FILE: include/drivers/regmap/sun6i-i2c.h
type simple_device (line 12) | struct simple_device
FILE: include/drivers/regmap/sunxi-rsb.h
type simple_device (line 12) | struct simple_device
FILE: include/drivers/regulator.h
type regulator_handle (line 12) | struct regulator_handle {
type regulator_handle (line 29) | struct regulator_handle
type regulator_handle (line 43) | struct regulator_handle
type regulator_handle (line 55) | struct regulator_handle
FILE: include/drivers/regulator/axp20x.h
type axp20x_regulator (line 13) | struct axp20x_regulator {
FILE: include/drivers/regulator/axp221.h
type axp20x_regulator (line 32) | struct axp20x_regulator
FILE: include/drivers/regulator/axp803.h
type axp20x_regulator (line 34) | struct axp20x_regulator
FILE: include/drivers/regulator/axp805.h
type axp20x_regulator (line 31) | struct axp20x_regulator
FILE: include/drivers/regulator/gpio.h
type gpio_regulator (line 12) | struct gpio_regulator {
type gpio_regulator (line 18) | struct gpio_regulator
type gpio_regulator (line 22) | struct gpio_regulator
type gpio_regulator (line 26) | struct gpio_regulator
type gpio_regulator (line 30) | struct gpio_regulator
FILE: include/drivers/regulator/sy8106a.h
type regmap_device (line 14) | struct regmap_device
FILE: include/drivers/serial.h
function serial_getc (line 37) | static inline char
function serial_putc (line 43) | static inline void
function serial_puts (line 48) | static inline void
function serial_init (line 53) | static inline void
function serial_ready (line 58) | static inline bool
FILE: include/drivers/watchdog.h
type device (line 16) | struct device
type device (line 23) | struct device
type device (line 30) | struct device
FILE: include/drivers/watchdog/sun6i-a31-wdt.h
type sun6i_a31_wdt (line 12) | struct sun6i_a31_wdt {
type sun6i_a31_wdt (line 17) | struct sun6i_a31_wdt
FILE: include/drivers/watchdog/sun9i-a80-twd.h
type simple_device (line 12) | struct simple_device
FILE: include/lib/bitmap.h
function bitmap_clear (line 44) | static inline void
function bitmap_get (line 56) | static inline bool
function bitmap_set (line 68) | static inline void
FILE: include/lib/byteswap.h
function bswap16 (line 11) | static inline uint16_t
function bswap32 (line 18) | static inline uint32_t
FILE: include/lib/division.h
function udiv_round (line 17) | static inline uint32_t
FILE: include/lib/mmio.h
function mmio_clr_32 (line 17) | static inline void
function mmio_clrset_32 (line 32) | static inline void
function mmio_get_32 (line 46) | static inline uint32_t
function mmio_poll_32 (line 60) | static inline void
function mmio_polleq_32 (line 77) | static inline void
function mmio_pollz_32 (line 93) | static inline void
function mmio_read_32 (line 109) | static inline uint32_t
function mmio_read_8 (line 123) | static inline uint8_t
function mmio_set_32 (line 141) | static inline void
function mmio_write_32 (line 155) | static inline void
function mmio_write_8 (line 169) | static inline void
FILE: include/lib/scpi_protocol.h
type scpi_msg (line 127) | struct scpi_msg {
type scpi_mem (line 149) | struct scpi_mem {
FILE: include/stdlib/ctype.h
function isalnum (line 22) | static inline bool
function isblank (line 28) | static inline bool
function iscntrl (line 34) | static inline bool
function ispunct (line 40) | static inline bool
function isspace (line 46) | static inline bool
function isxdigit (line 52) | static inline bool
FILE: include/stdlib/stdarg.h
type __builtin_va_list (line 15) | typedef __builtin_va_list va_list;
FILE: include/stdlib/stdint.h
type intmax_t (line 42) | typedef long long intmax_t;
type uintmax_t (line 50) | typedef unsigned long long uintmax_t;
FILE: lib/bitfield.c
function bitfield_get (line 11) | uint32_t
function bitfield_set (line 17) | uint32_t
function mmio_get_bitfield_32 (line 23) | uint32_t
function mmio_set_bitfield_32 (line 29) | void
FILE: tools/load.c
function main (line 30) | int
FILE: tools/test.c
type scpi_call_times (line 120) | struct scpi_call_times {
function bitmap_weight (line 218) | static unsigned
function data_cache_clean (line 228) | static void
function difftimespec (line 255) | static long
function log (line 264) | static void
function msgbox_ack (line 289) | static void
function msgbox_receive (line 299) | static void
function msgbox_send (line 320) | static void
function scpi_msg_size (line 333) | static size_t
function scpi_copy_msg (line 342) | static void
function scpi_has_command (line 360) | static bool
function scpi_prepare_msg (line 372) | static void
function scpi_send_request (line 384) | static bool
function scpi_serve_reply (line 427) | static bool
function test_assert_fail (line 469) | static noreturn void
function test_complete (line 480) | static void
function test_fail (line 493) | static void
function test_send_request (line 506) | static void
function test_serve_reply (line 524) | static void
function test_summary (line 536) | static void
function try_basic (line 549) | static void
function try_boot (line 593) | static void
function try_clocks (line 611) | static void
function try_css_power (line 725) | static void
function try_dvfs (line 751) | static void
function try_psus (line 834) | static void
function try_sensors (line 944) | static void
function try_sys_power (line 1013) | static void
function main (line 1036) | int
Condensed preview — 313 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (956K chars).
[
{
"path": ".gitignore",
"chars": 40,
"preview": "/..config*\n/.config*\n/build/\n/defconfig\n"
},
{
"path": ".travis.yml",
"chars": 2709,
"preview": "---\ndist: bionic\n\nlanguage: c\n\nmatrix:\n include:\n - addons:\n apt:\n packages:\n - codespell"
},
{
"path": ".uncrustify",
"chars": 24041,
"preview": "align_asm_colon = false\nalign_assign_span = 1\nalign_assign_thresh = 8\nalign_en"
},
{
"path": "3rdparty/Makefile",
"chars": 137,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nhostpro"
},
{
"path": "3rdparty/kconfig/Makefile",
"chars": 1808,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: GPL-2.0-only\n#\n# Based in part on scrip"
},
{
"path": "3rdparty/kconfig/conf.c",
"chars": 16112,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#include <ctype.h"
},
{
"path": "3rdparty/kconfig/confdata.c",
"chars": 27960,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#include <sys/mma"
},
{
"path": "3rdparty/kconfig/expr.c",
"chars": 30726,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#include <ctype.h"
},
{
"path": "3rdparty/kconfig/expr.h",
"chars": 9873,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#ifndef EXPR_H"
},
{
"path": "3rdparty/kconfig/lexer.l",
"chars": 9701,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n%option nostdin"
},
{
"path": "3rdparty/kconfig/list.h",
"chars": 3749,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n#ifndef LIST_H\n#define LIST_H\n\n/*\n * Copied from include/linux/...\n */\n\n#undef of"
},
{
"path": "3rdparty/kconfig/lkc.h",
"chars": 4413,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#ifndef LKC_H\n"
},
{
"path": "3rdparty/kconfig/lkc_proto.h",
"chars": 1929,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n#include <stdarg.h>\n\n/* confdata.c */\nvoid conf_parse(const char *name);\nint conf"
},
{
"path": "3rdparty/kconfig/menu.c",
"chars": 22753,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#include <ctype.h"
},
{
"path": "3rdparty/kconfig/nconf-cfg.sh",
"chars": 1348,
"preview": "#!/bin/sh\n# SPDX-License-Identifier: GPL-2.0\n\nPKG=\"ncursesw menuw panelw\"\nPKG2=\"ncurses menu panel\"\n\nif [ -n \"$(command "
},
{
"path": "3rdparty/kconfig/nconf.c",
"chars": 39064,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>\n *\n * Derived from menu"
},
{
"path": "3rdparty/kconfig/nconf.gui.c",
"chars": 15122,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>\n *\n * Derived from menu"
},
{
"path": "3rdparty/kconfig/nconf.h",
"chars": 1862,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n/*\n * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>\n *\n * Derived from m"
},
{
"path": "3rdparty/kconfig/parser.y",
"chars": 15694,
"preview": "/* SPDX-License-Identifier: GPL-2.0 */\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n%{\n\n#include <c"
},
{
"path": "3rdparty/kconfig/preprocess.c",
"chars": 11247,
"preview": "// SPDX-License-Identifier: GPL-2.0\n//\n// Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com>\n\n#include <"
},
{
"path": "3rdparty/kconfig/symbol.c",
"chars": 29322,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>\n */\n\n#include <ctype.h"
},
{
"path": "3rdparty/kconfig/util.c",
"chars": 2210,
"preview": "// SPDX-License-Identifier: GPL-2.0\n/*\n * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org>\n * Copyright (C) "
},
{
"path": "CONTRIBUTING.md",
"chars": 7775,
"preview": "# Contribution guidelines\n\nThank you for expressing interest in contributing to the development and/or\nmaintenance of th"
},
{
"path": "Doxyfile",
"chars": 5197,
"preview": "# Doxyfile 1.8.16\n\n#---------------------------------------------------------------------------\n# Project related config"
},
{
"path": "Kconfig",
"chars": 251,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nmainmen"
},
{
"path": "LICENSE.md",
"chars": 22763,
"preview": "# Crust Firmware Licensing\n\nThe Crust firmware itself is dual-licensed as BSD-3-clause or GPL-2.0-only. You\nmay use and "
},
{
"path": "Makefile",
"chars": 5369,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nSRC\t\t ="
},
{
"path": "README.md",
"chars": 7128,
"preview": "# Crust: Libre SCP firmware for Allwinner sunxi SoCs\n\n[ Include consid"
},
{
"path": "drivers/Kconfig",
"chars": 354,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nmenu \"D"
},
{
"path": "drivers/Makefile",
"chars": 391,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-$(C"
},
{
"path": "drivers/cec/Kconfig",
"chars": 334,
"preview": "#\n# Copyright © 2021-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nconfig "
},
{
"path": "drivers/cec/Makefile",
"chars": 152,
"preview": "#\n# Copyright © 2021-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/cec/cec.c",
"chars": 372,
"preview": "/*\n * Copyright © 2021-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/cec/dw-hdmi-cec.c",
"chars": 4797,
"preview": "/*\n * Copyright © 2021-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/cir/Kconfig",
"chars": 1636,
"preview": "#\n# Copyright © 2020-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nconfig "
},
{
"path": "drivers/cir/Makefile",
"chars": 265,
"preview": "#\n# Copyright © 2020-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/cir/cir.c",
"chars": 368,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/cir/cir.h",
"chars": 1154,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/cir/nec.c",
"chars": 2833,
"preview": "/*\n * Copyright © 2021-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/cir/rc6.c",
"chars": 3388,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/cir/sunxi-cir.c",
"chars": 3070,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/Kconfig",
"chars": 523,
"preview": "#\n# Copyright © 2020 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nchoice\n\tbool"
},
{
"path": "drivers/clock/Makefile",
"chars": 659,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/clock/ccu.c",
"chars": 2943,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/ccu.h",
"chars": 3168,
"preview": "/*\n * Copyright © 2019-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/ccu_helpers.c",
"chars": 1212,
"preview": "/*\n * Copyright © 2019-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/clock.c",
"chars": 4113,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/clock.h",
"chars": 944,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/r_ccu_common.c",
"chars": 2988,
"preview": "/*\n * Copyright © 2019-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/sun50i-a64-ccu.c",
"chars": 6415,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/sun50i-h6-ccu.c",
"chars": 5564,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/sun50i-h6-r-ccu.c",
"chars": 5540,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/sun8i-a23-ccu.c",
"chars": 5896,
"preview": "/*\n * Copyright © 2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/clock/sun8i-a83t-ccu.c",
"chars": 2965,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/sun8i-h3-ccu.c",
"chars": 5806,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/clock/sun8i-r-ccu.c",
"chars": 4877,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/counter/Makefile",
"chars": 361,
"preview": "#\n# Copyright © 2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-$(CONFIG"
},
{
"path": "drivers/counter/sun6i-a31-cnt64.c",
"chars": 348,
"preview": "/*\n * Copyright © 2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/counter/sun9i-a80-timestamp.c",
"chars": 353,
"preview": "/*\n * Copyright © 2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/css/Makefile",
"chars": 387,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/css/css.c",
"chars": 3874,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/css.h",
"chars": 2944,
"preview": "/*\n * Copyright © 2019-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/css_default.c",
"chars": 1227,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/css_helpers.c",
"chars": 894,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/css_power_state.c",
"chars": 881,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/sun50i-a64-css.c",
"chars": 4645,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/sun50i-h6-css.c",
"chars": 4395,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/css/sun6i-a31-css.c",
"chars": 3855,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/dram/Makefile",
"chars": 269,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/dram/dram.c",
"chars": 234,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/dram/sun50i-h6-dram.c",
"chars": 3499,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/dram/sun8i-h3-dram.c",
"chars": 8640,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/gpio/Makefile",
"chars": 152,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/gpio/gpio.c",
"chars": 1216,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/gpio/gpio.h",
"chars": 542,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/gpio/sunxi-gpio.c",
"chars": 3623,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/irq/Makefile",
"chars": 379,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/irq/irq.c",
"chars": 305,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/irq/sun6i-a31-r-intc.c",
"chars": 2591,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/mfd/Kconfig",
"chars": 955,
"preview": "#\n# Copyright © 2020-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nconfig "
},
{
"path": "drivers/mfd/Makefile",
"chars": 150,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-$(C"
},
{
"path": "drivers/mfd/axp20x.c",
"chars": 1493,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/msgbox/Makefile",
"chars": 155,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/msgbox/msgbox.c",
"chars": 1011,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/msgbox/msgbox.h",
"chars": 682,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/msgbox/sunxi-msgbox.c",
"chars": 3695,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/pmic/Kconfig",
"chars": 354,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nmenu \"P"
},
{
"path": "drivers/pmic/Makefile",
"chars": 271,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/pmic/axp20x.c",
"chars": 1085,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/pmic/axp20x.h",
"chars": 883,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/pmic/axp223.c",
"chars": 921,
"preview": "/*\n * Copyright © 2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/pmic/axp803.c",
"chars": 1112,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/pmic/axp805.c",
"chars": 1196,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/pmic/pmic.c",
"chars": 1191,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/pmic/pmic.h",
"chars": 514,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regmap/Kconfig",
"chars": 1479,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nchoice\n"
},
{
"path": "drivers/regmap/Makefile",
"chars": 244,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y "
},
{
"path": "drivers/regmap/regmap-i2c.c",
"chars": 2025,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regmap/regmap-i2c.h",
"chars": 826,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regmap/regmap.c",
"chars": 2056,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regmap/regmap.h",
"chars": 557,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regmap/sun6i-i2c.c",
"chars": 6532,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regmap/sunxi-rsb.c",
"chars": 3752,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/Kconfig",
"chars": 2411,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nmenu \"R"
},
{
"path": "drivers/regulator/Makefile",
"chars": 381,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/regulator/axp20x.c",
"chars": 1553,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/axp20x.h",
"chars": 603,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/axp221.c",
"chars": 2368,
"preview": "/*\n * Copyright © 2023 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/regulator/axp803.c",
"chars": 2576,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/axp805.c",
"chars": 2234,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/gpio.c",
"chars": 2740,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/regulator.c",
"chars": 1279,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/regulator.h",
"chars": 546,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/regulator/sy8106a.c",
"chars": 1405,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/Kconfig",
"chars": 1291,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nconfig "
},
{
"path": "drivers/serial/Makefile",
"chars": 427,
"preview": "#\n# Copyright © 2019-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/serial/serial.c",
"chars": 913,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/sun50i-a64-uart.c",
"chars": 3505,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/sun50i-h6-uart.c",
"chars": 2968,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/sun8i-a23-uart.c",
"chars": 3500,
"preview": "/*\n * Copyright © 2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/serial/sun8i-a83t-uart.c",
"chars": 3515,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/sun8i-h3-uart.c",
"chars": 2964,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/uart.c",
"chars": 1030,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/serial/uart.h",
"chars": 637,
"preview": "/*\n * Copyright © 2020-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/watchdog/Kconfig",
"chars": 1240,
"preview": "#\n# Copyright © 2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nchoice\n\tbool"
},
{
"path": "drivers/watchdog/Makefile",
"chars": 246,
"preview": "#\n# Copyright © 2017-2022 The Crust Firmware Authors.\n# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n#\n\nobj-y +"
},
{
"path": "drivers/watchdog/sun6i-a31-wdt.c",
"chars": 2086,
"preview": "/*\n * Copyright © 2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#includ"
},
{
"path": "drivers/watchdog/sun9i-a80-twd.c",
"chars": 2515,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/watchdog/watchdog.c",
"chars": 1034,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "drivers/watchdog/watchdog.h",
"chars": 467,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
},
{
"path": "include/common/debug.h",
"chars": 1944,
"preview": "/*\n * Copyright © 2017-2022 The Crust Firmware Authors.\n * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only\n */\n\n#i"
}
]
// ... and 113 more files (download for full content)
About this extraction
This page contains the full source code of the crust-firmware/crust GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 313 files (856.5 KB), approximately 272.7k tokens, and a symbol index with 1179 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.