From 52067dae006c3adf13dddbc6ada39cd4cc505ad4 Mon Sep 17 00:00:00 2001 From: Dennis Ruffer Date: Thu, 29 Jun 2023 07:07:03 -0700 Subject: [PATCH 1/2] zephyr: Pick up some more changes found in the private repos (#211) Add merge=ours to lines I forgot to put it on. Remove .github files we don't want again. Not sure why nightly merges are not working and we get these back every night, but I'm investigating. I added some files from upstream which I had to remove to get it building properly again. I took out all of my changes from the Pearl Geck Starter Kit (efm32pg_stk3402a). The board.c, h and CMakeLists.txt files are being removed from many boards and I will be doing that to DevEdge too. I removed all of the platform_exclude: tmo_dev_edge from twister tests that I just added recently. Signed-off-by: Dennis Ruffer --- .gitattributes | 16 +- .github/ISSUE_TEMPLATE/001_bug_report.md | 57 - .github/ISSUE_TEMPLATE/002_enhancement.md | 20 - .github/ISSUE_TEMPLATE/003_rfc-proposal.md | 51 - .github/ISSUE_TEMPLATE/004_feature_request.md | 20 - .../ISSUE_TEMPLATE/005_hardware_support.md | 19 - .github/ISSUE_TEMPLATE/006_nomination.md | 42 - .github/ISSUE_TEMPLATE/007_ext-source.md | 68 - .github/ISSUE_TEMPLATE/008_bin-blobs.md | 41 - .github/workflows/assigner.yml | 38 - .github/workflows/backport.yml | 31 - .github/workflows/backport_issue_check.yml | 31 - .github/workflows/bsim-tests-publish.yaml | 28 - .github/workflows/bsim-tests.yaml | 161 - .github/workflows/bug_snapshot.yaml | 67 - .github/workflows/clang.yaml | 163 - .github/workflows/codecov.yaml | 176 - .github/workflows/coding_guidelines.yml | 59 - .github/workflows/compliance.yml | 90 - .github/workflows/daily_test_version.yml | 38 - .github/workflows/devicetree_checks.yml | 75 - .github/workflows/do_not_merge.yml | 18 - .github/workflows/doc-build.yml | 172 - .github/workflows/doc-publish-pr.yml | 63 - .github/workflows/doc-publish.yml | 55 - .github/workflows/errno.yml | 32 - .github/workflows/footprint-tracking.yml | 85 - .github/workflows/footprint.yml | 71 - .../greet_first_time_contributor.yml | 50 - .github/workflows/issue_count.yml | 54 - .github/workflows/issues-report-config.json | 37 - .github/workflows/license_check.yml | 32 - .github/workflows/manifest.yml | 27 - .github/workflows/release.yml | 60 - .github/workflows/scripts_tests.yml | 71 - .../stale-workflow-queue-cleanup.yml | 28 - .github/workflows/stale_issue.yml | 28 - .github/workflows/twister.yaml | 332 -- .github/workflows/twister_tests.yml | 66 - .github/workflows/west_cmds.yml | 80 - boards/arm/cc3220sf_launchxl/pinmux.c | 157 - boards/arm/cc3235sf_launchxl/pinmux.c | 133 - boards/arm/efm32hg_slstk3400a/CMakeLists.txt | 6 - boards/arm/efm32hg_slstk3400a/board.c | 32 - boards/arm/efm32hg_slstk3400a/board.h | 14 - boards/arm/efm32pg_stk3401a/CMakeLists.txt | 6 - boards/arm/efm32pg_stk3401a/board.c | 32 - boards/arm/efm32pg_stk3401a/board.h | 14 - boards/arm/efm32pg_stk3402a/CMakeLists.txt | 6 - boards/arm/efm32pg_stk3402a/Kconfig.defconfig | 7 - boards/arm/efm32pg_stk3402a/board.c | 32 - boards/arm/efm32pg_stk3402a/board.h | 14 - boards/arm/efm32pg_stk3402a/doc/index.rst | 213 +- .../efm32pg_stk3402a-pinctrl.dtsi | 30 - .../efm32pg_stk3402a/efm32pg_stk3402a.yaml | 5 - .../efm32pg_stk3402a_common.dtsi | 19 +- .../efm32pg_stk3402a_defconfig | 7 - .../efm32pg_stk3402a_jg_defconfig | 1 - .../arm/efm32pg_stk3402a/pre_dt_board.cmake | 5 - boards/arm/efm32wg_stk3800/CMakeLists.txt | 6 - boards/arm/efm32wg_stk3800/board.c | 31 - boards/arm/efm32wg_stk3800/board.h | 14 - boards/arm/efr32_radio/board.c | 41 - .../efr32mg_sltb004a-pinctrl.dtsi | 41 - .../arm/efr32mg_sltb004a/efr32mg_sltb004a.dts | 19 +- .../efr32mg_sltb004a_defconfig | 1 - boards/arm/pinetime_devkit0/CMakeLists.txt | 7 - .../misc/pine64,pinetime-key-out.yaml | 15 - boards/arm/pinetime_devkit0/key_out.c | 39 - .../CMakeLists.txt | 4 - .../arm/sparkfun_thing_plus_nrf9160/board.c | 31 - boards/arm64/xenvm/Kconfig | 8 - boards/posix/native_posix/sdl_events.c | 82 - boards/riscv/rv32m1_vega/CMakeLists.txt | 6 - boards/riscv/rv32m1_vega/Kconfig | 12 - boards/riscv/rv32m1_vega/board.c | 38 - .../nxp_adsp_imx8m/nxp_adsp_imx8m_uart.conf | 7 - .../nxp_adsp_imx8m_uart.overlay | 33 - cmake/modules/root.cmake | 24 +- doc/conf.py | 8 +- doc/connectivity/index.rst | 2 +- doc/connectivity/usb_c/index.rst | 9 - doc/connectivity/usb_c/ucds.rst | 215 -- doc/releases/release-notes-3.4.rst | 229 +- doc/security/vulnerabilities.rst | 10 + doc/services/index.rst | 1 - doc/services/usb/hid.rst | 56 - doc/services/usb/index.rst | 29 - doc/services/usb/udc.rst | 17 - doc/services/usb/uds.rst | 164 - doc/services/usb/uds_cdc_acm.rst | 105 - doc/services/usb/uds_next.rst | 35 - doc/services/usb/uds_testing.rst | 50 - doc/services/usb/uhc.rst | 15 - drivers/sensor/cxd5605/CMakeLists.txt | 1 + drivers/sensor/cxd5605/Kconfig | 14 +- drivers/sensor/cxd5605/cxd5605.c | 774 +++-- drivers/sensor/cxd5605/cxd5605.h | 37 + drivers/sensor/cxd5605/cxd5605_lib_exports.c | 85 + dts/arm/nuvoton/npcx.dtsi | 659 ---- dts/arm/nuvoton/npcx7.dtsi | 244 -- dts/arm/nuvoton/npcx9.dtsi | 266 -- dts/arm/silabs/efr32bg22-pinctrl.dtsi | 28 - dts/arm/silabs/efr32bg22c224f512im40.dtsi | 23 - dts/arm/silabs/efr32mg.dtsi | 10 - include/zephyr/bluetooth/conn.h | 2 +- include/zephyr/bluetooth/hci.h | 2981 ++++++++++++++++- include/zephyr/drivers/fuel_gauge.h | 17 + include/zephyr/drivers/sensor/cxd5605.h | 71 +- include/zephyr/drivers/sensor/gnss.h | 113 +- samples/modules/nanopb/sample.yaml | 1 - samples/sensor/cxd5605_hot/src/main.c | 4 +- samples/subsys/nvs/sample.yaml | 2 +- .../shell_module/boards/efm32pg_stk3402a.conf | 15 - samples/subsys/task_wdt/sample.yaml | 1 - .../cmake/modules/sysbuild_extensions.cmake | 10 + .../l2/ieee802154/ieee802154_radio_utils.h | 95 - subsys/shell/modules/kernel_service.c | 9 + tests/benchmarks/sched/testcase.yaml | 1 - .../counter/counter_basic_api/testcase.yaml | 2 +- tests/drivers/flash/common/testcase.yaml | 1 - .../boards/efm32pg_stk3402a.overlay | 13 - .../fixed/boards/efm32pg_stk3402a.overlay | 16 - tests/kernel/mem_slab/mslab/testcase.yaml | 1 - .../usage/thread_runtime_stats/testcase.yaml | 1 - tests/kernel/workq/work_queue/testcase.yaml | 1 - tests/lib/cmsis_dsp/filtering/testcase.yaml | 2 - tests/subsys/dsp/basicmath/testcase.yaml | 2 - tests/subsys/jwt/testcase.yaml | 1 - .../logging/log_backend_init/testcase.yaml | 1 - .../logging/log_core_additional/testcase.yaml | 1 - .../logging/log_timestamp/testcase.yaml | 1 - .../portability/cmsis_rtos_v2/testcase.yaml | 2 +- tests/subsys/rtio/rtio_api/testcase.yaml | 2 - west.yml | 2 +- 135 files changed, 3966 insertions(+), 6335 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/001_bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/002_enhancement.md delete mode 100644 .github/ISSUE_TEMPLATE/003_rfc-proposal.md delete mode 100644 .github/ISSUE_TEMPLATE/004_feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/005_hardware_support.md delete mode 100644 .github/ISSUE_TEMPLATE/006_nomination.md delete mode 100644 .github/ISSUE_TEMPLATE/007_ext-source.md delete mode 100644 .github/ISSUE_TEMPLATE/008_bin-blobs.md delete mode 100644 .github/workflows/assigner.yml delete mode 100644 .github/workflows/backport.yml delete mode 100644 .github/workflows/backport_issue_check.yml delete mode 100644 .github/workflows/bsim-tests-publish.yaml delete mode 100644 .github/workflows/bsim-tests.yaml delete mode 100644 .github/workflows/bug_snapshot.yaml delete mode 100644 .github/workflows/clang.yaml delete mode 100644 .github/workflows/codecov.yaml delete mode 100644 .github/workflows/coding_guidelines.yml delete mode 100644 .github/workflows/compliance.yml delete mode 100644 .github/workflows/daily_test_version.yml delete mode 100644 .github/workflows/devicetree_checks.yml delete mode 100644 .github/workflows/do_not_merge.yml delete mode 100644 .github/workflows/doc-build.yml delete mode 100644 .github/workflows/doc-publish-pr.yml delete mode 100644 .github/workflows/doc-publish.yml delete mode 100644 .github/workflows/errno.yml delete mode 100644 .github/workflows/footprint-tracking.yml delete mode 100644 .github/workflows/footprint.yml delete mode 100644 .github/workflows/greet_first_time_contributor.yml delete mode 100644 .github/workflows/issue_count.yml delete mode 100644 .github/workflows/issues-report-config.json delete mode 100644 .github/workflows/license_check.yml delete mode 100644 .github/workflows/manifest.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/scripts_tests.yml delete mode 100644 .github/workflows/stale-workflow-queue-cleanup.yml delete mode 100644 .github/workflows/stale_issue.yml delete mode 100644 .github/workflows/twister.yaml delete mode 100644 .github/workflows/twister_tests.yml delete mode 100644 .github/workflows/west_cmds.yml delete mode 100644 boards/arm/cc3220sf_launchxl/pinmux.c delete mode 100644 boards/arm/cc3235sf_launchxl/pinmux.c delete mode 100644 boards/arm/efm32hg_slstk3400a/CMakeLists.txt delete mode 100644 boards/arm/efm32hg_slstk3400a/board.c delete mode 100644 boards/arm/efm32hg_slstk3400a/board.h delete mode 100644 boards/arm/efm32pg_stk3401a/CMakeLists.txt delete mode 100644 boards/arm/efm32pg_stk3401a/board.c delete mode 100644 boards/arm/efm32pg_stk3401a/board.h delete mode 100644 boards/arm/efm32pg_stk3402a/CMakeLists.txt delete mode 100644 boards/arm/efm32pg_stk3402a/board.c delete mode 100644 boards/arm/efm32pg_stk3402a/board.h delete mode 100644 boards/arm/efm32pg_stk3402a/efm32pg_stk3402a-pinctrl.dtsi delete mode 100644 boards/arm/efm32pg_stk3402a/pre_dt_board.cmake delete mode 100644 boards/arm/efm32wg_stk3800/CMakeLists.txt delete mode 100644 boards/arm/efm32wg_stk3800/board.c delete mode 100644 boards/arm/efm32wg_stk3800/board.h delete mode 100644 boards/arm/efr32_radio/board.c delete mode 100644 boards/arm/efr32mg_sltb004a/efr32mg_sltb004a-pinctrl.dtsi delete mode 100644 boards/arm/pinetime_devkit0/CMakeLists.txt delete mode 100644 boards/arm/pinetime_devkit0/dts/bindings/misc/pine64,pinetime-key-out.yaml delete mode 100644 boards/arm/pinetime_devkit0/key_out.c delete mode 100644 boards/arm/sparkfun_thing_plus_nrf9160/CMakeLists.txt delete mode 100644 boards/arm/sparkfun_thing_plus_nrf9160/board.c delete mode 100644 boards/arm64/xenvm/Kconfig delete mode 100644 boards/posix/native_posix/sdl_events.c delete mode 100644 boards/riscv/rv32m1_vega/CMakeLists.txt delete mode 100644 boards/riscv/rv32m1_vega/Kconfig delete mode 100644 boards/riscv/rv32m1_vega/board.c delete mode 100644 boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.conf delete mode 100644 boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.overlay delete mode 100644 doc/connectivity/usb_c/index.rst delete mode 100644 doc/connectivity/usb_c/ucds.rst delete mode 100644 doc/services/usb/hid.rst delete mode 100644 doc/services/usb/index.rst delete mode 100644 doc/services/usb/udc.rst delete mode 100644 doc/services/usb/uds.rst delete mode 100644 doc/services/usb/uds_cdc_acm.rst delete mode 100644 doc/services/usb/uds_next.rst delete mode 100644 doc/services/usb/uds_testing.rst delete mode 100644 doc/services/usb/uhc.rst create mode 100644 drivers/sensor/cxd5605/cxd5605_lib_exports.c delete mode 100644 dts/arm/nuvoton/npcx.dtsi delete mode 100644 dts/arm/nuvoton/npcx7.dtsi delete mode 100644 dts/arm/nuvoton/npcx9.dtsi delete mode 100644 dts/arm/silabs/efr32bg22-pinctrl.dtsi delete mode 100644 dts/arm/silabs/efr32bg22c224f512im40.dtsi delete mode 100644 samples/subsys/shell/shell_module/boards/efm32pg_stk3402a.conf delete mode 100644 subsys/net/l2/ieee802154/ieee802154_radio_utils.h delete mode 100644 tests/drivers/gpio/gpio_basic_api/boards/efm32pg_stk3402a.overlay delete mode 100644 tests/drivers/regulator/fixed/boards/efm32pg_stk3402a.overlay diff --git a/.gitattributes b/.gitattributes index 1b488e8a11c..75cc9cc2181 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,14 +16,14 @@ # will never be auto-merged into from main. If the file doesn't exist here, then # any upstream changes will override ours. .gitattributes merge=ours -.github/ISSUE_TEMPLATE/001_bug_report.md -.github/ISSUE_TEMPLATE/002_enhancement.md -.github/ISSUE_TEMPLATE/003_rfc-proposal.md -.github/ISSUE_TEMPLATE/004_feature_request.md -.github/ISSUE_TEMPLATE/005_hardware_support.md -.github/ISSUE_TEMPLATE/006_nomination.md -.github/ISSUE_TEMPLATE/007_ext-source.md -.github/ISSUE_TEMPLATE/008_bin-blobs.md +.github/ISSUE_TEMPLATE/001_bug_report.md merge=ours +.github/ISSUE_TEMPLATE/002_enhancement.md merge=ours +.github/ISSUE_TEMPLATE/003_rfc-proposal.md merge=ours +.github/ISSUE_TEMPLATE/004_feature_request.md merge=ours +.github/ISSUE_TEMPLATE/005_hardware_support.md merge=ours +.github/ISSUE_TEMPLATE/006_nomination.md merge=ours +.github/ISSUE_TEMPLATE/007_ext-source.md merge=ours +.github/ISSUE_TEMPLATE/008_bin-blobs.md merge=ours .github/workflows/assigner.yml merge=ours .github/workflows/backport.yml merge=ours .github/workflows/backport_issue_check.yml merge=ours diff --git a/.github/ISSUE_TEMPLATE/001_bug_report.md b/.github/ISSUE_TEMPLATE/001_bug_report.md deleted file mode 100644 index 57f8652b65b..00000000000 --- a/.github/ISSUE_TEMPLATE/001_bug_report.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve Zephyr -title: '' -labels: bug -assignees: '' - ---- - -**Notes (delete this)** -Github Discussions (https://github.com/zephyrproject-rtos/zephyr/discussions) -are available to first verify that the issue is a genuine Zephyr bug and not a -consequence of Zephyr services misuse. - -This issue list is only for bugs in the main Zephyr code base -(https://github.com/zephyrproject-rtos/zephyr/). If the bug is for a project -fork (such as NCS) specific feature, please open an issue in the fork project -instead. - -**Describe the bug** -A clear and concise description of what the bug is. - -Please also mention any information which could help others to understand -the problem you're facing: - - What target platform are you using? - - What have you tried to diagnose or workaround this issue? - - Is this a regression? If yes, have you been able to "git bisect" it to a - specific commit? - - ... - -**To Reproduce** -Steps to reproduce the behavior: -1. mkdir build; cd build -2. cmake -DBOARD=board\_xyz -3. make -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Impact** -What impact does this issue have on your progress (e.g., annoyance, showstopper) - -**Logs and console output** -If applicable, add console logs or other types of debug information -e.g Wireshark capture or Logic analyzer capture (upload in zip archive). -copy-and-paste text and put a code fence (\`\`\`) before and after, to help -explain the issue. (if unable to obtain text log, add a screenshot) - -**Environment (please complete the following information):** - - OS: (e.g. Linux, MacOS, Windows) - - Toolchain (e.g Zephyr SDK, ...) - - Commit SHA or Version used - -**Additional context** -Add any other context that could be relevant to your issue, such as pin setting, -target configuration, ... diff --git a/.github/ISSUE_TEMPLATE/002_enhancement.md b/.github/ISSUE_TEMPLATE/002_enhancement.md deleted file mode 100644 index 615db8fec2e..00000000000 --- a/.github/ISSUE_TEMPLATE/002_enhancement.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Enhancement -about: Suggest enhancements to existing features -title: '' -labels: Enhancement -assignees: '' - ---- - -**Is your enhancement proposal related to a problem? Please describe.** -A clear and concise description of what the problem is. - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or graphics (drag-and-drop an image) about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/003_rfc-proposal.md b/.github/ISSUE_TEMPLATE/003_rfc-proposal.md deleted file mode 100644 index fbb1fc8a1e1..00000000000 --- a/.github/ISSUE_TEMPLATE/003_rfc-proposal.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: RFC / Proposal -about: Submit an RFC / Proposal -title: '' -labels: RFC -assignees: '' - ---- - -## Introduction - -This section targets end users, TSC members, maintainers and anyone else that might -need a quick explanation of your proposed change. - -### Problem description - -Why do we want this change and what problem are we trying to address? - -### Proposed change - -A brief summary of the proposed change - the 10,000 ft view on what it will -change once this change is implemented. - -## Detailed RFC - -In this section of the document the target audience is the dev team. Upon -reading this section each engineer should have a rather clear picture of what -needs to be done in order to implement the described feature. - -### Proposed change (Detailed) - -This section is freeform - you should describe your change in as much detail -as possible. Please also ensure to include any context or background info here. -For example, do we have existing components which can be reused or altered. - -By reading this section, each team member should be able to know what exactly -you're planning to change and how. - -### Dependencies - -Highlight how the change may affect the rest of the project (new components, -modifications in other areas), or other teams/projects. - -### Concerns and Unresolved Questions - -List any concerns, unknowns, and generally unresolved questions etc. - -## Alternatives - -List any alternatives considered, and the reasons for choosing this option -over them. diff --git a/.github/ISSUE_TEMPLATE/004_feature_request.md b/.github/ISSUE_TEMPLATE/004_feature_request.md deleted file mode 100644 index 3ffc06790ef..00000000000 --- a/.github/ISSUE_TEMPLATE/004_feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: Feature Request -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or graphics (drag-and-drop an image) about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/005_hardware_support.md b/.github/ISSUE_TEMPLATE/005_hardware_support.md deleted file mode 100644 index a81be5b81f8..00000000000 --- a/.github/ISSUE_TEMPLATE/005_hardware_support.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Hardware Support -about: Suggest adding hardware support -title: '' -labels: Hardware Support -assignees: '' - ---- - -**Is this request related to a missing driver support for a particular hardware platform, SoC or board? Please describe.** -Describe in details the hardware support being requested and why this support benefits Zephyr. - -**Describe why you are asking for this support?** -Describe why you are asking for this support instead of contributing it directly to the tree - -If this is a new board or SoC, please state whether you are willing to maintain the Zephyr support for it if it is included in the main tree - -**Additional context** -Add any other context or graphics (drag-and-drop an image) about the hardware here. diff --git a/.github/ISSUE_TEMPLATE/006_nomination.md b/.github/ISSUE_TEMPLATE/006_nomination.md deleted file mode 100644 index 832fb7b8296..00000000000 --- a/.github/ISSUE_TEMPLATE/006_nomination.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -name: Contributor Nomination -about: Nominate a GitHub user for additional rights on the Zephyr Project -title: '' -labels: Role Nomination -assignees: '' - ---- - -# Background - -The [TSC Project Roles] defines the main roles for the Zephyr Project, including -Maintainer, Collaborator, and Contributor. - -By default anyone that contributes code or documentation is a Contributor, but -with the lowest [GitHub Permission Level] of Read. For example, Contributors -with Read permission do not have the permission to add reviewers to a pull -request. - -Use this template to nominate a GitHub user for the Contributor role with -Triage permission level, which allows the user to add reviewers to a pull -request and be added as a reviewer by other users. - -# Nomination - -## GitHub User - -Provide the following information about the GitHub user: - -1. Full Name -1. GitHub username -1. Organization (optional) - -## Supporting Documents - -Add links to 3-5 GitHub pull requests, in the Zephyr project, authored or -reviewed by the GitHub user that demonstrate the user's dedication to the -Zephyr project. - - -[TSC Project Roles]: -[GitHub Permission Level]: diff --git a/.github/ISSUE_TEMPLATE/007_ext-source.md b/.github/ISSUE_TEMPLATE/007_ext-source.md deleted file mode 100644 index 835450cd507..00000000000 --- a/.github/ISSUE_TEMPLATE/007_ext-source.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -name: External Source Code -about: Submit a proposal to integrate external source code -title: '' -labels: TSC -assignees: '' - ---- - -## Origin - -Name of project hosting the original open source code -Provide a link to the source - -## Purpose - -Brief description of what this software does - -## Mode of integration - -Describe whether you'd like to integrate this external component in the main tree -or as a module, and why. If the mode of integration is a module, suggest a -repository name for the module - -## Maintainership - -List the person(s) that will be maintaining the integration of this external code -for the foreseeable future. Please use GitHub IDs to identify them. You can -choose to identify a single maintainer only or add collaborators as well - -## Pull Request - -Pull request (if any) with the actual implementation of the integration, be it -in the main tree or as a module (pointing to your own fork for now). Make sure -the PR is correctly labeled as "DNM" - -## Description - -Long description that will help reviewers discuss suitability of the -component to solve the problem at hand (there may be a better options -available.) - -What is its primary functionality (e.g., SQLLite is a lightweight -database)? - -What problem are you trying to solve? (e.g., a state store is -required to maintain ...) - -Why is this the right component to solve it (e.g., SQLite is small, -easy to use, and has a very liberal license.) - -## Dependencies - -What other components does this package depend on? - -Will the Zephyr project have a direct dependency on the component, or -will it be included via an abstraction layer with this component as a -replaceable implementation? - -## Revision - -Version or SHA you would like to integrate initially - -## License - -Please use an SPDX identifier (https://spdx.org/licenses/), such as -``BSD-3-Clause`` - diff --git a/.github/ISSUE_TEMPLATE/008_bin-blobs.md b/.github/ISSUE_TEMPLATE/008_bin-blobs.md deleted file mode 100644 index cde55e03bef..00000000000 --- a/.github/ISSUE_TEMPLATE/008_bin-blobs.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: Binary blobs -about: Submit a proposal to integrate binary blob(s) -title: '' -labels: TSC -assignees: '' - ---- - -## Origin - -Describe where the binary blob(s) originate from - -## Type - -- [ ] Precompiled library -- [ ] Firmware image - -## Module - -The Zephyr module that this blob(s) will be referenced from - -## Purpose - -Brief description of what the blob(s) do. It is especially important to describe -the functionality that the blob(s) provide, to the largest extent possible - -## Pull Request - -Link to the Pull request with the actual implementation of the integration. If -you are submitting this as part of a new module you may link to the same Pull -Request that introduced the new module. - -## Dependencies - -What other components do the blob(s) depend on, if any? - -## License - -Document the license the blob(s) are distributed under - diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml deleted file mode 100644 index 87293159056..00000000000 --- a/.github/workflows/assigner.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Pull Request Assigner - -on: - pull_request_target: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - - v*-branch - -jobs: - assignment: - name: Pull Request Assignment - if: github.event.pull_request.draft == false - runs-on: ubuntu-22.04 - - steps: - - name: Install Python dependencies - run: | - sudo pip3 install -U setuptools wheel pip - pip3 install -U PyGithub>=1.55 - - - name: Check out source code - uses: actions/checkout@v3 - - - name: Run assignment script - env: - GITHUB_TOKEN: ${{ secrets.ZB_GITHUB_TOKEN }} - run: | - python3 scripts/set_assignees.py \ - -v \ - -o ${{ github.event.repository.owner.login }} \ - -r ${{ github.event.repository.name }} \ - -M MAINTAINERS.yml \ - -P ${{ github.event.pull_request.number }} diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml deleted file mode 100644 index 5e28332c2a2..00000000000 --- a/.github/workflows/backport.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Backport -on: - pull_request_target: - types: - - closed - - labeled - branches: - - main - -jobs: - backport: - name: Backport - runs-on: ubuntu-22.04 - # Only react to merged PRs for security reasons. - # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. - if: > - github.event.pull_request.merged && - ( - github.event.action == 'closed' || - ( - github.event.action == 'labeled' && - contains(github.event.label.name, 'backport') - ) - ) - steps: - - name: Backport - uses: zephyrproject-rtos/action-backport@v2.0.3-3 - with: - github_token: ${{ secrets.ZB_GITHUB_TOKEN }} - issue_labels: Backport - labels_template: '["Backport"]' diff --git a/.github/workflows/backport_issue_check.yml b/.github/workflows/backport_issue_check.yml deleted file mode 100644 index a66edd318f7..00000000000 --- a/.github/workflows/backport_issue_check.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Backport Issue Check - -on: - pull_request_target: - branches: - - v*-branch - -jobs: - backport: - name: Backport Issue Check - runs-on: ubuntu-22.04 - if: github.repository == 'zephyrproject-rtos/zephyr' - - steps: - - name: Check out source code - uses: actions/checkout@v3 - - - name: Install Python dependencies - run: | - sudo pip3 install -U setuptools wheel pip - pip3 install -U pygithub - - - name: Run backport issue checker - env: - GITHUB_TOKEN: ${{ secrets.ZB_GITHUB_TOKEN }} - run: | - ./scripts/release/list_backports.py \ - -o ${{ github.event.repository.owner.login }} \ - -r ${{ github.event.repository.name }} \ - -b ${{ github.event.pull_request.base.ref }} \ - -p ${{ github.event.pull_request.number }} diff --git a/.github/workflows/bsim-tests-publish.yaml b/.github/workflows/bsim-tests-publish.yaml deleted file mode 100644 index 132a891cc46..00000000000 --- a/.github/workflows/bsim-tests-publish.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish BabbleSim Tests Results - -on: - workflow_run: - workflows: ["BabbleSim Tests"] - types: - - completed -jobs: - bsim-test-results: - name: "Publish BabbleSim Test Results" - runs-on: ubuntu-22.04 - if: github.event.workflow_run.conclusion != 'skipped' - - steps: - - name: Download artifacts - uses: dawidd6/action-download-artifact@v2 - with: - run_id: ${{ github.event.workflow_run.id }} - - - name: Publish BabbleSim Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - with: - check_name: BabbleSim Test Results - comment_mode: off - commit: ${{ github.event.workflow_run.head_sha }} - event_file: event/event.json - event_name: ${{ github.event.workflow_run.event }} - files: "bsim-test-results/**/bsim_results.xml" diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml deleted file mode 100644 index 16d3b7a1f4a..00000000000 --- a/.github/workflows/bsim-tests.yaml +++ /dev/null @@ -1,161 +0,0 @@ -name: BabbleSim Tests - -on: - pull_request: - paths: - - ".github/workflows/bsim-tests.yaml" - - ".github/workflows/bsim-tests-publish.yaml" - - "west.yml" - - "subsys/bluetooth/**" - - "tests/bsim/**" - - "samples/bluetooth/**" - - "boards/posix/**" - - "soc/posix/**" - - "arch/posix/**" - - "samples/net/sockets/echo_*/**" - - "modules/openthread/**" - - "subsys/net/l2/openthread/**" - - "include/zephyr/net/openthread.h" - - "drivers/ieee802154/**" - - "include/zephyr/net/ieee802154*" - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - bsim-test: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: zephyr-runner-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - volumes: - - /repo-cache/zephyrproject:/github/cache/zephyrproject - env: - ZEPHYR_TOOLCHAIN_VARIANT: zephyr - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - EDTT_PATH: ../tools/edtt - bsim_bluetooth_test_results_file: ./bsim_bluetooth/bsim_results.xml - bsim_networking_test_results_file: ./bsim_net/bsim_results.xml - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Clone cached Zephyr repository - continue-on-error: true - run: | - git clone --shared /github/cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Environment Setup - env: - BASE_REF: ${{ github.base_ref }} - run: | - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Bot" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git log --pretty=oneline | head -n 10 - west init -l . || true - west config manifest.group-filter -- +ci - west config --global update.narrow true - west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /github/cache/zephyrproject) - west forall -c 'git reset --hard HEAD' - - - name: Check common triggering files - uses: tj-actions/changed-files@v35 - id: check-common-files - with: - files: | - .github/workflows/bsim-tests.yaml - .github/workflows/bsim-tests-publish.yaml - west.yml - boards/posix/** - soc/posix/** - arch/posix/** - tests/bsim/* - - - name: Check if Bluethooth files changed - uses: tj-actions/changed-files@v35 - id: check-bluetooth-files - with: - files: | - tests/bsim/bluetooth/** - samples/bluetooth/** - subsys/bluetooth/** - - - name: Check if Networking files changed - uses: tj-actions/changed-files@v35 - id: check-networking-files - with: - files: | - tests/bsim/net/** - samples/net/sockets/echo_*/** - modules/openthread/** - subsys/net/l2/openthread/** - include/zephyr/net/openthread.h - drivers/ieee802154/** - include/zephyr/net/ieee802154* - - - name: Update BabbleSim to manifest revision - if: > - steps.check-bluetooth-files.outputs.any_changed == 'true' - || steps.check-networking-files.outputs.any_changed == 'true' - || steps.check-common-files.outputs.any_changed == 'true' - run: | - export BSIM_VERSION=$( west list bsim -f {revision} ) - echo "Manifest points to bsim sha $BSIM_VERSION" - cd /opt/bsim_west/bsim - git fetch -n origin ${BSIM_VERSION} - git config --global advice.detachedHead false - git checkout ${BSIM_VERSION} - west update - make everything -s -j 8 - - - name: Run Bluetooth Tests with BSIM - if: steps.check-bluetooth-files.outputs.any_changed == 'true' || steps.check-common-files.outputs.any_changed == 'true' - run: | - export ZEPHYR_BASE=${PWD} - WORK_DIR=${ZEPHYR_BASE}/bsim_bluetooth tests/bsim/bluetooth/compile.sh - RESULTS_FILE=${ZEPHYR_BASE}/${bsim_bluetooth_test_results_file} \ - SEARCH_PATH=tests/bsim/bluetooth/ tests/bsim/run_parallel.sh - - - name: Run Networking Tests with BSIM - if: steps.check-networking-files.outputs.any_changed == 'true' || steps.check-common-files.outputs.any_changed == 'true' - run: | - export ZEPHYR_BASE=${PWD} - WORK_DIR=${ZEPHYR_BASE}/bsim_net tests/bsim/net/compile.sh - RESULTS_FILE=${ZEPHYR_BASE}/${bsim_networking_test_results_file} \ - SEARCH_PATH=tests/bsim/net/ tests/bsim/run_parallel.sh - - - name: Upload Test Results - if: always() - uses: actions/upload-artifact@v3 - with: - name: bsim-test-results - path: | - ./bsim_bluetooth/bsim_results.xml - ./bsim_net/bsim_results.xml - ${{ github.event_path }} - if-no-files-found: warn - - - name: Upload Event Details - if: always() - uses: actions/upload-artifact@v3 - with: - name: event - path: | - ${{ github.event_path }} diff --git a/.github/workflows/bug_snapshot.yaml b/.github/workflows/bug_snapshot.yaml deleted file mode 100644 index d19f881ddcd..00000000000 --- a/.github/workflows/bug_snapshot.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) 2021, 2022 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Make a snapshot of open bugs as a python pickle file, compressed -# using xz. Upload the xz file to Amazon S3. - -name: Bug Snapshot - -on: - workflow_dispatch: - branches: [main] - schedule: - # Run daily at 14:05 - - cron: '5 14 * * *' - -jobs: - make_bugs_pickle: - name: Make bugs pickle - runs-on: ubuntu-22.04 - if: github.repository_owner == 'zephyrproject-rtos' - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Python dependencies - run: | - sudo pip3 install -U setuptools wheel pip - pip3 install -U pygithub - - - name: Snapshot bugs - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - BUGS_PICKLE_FILENAME="zephyr-bugs-$(date -I).pickle.xz" - BUGS_PICKLE_PATH="${RUNNER_TEMP}/${BUGS_PICKLE_FILENAME}" - - set -euo pipefail - python3 scripts/make_bugs_pickle.py | xz > ${BUGS_PICKLE_PATH} - - echo "BUGS_PICKLE_FILENAME=${BUGS_PICKLE_FILENAME}" >> ${GITHUB_ENV} - echo "BUGS_PICKLE_PATH=${BUGS_PICKLE_PATH}" >> ${GITHUB_ENV} - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ vars.AWS_BUILDS_ZEPHYR_BUG_SNAPSHOT_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_BUILDS_ZEPHYR_BUG_SNAPSHOT_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Upload to AWS S3 - run: | - REPOSITORY_NAME="${GITHUB_REPOSITORY#*/}" - - PUBLISH_BUCKET="builds.zephyrproject.org" - PUBLISH_DOMAIN="builds.zephyrproject.io" - if [ "${{github.event_name}}" = "schedule" ]; then - PUBLISH_ROOT="${REPOSITORY_NAME}/bug-snapshot/daily" - else - PUBLISH_ROOT="${REPOSITORY_NAME}/bug-snapshot" - fi - - PUBLISH_UPLOAD_URI="s3://${PUBLISH_BUCKET}/${PUBLISH_ROOT}/${BUGS_PICKLE_FILENAME}" - PUBLISH_DOWNLOAD_URI="https://${PUBLISH_DOMAIN}/${PUBLISH_ROOT}/${BUGS_PICKLE_FILENAME}" - - aws s3 cp --quiet ${BUGS_PICKLE_PATH} ${PUBLISH_UPLOAD_URI} - echo "Bug pickle is available at: ${PUBLISH_DOWNLOAD_URI}" >> ${GITHUB_STEP_SUMMARY} diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml deleted file mode 100644 index 9108d31b45b..00000000000 --- a/.github/workflows/clang.yaml +++ /dev/null @@ -1,163 +0,0 @@ -name: Build with Clang/LLVM - -on: pull_request_target - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - clang-build: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: zephyr-runner-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - volumes: - - /repo-cache/zephyrproject:/github/cache/zephyrproject - strategy: - fail-fast: false - matrix: - platform: ["native_posix"] - env: - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16 - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - outputs: - report_needed: ${{ steps.twister.outputs.report_needed }} - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Clone cached Zephyr repository - continue-on-error: true - run: | - git clone --shared /github/cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Environment Setup - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Bot" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git log --pretty=oneline | head -n 10 - west init -l . || true - west config --global update.narrow true - # In some cases modules are left in a state where they can't be - # updated (i.e. when we cancel a job and the builder is killed), - # So first retry to update, if that does not work, remove all modules - # and start over. (Workaround until we implement more robust module - # west caching). - west update --path-cache /github/cache/zephyrproject 2>&1 1> west.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west2.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /github/cache/zephyrproject) - - - name: Check Environment - run: | - cmake --version - ${LLVM_TOOLCHAIN_PATH}/bin/clang --version - gcc --version - ls -la - - - name: Prepare ccache timestamp/data - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - string(REPLACE "/" "_" repo ${{github.repository}}) - string(REPLACE "-" "_" repo2 ${repo}) - file(APPEND $ENV{GITHUB_OUTPUT} "repo=${repo2}\n") - - - name: use cache - id: cache-ccache - uses: zephyrproject-rtos/action-s3-cache@v1.2.0 - with: - key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache - path: /github/home/.cache/ccache - aws-s3-bucket: ccache.zephyrproject.org - aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CCACHE_SECRET_ACCESS_KEY }} - aws-region: us-east-2 - - - name: ccache stats initial - run: | - mkdir -p /github/home/.cache - test -d github/home/.cache/ccache && rm -rf /github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache - ccache -M 10G -s - - - name: Run Tests with Twister - id: twister - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=llvm - - # check if we need to run a full twister or not based on files changed - python3 ./scripts/ci/test_plan.py --platform ${{ matrix.platform }} -c origin/${BASE_REF}.. - - # We can limit scope to just what has changed - if [ -s testplan.json ]; then - echo "report_needed=1" >> $GITHUB_OUTPUT - # Full twister but with options based on changes - ./scripts/twister --force-color --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 - else - # if nothing is run, skip reporting step - echo "report_needed=0" >> $GITHUB_OUTPUT - fi - - - name: ccache stats post - run: | - ccache -s - ccache -p - - - name: Upload Unit Test Results - if: always() && steps.twister.outputs.report_needed != 0 - uses: actions/upload-artifact@v3 - with: - name: Unit Test Results (Subset ${{ matrix.platform }}) - path: twister-out/twister.xml - - clang-build-results: - name: "Publish Unit Tests Results" - needs: clang-build - runs-on: ubuntu-22.04 - if: (success() || failure() ) && needs.clang-build.outputs.report_needed != 0 - steps: - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - name: Merge Test Results - run: | - pip3 install junitparser junit2html - junitparser merge artifacts/*/twister.xml junit.xml - junit2html junit.xml junit-clang.html - - - name: Upload Unit Test Results in HTML - if: always() - uses: actions/upload-artifact@v3 - with: - name: HTML Unit Test Results - if-no-files-found: ignore - path: | - junit-clang.html - - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - check_name: Unit Test Results - files: "**/twister.xml" - comment_mode: off diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml deleted file mode 100644 index 0bf6f3ccfd2..00000000000 --- a/.github/workflows/codecov.yaml +++ /dev/null @@ -1,176 +0,0 @@ -name: Code Coverage with codecov - -on: - schedule: - - cron: '25 */3 * * 1-5' - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - codecov: - if: github.repository == 'zephyrproject-rtos/zephyr' - runs-on: zephyr-runner-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - volumes: - - /repo-cache/zephyrproject:/github/cache/zephyrproject - strategy: - fail-fast: false - matrix: - platform: ["native_posix", "qemu_x86", "unit_testing"] - env: - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Update PATH for west - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Clone cached Zephyr repository - continue-on-error: true - run: | - git clone --shared /github/cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: west setup - run: | - west init -l . || true - west update 1> west.update.log || west update 1> west.update-2.log - - - name: Check Environment - run: | - cmake --version - gcc --version - ls -la - - name: Prepare ccache keys - id: ccache_cache_prop - shell: cmake -P {0} - run: | - string(REPLACE "/" "_" repo ${{github.repository}}) - string(REPLACE "-" "_" repo2 ${repo}) - file(APPEND $ENV{GITHUB_OUTPUT} "repo=${repo2}\n") - - - name: use cache - id: cache-ccache - uses: zephyrproject-rtos/action-s3-cache@v1.2.0 - with: - key: ${{ steps.ccache_cache_prop.outputs.repo }}-${{github.event_name}}-${{matrix.platform}}-codecov-ccache - path: /github/home/.cache/ccache - aws-s3-bucket: ccache.zephyrproject.org - aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CCACHE_SECRET_ACCESS_KEY }} - aws-region: us-east-2 - - - name: ccache stats initial - run: | - mkdir -p /github/home/.cache - test -d github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache - ccache -M 10G -s - - - name: Run Tests with Twister (Push) - continue-on-error: true - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - mkdir -p coverage/reports - ./scripts/twister --force-color -N -v --filter runnable -p ${{ matrix.platform }} --coverage -T tests - - - name: Generate Coverage Report - run: | - mv twister-out/coverage.info lcov.pre.info - lcov -q --remove lcov.pre.info mylib.c --remove lcov.pre.info tests/\* \ - --remove lcov.pre.info samples/\* --remove lcov.pre.info ext/\* \ - --remove lcov.pre.info *generated* \ - -o coverage/reports/${{ matrix.platform }}.info --rc lcov_branch_coverage=1 - - - name: ccache stats post - run: | - ccache -s - ccache -p - - - name: Upload Coverage Results - if: always() - uses: actions/upload-artifact@v3 - with: - name: Coverage Data (Subset ${{ matrix.platform }}) - path: coverage/reports/${{ matrix.platform }}.info - - codecov-results: - name: "Publish Coverage Results" - needs: codecov - runs-on: ubuntu-22.04 - # the codecov job might be skipped, we don't need to run this job then - if: success() || failure() - - steps: - - name: checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: coverage/reports - - - name: Move coverage files - run: | - mv ./coverage/reports/*/*.info ./coverage/reports - ls -la ./coverage/reports - - - name: Generate list of coverage files - id: get-coverage-files - shell: cmake -P {0} - run: | - file(GLOB INPUT_FILES_LIST "coverage/reports/*.info") - set(MERGELIST "") - set(FILELIST "") - foreach(ITEM ${INPUT_FILES_LIST}) - get_filename_component(f ${ITEM} NAME) - if(FILELIST STREQUAL "") - set(FILELIST "${f}") - else() - set(FILELIST "${FILELIST},${f}") - endif() - endforeach() - foreach(ITEM ${INPUT_FILES_LIST}) - get_filename_component(f ${ITEM} NAME) - if(MERGELIST STREQUAL "") - set(MERGELIST "-a ${f}") - else() - set(MERGELIST "${MERGELIST} -a ${f}") - endif() - endforeach() - file(APPEND $ENV{GITHUB_OUTPUT} "mergefiles=${MERGELIST}\n") - file(APPEND $ENV{GITHUB_OUTPUT} "covfiles=${FILELIST}\n") - - - name: Merge coverage files - run: | - sudo apt-get update - sudo apt-get install -y lcov - cd ./coverage/reports - lcov ${{ steps.get-coverage-files.outputs.mergefiles }} -o merged.info --rc lcov_branch_coverage=1 - - - name: Upload coverage to Codecov - if: always() - uses: codecov/codecov-action@v3 - with: - directory: ./coverage/reports - env_vars: OS,PYTHON - fail_ci_if_error: false - verbose: true - files: merged.info diff --git a/.github/workflows/coding_guidelines.yml b/.github/workflows/coding_guidelines.yml deleted file mode 100644 index ea632b7f0b2..00000000000 --- a/.github/workflows/coding_guidelines.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Coding Guidelines - -on: pull_request - -jobs: - compliance_job: - runs-on: ubuntu-22.04 - name: Run coding guidelines checks on patch series (PR) - steps: - - name: Checkout the code - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: cache-pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-doc-pip - - - name: Install python dependencies - run: | - pip3 install unidiff - pip3 install wheel - pip3 install sh - - - name: Install Packages - run: | - sudo apt-get update - sudo apt-get install coccinelle - - - name: Run Coding Guildeines Checks - continue-on-error: true - id: coding_guidelines - env: - BASE_REF: ${{ github.base_ref }} - run: | - export ZEPHYR_BASE=$PWD - git config --global user.email "actions@zephyrproject.org" - git config --global user.name "Github Actions" - git remote -v - git rebase origin/${BASE_REF} - source zephyr-env.sh - # debug - ls -la - git log --pretty=oneline | head -n 10 - ./scripts/ci/guideline_check.py --output output.txt -c origin/${BASE_REF}.. - - - name: check-warns - run: | - if [[ -s "output.txt" ]]; then - errors=$(cat output.txt) - errors="${errors//'%'/'%25'}" - errors="${errors//$'\n'/'%0A'}" - errors="${errors//$'\r'/'%0D'}" - echo "::error file=output.txt::$errors" - exit 1; - fi diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml deleted file mode 100644 index f84faff3e4a..00000000000 --- a/.github/workflows/compliance.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Compliance Checks - -on: pull_request - -jobs: - check_compliance: - runs-on: ubuntu-22.04 - name: Run compliance checks on patch series (PR) - steps: - - name: Update PATH for west - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Checkout the code - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: cache-pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-doc-pip - - - name: Install python dependencies - run: | - pip3 install setuptools - pip3 install wheel - pip3 install python-magic lxml junitparser gitlint pylint pykwalify yamllint - pip3 install west - - - name: west setup - env: - BASE_REF: ${{ github.base_ref }} - run: | - git config --global user.email "you@example.com" - git config --global user.name "Your Name" - git remote -v - # Ensure there's no merge commits in the PR - [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ - (echo "::error ::Merge commits not allowed, rebase instead";false) - git rebase origin/${BASE_REF} - # debug - git log --pretty=oneline | head -n 10 - west init -l . || true - west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log - - - name: Run Compliance Tests - continue-on-error: true - id: compliance - env: - BASE_REF: ${{ github.base_ref }} - run: | - export ZEPHYR_BASE=$PWD - # debug - ls -la - git log --pretty=oneline | head -n 10 - ./scripts/ci/check_compliance.py --annotate -e KconfigBasic \ - -c origin/${BASE_REF}.. - - - name: upload-results - uses: actions/upload-artifact@v3 - continue-on-error: true - with: - name: compliance.xml - path: compliance.xml - - - name: check-warns - run: | - if [[ ! -s "compliance.xml" ]]; then - exit 1; - fi - - files=($(./scripts/ci/check_compliance.py -l)) - for file in "${files[@]}"; do - f="${file}.txt" - if [[ -s $f ]]; then - errors=$(cat $f) - errors="${errors//'%'/'%25'}" - errors="${errors//$'\n'/'%0A'}" - errors="${errors//$'\r'/'%0D'}" - echo "::error file=${f}::$errors" - exit=1 - fi - done - - if [ "${exit}" == "1" ]; then - exit 1; - fi diff --git a/.github/workflows/daily_test_version.yml b/.github/workflows/daily_test_version.yml deleted file mode 100644 index ba02bb68975..00000000000 --- a/.github/workflows/daily_test_version.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2020 Intel Corp. -# SPDX-License-Identifier: Apache-2.0 - -name: Publish commit for daily testing - -on: - schedule: - - cron: '50 22 * * *' - push: - branches: - - refs/tags/* - -jobs: - get_version: - runs-on: ubuntu-22.04 - if: github.repository == 'zephyrproject-rtos/zephyr' - - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: install-pip - run: | - pip3 install gitpython - - - name: checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Upload to AWS S3 - run: | - python3 scripts/ci/version_mgr.py --update . - aws s3 cp versions.json s3://testing.zephyrproject.org/daily_tests/versions.json diff --git a/.github/workflows/devicetree_checks.yml b/.github/workflows/devicetree_checks.yml deleted file mode 100644 index 465a8673149..00000000000 --- a/.github/workflows/devicetree_checks.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright (c) 2020 Linaro Limited. -# Copyright (c) 2020 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -name: Devicetree script tests - -on: - push: - branches: - - main - - v*-branch - paths: - - 'scripts/dts/**' - - '.github/workflows/devicetree_checks.yml' - pull_request: - branches: - - main - - v*-branch - paths: - - 'scripts/dts/**' - - '.github/workflows/devicetree_checks.yml' - -jobs: - devicetree-checks: - name: Devicetree script tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [3.8, 3.9, '3.10'] - os: [ubuntu-22.04, macos-11, windows-2022] - exclude: - - os: macos-11 - python-version: 3.6 - - os: windows-2022 - python-version: 3.6 - steps: - - name: checkout - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: cache-pip-linux - if: startsWith(runner.os, 'Linux') - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: cache-pip-mac - if: startsWith(runner.os, 'macOS') - uses: actions/cache@v3 - with: - path: ~/Library/Caches/pip - # Trailing '-' was just to get a different cache name - key: ${{ runner.os }}-pip-${{ matrix.python-version }}- - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - - name: cache-pip-win - if: startsWith(runner.os, 'Windows') - uses: actions/cache@v3 - with: - path: ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: install python dependencies - run: | - pip3 install wheel - pip3 install pytest pyyaml tox - - name: run tox - working-directory: scripts/dts/python-devicetree - run: | - tox diff --git a/.github/workflows/do_not_merge.yml b/.github/workflows/do_not_merge.yml deleted file mode 100644 index 14c651a25f1..00000000000 --- a/.github/workflows/do_not_merge.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Do Not Merge - -on: - pull_request: - types: [synchronize, opened, reopened, labeled, unlabeled] - -jobs: - do-not-merge: - if: ${{ contains(github.event.*.labels.*.name, 'DNM') || - contains(github.event.*.labels.*.name, 'TSC') }} - name: Prevent Merging - runs-on: ubuntu-22.04 - steps: - - name: Check for label - run: | - echo "Pull request is labeled as 'DNM' or 'TSC'" - echo "This workflow fails so that the pull request cannot be merged" - exit 1 diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml deleted file mode 100644 index 466f9c8afbd..00000000000 --- a/.github/workflows/doc-build.yml +++ /dev/null @@ -1,172 +0,0 @@ -# Copyright (c) 2020 Linaro Limited. -# SPDX-License-Identifier: Apache-2.0 - -name: Documentation Build - -on: - schedule: - - cron: '0 */3 * * *' - push: - tags: - - v* - pull_request: - paths: - - 'doc/**' - - '**.rst' - - 'include/**' - - 'kernel/include/kernel_arch_interface.h' - - 'lib/libc/**' - - 'subsys/testsuite/ztest/include/**' - - 'tests/**' - - '**/Kconfig*' - - 'west.yml' - - '.github/workflows/doc-build.yml' - - 'scripts/dts/**' - - 'scripts/requirements-doc.txt' - -env: - # NOTE: west docstrings will be extracted from the version listed here - WEST_VERSION: 1.0.0 - # The latest CMake available directly with apt is 3.18, but we need >=3.20 - # so we fetch that through pip. - CMAKE_VERSION: 3.20.5 - DOXYGEN_VERSION: 1.9.6 - -jobs: - doc-build-html: - name: "Documentation Build (HTML)" - runs-on: ubuntu-22.04 - timeout-minutes: 45 - concurrency: - group: doc-build-html-${{ github.ref }} - cancel-in-progress: true - - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: install-pkgs - run: | - sudo apt-get update - sudo apt-get install -y ninja-build graphviz - wget --no-verbose "https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" - tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz - echo "${PWD}/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH - - - name: cache-pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: pip-${{ hashFiles('scripts/requirements-doc.txt') }} - - - name: install-pip - run: | - sudo pip3 install -U setuptools wheel pip - pip3 install -r scripts/requirements-doc.txt - pip3 install west==${WEST_VERSION} - pip3 install cmake==${CMAKE_VERSION} - - - name: west setup - run: | - west init -l . - - - name: build-docs - run: | - if [[ "$GITHUB_REF" =~ "refs/tags/v" ]]; then - DOC_TAG="release" - else - DOC_TAG="development" - fi - - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - DOC_TARGET="html-fast" - else - DOC_TARGET="html" - fi - - DOC_TAG=${DOC_TAG} SPHINXOPTS="-q -W -t publish" make -C doc ${DOC_TARGET} - - - name: compress-docs - run: | - tar cfJ html-output.tar.xz --directory=doc/_build html - - - name: upload-build - uses: actions/upload-artifact@v3 - with: - name: html-output - path: html-output.tar.xz - - - name: process-pr - if: github.event_name == 'pull_request' - run: | - REPO_NAME="${{ github.event.repository.name }}" - PR_NUM="${{ github.event.pull_request.number }}" - DOC_URL="https://builds.zephyrproject.io/${REPO_NAME}/pr/${PR_NUM}/docs/" - - echo "${PR_NUM}" > pr_num - echo "Documentation will be available shortly at: ${DOC_URL}" >> $GITHUB_STEP_SUMMARY - - - name: upload-pr-number - uses: actions/upload-artifact@v3 - if: github.event_name == 'pull_request' - with: - name: pr_num - path: pr_num - - doc-build-pdf: - name: "Documentation Build (PDF)" - if: github.event_name != 'pull_request' - runs-on: ubuntu-22.04 - container: texlive/texlive:latest - timeout-minutes: 60 - concurrency: - group: doc-build-pdf-${{ github.ref }} - cancel-in-progress: true - - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: install-pkgs - run: | - apt-get update - apt-get install -y python3-pip python3-venv ninja-build doxygen graphviz librsvg2-bin - - - name: cache-pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: pip-${{ hashFiles('scripts/requirements-doc.txt') }} - - - name: setup-venv - run: | - python3 -m venv .venv - . .venv/bin/activate - echo PATH=$PATH >> $GITHUB_ENV - - - name: install-pip - run: | - pip3 install -U setuptools wheel pip - pip3 install -r scripts/requirements-doc.txt - pip3 install west==${WEST_VERSION} - pip3 install cmake==${CMAKE_VERSION} - - - name: west setup - run: | - west init -l . - - - name: build-docs - run: | - if [[ "$GITHUB_REF" =~ "refs/tags/v" ]]; then - DOC_TAG="release" - else - DOC_TAG="development" - fi - - DOC_TAG=${DOC_TAG} SPHINXOPTS="-q -j auto" LATEXMKOPTS="-quiet -halt-on-error" make -C doc pdf - - - name: upload-build - uses: actions/upload-artifact@v3 - with: - name: pdf-output - path: doc/_build/latex/zephyr.pdf diff --git a/.github/workflows/doc-publish-pr.yml b/.github/workflows/doc-publish-pr.yml deleted file mode 100644 index 6db566d4e1f..00000000000 --- a/.github/workflows/doc-publish-pr.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2020 Linaro Limited. -# Copyright (c) 2021 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -name: Documentation Publish (Pull Request) - -on: - workflow_run: - workflows: ["Documentation Build"] - types: - - completed - -jobs: - doc-publish: - name: Publish Documentation - runs-on: ubuntu-22.04 - if: | - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' && - github.repository == 'zephyrproject-rtos/zephyr' - - steps: - - name: Download artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: doc-build.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Load PR number - run: | - echo "PR_NUM=$(> $GITHUB_ENV - - - name: Check PR number - id: check-pr - uses: carpentries/actions/check-valid-pr@v0.14.0 - with: - pr: ${{ env.PR_NUM }} - sha: ${{ github.event.workflow_run.head_sha }} - - - name: Validate PR number - if: steps.check-pr.outputs.VALID != 'true' - run: | - echo "ABORT: PR number validation failed!" - exit 1 - - - name: Uncompress HTML docs - run: | - tar xf html-output/html-output.tar.xz -C html-output - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ vars.AWS_BUILDS_ZEPHYR_PR_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_BUILDS_ZEPHYR_PR_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Upload to AWS S3 - env: - HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} - run: | - aws s3 sync --quiet html-output/html \ - s3://builds.zephyrproject.org/${{ github.event.repository.name }}/pr/${PR_NUM}/docs \ - --delete diff --git a/.github/workflows/doc-publish.yml b/.github/workflows/doc-publish.yml deleted file mode 100644 index 5262d9db67e..00000000000 --- a/.github/workflows/doc-publish.yml +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) 2020 Linaro Limited. -# Copyright (c) 2021 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -name: Documentation Publish - -on: - workflow_run: - workflows: ["Documentation Build"] - branches: - - main - - v* - types: - - completed - -jobs: - doc-publish: - name: Publish Documentation - runs-on: ubuntu-22.04 - if: | - github.event.workflow_run.event != 'pull_request' && - github.event.workflow_run.conclusion == 'success' && - github.repository == 'zephyrproject-rtos/zephyr' - - steps: - - name: Download artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: doc-build.yml - run_id: ${{ github.event.workflow_run.id }} - - - name: Uncompress HTML docs - run: | - tar xf html-output/html-output.tar.xz -C html-output - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ vars.AWS_DOCS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_DOCS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Upload to AWS S3 - env: - HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} - run: | - if [ "${HEAD_BRANCH:0:1}" == "v" ]; then - VERSION=${HEAD_BRANCH:1} - else - VERSION="latest" - fi - - aws s3 sync --quiet html-output/html s3://docs.zephyrproject.org/${VERSION} --delete - aws s3 sync --quiet html-output/html/doxygen/html s3://docs.zephyrproject.org/apidoc/${VERSION} --delete - aws s3 cp --quiet pdf-output/zephyr.pdf s3://docs.zephyrproject.org/${VERSION}/zephyr.pdf diff --git a/.github/workflows/errno.yml b/.github/workflows/errno.yml deleted file mode 100644 index 6f76d43a312..00000000000 --- a/.github/workflows/errno.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Error numbers -on: - pull_request: - paths: - - '.github/workflows/errno.yml' - - 'lib/libc/minimal/include/errno.h' - - 'scripts/ci/errno.py' - -jobs: - check-errno: - runs-on: ubuntu-22.04 - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - env: - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: checkout - uses: actions/checkout@v3 - - - name: Run errno.py - run: | - export ZEPHYR_BASE=${PWD} - ./scripts/ci/errno.py diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml deleted file mode 100644 index 5640f7ac7cf..00000000000 --- a/.github/workflows/footprint-tracking.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Footprint Tracking - -# Run every 12 hours and on tags -on: - schedule: - - cron: '50 1/12 * * *' - push: - paths: - - 'VERSION' - - '.github/workflows/footprint-tracking.yml' - branches: - - main - - v*-branch - tags: - # only publish v* tags, do not care about zephyr-v* which point to the - # same commit - - 'v*' - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - footprint-tracking: - runs-on: ubuntu-22.04 - if: github.repository_owner == 'zephyrproject-rtos' - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - strategy: - fail-fast: false - env: - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - ZEPHYR_TOOLCHAIN_VARIANT: zephyr - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Update PATH for west - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install -y python3-venv - sudo pip3 install -U setuptools wheel pip gitpython - - - name: checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: west setup - run: | - west init -l . || true - west config --global update.narrow true - west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Record Footprint - env: - BASE_REF: ${{ github.base_ref }} - run: | - export ZEPHYR_BASE=${PWD} - ./scripts/footprint/track.py -p scripts/footprint/plan.txt - - - name: Upload footprint data - run: | - python3 -m venv .venv - . .venv/bin/activate - pip3 install awscli - aws s3 sync --quiet footprint_data/ s3://testing.zephyrproject.org/footprint_data/ diff --git a/.github/workflows/footprint.yml b/.github/workflows/footprint.yml deleted file mode 100644 index 253823b33b0..00000000000 --- a/.github/workflows/footprint.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Footprint Delta - -on: pull_request - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - footprint-delta: - runs-on: ubuntu-22.04 - if: github.repository == 'zephyrproject-rtos/zephyr' - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - strategy: - fail-fast: false - env: - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - ZEPHYR_TOOLCHAIN_VARIANT: zephyr - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Update PATH for west - run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: west setup - run: | - west init -l . || true - west config --global update.narrow true - west update 2>&1 1> west.update.log || west update 2>&1 1> west.update.log - - - name: Detect Changes in Footprint - env: - BASE_REF: ${{ github.base_ref }} - run: | - export ZEPHYR_BASE=${PWD} - git config --global user.email "actions@zephyrproject.org" - git config --global user.name "Github Actions" - git remote -v - git rebase origin/${BASE_REF} - git checkout -b this_pr - west update - west build -b frdm_k64f tests/benchmarks/footprints -t ram_report - cp build/ram.json ram2.json - west build -b frdm_k64f tests/benchmarks/footprints -t rom_report - cp build/rom.json rom2.json - - git checkout origin/${BASE_REF} - west update - west build -p always -b frdm_k64f tests/benchmarks/footprints -t ram_report - west build -b frdm_k64f tests/benchmarks/footprints -t rom_report - cp build/ram.json ram1.json - cp build/rom.json rom1.json - - git checkout this_pr - ./scripts/footprint/fpdiff.py ram1.json ram2.json - ./scripts/footprint/fpdiff.py rom1.json rom2.json diff --git a/.github/workflows/greet_first_time_contributor.yml b/.github/workflows/greet_first_time_contributor.yml deleted file mode 100644 index 0c078026692..00000000000 --- a/.github/workflows/greet_first_time_contributor.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Greet first time contributor - -on: - issues: - types: [opened] - pull_request_target: - types: [opened, closed] - -jobs: - check_for_first_interaction: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: zephyrproject-rtos/action-first-interaction@v1.1.1-zephyr-3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - issue-message: > - Hi @${{github.event.issue.user.login}}! We appreciate you submitting your first issue - for our open-source project. 🌟 - - - Even though I'm a bot, I can assure you that the whole community is genuinely grateful - for your time and effort. 🤖💙 - - pr-opened-message: > - Hello @${{ github.event.pull_request.user.login }}, and thank you very much for your - first pull request to the Zephyr project! - - - A project maintainer just triggered our CI pipeline to run it against your PR and - ensure it's compliant and doesn't cause any issues. You might want to take this - opportunity to review the project's [Contributor - Expectations](https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html) - and make any updates to your pull request if necessary. 😊 - - pr-merged-message: > - Hi @${{ github.event.pull_request.user.login }}! - - Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a - fantastic achievement, and we're thrilled to have you as part of our community! - - - To celebrate this milestone and showcase your contribution, we'd love to award you the - Zephyr Technical Contributor badge. If you're interested, please claim your badge by - filling out this form: [Claim Your Zephyr Badge](https://forms.gle/oCw9iAPLhUsHTapc8). - - - Thank you for your valuable input, and we look forward to seeing more of your - contributions in the future! 🪁 diff --git a/.github/workflows/issue_count.yml b/.github/workflows/issue_count.yml deleted file mode 100644 index 9c143dbd1f4..00000000000 --- a/.github/workflows/issue_count.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Issue Tracker - -on: - schedule: - - cron: '*/10 * * * *' - -env: - OUTPUT_FILE_NAME: IssuesReport.md - COMMITTER_EMAIL: actions@github.com - COMMITTER_NAME: github-actions - COMMITTER_USERNAME: github-actions - - -jobs: - track-issues: - name: "Collect Issue Stats" - runs-on: ubuntu-22.04 - if: github.repository == 'zephyrproject-rtos/zephyr' - - steps: - - name: Download configuration file - run: | - wget -q https://raw.githubusercontent.com/$GITHUB_REPOSITORY/main/.github/workflows/issues-report-config.json - - - name: install-packages - run: | - sudo apt-get update - sudo apt-get install discount - - - uses: brcrista/summarize-issues@v3 - with: - title: 'Issues Report for ${{ github.repository }}' - configPath: 'issues-report-config.json' - outputPath: ${{ env.OUTPUT_FILE_NAME }} - token: ${{ secrets.GITHUB_TOKEN }} - - - name: upload-stats - uses: actions/upload-artifact@v3 - continue-on-error: true - with: - name: ${{ env.OUTPUT_FILE_NAME }} - path: ${{ env.OUTPUT_FILE_NAME }} - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Post Results - run: | - mkd2html IssuesReport.md IssuesReport.html - aws s3 cp --quiet IssuesReport.html s3://testing.zephyrproject.org/issues/$GITHUB_REPOSITORY/index.html diff --git a/.github/workflows/issues-report-config.json b/.github/workflows/issues-report-config.json deleted file mode 100644 index ad069b99c8b..00000000000 --- a/.github/workflows/issues-report-config.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "section": "High Priority Bugs", - "labels": ["bug", "priority: high"], - "threshold": 0 - }, - { - "section": "Medium Priority Bugs", - "labels": ["bug", "priority: medium"], - "threshold": 20 - }, - { - "section": "Low Priority Bugs", - "labels": ["bug", "priority: low"], - "threshold": 100 - }, - { - "section": "Enhancements", - "labels": ["Enhancement"], - "threshold": 500 - }, - { - "section": "Features", - "labels": ["Feature"], - "threshold": 100 - }, - { - "section": "Questions", - "labels": ["question"], - "threshold": 100 - }, - { - "section": "Static Analysis", - "labels": ["Coverity"], - "threshold": 100 - } -] diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml deleted file mode 100644 index e869df1fb63..00000000000 --- a/.github/workflows/license_check.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Scancode - -on: [pull_request] - -jobs: - scancode_job: - runs-on: ubuntu-22.04 - name: Scan code for licenses - steps: - - name: Checkout the code - uses: actions/checkout@v1 - - name: Scan the code - id: scancode - uses: zephyrproject-rtos/action_scancode@v4 - with: - directory-to-scan: 'scan/' - - name: Artifact Upload - uses: actions/upload-artifact@v3 - with: - name: scancode - path: ./artifacts - - - name: Verify - run: | - if [ -s ./artifacts/report.txt ]; then - report=$(cat ./artifacts/report.txt) - report="${report//'%'/'%25'}" - report="${report//$'\n'/'%0A'}" - report="${report//$'\r'/'%0D'}" - echo "::error file=./artifacts/report.txt::$report" - exit 1 - fi diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml deleted file mode 100644 index 1ea0031fb56..00000000000 --- a/.github/workflows/manifest.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Manifest -on: - pull_request_target: - -jobs: - contribs: - runs-on: ubuntu-22.04 - name: Manifest - steps: - - name: Checkout the code - uses: actions/checkout@v3 - with: - path: zephyrproject/zephyr - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Manifest - uses: zephyrproject-rtos/action-manifest@a6d0c6e52bbbb7d6df23ceb42842edcb4582b8dc - with: - github-token: ${{ secrets.ZB_GITHUB_TOKEN }} - manifest-path: 'west.yml' - checkout-path: 'zephyrproject/zephyr' - label-prefix: 'manifest-' - verbosity-level: '1' - labels: 'manifest' - dnm-labels: 'DNM' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ab0e9384ae7..00000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Create a Release - -on: - push: - tags: - - 'v*' - - '!v*rc*' - -jobs: - release: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Get the version - id: get_version - run: | - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - echo "TRIMMED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 - with: - args: spdx -o zephyr-${{ steps.get_version.outputs.VERSION }}.spdx - - - name: upload-results - uses: actions/upload-artifact@v3 - continue-on-error: true - with: - name: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx - path: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx - - - name: Create empty release notes body - run: | - echo "TODO: add release overview and notes link" > release-notes.txt - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Zephyr ${{ steps.get_version.outputs.TRIMMED_VERSION }} - body_path: release-notes.txt - draft: true - prerelease: true - - - name: Upload Release Assets - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx - asset_name: zephyr-${{ steps.get_version.outputs.VERSION }}.spdx - asset_content_type: text/plain diff --git a/.github/workflows/scripts_tests.yml b/.github/workflows/scripts_tests.yml deleted file mode 100644 index 132d8f357c8..00000000000 --- a/.github/workflows/scripts_tests.yml +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2023 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -name: Scripts tests - -on: - push: - branches: - - main - - v*-branch - paths: - - 'scripts/build/**' - - '.github/workflows/scripts_tests.yml' - pull_request: - branches: - - main - - v*-branch - paths: - - 'scripts/build/**' - - '.github/workflows/scripts_tests.yml' - -jobs: - scripts-tests: - name: Scripts tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [3.8, 3.9, '3.10'] - os: [ubuntu-20.04] - steps: - - name: checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Rebase - continue-on-error: true - env: - BASE_REF: ${{ github.base_ref }} - PR_HEAD: ${{ github.event.pull_request.head.sha }} - run: | - git config --global user.email "actions@zephyrproject.org" - git config --global user.name "Github Actions" - git rebase origin/${BASE_REF} - git log --graph --oneline HEAD...${PR_HEAD} - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: cache-pip-linux - if: startsWith(runner.os, 'Linux') - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - - name: install-packages - run: | - pip3 install -r scripts/requirements-base.txt -r scripts/requirements-build-test.txt - - - name: Run pytest - env: - ZEPHYR_BASE: ./ - run: | - echo "Run script tests" - pytest ./scripts/build diff --git a/.github/workflows/stale-workflow-queue-cleanup.yml b/.github/workflows/stale-workflow-queue-cleanup.yml deleted file mode 100644 index ec1a4cc716f..00000000000 --- a/.github/workflows/stale-workflow-queue-cleanup.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Stale Workflow Queue Cleanup - -on: - workflow_dispatch: - branches: [main] - schedule: - # everyday at 15:00 - - cron: '0 15 * * *' - -concurrency: - group: stale-workflow-queue-cleanup - cancel-in-progress: true - -jobs: - cleanup: - name: Cleanup - runs-on: ubuntu-22.04 - - steps: - - name: Delete stale queued workflow runs - uses: MajorScruffy/delete-old-workflow-runs@v0.3.0 - with: - repository: ${{ github.repository }} - # Remove any workflow runs in "queued" state for more than 1 day - older-than-seconds: 86400 - status: queued - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale_issue.yml b/.github/workflows/stale_issue.yml deleted file mode 100644 index d93aa1f381d..00000000000 --- a/.github/workflows/stale_issue.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Close stale pull requests/issues" -on: - schedule: - - cron: "16 00 * * *" - -jobs: - stale: - name: Find Stale issues and PRs - runs-on: ubuntu-22.04 - if: github.repository == 'zephyrproject-rtos/zephyr' - steps: - - uses: actions/stale@v8 - with: - stale-pr-message: 'This pull request has been marked as stale because it has been open (more - than) 60 days with no activity. Remove the stale label or add a comment saying that you - would like to have the label removed otherwise this pull request will automatically be - closed in 14 days. Note, that you can always re-open a closed pull request at any time.' - stale-issue-message: 'This issue has been marked as stale because it has been open (more - than) 60 days with no activity. Remove the stale label or add a comment saying that you - would like to have the label removed otherwise this issue will automatically be closed in - 14 days. Note, that you can always re-open a closed issue at any time.' - days-before-stale: 60 - days-before-close: 14 - stale-issue-label: 'Stale' - stale-pr-label: 'Stale' - exempt-pr-labels: 'Blocked,In progress' - exempt-issue-labels: 'In progress,Enhancement,Feature,Feature Request,RFC,Meta,Process' - operations-per-run: 400 diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml deleted file mode 100644 index 0ef09373bf6..00000000000 --- a/.github/workflows/twister.yaml +++ /dev/null @@ -1,332 +0,0 @@ -name: Run tests with twister - -on: - workflow_call: - push: - branches: - - main - - v*-branch - pull_request_target: - branches: - - main - - v*-branch - schedule: - # Run at 03:00 UTC on every Sunday - - cron: '0 3 * * 0' - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - twister-build-prep: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: zephyr-runner-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - volumes: - - /repo-cache/zephyrproject:/github/cache/zephyrproject - outputs: - subset: ${{ steps.output-services.outputs.subset }} - size: ${{ steps.output-services.outputs.size }} - fullrun: ${{ steps.output-services.outputs.fullrun }} - env: - MATRIX_SIZE: 10 - PUSH_MATRIX_SIZE: 15 - DAILY_MATRIX_SIZE: 80 - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - TESTS_PER_BUILDER: 700 - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Clone cached Zephyr repository - if: github.event_name == 'pull_request_target' - continue-on-error: true - run: | - git clone --shared /github/cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - if: github.event_name == 'pull_request_target' - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Environment Setup - if: github.event_name == 'pull_request_target' - run: | - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Bot" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git log --pretty=oneline | head -n 10 - west init -l . || true - west config manifest.group-filter -- +ci - west config --global update.narrow true - west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /github/cache/zephyrproject) - west forall -c 'git reset --hard HEAD' - - - name: Generate Test Plan with Twister - if: github.event_name == 'pull_request_target' - id: test-plan - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER - if [ -s .testplan ]; then - cat .testplan >> $GITHUB_ENV - else - echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV - fi - rm -f testplan.json .testplan - - - name: Determine matrix size - id: output-services - run: | - if [ "${{github.event_name}}" = "pull_request_target" ]; then - if [ -n "${TWISTER_NODES}" ]; then - subset="[$(seq -s',' 1 ${TWISTER_NODES})]" - else - subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" - fi - size=${TWISTER_NODES} - elif [ "${{github.event_name}}" = "push" ]; then - subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" - size=${MATRIX_SIZE} - elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then - subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" - size=${DAILY_MATRIX_SIZE} - else - size=0 - fi - echo "subset=${subset}" >> $GITHUB_OUTPUT - echo "size=${size}" >> $GITHUB_OUTPUT - echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT - - twister-build: - runs-on: zephyr-runner-linux-x64-4xlarge - needs: twister-build-prep - if: needs.twister-build-prep.outputs.size != 0 - container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.4 - options: '--entrypoint /bin/bash' - volumes: - - /repo-cache/zephyrproject:/github/cache/zephyrproject - strategy: - fail-fast: false - matrix: - subset: ${{fromJSON(needs.twister-build-prep.outputs.subset)}} - env: - ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - TWISTER_COMMON: ' --force-color --inline-logs -v -N -M --retry-failed 3 ' - DAILY_OPTIONS: ' -M --build-only --all --show-footprint' - PR_OPTIONS: ' --clobber-output --integration' - PUSH_OPTIONS: ' --clobber-output -M --show-footprint' - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Clone cached Zephyr repository - continue-on-error: true - run: | - git clone --shared /github/cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Environment Setup - run: | - if [ "${{github.event_name}}" = "pull_request_target" ]; then - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Builder" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git log --pretty=oneline | head -n 10 - fi - echo "$HOME/.local/bin" >> $GITHUB_PATH - - west init -l . || true - west config --global update.narrow true - west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /github/cache/zephyrproject) - west forall -c 'git reset --hard HEAD' - - - name: Check Environment - run: | - cmake --version - gcc --version - ls -la - echo "github.ref: ${{ github.ref }}" - echo "github.base_ref: ${{ github.base_ref }}" - echo "github.ref_name: ${{ github.ref_name }}" - - - name: Prepare ccache timestamp/data - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - string(REPLACE "/" "_" repo ${{github.repository}}) - string(REPLACE "-" "_" repo2 ${repo}) - file(APPEND $ENV{GITHUB_OUTPUT} "repo=${repo2}\n") - - - name: use cache - id: cache-ccache - uses: zephyrproject-rtos/action-s3-cache@v1.2.0 - continue-on-error: true - with: - key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-${{github.event_name}}-${{ matrix.subset }}-ccache - path: /github/home/.cache/ccache - aws-s3-bucket: ccache.zephyrproject.org - aws-access-key-id: ${{ vars.AWS_CCACHE_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_CCACHE_SECRET_ACCESS_KEY }} - aws-region: us-east-2 - - - name: ccache stats initial - run: | - mkdir -p /github/home/.cache - test -d github/home/.cache/ccache && rm -rf /github/home/.cache/ccache && mv github/home/.cache/ccache /github/home/.cache/ccache - ccache -M 10G -s - - - if: github.event_name == 'push' - name: Run Tests with Twister (Push) - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - ./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS} - if [ "${{matrix.subset}}" = "1" ]; then - ./scripts/zephyr_module.py --twister-out module_tests.args - if [ -s module_tests.args ]; then - ./scripts/twister +module_tests.args --outdir module_tests ${TWISTER_COMMON} ${PUSH_OPTIONS} - fi - fi - - - if: github.event_name == 'pull_request_target' - name: Run Tests with Twister (Pull Request) - run: | - rm -f testplan.json - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request - ./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} --load-tests testplan.json ${TWISTER_COMMON} ${PR_OPTIONS} - if [ "${{matrix.subset}}" = "1" -a ${{needs.twister-build-prep.outputs.fullrun}} = 'True' ]; then - ./scripts/zephyr_module.py --twister-out module_tests.args - if [ -s module_tests.args ]; then - ./scripts/twister +module_tests.args --outdir module_tests ${TWISTER_COMMON} ${PR_OPTIONS} - fi - fi - - - if: github.event_name == 'schedule' - name: Run Tests with Twister (Daily) - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - ./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${DAILY_OPTIONS} - if [ "${{matrix.subset}}" = "1" ]; then - ./scripts/zephyr_module.py --twister-out module_tests.args - if [ -s module_tests.args ]; then - ./scripts/twister +module_tests.args --outdir module_tests ${TWISTER_COMMON} ${DAILY_OPTIONS} - fi - fi - - - name: ccache stats post - run: | - ccache -p - ccache -s - - - name: Upload Unit Test Results - if: always() - uses: actions/upload-artifact@v3 - with: - name: Unit Test Results (Subset ${{ matrix.subset }}) - if-no-files-found: ignore - path: | - twister-out/twister.xml - twister-out/twister.json - module_tests/twister.xml - testplan.json - - twister-test-results: - name: "Publish Unit Tests Results" - env: - ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }} - ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443" - needs: twister-build - runs-on: ubuntu-22.04 - # the build-and-test job might be skipped, we don't need to run this job then - if: success() || failure() - - steps: - # Needed for opensearch and upload script - - if: github.event_name == 'push' || github.event_name == 'schedule' - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - - if: github.event_name == 'push' || github.event_name == 'schedule' - name: Upload to opensearch - run: | - pip3 install elasticsearch - # set run date on upload to get consistent and unified data across the matrix. - run_date=`date --iso-8601=minutes` - if [ "${{github.event_name}}" = "push" ]; then - python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ - --index zephyr-main-ci-push-1 artifacts/*/*/twister.json - elif [ "${{github.event_name}}" = "schedule" ]; then - python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ - --index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json - fi - - - name: Merge Test Results - run: | - pip3 install junitparser junit2html - junitparser merge artifacts/*/*/twister.xml junit.xml - junit2html junit.xml junit.html - - - name: Upload Unit Test Results in HTML - if: always() - uses: actions/upload-artifact@v3 - with: - name: HTML Unit Test Results - if-no-files-found: ignore - path: | - junit.html - - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - with: - check_name: Unit Test Results - files: "**/twister.xml" - comment_mode: off diff --git a/.github/workflows/twister_tests.yml b/.github/workflows/twister_tests.yml deleted file mode 100644 index 05ea87dfd42..00000000000 --- a/.github/workflows/twister_tests.yml +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2020 Intel Corporation. -# SPDX-License-Identifier: Apache-2.0 - -name: Twister TestSuite - -on: - push: - branches: - - main - - v*-branch - paths: - - 'scripts/pylib/twister/**' - - 'scripts/twister' - - 'scripts/tests/twister/**' - - '.github/workflows/twister_tests.yml' - pull_request: - branches: - - main - - v*-branch - paths: - - 'scripts/pylib/twister/**' - - 'scripts/twister' - - 'scripts/tests/twister/**' - - '.github/workflows/twister_tests.yml' - -jobs: - twister-tests: - name: Twister Unit Tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [3.8, 3.9, '3.10'] - os: [ubuntu-22.04] - steps: - - name: checkout - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: cache-pip-linux - if: startsWith(runner.os, 'Linux') - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: install-packages - run: | - pip3 install -r scripts/requirements-base.txt -r scripts/requirements-build-test.txt - - name: Run pytest for twisterlib - env: - ZEPHYR_BASE: ./ - ZEPHYR_TOOLCHAIN_VARIANT: zephyr - run: | - echo "Run twister tests" - PYTHONPATH=./scripts/tests pytest ./scripts/tests/twister - - name: Run pytest for pytest-twister-harness - env: - ZEPHYR_BASE: ./ - ZEPHYR_TOOLCHAIN_VARIANT: zephyr - PYTHONPATH: ./scripts/pylib/pytest-twister-harness/src:${PYTHONPATH} - run: | - echo "Run twister tests" - pytest ./scripts/pylib/pytest-twister-harness/tests diff --git a/.github/workflows/west_cmds.yml b/.github/workflows/west_cmds.yml deleted file mode 100644 index f1d2c4c6c7c..00000000000 --- a/.github/workflows/west_cmds.yml +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (c) 2020 Linaro Limited. -# SPDX-License-Identifier: Apache-2.0 - -name: Zephyr West Command Tests - -on: - push: - branches: - - main - - v*-branch - paths: - - 'scripts/west-commands.yml' - - 'scripts/west_commands/**' - - '.github/workflows/west_cmds.yml' - pull_request: - branches: - - main - - v*-branch - paths: - - 'scripts/west-commands.yml' - - 'scripts/west_commands/**' - - '.github/workflows/west_cmds.yml' - -jobs: - west-commnads: - name: West Command Tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [3.8, 3.9, '3.10'] - os: [ubuntu-22.04, macos-11, windows-2022] - exclude: - - os: macos-11 - python-version: 3.6 - - os: windows-2022 - python-version: 3.6 - steps: - - name: checkout - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: cache-pip-linux - if: startsWith(runner.os, 'Linux') - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: cache-pip-mac - if: startsWith(runner.os, 'macOS') - uses: actions/cache@v3 - with: - path: ~/Library/Caches/pip - # Trailing '-' was just to get a different cache name - key: ${{ runner.os }}-pip-${{ matrix.python-version }}- - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - - name: cache-pip-win - if: startsWith(runner.os, 'Windows') - uses: actions/cache@v3 - with: - path: ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: install pytest - run: | - pip3 install wheel - pip3 install pytest west pyelftools canopen progress mypy intelhex psutil ply pyserial - - name: run pytest-win - if: runner.os == 'Windows' - run: | - python ./scripts/west_commands/run_tests.py - - name: run pytest-mac-linux - if: runner.os != 'Windows' - run: | - ./scripts/west_commands/run_tests.py diff --git a/boards/arm/cc3220sf_launchxl/pinmux.c b/boards/arm/cc3220sf_launchxl/pinmux.c deleted file mode 100644 index 69947a875d1..00000000000 --- a/boards/arm/cc3220sf_launchxl/pinmux.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * pinmux.c - * - * configure the device pins for different peripheral signals - * - * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This file was automatically generated on 7/21/2014 at 3:06:20 PM - * by TI PinMux version 3.0.334 - * (Then modified to meet Zephyr coding style) - */ - -/* - * TI Recommends use of the PinMux utility to ensure consistent configuration - * of pins: http://processors.wiki.ti.com/index.php/TI_PinMux_Tool - * - * Zephyr GPIO API however allows runtime configuration by applications. - * - * For the TI CC32XX port we leverage this output file - * from the PinMux tool, and guard sections based on Kconfig variables. - * - * The individual (uart/gpio) driver init/configuration functions - * therefore assume pinmux initialization is done here rather in the drivers - * at runtime. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Defines taken from SimpleLink SDK's I2CCC32XX.h: */ -/* - * Macros defining possible I2C signal pin mux options - * - * The bits in the pin mode macros are as follows: - * The lower 8 bits of the macro refer to the pin, offset by 1, to match - * driverlib pin defines. For example, I2C_CC32XX_PIN_01_I2C_SCL & 0xff = 0, - * which equals PIN_01 in driverlib pin.h. By matching the PIN_xx defines in - * driverlib pin.h, we can pass the pin directly to the driverlib functions. - * The upper 8 bits of the macro correspond to the pin mux config mode - * value for the pin to operate in the I2C mode. For example, pin 1 is - * configured with mode 1 to operate as I2C_SCL. - */ -#define I2C_CC32XX_PIN_01_I2C_SCL 0x100 /*!< PIN 1 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_02_I2C_SDA 0x101 /*!< PIN 2 is used for I2C_SDA */ -#define I2C_CC32XX_PIN_03_I2C_SCL 0x502 /*!< PIN 3 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_04_I2C_SDA 0x503 /*!< PIN 4 is used for I2C_SDA */ -#define I2C_CC32XX_PIN_05_I2C_SCL 0x504 /*!< PIN 5 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_06_I2C_SDA 0x505 /*!< PIN 6 is used for I2C_SDA */ -#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */ - -int pinmux_initialize(void) -{ - -#ifdef CONFIG_UART_CC32XX - /* Configure PIN_55 for UART0 UART0_TX */ - MAP_PinTypeUART(PIN_55, PIN_MODE_3); - - /* Configure PIN_57 for UART0 UART0_RX */ - MAP_PinTypeUART(PIN_57, PIN_MODE_3); -#endif - - /* Enable Peripheral Clocks */ - MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK); - - /* The following enables the 3 LEDs for the blinking samples */ - - /* Configure PIN_64 for GPIOOutput */ - MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT); - - /* Configure PIN_01 for GPIOOutput */ - MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT); - - /* Configure PIN_02 for GPIOOutput */ - MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT); - - /* SW3: Configure PIN_04 (GPIO13) for GPIOInput */ - MAP_PinTypeGPIO(PIN_04, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x20, GPIO_DIR_MODE_IN); - - MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK); - - /* SW2: Configure PIN_15 (GPIO22) for GPIOInput */ - MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_IN); - - MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK); - -#ifdef CONFIG_I2C_CC32XX - { - unsigned long pin; - unsigned long mode; - - /* Enable the I2C module clocks and wait for completion:*/ - MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, - PRCM_RUN_MODE_CLK | - PRCM_SLP_MODE_CLK); - while (!MAP_PRCMPeripheralStatusGet(PRCM_I2CA0)) { - } - - pin = I2C_CC32XX_PIN_01_I2C_SCL & 0xff; - mode = (I2C_CC32XX_PIN_01_I2C_SCL >> 8) & 0xff; - MAP_PinTypeI2C(pin, mode); - - pin = I2C_CC32XX_PIN_02_I2C_SDA & 0xff; - mode = (I2C_CC32XX_PIN_02_I2C_SDA >> 8) & 0xff; - MAP_PinTypeI2C(pin, mode); - } -#endif - - return 0; -} - -SYS_INIT(pinmux_initialize, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/boards/arm/cc3235sf_launchxl/pinmux.c b/boards/arm/cc3235sf_launchxl/pinmux.c deleted file mode 100644 index f4ebff48d65..00000000000 --- a/boards/arm/cc3235sf_launchxl/pinmux.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2019, Texas Instruments Incorporated - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * pinmux.c - * - * configure the device pins for different peripheral signals - */ - -/* - * This file was automatically generated on 7/21/2014 at 3:06:20 PM - * by TI PinMux version 3.0.334 - * (Then modified to meet Zephyr coding style) - */ - -/* - * TI Recommends use of the PinMux utility to ensure consistent configuration - * of pins: http://processors.wiki.ti.com/index.php/TI_PinMux_Tool - * - * Zephyr GPIO API however allows runtime configuration by applications. - * - * For the TI CC32XX port we leverage this output file - * from the PinMux tool, and guard sections based on Kconfig variables. - * - * The individual (uart/gpio) driver init/configuration functions - * therefore assume pinmux initialization is done here rather in the drivers - * at runtime. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Defines taken from SimpleLink SDK's I2CCC32XX.h: */ -/* - * Macros defining possible I2C signal pin mux options - * - * The bits in the pin mode macros are as follows: - * The lower 8 bits of the macro refer to the pin, offset by 1, to match - * driverlib pin defines. For example, I2C_CC32XX_PIN_01_I2C_SCL & 0xff = 0, - * which equals PIN_01 in driverlib pin.h. By matching the PIN_xx defines in - * driverlib pin.h, we can pass the pin directly to the driverlib functions. - * The upper 8 bits of the macro correspond to the pin mux config mode - * value for the pin to operate in the I2C mode. For example, pin 1 is - * configured with mode 1 to operate as I2C_SCL. - */ -#define I2C_CC32XX_PIN_01_I2C_SCL 0x100 /*!< PIN 1 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_02_I2C_SDA 0x101 /*!< PIN 2 is used for I2C_SDA */ -#define I2C_CC32XX_PIN_03_I2C_SCL 0x502 /*!< PIN 3 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_04_I2C_SDA 0x503 /*!< PIN 4 is used for I2C_SDA */ -#define I2C_CC32XX_PIN_05_I2C_SCL 0x504 /*!< PIN 5 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_06_I2C_SDA 0x505 /*!< PIN 6 is used for I2C_SDA */ -#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */ -#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */ - -int pinmux_initialize(void) -{ - -#ifdef CONFIG_UART_CC32XX - /* Configure PIN_55 for UART0 UART0_TX */ - MAP_PinTypeUART(PIN_55, PIN_MODE_3); - - /* Configure PIN_57 for UART0 UART0_RX */ - MAP_PinTypeUART(PIN_57, PIN_MODE_3); -#endif - - /* Enable Peripheral Clocks */ - MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK); - - /* The following enables the 3 LEDs for the blinking samples */ - - /* Configure PIN_64 for GPIOOutput */ - MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT); - - /* Configure PIN_01 for GPIOOutput */ - MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT); - - /* Configure PIN_02 for GPIOOutput */ - MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT); - - /* SW3: Configure PIN_04 (GPIO13) for GPIOInput */ - MAP_PinTypeGPIO(PIN_04, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA1_BASE, 0x20, GPIO_DIR_MODE_IN); - - MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK); - - /* SW2: Configure PIN_15 (GPIO22) for GPIOInput */ - MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false); - MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_IN); - - MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK); - - -#ifdef CONFIG_I2C_CC32XX - { - unsigned long pin; - unsigned long mode; - - /* Enable the I2C module clocks and wait for completion:*/ - MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, - PRCM_RUN_MODE_CLK | - PRCM_SLP_MODE_CLK); - while (!MAP_PRCMPeripheralStatusGet(PRCM_I2CA0)) { - } - - pin = I2C_CC32XX_PIN_01_I2C_SCL & 0xff; - mode = (I2C_CC32XX_PIN_01_I2C_SCL >> 8) & 0xff; - MAP_PinTypeI2C(pin, mode); - - pin = I2C_CC32XX_PIN_02_I2C_SDA & 0xff; - mode = (I2C_CC32XX_PIN_02_I2C_SDA >> 8) & 0xff; - MAP_PinTypeI2C(pin, mode); - } -#endif - - return 0; -} - -SYS_INIT(pinmux_initialize, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/boards/arm/efm32hg_slstk3400a/CMakeLists.txt b/boards/arm/efm32hg_slstk3400a/CMakeLists.txt deleted file mode 100644 index a7a82c8b608..00000000000 --- a/boards/arm/efm32hg_slstk3400a/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_UART_GECKO) - zephyr_library() - zephyr_library_sources(board.c) -endif() diff --git a/boards/arm/efm32hg_slstk3400a/board.c b/boards/arm/efm32hg_slstk3400a/board.c deleted file mode 100644 index ae69f6ee5d2..00000000000 --- a/boards/arm/efm32hg_slstk3400a/board.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018 Marcio Montenegro - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "board.h" -#include -#include - -static int efm32hg_slstk3400a_init(void) -{ - const struct device *bce_dev; /* Board Controller Enable Gpio Device */ - - - /* Enable the board controller to be able to use the serial port */ - bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE); - - if (!device_is_ready(bce_dev)) { - printk("Board controller gpio port is not ready!\n"); - return -ENODEV; - } - - gpio_pin_configure(bce_dev, BC_ENABLE_GPIO_PIN, GPIO_OUTPUT_HIGH); - - return 0; -} - -/* needs to be done after GPIO driver init */ -SYS_INIT(efm32hg_slstk3400a_init, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/efm32hg_slstk3400a/board.h b/boards/arm/efm32hg_slstk3400a/board.h deleted file mode 100644 index 73932b978e9..00000000000 --- a/boards/arm/efm32hg_slstk3400a/board.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2018 Marcio Montenegro - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __INC_BOARD_H -#define __INC_BOARD_H - -/* This pin is used to enable the serial port using the board controller */ -#define BC_ENABLE_GPIO_NODE DT_NODELABEL(gpioa) -#define BC_ENABLE_GPIO_PIN 9 - -#endif /* __INC_BOARD_H */ diff --git a/boards/arm/efm32pg_stk3401a/CMakeLists.txt b/boards/arm/efm32pg_stk3401a/CMakeLists.txt deleted file mode 100644 index a7a82c8b608..00000000000 --- a/boards/arm/efm32pg_stk3401a/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_UART_GECKO) - zephyr_library() - zephyr_library_sources(board.c) -endif() diff --git a/boards/arm/efm32pg_stk3401a/board.c b/boards/arm/efm32pg_stk3401a/board.c deleted file mode 100644 index a2677965a4a..00000000000 --- a/boards/arm/efm32pg_stk3401a/board.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2020 Rafael Dias Menezes - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "board.h" -#include -#include - -static int efm32pg_stk3401a_init(void) -{ - const struct device *bce_dev; /* Board Controller Enable Gpio Device */ - - - /* Enable the board controller to be able to use the serial port */ - bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE); - - if (!device_is_ready(bce_dev)) { - printk("Board controller gpio port is not ready!\n"); - return -ENODEV; - } - - gpio_pin_configure(bce_dev, BC_ENABLE_GPIO_PIN, GPIO_OUTPUT_HIGH); - - return 0; -} - -/* needs to be done after GPIO driver init */ -SYS_INIT(efm32pg_stk3401a_init, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/efm32pg_stk3401a/board.h b/boards/arm/efm32pg_stk3401a/board.h deleted file mode 100644 index f88ee79edd2..00000000000 --- a/boards/arm/efm32pg_stk3401a/board.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2018 Christian Taedcke - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __INC_BOARD_H -#define __INC_BOARD_H - -/* This pin is used to enable the serial port using the board controller */ -#define BC_ENABLE_GPIO_NODE DT_NODELABEL(gpioa) -#define BC_ENABLE_GPIO_PIN 5 - -#endif /* __INC_BOARD_H */ diff --git a/boards/arm/efm32pg_stk3402a/CMakeLists.txt b/boards/arm/efm32pg_stk3402a/CMakeLists.txt deleted file mode 100644 index a7a82c8b608..00000000000 --- a/boards/arm/efm32pg_stk3402a/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_UART_GECKO) - zephyr_library() - zephyr_library_sources(board.c) -endif() diff --git a/boards/arm/efm32pg_stk3402a/Kconfig.defconfig b/boards/arm/efm32pg_stk3402a/Kconfig.defconfig index cba97cddefd..5f298e584c3 100644 --- a/boards/arm/efm32pg_stk3402a/Kconfig.defconfig +++ b/boards/arm/efm32pg_stk3402a/Kconfig.defconfig @@ -2,8 +2,6 @@ # Copyright (c) 2018, Christian Taedcke # Copyright (c) 2019 Lemonbeat GmbH -# Copyright (c) 2022 T-Mobile USA, Inc. - # SPDX-License-Identifier: Apache-2.0 if BOARD_EFM32PG_STK3402A || BOARD_EFM32PG_STK3402A_JG @@ -18,9 +16,4 @@ config CMU_HFXO_FREQ config CMU_LFXO_FREQ default 32768 -config COUNTER_GECKO_RTCC - bool - default y - depends on COUNTER - endif # BOARD_EFM32PG_STK3402A || BOARD_EFM32PG_STK3402A_JG diff --git a/boards/arm/efm32pg_stk3402a/board.c b/boards/arm/efm32pg_stk3402a/board.c deleted file mode 100644 index 8809b013920..00000000000 --- a/boards/arm/efm32pg_stk3402a/board.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018 Christian Taedcke - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "board.h" -#include -#include - -static int efm32pg_stk3402a_init(void) -{ - const struct device *bce_dev; /* Board Controller Enable Gpio Device */ - - - /* Enable the board controller to be able to use the serial port */ - bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE); - - if (!device_is_ready(bce_dev)) { - printk("Board controller gpio port is not ready!\n"); - return -ENODEV; - } - - gpio_pin_configure(bce_dev, BC_ENABLE_GPIO_PIN, GPIO_OUTPUT_HIGH); - - return 0; -} - -/* needs to be done after GPIO driver init */ -SYS_INIT(efm32pg_stk3402a_init, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/efm32pg_stk3402a/board.h b/boards/arm/efm32pg_stk3402a/board.h deleted file mode 100644 index f88ee79edd2..00000000000 --- a/boards/arm/efm32pg_stk3402a/board.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2018 Christian Taedcke - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __INC_BOARD_H -#define __INC_BOARD_H - -/* This pin is used to enable the serial port using the board controller */ -#define BC_ENABLE_GPIO_NODE DT_NODELABEL(gpioa) -#define BC_ENABLE_GPIO_PIN 5 - -#endif /* __INC_BOARD_H */ diff --git a/boards/arm/efm32pg_stk3402a/doc/index.rst b/boards/arm/efm32pg_stk3402a/doc/index.rst index 6344bb6fb30..ca7ffe8471e 100644 --- a/boards/arm/efm32pg_stk3402a/doc/index.rst +++ b/boards/arm/efm32pg_stk3402a/doc/index.rst @@ -6,9 +6,9 @@ EFM32 Pearl Gecko Starter Kit Overview ******** -The EFM32 Pearl Gecko Starter Kit EFM32PG-STK3402A contains an MCU from -the EFM32PG family built on an ARM® Cortex®-M4F processor with excellent -low power capabilities. +The EFM32 Pearl Gecko Starter Kit EFM32PG-STK3402A contains an MCU from the +EFM32PG family built on an ARM® Cortex®-M4F processor with excellent low +power capabilities. .. figure:: efm32pg_stk3402a.jpg :align: center @@ -19,8 +19,8 @@ low power capabilities. Hardware ******** -- Advanced Energy Monitoring provides real-time information about the - energy consumption of an application or prototype design. +- Advanced Energy Monitoring provides real-time information about the energy + consumption of an application or prototype design. - Ultra low power 128x128 pixel Memory-LCD - 2 user buttons, 2 LEDs and a touch slider - Humidity, temperature, and inductive-capacitive metal sensor @@ -38,8 +38,7 @@ For more information about the EFM32PG SoC and EFM32PG-STK3402A board: Supported Features ================== -The efm32pg_stk3402a board configuration supports the following -hardware features: +The efm32pg_stk3402a board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | Interface | Controller | Driver/Component | @@ -70,8 +69,8 @@ The default configuration can be found in the defconfig file: ``boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_defconfig`` -The default configuration when building for this EFM32JG12B SoC can be -found in another defconfig file: +The default configuration when building for this EFM32JG12B SoC can be found in +another defconfig file: ``boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_defconfig_jg`` @@ -80,64 +79,60 @@ Other hardware features are currently not supported by the port. EFM32 Jade Gecko SoC -------------------- -The EFM32 Pearl Gecko Starter Kit EFM32PG-STK3402A can also be used to -evaluate the EFM32 Jade Gecko SoC (EFM32JG12B). The only difference -between the Pearl Gecko and the Jade Gecko is their core. The Pearl -Gecko contains an ARM® Cortex®-M4F core, and the Jade Gecko an ARM® -Cortex®-M3 core. Other features such as memory and peripherals are the -same. +The EFM32 Pearl Gecko Starter Kit EFM32PG-STK3402A can also be used to evaluate +the EFM32 Jade Gecko SoC (EFM32JG12B). The only difference between the Pearl +Gecko and the Jade Gecko is their core. The Pearl Gecko contains an ARM® +Cortex®-M4F core, and the Jade Gecko an ARM® Cortex®-M3 core. Other features +such as memory and peripherals are the same. -Code that is built for the Jade Gecko also runs on an equivalent Pearl -Gecko. +Code that is built for the Jade Gecko also runs on an equivalent Pearl Gecko. -To build firmware for the Jade Gecko and run it on the EFM32 Pearl Gecko -Starter Kit, use the board ``efm32pg_stk3402a_jg`` instead of -``efm32pg_stk3402a``. +To build firmware for the Jade Gecko and run it on the EFM32 Pearl Gecko Starter +Kit, use the board ``efm32pg_stk3402a_jg`` instead of ``efm32pg_stk3402a``. Connections and IOs =================== -The EFM32PG12 SoC has twelve GPIO controllers (PORTA to PORTL), but only -four are currently enabled (PORTA, PORTB, PORTD and PORTF) for the -EFM32PG-STK3402A board. - -In the following table, the column **Name** contains pin names. For -example, PE2 means pin number 2 on PORTE, as used in the board's -datasheets and manuals. - -+-------+-----+-------------+-------------------------------------+ -| Name | LOC | Function | Usage | -+=======+=====+=============+=====================================+ -| PF4 | | GPIO | LED0 | -+-------+-----+-------------+-------------------------------------+ -| PF5 | | GPIO | LED1 | -+-------+-----+-------------+-------------------------------------+ -| PF6 | | GPIO | Push Button PB0 | -+-------+-----+-------------+-------------------------------------+ -| PF7 | | GPIO | Push Button PB1 | -+-------+-----+-------------+-------------------------------------+ -| PA5 | | GPIO | Board Controller Enable | -| | | | EFM_BC_EN / VCOM_ENABLE | -+-------+-----+-------------+-------------------------------------+ -| PA0 | 0 | UART_TX | UART TX Console VCOM_TX US0_TX | -+-------+-----+-------------+-------------------------------------+ -| PA1 | 0 | UART_RX | UART RX Console VCOM_RX US0_RX | -+-------+-----+-------------+-------------------------------------+ -| PD10 | 18 | UART_TX | EXP12_UART_TX LEU0_TX | -+-------+-----+-------------+-------------------------------------+ -| PD11 | 18 | UART_RX | EXP14_UART_RX LEU0_RX | -+-------+-----+-------------+-------------------------------------+ -| PC10 | 15 | I2C_SDA | ENV_I2C_SDA I2C0_SDA | -+-------+-----+-------------+-------------------------------------+ -| PC11 | 15 | I2C_SCL | ENV_I2C_SCL I2C0_SCL | -+-------+-----+-------------+-------------------------------------+ +The EFM32PG12 SoC has twelve GPIO controllers (PORTA to PORTL), but only four +are currently enabled (PORTA, PORTB, PORTD and PORTF) for the EFM32PG-STK3402A +board. + +In the following table, the column **Name** contains pin names. For example, PE2 +means pin number 2 on PORTE, as used in the board's datasheets and manuals. + ++-------+-------------+-------------------------------------+ +| Name | Function | Usage | ++=======+=============+=====================================+ +| PF4 | GPIO | LED0 | ++-------+-------------+-------------------------------------+ +| PF5 | GPIO | LED1 | ++-------+-------------+-------------------------------------+ +| PF6 | GPIO | Push Button PB0 | ++-------+-------------+-------------------------------------+ +| PF7 | GPIO | Push Button PB1 | ++-------+-------------+-------------------------------------+ +| PA5 | GPIO | Board Controller Enable | +| | | EFM_BC_EN | ++-------+-------------+-------------------------------------+ +| PA0 | UART_TX | UART TX Console VCOM_TX US0_TX #0 | ++-------+-------------+-------------------------------------+ +| PA1 | UART_RX | UART RX Console VCOM_RX US0_RX #0 | ++-------+-------------+-------------------------------------+ +| PD10 | UART_TX | EXP12_UART_TX LEU0_TX #18 | ++-------+-------------+-------------------------------------+ +| PD11 | UART_RX | EXP14_UART_RX LEU0_RX #18 | ++-------+-------------+-------------------------------------+ +| PC10 | I2C_SDA | ENV_I2C_SDA I2C0_SDA #15 | ++-------+-------------+-------------------------------------+ +| PC11 | I2C_SCL | ENV_I2C_SCL I2C0_SCL #15 | ++-------+-------------+-------------------------------------+ System Clock ============ -The EFM32PG SoC is configured to use the 40 MHz external oscillator on -the board. +The EFM32PG SoC is configured to use the 40 MHz external oscillator on the +board. Serial Port =========== @@ -148,27 +143,25 @@ Programming and Debugging ************************* .. note:: - Before using the kit the first time, you should update the J-Link - firmware from `J-Link-Downloads`_ + Before using the kit the first time, you should update the J-Link firmware + from `J-Link-Downloads`_ Flashing ======== -The EFM32PG-STK3402A includes an `J-Link`_ serial and -debug adaptor built into the board. The adaptor provides: +The EFM32PG-STK3402A includes an `J-Link`_ serial and debug adaptor built into the +board. The adaptor provides: -- A USB connection to the host computer, which exposes a mass storage - device and a USB serial port. -- A serial flash device, which implements the USB flash disk file - storage. -- A physical UART connection which is relayed over interface USB serial - port. +- A USB connection to the host computer, which exposes a mass storage device and a + USB serial port. +- A serial flash device, which implements the USB flash disk file storage. +- A physical UART connection which is relayed over interface USB serial port. Flashing an application to EFM32PG-STK3402A ------------------------------------------- -The sample application :ref:`hello_world` is used for this example. Build the -Zephyr kernel and application: +The sample application :ref:`hello_world` is used for this example. +Build the Zephyr kernel and application: .. zephyr-app-commands:: :zephyr-app: samples/hello_world @@ -179,97 +172,23 @@ Connect the EFM32PG-STK3402A to your host computer using the USB port and you should see a USB connection which exposes a mass storage device(STK3402A). Copy the generated zephyr.bin to the STK3402A drive. -Use a USB-to-UART converter such as an FT232/CP2102 to connect to the -UART on the expansion header. +Use a USB-to-UART converter such as an FT232/CP2102 to connect to the UART on the +expansion header. -Open a serial terminal (minicom, putty, etc.) with the following -settings: +Open a serial terminal (minicom, putty, etc.) with the following settings: - Speed: 115200 - Data: 8 bits - Parity: None - Stop bits: 1 -Reset the board and you'll see the following message on the -corresponding serial port terminal session: +Reset the board and you'll see the following message on the corresponding serial port +terminal session: .. code-block:: console Hello World! arm -Twister Testing on EFM32PG-STK3402A -=================================== - -A very simple test on the GPIO functionality can be found at: - - ``tests/drivers/gpio/gpio_basic_api`` - -The Twister tests can be run from the boards folder as follows: - -.. code-block:: console - - ../../../../zephyr/scripts/twister --device-testing \ - --hardware-map efm32pg_stk3402a-map.yml \ - --load-tests efm32pg_stk3402a-testplan.json - -Documenting the EFM32PG-STK3402A -******************************** - -The Zephyr documentation is based upon -`reStructuredText `__, -and `Sphinx `__, which are text based tools -that have limited facilities for `WYSIWYG (pronounced wiz-ee-wig) what you see is what you get: -`__. - -However, there are work arounds that can help you convert from -various other tools to **rst** files. While this is not Pearl Gecko -specific, it is included here, along with the changes above, as a -convenience, until we push upstream. Then a more appropriate location -can be found. - -I have a preference for -`rich text editors `__\ ” -and a promoter of -`Literate Programming `__, -but I’m using Microsoft’s Word to edit this text. I started from the -original **rst** file and used `Pandoc `__ -to convert to **docx**. - -.. code-block:: console - - pandoc -f rst -t docx \ - "//wsl.localhost/Ubuntu-20.04//zephyrproject/zephyr/boards/arm/efm32pg_stk3402a/doc/index.rst" \ - -o gp_stk.docx** - -Note that your paths may vary but mine show the variability of the -systems that can be used. The **wsl** indicates that I’m using -`WSL2 `__ on -`WIN11 `__ to build the -`**html** `__ -documentation. That is the version where board documentation is -generated, rather than the -`**pdf** `__ -version. - -There may be a need to post the generated documentation internally, or -integrate some pages into something like -`Confluence `__, which we -do and why I chose this path. Word provides that path but you don't need -to save a **doc** version, rather than a **docx**. Simply create a page -and **Publish** it. Then hit the **…** to the right of the Edit button and -choose **Import Word Document**. There will likely be some minor edits you -need to make, but the content should be close. - -If you already have a **Confluence** page, then in that same **…** menu you -can use the **Export to Word** menu item. That will create a **doc** file -that Word can convert to a **docx** file before using **Pandoc** to convert -it to **rst** format by reversing the names used above. Again, you will need -to make edits to comply with the Zephyr specific macros, but the content -(other than images) should mostly be there. If the **rst** file was constructed -by hand, then **Pandoc** may make other choices for line and column widths. -For small edits, doing it directly in the **rst** file is most efficient, but -if you have a lot of content, this method may be useful. - .. _EFM32PG-STK3402A Website: https://www.silabs.com/products/development-tools/mcu/32-bit/efm32-pearl-gecko-pg12-starter-kit diff --git a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a-pinctrl.dtsi b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a-pinctrl.dtsi deleted file mode 100644 index 3409dc40c94..00000000000 --- a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a-pinctrl.dtsi +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022 Silicon Labs - * Copyright (c) 2023 T-Mobile USA, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -&pinctrl { - /* configuration for usart0 device, default state - operating as UART */ - usart0_default: usart0_default { - group1 { - psels = , - , - , - ; - }; - }; - - /* configuration for leuart0 device */ - leuart0_default: leuart0_default { - group1 { - psels = , - , - , - ; - }; - }; -}; diff --git a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.yaml b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.yaml index 69035ca4455..707e1b02169 100644 --- a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.yaml +++ b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a.yaml @@ -1,7 +1,3 @@ -# Copyright (c) 2022 T-Mobile USA, Inc. -# -# SPDX-License-Identifier: Apache-2.0 - identifier: efm32pg_stk3402a name: EFM32PG-STK3402A type: mcu @@ -17,7 +13,6 @@ supported: - gpio - nvs - watchdog - - counter testing: ignore_tags: - net diff --git a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_common.dtsi b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_common.dtsi index d32f49928fe..d862a0da5b7 100644 --- a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_common.dtsi +++ b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_common.dtsi @@ -1,13 +1,10 @@ /* * Copyright (c) 2017 Christian Taedcke * Copyright (c) 2019 Lemonbeat GmbH - * Copyright (c) 2023 T-Mobile USA, Inc. * * SPDX-License-Identifier: Apache-2.0 */ -#include "efm32pg_stk3402a-pinctrl.dtsi" - / { model = "Silicon Labs EFM32PG STK3402A board"; @@ -70,15 +67,15 @@ &usart0 { current-speed = <115200>; - pinctrl-0 = <&usart0_default>; - pinctrl-names = "default"; + location-rx = ; + location-tx = ; status = "okay"; }; &leuart0 { current-speed = <9600>; - pinctrl-0 = <&leuart0_default>; - pinctrl-names = "default"; + location-rx = ; + location-tx = ; status = "okay"; }; @@ -89,7 +86,7 @@ }; &rtcc0 { - prescaler = <32768>; + prescaler = <1>; status = "okay"; }; @@ -110,6 +107,12 @@ &gpioa { status = "okay"; + + board-controller-enable { + gpio-hog; + gpios = <5 GPIO_ACTIVE_HIGH>; + output-high; + }; }; &gpiob { diff --git a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_defconfig b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_defconfig index 46a313627d5..d3805477749 100644 --- a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_defconfig +++ b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_defconfig @@ -1,18 +1,11 @@ -# Copyright (c) 2023 T-Mobile USA, Inc. -# # SPDX-License-Identifier: Apache-2.0 CONFIG_SOC_SERIES_EFM32PG12B=y CONFIG_BOARD_EFM32PG_STK3402A=y -CONFIG_PINCTRL=y CONFIG_ARM_MPU=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_GPIO=y -CONFIG_COUNTER=y -CONFIG_POSIX_CLOCK=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=40000000 CONFIG_CMU_HFCLK_HFXO=y -CONFIG_PERSISTENT_GECKO_RTCC=y -CONFIG_NOTIFY=y diff --git a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_jg_defconfig b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_jg_defconfig index ba043b2abb8..36c92f45d2e 100644 --- a/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_jg_defconfig +++ b/boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_jg_defconfig @@ -2,7 +2,6 @@ CONFIG_SOC_SERIES_EFM32JG12B=y CONFIG_BOARD_EFM32PG_STK3402A_JG=y -CONFIG_PINCTRL=y CONFIG_ARM_MPU=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/arm/efm32pg_stk3402a/pre_dt_board.cmake b/boards/arm/efm32pg_stk3402a/pre_dt_board.cmake deleted file mode 100644 index beb76b85552..00000000000 --- a/boards/arm/efm32pg_stk3402a/pre_dt_board.cmake +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2021 Linaro Limited -# SPDX-License-Identifier: Apache-2.0 - -# SPI is implemented via usart so node name isn't spi@... -list(APPEND EXTRA_DTC_FLAGS "-Wno-spi_bus_bridge") diff --git a/boards/arm/efm32wg_stk3800/CMakeLists.txt b/boards/arm/efm32wg_stk3800/CMakeLists.txt deleted file mode 100644 index a7a82c8b608..00000000000 --- a/boards/arm/efm32wg_stk3800/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_UART_GECKO) - zephyr_library() - zephyr_library_sources(board.c) -endif() diff --git a/boards/arm/efm32wg_stk3800/board.c b/boards/arm/efm32wg_stk3800/board.c deleted file mode 100644 index acf9406da61..00000000000 --- a/boards/arm/efm32wg_stk3800/board.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2017 Christian Taedcke - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "board.h" -#include -#include - -static int efm32wg_stk3800_init(void) -{ - const struct device *bce_dev; /* Board Controller Enable Gpio Device */ - - - /* Enable the board controller to be able to use the serial port */ - bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE); - - if (!device_is_ready(bce_dev)) { - printk("Board controller gpio port not ready!\n"); - return -ENODEV; - } - - gpio_pin_configure(bce_dev, BC_ENABLE_GPIO_PIN, GPIO_OUTPUT_HIGH); - - return 0; -} - -/* needs to be done after GPIO driver init */ -SYS_INIT(efm32wg_stk3800_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/efm32wg_stk3800/board.h b/boards/arm/efm32wg_stk3800/board.h deleted file mode 100644 index 8fefb947014..00000000000 --- a/boards/arm/efm32wg_stk3800/board.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2017 Christian Taedcke - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __INC_BOARD_H -#define __INC_BOARD_H - -/* This pin is used to enable the serial port using the board controller */ -#define BC_ENABLE_GPIO_NODE DT_NODELABEL(gpiof) -#define BC_ENABLE_GPIO_PIN 7 - -#endif /* __INC_BOARD_H */ diff --git a/boards/arm/efr32_radio/board.c b/boards/arm/efr32_radio/board.c deleted file mode 100644 index d6ac8237b78..00000000000 --- a/boards/arm/efr32_radio/board.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018 Christian Taedcke - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/* This pin is used to enable the serial port using the board controller */ -#if defined(CONFIG_BOARD_EFR32_RADIO_BRD4180A) -#define VCOM_ENABLE_GPIO_NODE DT_NODELABEL(gpiod) -#define VCOM_ENABLE_GPIO_PIN 4 -#elif defined(CONFIG_BOARD_EFR32_RADIO_BRD4187C) -#define VCOM_ENABLE_GPIO_NODE DT_NODELABEL(gpiob) -#define VCOM_ENABLE_GPIO_PIN 0 -#else -#define VCOM_ENABLE_GPIO_NODE DT_NODELABEL(gpioa) -#define VCOM_ENABLE_GPIO_PIN 5 -#endif - -static int efr32_radio_init(void) -{ - const struct device *vce_dev; /* Virtual COM Port Enable GPIO Device */ - - - /* Enable the board controller to be able to use the serial port */ - vce_dev = DEVICE_DT_GET(VCOM_ENABLE_GPIO_NODE); - if (!device_is_ready(vce_dev)) { - printk("Virtual COM Port Enable device is not ready!\n"); - return -ENODEV; - } - - gpio_pin_configure(vce_dev, VCOM_ENABLE_GPIO_PIN, GPIO_OUTPUT_HIGH); - - return 0; -} - -/* needs to be done after GPIO driver init */ -SYS_INIT(efr32_radio_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a-pinctrl.dtsi b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a-pinctrl.dtsi deleted file mode 100644 index a876b4d6261..00000000000 --- a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a-pinctrl.dtsi +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2022 Silicon Labs - * Copyright (c) 2023 T-Mobile USA, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -&pinctrl { - /* configuration for usart0 device, default state - operating as UART */ - usart0_default: usart0_default { - group1 { - psels = , - , - , - ; - }; - }; - - usart2_default: usart2_default { - group1 { - psels = , - , - , - , - , - ; - }; - }; - - /* configuration for leuart0 device */ - leuart0_default: leuart0_default { - group1 { - psels = , - , - , - ; - }; - }; -}; diff --git a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts index ca1d15c4027..84723ba6cd5 100644 --- a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts +++ b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a.dts @@ -6,7 +6,6 @@ /dts-v1/; #include -#include "efr32mg_sltb004a-pinctrl.dtsi" / { model = "Silabs EFR32MG SLTB004A board (aka Thunderboard Sense 2)"; @@ -72,22 +71,24 @@ &usart0 { current-speed = <115200>; - pinctrl-0 = <&usart0_default>; - pinctrl-names = "default"; + location-rx = ; + location-tx = ; status = "okay"; }; &usart2 { compatible = "silabs,gecko-spi-usart"; - cs-gpios = <&gpiok 1 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&usart2_default>; - pinctrl-names = "default"; - status = "okay"; #address-cells = <1>; #size-cells = <0>; + location-rx = ; + location-tx = ; + location-clk = ; + cs-gpios = <&gpiok 1 GPIO_ACTIVE_LOW>; + + status = "okay"; mx25r80: mx25r8035f@0 { compatible = "jedec,spi-nor"; @@ -106,8 +107,8 @@ &leuart0 { current-speed = <9600>; - pinctrl-0 = <&leuart0_default>; - pinctrl-names = "default"; + location-rx = ; + location-tx = ; status = "okay"; }; diff --git a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a_defconfig b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a_defconfig index cef2eb90c14..4182a0df8e4 100644 --- a/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a_defconfig +++ b/boards/arm/efr32mg_sltb004a/efr32mg_sltb004a_defconfig @@ -3,7 +3,6 @@ CONFIG_ARM_MPU=y CONFIG_SOC_SERIES_EFR32MG12P=y CONFIG_BOARD_EFR32MG_SLTB004A=y -CONFIG_PINCTRL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/arm/pinetime_devkit0/CMakeLists.txt b/boards/arm/pinetime_devkit0/CMakeLists.txt deleted file mode 100644 index 6bfe8fe54f3..00000000000 --- a/boards/arm/pinetime_devkit0/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2021 Casper Meijn -# SPDX-License-Identifier: Apache-2.0 - -description: | - Key out definition for PineTime. This pin needs to be high before the button (key_in) becomes - available. - -compatible: "pine64,pinetime-key-out" - -include: base.yaml - -properties: - gpios: - type: phandle-array - required: true diff --git a/boards/arm/pinetime_devkit0/key_out.c b/boards/arm/pinetime_devkit0/key_out.c deleted file mode 100644 index db8f3506f93..00000000000 --- a/boards/arm/pinetime_devkit0/key_out.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021 Casper Meijn - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -LOG_MODULE_REGISTER(pine64_pinetime_key_out); - -#define KEY_OUT_NODE DT_PATH(key_out) - -#if DT_NODE_HAS_STATUS(KEY_OUT_NODE, okay) - -static const struct gpio_dt_spec key_out = GPIO_DT_SPEC_GET(KEY_OUT_NODE, gpios); - -static int pinetime_key_out_init(void) -{ - int ret; - - if (!device_is_ready(key_out.port)) { - LOG_ERR("key out gpio device %s is not ready", - key_out.port->name); - return -ENODEV; - } - - ret = gpio_pin_configure_dt(&key_out, GPIO_OUTPUT_ACTIVE); - if (ret != 0) { - LOG_ERR("failed to configure %s pin %d (err %d)", - key_out.port->name, key_out.pin, ret); - return ret; - } - - return 0; -} - -SYS_INIT(pinetime_key_out_init, POST_KERNEL, 99); -#endif diff --git a/boards/arm/sparkfun_thing_plus_nrf9160/CMakeLists.txt b/boards/arm/sparkfun_thing_plus_nrf9160/CMakeLists.txt deleted file mode 100644 index 218a0602483..00000000000 --- a/boards/arm/sparkfun_thing_plus_nrf9160/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() -zephyr_library_sources(board.c) diff --git a/boards/arm/sparkfun_thing_plus_nrf9160/board.c b/boards/arm/sparkfun_thing_plus_nrf9160/board.c deleted file mode 100644 index b582182e6fc..00000000000 --- a/boards/arm/sparkfun_thing_plus_nrf9160/board.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2020 Circuit Dojo LLC - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#define GPIO0 DT_NODELABEL(gpio0) -#define POWER_LATCH_PIN 31 - -static int board_sparkfun_thing_plus_nrf9160_init(void) -{ - - /* Get handle of the GPIO device. */ - const struct device *const gpio = DEVICE_DT_GET(GPIO0); - - if (!device_is_ready(gpio)) { - return -ENODEV; - } - - /* Configure latch pin as output. */ - gpio_pin_configure(gpio, POWER_LATCH_PIN, GPIO_OUTPUT_HIGH); - - return 0; -} - -/* needs to be done after GPIO driver init */ -SYS_INIT(board_sparkfun_thing_plus_nrf9160_init, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/boards/arm64/xenvm/Kconfig b/boards/arm64/xenvm/Kconfig deleted file mode 100644 index d6735af0283..00000000000 --- a/boards/arm64/xenvm/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Arm Limited (or its affiliates). All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -config XENVM_USE_GIC_V3 - bool "Xen VM using GICv3" - depends on BOARD_XENVM - help - Configure Xen VM to use GICv3 instead of default GICv2. diff --git a/boards/posix/native_posix/sdl_events.c b/boards/posix/native_posix/sdl_events.c deleted file mode 100644 index e2cb2042d7b..00000000000 --- a/boards/posix/native_posix/sdl_events.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018 Jan Van Winkel - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "posix_board_if.h" -#include "soc.h" -#include -#include - -#include - -static void sdl_handle_window_event(const SDL_Event *event) -{ - SDL_Window *window; - SDL_Renderer *renderer; - - switch (event->window.event) { - case SDL_WINDOWEVENT_EXPOSED: - - window = SDL_GetWindowFromID(event->window.windowID); - if (window == NULL) { - return; - } - - renderer = SDL_GetRenderer(window); - if (renderer == NULL) { - return; - } - SDL_RenderPresent(renderer); - break; - default: - break; - } -} - -static void sdl_handle_events(void *p1, void *p2, void *p3) -{ - SDL_Event event; - - ARG_UNUSED(p1); - ARG_UNUSED(p2); - ARG_UNUSED(p3); - - for (;;) { - while (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_WINDOWEVENT: - sdl_handle_window_event(&event); - break; - case SDL_QUIT: - posix_exit(0); - break; - default: - break; - } - } - - k_msleep(CONFIG_SDL_THREAD_INTERVAL); - } -} - -static void sdl_init(void) -{ - if (SDL_Init(SDL_INIT_VIDEO) != 0) { - posix_print_error_and_exit("Error on SDL_Init (%s)\n", - SDL_GetError()); - } -} - -static void sdl_cleanup(void) -{ - SDL_Quit(); -} - -NATIVE_TASK(sdl_init, PRE_BOOT_2, 1); -NATIVE_TASK(sdl_cleanup, ON_EXIT, 2); - -K_THREAD_DEFINE(sdl, CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE, - sdl_handle_events, NULL, NULL, NULL, - CONFIG_SDL_THREAD_PRIORITY, K_ESSENTIAL, 0); diff --git a/boards/riscv/rv32m1_vega/CMakeLists.txt b/boards/riscv/rv32m1_vega/CMakeLists.txt deleted file mode 100644 index 18bb64863dd..00000000000 --- a/boards/riscv/rv32m1_vega/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -if(CONFIG_BT_CTLR_DEBUG_PINS) - zephyr_library() - zephyr_library_sources(board.c) -endif() diff --git a/boards/riscv/rv32m1_vega/Kconfig b/boards/riscv/rv32m1_vega/Kconfig deleted file mode 100644 index b76834fc3be..00000000000 --- a/boards/riscv/rv32m1_vega/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# OpenISA VEGAboard board configuration - -# Copyright (c) 2022 Henrik Brix Andersen -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_INIT_PRIORITY - int "Board initialization priority" - default 45 - depends on BOARD_RV32M1_VEGA && BT_CTLR_DEBUG_PINS - help - Board initialization priority. The board initialization must take - place after the GPIO driver is initialized. diff --git a/boards/riscv/rv32m1_vega/board.c b/boards/riscv/rv32m1_vega/board.c deleted file mode 100644 index 19ddc931d61..00000000000 --- a/boards/riscv/rv32m1_vega/board.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 Henrik Brix Andersen - * Copyright 2018 Foundries.io Ltd - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -static int rv32m1_vega_board_init(void) -{ - const struct device *const gpiob = DEVICE_DT_GET(DT_NODELABEL(gpiob)); - const struct device *const gpioc = DEVICE_DT_GET(DT_NODELABEL(gpioc)); - const struct device *const gpiod = DEVICE_DT_GET(DT_NODELABEL(gpiod)); - - - __ASSERT_NO_MSG(device_is_ready(gpiob)); - __ASSERT_NO_MSG(device_is_ready(gpioc)); - __ASSERT_NO_MSG(device_is_ready(gpiod)); - - gpio_pin_configure(gpiob, 29, GPIO_OUTPUT); - - gpio_pin_configure(gpioc, 28, GPIO_OUTPUT); - gpio_pin_configure(gpioc, 29, GPIO_OUTPUT); - gpio_pin_configure(gpioc, 30, GPIO_OUTPUT); - - gpio_pin_configure(gpiod, 0, GPIO_OUTPUT); - gpio_pin_configure(gpiod, 1, GPIO_OUTPUT); - gpio_pin_configure(gpiod, 2, GPIO_OUTPUT); - gpio_pin_configure(gpiod, 3, GPIO_OUTPUT); - gpio_pin_configure(gpiod, 4, GPIO_OUTPUT); - gpio_pin_configure(gpiod, 5, GPIO_OUTPUT); - - return 0; -} - -SYS_INIT(rv32m1_vega_board_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY); diff --git a/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.conf b/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.conf deleted file mode 100644 index e662fa1f4b7..00000000000 --- a/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.conf +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_CLOCK_CONTROL=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_CONSOLE=y -CONFIG_PINCTRL=y diff --git a/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.overlay b/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.overlay deleted file mode 100644 index 24bf474c606..00000000000 --- a/boards/xtensa/nxp_adsp_imx8m/nxp_adsp_imx8m_uart.overlay +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2023 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/ { - chosen { - zephyr,console = &uart4; - zephyr,shell-uart = &uart4; - }; -}; - -&pinctrl { - /omit-if-no-ref/ uart4_default: uart4_default { - group0 { - pinmux = <&iomuxc_uart4_rxd_uart_rx_uart4_rx>, - <&iomuxc_uart4_txd_uart_tx_uart4_tx>; - bias-pull-up; - slew-rate = "slow"; - drive-strength = "x1"; - }; - }; -}; - -&uart4 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart4_default>; - pinctrl-names = "default"; -}; diff --git a/cmake/modules/root.cmake b/cmake/modules/root.cmake index 603b3b59cc9..0f4d5e1437b 100644 --- a/cmake/modules/root.cmake +++ b/cmake/modules/root.cmake @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # -# Copyright (c) 2021, Nordic Semiconductor ASA +# Copyright (c) 2021-2023, Nordic Semiconductor ASA # Convert Zephyr roots to absolute paths. # @@ -21,21 +21,6 @@ include_guard(GLOBAL) include(extensions) -# Convert paths to absolute, relative from APPLICATION_SOURCE_DIR -zephyr_file(APPLICATION_ROOT MODULE_EXT_ROOT) - -# Convert paths to absolute, relative from APPLICATION_SOURCE_DIR -zephyr_file(APPLICATION_ROOT BOARD_ROOT) - -# Convert paths to absolute, relative from APPLICATION_SOURCE_DIR -zephyr_file(APPLICATION_ROOT SOC_ROOT) - -# Convert paths to absolute, relative from APPLICATION_SOURCE_DIR -zephyr_file(APPLICATION_ROOT ARCH_ROOT) - -# Convert paths to absolute, relative from APPLICATION_SOURCE_DIR -zephyr_file(APPLICATION_ROOT SCA_ROOT) - # Merge in variables from other sources (e.g. sysbuild) zephyr_get(MODULE_EXT_ROOT MERGE SYSBUILD GLOBAL) zephyr_get(BOARD_ROOT MERGE SYSBUILD GLOBAL) @@ -43,6 +28,13 @@ zephyr_get(SOC_ROOT MERGE SYSBUILD GLOBAL) zephyr_get(ARCH_ROOT MERGE SYSBUILD GLOBAL) zephyr_get(SCA_ROOT MERGE SYSBUILD GLOBAL) +# Convert paths to absolute, relative from APPLICATION_SOURCE_DIR +zephyr_file(APPLICATION_ROOT MODULE_EXT_ROOT) +zephyr_file(APPLICATION_ROOT BOARD_ROOT) +zephyr_file(APPLICATION_ROOT SOC_ROOT) +zephyr_file(APPLICATION_ROOT ARCH_ROOT) +zephyr_file(APPLICATION_ROOT SCA_ROOT) + if(unittest IN_LIST Zephyr_FIND_COMPONENTS) # Zephyr used in unittest mode, use dedicated unittest root. set(BOARD_ROOT ${ZEPHYR_BASE}/subsys/testsuite) diff --git a/doc/conf.py b/doc/conf.py index 2545ffea54e..72263cfc11e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -159,16 +159,12 @@ "current_version": version, "versions": ( ("latest", "/"), + ("3.4.0", "/3.4.0/"), ("3.3.0", "/3.3.0/"), ("3.2.0", "/3.2.0/"), ("3.1.0", "/3.1.0/"), ("3.0.0", "/3.0.0/"), - ("2.7.4 (LTS)", "/2.7.4/"), - ("2.6.0", "/2.6.0/"), - ("2.5.0", "/2.5.0/"), - ("2.4.0", "/2.4.0/"), - ("2.3.0", "/2.3.0/"), - ("1.14.1", "/1.14.1/"), + ("2.7.5 (LTS)", "/2.7.5/"), ), "display_vcs_link": True, "reference_links": { diff --git a/doc/connectivity/index.rst b/doc/connectivity/index.rst index 1c70ccdf01b..c135ed410bb 100644 --- a/doc/connectivity/index.rst +++ b/doc/connectivity/index.rst @@ -9,4 +9,4 @@ Connectivity bluetooth/index.rst networking/index.rst lora_lorawan/index.rst - usb_c/index.rst + usb/index.rst diff --git a/doc/connectivity/usb_c/index.rst b/doc/connectivity/usb_c/index.rst deleted file mode 100644 index c28931d59be..00000000000 --- a/doc/connectivity/usb_c/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _usbc_api: - -USB-C device support -#################### - -.. toctree:: - :maxdepth: 1 - - ucds.rst diff --git a/doc/connectivity/usb_c/ucds.rst b/doc/connectivity/usb_c/ucds.rst deleted file mode 100644 index 569f784eae2..00000000000 --- a/doc/connectivity/usb_c/ucds.rst +++ /dev/null @@ -1,215 +0,0 @@ -.. _usbc_device_stack: - -USB-C device stack -################## - -The USB-C device stack is a hardware independent interface between a -Type-C Port Controller (TCPC) and customer applications. It is a port of -the Google ChromeOS Type-C Port Manager (TCPM) stack. -It provides the following functionalities: - -* Uses the APIs provided by the Type-C Port Controller drivers to interact with - the Type-C Port Controller. -* Provides a programming interface that's used by a customer applications. - The APIs is described in - :zephyr_file:`include/zephyr/usb_c/usbc.h` - -Currently the device stack supports implementation of Sink only and Source only -devices. Dual Role Power (DRP) devices are not yet supported. - -:ref:`List` of samples for different purposes. - -Implementing a Sink Type-C and Power Delivery USB-C device -********************************************************** - -The configuration of a USB-C Device is done in the stack layer and devicetree. - -The following devicetree, structures and callbacks need to be defined: - -* Devicetree usb-c-connector node referencing a TCPC -* Devicetree vbus node referencing a VBUS measurment device -* User defined structure that encapsulates application specific data -* Policy callbacks - -For example, for the Sample USB-C Sink application: - -Each Physical Type-C port is represented in the devicetree by a usb-c-connector -compatible node: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/boards/b_g474e_dpow1.overlay - :language: dts - :start-after: usbc.rst usbc-port start - :end-before: usbc.rst usbc-port end - :linenos: - -VBUS is measured by a device that's referenced in the devicetree by a -usb-c-vbus-adc compatible node: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/boards/b_g474e_dpow1.overlay - :language: dts - :start-after: usbc.rst vbus-voltage-divider-adc start - :end-before: usbc.rst vbus-voltage-divider-adc end - :linenos: - - -A user defined structure is defined and later registered with the subsystem and can -be accessed from callback through an API: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst port data object start - :end-before: usbc.rst port data object end - :linenos: - -These callbacks are used by the subsystem to set or get application specific data: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst callbacks start - :end-before: usbc.rst callbacks end - :linenos: - -This callback is used by the subsystem to query if a certain action can be taken: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst check start - :end-before: usbc.rst check end - :linenos: - -This callback is used by the subsystem to notify the application of an event: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst notify start - :end-before: usbc.rst notify end - :linenos: - -Registering the callbacks: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst register start - :end-before: usbc.rst register end - :linenos: - -Register the user defined structure: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst user data start - :end-before: usbc.rst user data end - :linenos: - -Start the USB-C subsystem: - -.. literalinclude:: ../../../samples/subsys/usb_c/sink/src/main.c - :language: c - :start-after: usbc.rst usbc start - :end-before: usbc.rst usbc end - :linenos: - -Implementing a Source Type-C and Power Delivery USB-C device -************************************************************ - -The configuration of a USB-C Device is done in the stack layer and devicetree. - -Define the following devicetree, structures and callbacks: - -* Devicetree ``usb-c-connector`` node referencing a TCPC -* Devicetree ``vbus`` node referencing a VBUS measurment device -* User defined structure that encapsulates application specific data -* Policy callbacks - -For example, for the Sample USB-C Source application: - -Each Physical Type-C port is represented in the devicetree by a ``usb-c-connector`` -compatible node: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/boards/stm32g081b_eval.overlay - :language: dts - :start-after: usbc.rst usbc-port start - :end-before: usbc.rst usbc-port end - :linenos: - -VBUS is measured by a device that's referenced in the devicetree by a -``usb-c-vbus-adc`` compatible node: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/boards/stm32g081b_eval.overlay - :language: dts - :start-after: usbc.rst vbus-voltage-divider-adc start - :end-before: usbc.rst vbus-voltage-divider-adc end - :linenos: - - -A user defined structure is defined and later registered with the subsystem and can -be accessed from callback through an API: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst port data object start - :end-before: usbc.rst port data object end - :linenos: - -These callbacks are used by the subsystem to set or get application specific data: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst callbacks start - :end-before: usbc.rst callbacks end - :linenos: - -This callback is used by the subsystem to query if a certain action can be taken: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst check start - :end-before: usbc.rst check end - :linenos: - -This callback is used by the subsystem to notify the application of an event: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst notify start - :end-before: usbc.rst notify end - :linenos: - -Registering the callbacks: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst register start - :end-before: usbc.rst register end - :linenos: - -Register the user defined structure: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst user data start - :end-before: usbc.rst user data end - :linenos: - -Start the USB-C subsystem: - -.. literalinclude:: ../../../samples/subsys/usb_c/source/src/main.c - :language: c - :start-after: usbc.rst usbc start - :end-before: usbc.rst usbc end - :linenos: - -API reference -************* - -.. doxygengroup:: _usbc_device_api - -SINK callback reference -*********************** - -.. doxygengroup:: sink_callbacks - -SOURCE callback reference -************************* - -.. doxygengroup:: source_callbacks diff --git a/doc/releases/release-notes-3.4.rst b/doc/releases/release-notes-3.4.rst index cb0f8c95897..0fb4efbe40f 100644 --- a/doc/releases/release-notes-3.4.rst +++ b/doc/releases/release-notes-3.4.rst @@ -2,33 +2,32 @@ .. _zephyr_3.4: -Zephyr 3.4.0 (Working Draft) -############################ +Zephyr 3.4.0 +############ We are pleased to announce the release of Zephyr version 3.4.0. Major enhancements with this release include: * Input subsystem: handles input events from various types of input devices and - distribute them to other threads in the application. -* Barrierr API: add architecture agnostic API for data memory barriers. + distributes them to other threads in the application. +* Barrier API: added architecture agnostic API for data memory barriers. * USB Device support: - * USB device controller API (UDC API) - * USB device controller API and nRF USBD controller driver. - * USB device stack implementation using new UDC API + * USB device controller API (UDC API) and nRF USBD controller driver. + * USB device stack implementation using new UDC API. -* Added Power Delivery Source Support to the USB-C Stack -* Bluetooth: Added support for Periodic Advertising with Responses (PAwR) -* Cache API functions are now fully inlined by compilers. +* Added Power Delivery Source Support to the USB-C Stack. +* Bluetooth: Added support for Periodic Advertising with Responses (PAwR). +* Cache API functions are now fully in-lined by compilers. * Added an API for real-time clocks (RTC). -* Added Retention subsystem -* Added initial support for MMU on Xtensa -* SMBus (System Management Bus) API +* Added Retention subsystem. +* Added initial support for MMU on Xtensa. +* SMBus (System Management Bus) API. * Various improvements to the testing framework and twister: - Introduction of 3 new test harnesses into twister supporting pyTest, - GoogleTest and RobotFramework + GoogleTest and Robot Framework. - Transitioning to new Ztest API was completed and legacy Ztest was deprecated. * Added Snippets: Support common configuration settings that can be used across @@ -39,6 +38,15 @@ The following sections provide detailed lists of changes by component. Security Vulnerability Related ****************************** +The following CVEs are addressed by this release: + +More detailed information can be found in: +https://docs.zephyrproject.org/latest/security/vulnerabilities.html + +* CVE-2023-1901: Under embargo until 2023-07-04 + +* CVE-2023-1902: Under embargo until 2023-07-04 + API Changes *********** @@ -155,7 +163,7 @@ Changes in this release names from ``KSCAN_NPCX_...`` to ``INPUT_NPCX_KBD...`` and the compatible from ``nuvoton,npcx-kscan`` to :dtcompatible:`nuvoton,npcx-kbd`. * Touchscreen drivers converted to use the input APIs can use the - :dtcompatible:`zephyr,kscan-input` driver to maintain Kscan compatilibity. + :dtcompatible:`zephyr,kscan-input` driver to maintain Kscan compatibility. * The declaration of :c:func:`main` has been changed from ``void main(void)`` to ``int main(void)``. The main function is required to @@ -223,7 +231,7 @@ Deprecated in this release board-specific configuration in board Kconfig fragments in the ``boards`` folder of the application. -* On nRF51 and nRF52-based boards, the behaviour of the reset reason being +* On nRF51 and nRF52-based boards, the behavior of the reset reason being provided to :c:func:`sys_reboot` and being set in the GPREGRET register has been dropped. This function will now just reboot the device without changing the register contents. The new method for setting this register uses the boot @@ -235,11 +243,13 @@ Deprecated in this release * Deprecated :c:macro:`PTHREAD_BARRIER_DEFINE` in favor of the standardized :c:func:`pthread_barrier_init` -* On all STM32 targets except STM32F2 series, ethernet drivers implementation +* On all STM32 targets except STM32F2 series, Ethernet drivers implementation based on STM32Cube Ethernet API V1 (:kconfig:option:`CONFIG_ETH_STM32_HAL_API_V1`) is now deprecated in favor of implementation based on more reliable and performant STM32Cube Ethernet API V2. +* Legacy Ztest API was deprecated. All new tests shall use the new Ztest API. + Stable API changes in this release ================================== @@ -298,6 +308,23 @@ Architectures * ARC + * Added MPUv8 support + * Add support of virtual UART over ARC hostlink channel + * Improved ARCv2 HS4x processors handling - added proper Kconfig options, provided default mcpu + * Improved ARCMWDT toolchain handling: + + * added rollback to check METAWARE_ROOT if ARCMWDT_TOOLCHAIN_PATH missing + * reworked extra warnings options handling in twister so it can be used with ARCMWDT + * used 64bit MDB binary by default + + * Fixed excessive ROM memory consumption if MPU is enabled and ROM & RAM are located in different + memory regions + * Fixed DSP registers handling in case of ARCMWDT + * Improved SMP handling: + + * Fixed potential livelock in thread abort due to exception + * Fixed IDU mask setup + * Removed absolute symbols :c:macro:`___callee_saved_t_SIZEOF` and :c:macro:`_K_THREAD_NO_FLOAT_SIZEOF` @@ -345,8 +372,6 @@ Architectures * Removed absolute symbol :c:macro:`_K_THREAD_NO_FLOAT_SIZEOF` -* X86 - * Xtensa * Fixed the cross stack call mechanism during nested interrupts where stack would be @@ -411,20 +436,32 @@ Bluetooth * Enhanced Provisioning Authentication support. * Mesh Remote Provisioning support including: + * Remote Provisioning Server and Client models. * Composition Data Page 128 and Models Metadata Page 128 support. + * Large Composition Data support including: + * Large Composition Data Server and Client models. * Models Metadata Page 0 support. + * New Transport Segmentation and Reassembly (SAR) implementation including: + * SAR Configuration Server and Client models. + * Mesh Private Beacons support including: + * Mesh Private Beacon Server and Client models. + * Opcodes Aggregator support including: + * Opcodes Aggregator Server and Client models. + * Proxy Solicitation support including: + * Solicitation PDU RPL Configuration Server and Client models. * On-Demand Private Proxy Server and Client models. + * Composition Data Page 1 support. * Other Mesh Profile Enhancements. * Added experimental support for Mesh Binary Large Object Transfer Model d1.0r04_PRr00 specification. @@ -467,6 +504,7 @@ Boards & SoC Support * STM32C0 series are now supported (with introduction of STM32C031 SoC). * STM32H5 series are now supported (with introduction of STM32H503 and STM32H573 SoCs). * Added support for STM32U599 SoC variants + * Nordic Semiconductor nRF9161 * Removed support for these SoC series: @@ -474,30 +512,62 @@ Boards & SoC Support * Added support for these ARC boards: + * DesignWare ARC HS4x/HS4xD Development Kit (HSDK4xD) - ARCv2 HS47D, SMP 4 cores + * nsim_hs3x_hostlink - simulation (nSIM-based) platform with hostlink UART + * Added support for these ARM boards: + * Aconno ACN52832 * Alientek STM32L475 Pandora + * Arduino GIGA R1 Wi-Fi + * BeagleConnect Freedom + * Infineon PSoC™ 6 BLE Prototyping Kit (CY8CPROTO-063-BLE) + * Infineon PSoC™ 6 Wi-Fi BT Prototyping Kit (CY8CPROTO-062-4343W) + * Infineon XMC4700 Relax Kit * MXChip AZ3166 IoT DevKit + * Nordic Semiconductor nRF9161 DK + * NXP MIMXRT1040-EVK + * NXP MIMXRT1062 FMURT6 + * PHYTEC PhyBOARD Polis (NXP i.MX8M Mini) + * PHYTEC PhyBOARD Pollux (NXP i.MX8M Plus) + * Raspberry Pi Pico W + * Raytac MDBT50Q-DB-33 + * Raytac MDBT50Q-DB-40 * Seeed Studio Wio Terminal + * Seeed Studio XIAO BLE Sense + * Silicon Labs BRD2601B + * Silicon Labs BRD4187C + * Silicon Labs EFR32 Thunderboard-style boards * ST Nucleo C031C6 + * ST Nucleo F042K6 * ST Nucleo H563ZI * ST STM32H573I-DK Discovery - * Raspberry Pi Pico W * Xilinx KV260 (Cortex-R5) * Added support for these ARM64 boards: * PHYTEC phyCORE-AM62x A53 - * MIMX93 EVK A53 (SOF) + * NXP i.MX93 EVK A55 (SOF variant) * Added support for these RISC-V boards: + * Intel FPGA Nios® V/m + * ITE IT82XX2 EV-Board + * Added support for these X86 boards: * Added support for these Xtensa boards: + * ESP32S3-DevKitM + * Made these changes for ARC boards: + * Added ARC MWDT toolchain support for qemu_arc_hs + * Improved emsdp platform support: + + * Added DFSS driver support + * Added pinctrl support + * Made these changes for ARM boards: * ``atsamc21n_xpro``: Enable support to CAN. @@ -510,6 +580,8 @@ Boards & SoC Support * ``nrf9160dk_nrf9160``: Changed the order of buttons and switches on the GPIO expander to match the order when using GPIO directly on the nRF9160 SoC. * ``STM32H747i_disco``: Enabled support for ST B-LCD40-DSI1 display extension + * ``qemu_cortex_m0``: Fixed prescaler of the system timer so that its frequency + is actually 1 MHz, not 2 MHz. * Made these changes for ARM64 boards: @@ -671,6 +743,11 @@ Build system and infrastructure | "image-1" | slot1_partition | +---------------------------------+---------------------------+ +* Fixed an issue whereby relative paths supplied for the ``BOARD_ROOT`` value + might wrongly emit a warning about a ``boards`` directory not being found. + +* Fixed an issue whereby relative paths did not work for sysbuild images. + Drivers and Sensors ******************* @@ -693,22 +770,23 @@ Drivers and Sensors * ADC - * MCUX LPADC driver now uses the channel parameter to select a software channel - configuration buffer. Use ``zephyr,input-positive`` and - ``zephyr,input-negative`` devicetree properties to select the hardware - channel(s) to link a software channel configuration to. - - * MCUX LPADC driver ``voltage-ref`` and ``power-level`` devicetree properties - were shifted to match the hardware as described in reference manual instead - of matching the NXP SDK enum identifers. - - * Added support for STM32C0 and STM32H5. - - * Added DMA support for STM32H7. - - * STM32: Resolutions are now listed in the device tree for each ADC instance - - * STM32: Sampling times are now listed in the device tree for each ADC instance + * MCUX LPADC driver now uses the channel parameter to select a software channel + configuration buffer. Use ``zephyr,input-positive`` and + ``zephyr,input-negative`` devicetree properties to select the hardware + channel(s) to link a software channel configuration to. + * MCUX LPADC driver ``voltage-ref`` and ``power-level`` devicetree properties + were shifted to match the hardware as described in reference manual instead + of matching the NXP SDK enum identifers. + * Added support for STM32C0 and STM32H5. + * Added DMA support for STM32H7. + * STM32: Resolutions are now listed in the device tree for each ADC instance + * STM32: Sampling times are now listed in the device tree for each ADC instance + * Added driver for Atmel SAM family ADC. + * Added driver for Gecko Incremental ADC. + * Added driver for Infineon CAT1 ADC. + * Added driver for TI ADS7052. + * Added driver for TI ADS114S0x family. + * Added drivers for Renesas SmartBond GPADC and SDADC. * Battery-backed RAM @@ -737,7 +815,7 @@ Drivers and Sensors * Clock control - * Atmel SAM/SAM0: Introduce peripheral clock control. + * Atmel SAM/SAM0: Introduced peripheral clock control. * Atmel SAM0: Improved ``samd20``/``samd21``/``samr21`` clocking mechanism. * STM32F4: Added support for PLL I2S @@ -759,8 +837,6 @@ Drivers and Sensors * Added support on STM32H5 series. -* DFU - * Disk * SDMMC STM32L4+: Now compatible with internal DMA @@ -768,6 +844,10 @@ Drivers and Sensors * Display + * Improved MCUX ELCDIF and SSD16XX display controller drivers + * Added support for ILI9342C display controller + * Added support for OTM8009A panel + * DMA * STM32C0: Added support for DMA @@ -783,10 +863,6 @@ Drivers and Sensors * Added support for STM32H5 series. -* ESPI - -* Ethernet - * Flash * Introduced new flash API call :c:func:`flash_ex_op` which calls @@ -815,10 +891,6 @@ Drivers and Sensors their initial sector split into two parts (usually marked as 0a and 0b). * STM32H5 now supports OSPI -* FPGA - -* Fuel Gauge - * GPIO * Converted the ``gpio_keys`` driver to the input subsystem. @@ -827,8 +899,6 @@ Drivers and Sensors * STM32: Supports newly introduced experimental API to enable/disable interrupts without re-config -* hwinfo - * I2C * Added support for STM32C0 and STM32H5 series @@ -837,29 +907,15 @@ Drivers and Sensors * STM32: Domain clock should now be configured by device tree. -* I3C - -* IEEE 802.15.4 - * Input * Introduced the :ref:`input` subsystem. -* Interrupt Controller - -* IPM - * KSCAN * Added a :dtcompatible:`zephyr,kscan-input` input to kscan compatibility driver. * Converted the ``ft5336`` and ``kscan_sdl`` drivers to the input subsystem. -* LED - -* MBOX - -* MEMC - * MIPI-DSI * Added support on STM32H7 @@ -889,6 +945,7 @@ Drivers and Sensors * Added support for STM32C0. * STM32: Now supports 6-PWM channels + * Added PWM driver for Microchip XEC BBLED. * Power domain @@ -902,8 +959,6 @@ Drivers and Sensors * Added support for nPM1300 PMIC * Added support for Raspberry Pi Pico core supply regulator -* Reset - * SDHC * Support was added for using CPOL/CPHA SPI clock modes with SD cards, as @@ -921,7 +976,7 @@ Drivers and Sensors * Serial - * Add UART3 and UART4 configuration for ``gd32vf103`` SoCs. + * Added UART3 and UART4 configuration for ``gd32vf103`` SoCs. * uart_altera: added new driver for Altera Avalon UART. * uart_emul: added new driver for emulated UART. * uart_esp32: @@ -958,6 +1013,11 @@ Drivers and Sensors * USB * Added remote wakeup support for the RP2040 SoC + * Added Battery Charging (BC12) API and PI3USB9201 driver implementation. + * Added new USB device controller drivers (using usb_dc API) for ITE IT82xx2 + and smartbond platforms. + * Added USB device controller driver skeleton for UDC API. + * Reworked DWC2 driver and added support for STM32F4 SoC family * W1 @@ -970,8 +1030,6 @@ Drivers and Sensors * Added support for STM32C0 and STM32H5 series -* WiFi - Networking ********** @@ -1175,8 +1233,16 @@ Networking USB *** -Devicetree -********** +* USB device support + + * Fixed control endpoint handling with MPS of 8 bytes. + +* New experimental USB support + + * Various improvements for new device support, better string descriptor support, + implemented usbd_class_shutdown API. + * Added USB Mass Storage class and CDC ECM class implementations for the new + device support. Libraries / Subsystems ********************** @@ -1309,9 +1375,17 @@ Libraries / Subsystems that will wake the system up in the future. This can be used to influence the system on which low power states can be used. + * Added a new device tree property ``zephyr,pm-device-runtime-auto`` to + automatically enable device runtime power management on a device after its + initialization. + HALs **** +* Nordic + + * Updated nrfx to version 3.0.0. + * STM32 * stm32cube: updated STM32F0 to cube version V1.11.4. @@ -1362,9 +1436,6 @@ Among other things, this update brings: * Improved docs * -Wall and -Wconversion compliance -Documentation -************* - Tests and Samples ***************** @@ -1372,12 +1443,4 @@ Tests and Samples system. One of them including the OpenThread stack. * For native_posix and the nrf52_bsim: Many tests have been fixed and enabled. * LittleFS sample has been given SPI example configuration for nrf52840dk_nrf52840. - -Issue Related Items -******************* - -Known Issues -============ - -Addressed issues -================ +* Migrated all tests to new Ztest API and deprecated legacy Ztest. diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 85fbe09deb5..81e92f8e9dc 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1312,3 +1312,13 @@ This has been fixed in main for v3.3.0 - `PR 54381 fix for v2.7.4 `_ + +CVE-2023-1901 +------------- + +Under embargo until 2023/07/04 + +CVE-2023-1902 +------------- + +Under embargo until 2023/07/04 diff --git a/doc/services/index.rst b/doc/services/index.rst index 7e2e7641348..b85d729b13d 100644 --- a/doc/services/index.rst +++ b/doc/services/index.rst @@ -28,7 +28,6 @@ OS Services storage/index.rst task_wdt/index.rst tfm/index - usb/index.rst virtualization/index.rst retention/index.rst rtio/index.rst diff --git a/doc/services/usb/hid.rst b/doc/services/usb/hid.rst deleted file mode 100644 index 9007a8cf343..00000000000 --- a/doc/services/usb/hid.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _usb_device_hid: - -USB Human Interface Devices (HID) support -######################################### - -Since the USB HID specification is not only used by the USB subsystem, the USB HID API -is split into two header files :zephyr_file:`include/zephyr/usb/class/hid.h` -and :zephyr_file:`include/zephyr/usb/class/usb_hid.h`. The second includes a specific -part for HID support in the USB device stack. - -HID Item helpers -**************** - -HID item helper macros can be used to compose a HID Report Descriptor. -The names correspond to those used in the USB HID Specification. - -Example of a HID Report Descriptor: - -.. code-block:: c - - static const uint8_t hid_report_desc[] = { - HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), - HID_USAGE(HID_USAGE_GEN_DESKTOP_UNDEFINED), - HID_COLLECTION(HID_COLLECTION_APPLICATION), - HID_LOGICAL_MIN8(0), - /* logical maximum 255 */ - HID_LOGICAL_MAX16(0xFF, 0x00), - HID_REPORT_ID(1), - HID_REPORT_SIZE(8), - HID_REPORT_COUNT(1), - HID_USAGE(HID_USAGE_GEN_DESKTOP_UNDEFINED), - /* HID_INPUT (Data, Variable, Absolute) */ - HID_INPUT(0x02), - HID_END_COLLECTION, - }; - - -HID items reference -******************* - -.. doxygengroup:: usb_hid_items - -HID Mouse and Keyboard report descriptors -***************************************** - -The pre-defined Mouse and Keyboard report descriptors can be used by -a HID device implementation or simply as examples. - -.. doxygengroup:: usb_hid_mk_report_desc - -HID Class Device API reference -****************************** - -USB HID devices like mouse, keyboard, or any other specific device use this API. - -.. doxygengroup:: usb_hid_device_api diff --git a/doc/services/usb/index.rst b/doc/services/usb/index.rst deleted file mode 100644 index 0e8029b3dc0..00000000000 --- a/doc/services/usb/index.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. _usb_api: - -USB device support -################## - -.. toctree:: - :maxdepth: 1 - - udc.rst - uds.rst - uds_testing.rst - hid.rst - uds_cdc_acm.rst - -New USB device support -###################### - -.. toctree:: - :maxdepth: 1 - - uds_next.rst - -USB host support -################ - -.. toctree:: - :maxdepth: 1 - - uhc.rst diff --git a/doc/services/usb/udc.rst b/doc/services/usb/udc.rst deleted file mode 100644 index 02d95d4add5..00000000000 --- a/doc/services/usb/udc.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. _udc_api: - -USB device controller driver -############################ - -The USB Device Controller Driver Layer implements the low level control routines -to deal directly with the hardware. All device controller drivers should -implement the APIs described in :zephyr_file:`include/zephyr/drivers/usb/usb_dc.h`. -This allows the integration of new USB device controllers to be done without -changing the upper layers. -With this API it is not possible to support more than one controller -instance at runtime. - -API reference -************* - -.. doxygengroup:: _usb_device_controller_api diff --git a/doc/services/usb/uds.rst b/doc/services/usb/uds.rst deleted file mode 100644 index 20438b524b6..00000000000 --- a/doc/services/usb/uds.rst +++ /dev/null @@ -1,164 +0,0 @@ -.. _usb_device_stack: - -USB device stack -################ - -The USB device stack is a hardware independent interface between USB -device controller driver and USB device class drivers or customer applications. -It is a port of the LPCUSB device stack and has been modified and expanded -over time. It provides the following functionalities: - -* Uses the APIs provided by the device controller drivers to interact with - the USB device controller. -* Responds to standard device requests and returns standard descriptors, - essentially handling 'Chapter 9' processing, specifically the standard - device requests in table 9-3 from the universal serial bus specification - revision 2.0. -* Provides a programming interface to be used by USB device classes or - customer applications. The APIs is described in - :zephyr_file:`include/zephyr/usb/usb_device.h` - -The device stack has few limitations with which it is not possible to support -more than one controller instance at runtime, and only one USB device -configuration is supported. - -Supported USB classes: - -* USB Audio (experimental) -* USB CDC ACM -* USB CDC ECM -* USB CDC EEM -* RNDIS -* USB MSC -* USB DFU -* Bluetooth HCI over USB -* USB HID class - -:ref:`List` of samples for different purposes. -CDC ACM and HID samples have configuration overlays for composite configuration. - -Implementing a non-standard USB class -************************************* - -The configuration of USB Device is done in the stack layer. - -The following structures and callbacks need to be defined: - -* Part of USB Descriptor table -* USB Endpoint configuration table -* USB Device configuration structure -* Endpoint callbacks -* Optionally class, vendor and custom handlers - -For example, for the USB loopback application: - -.. literalinclude:: ../../../subsys/usb/device/class/loopback.c - :language: c - :start-after: usb.rst config structure start - :end-before: usb.rst config structure end - :linenos: - -Endpoint configuration: - -.. literalinclude:: ../../../subsys/usb/device/class/loopback.c - :language: c - :start-after: usb.rst endpoint configuration start - :end-before: usb.rst endpoint configuration end - :linenos: - -USB Device configuration structure: - -.. literalinclude:: ../../../subsys/usb/device/class/loopback.c - :language: c - :start-after: usb.rst device config data start - :end-before: usb.rst device config data end - :linenos: - - -The vendor device requests are forwarded by the USB stack core driver to the -class driver through the registered vendor handler. - -For the loopback class driver, :c:func:`loopback_vendor_handler` processes -the vendor requests: - -.. literalinclude:: ../../../subsys/usb/device/class/loopback.c - :language: c - :start-after: usb.rst vendor handler start - :end-before: usb.rst vendor handler end - :linenos: - -The class driver waits for the :makevar:`USB_DC_CONFIGURED` device status code -before transmitting any data. - -.. _testing_USB_native_posix: - -USB Vendor and Product identifiers -********************************** - -The USB Vendor ID for the Zephyr project is ``0x2FE3``. -This USB Vendor ID must not be used when a vendor -integrates Zephyr USB device support into its own product. - -Each USB sample has its own unique Product ID. -The USB maintainer, if one is assigned, or otherwise the Zephyr Technical -Steering Committee, may allocate other USB Product IDs based on well-motivated -and documented requests. - -The following Product IDs are currently used: - -+-------------------------------------+--------+ -| Sample | PID | -+=====================================+========+ -| :ref:`usb_cdc-acm` | 0x0001 | -+-------------------------------------+--------+ -| :ref:`usb_cdc-acm_composite` | 0x0002 | -+-------------------------------------+--------+ -| :ref:`usb_hid-cdc` | 0x0003 | -+-------------------------------------+--------+ -| :ref:`cdc-acm-console` | 0x0004 | -+-------------------------------------+--------+ -| :ref:`usb_dfu` | 0x0005 | -+-------------------------------------+--------+ -| :ref:`usb_hid` | 0x0006 | -+-------------------------------------+--------+ -| :ref:`usb_hid-mouse` | 0x0007 | -+-------------------------------------+--------+ -| :ref:`usb_mass` | 0x0008 | -+-------------------------------------+--------+ -| :ref:`testusb-app` | 0x0009 | -+-------------------------------------+--------+ -| :ref:`webusb-sample` | 0x000A | -+-------------------------------------+--------+ -| :ref:`bluetooth-hci-usb-sample` | 0x000B | -+-------------------------------------+--------+ -| :ref:`bluetooth-hci-usb-h4-sample` | 0x000C | -+-------------------------------------+--------+ -| :ref:`wpanusb-sample` | 0x000D | -+-------------------------------------+--------+ - -The USB device descriptor field ``bcdDevice`` (Device Release Number) represents -the Zephyr kernel major and minor versions as a binary coded decimal value. - -API reference -************* - -There are two ways to transmit data, using the 'low' level read/write API or -the 'high' level transfer API. - -Low level API - To transmit data to the host, the class driver should call usb_write(). - Upon completion the registered endpoint callback will be called. Before - sending another packet the class driver should wait for the completion of - the previous write. When data is received, the registered endpoint callback - is called. usb_read() should be used for retrieving the received data. - For CDC ACM sample driver this happens via the OUT bulk endpoint handler - (cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data). - -High level API - The usb_transfer method can be used to transfer data to/from the host. The - transfer API will automatically split the data transmission into one or more - USB transaction(s), depending endpoint max packet size. The class driver does - not have to implement endpoint callback and should set this callback to the - generic usb_transfer_ep_callback. - -.. doxygengroup:: _usb_device_core_api diff --git a/doc/services/usb/uds_cdc_acm.rst b/doc/services/usb/uds_cdc_acm.rst deleted file mode 100644 index 09c75388e85..00000000000 --- a/doc/services/usb/uds_cdc_acm.rst +++ /dev/null @@ -1,105 +0,0 @@ -.. _usb_device_cdc_acm: - -USB device stack CDC ACM support -################################ - -The CDC ACM class is used as backend for different subsystems in Zephyr. -However, its configuration may not be easy for the inexperienced user. -Below is a description of the different use cases and some pitfalls. - -The interface for CDC ACM user is :ref:`uart_api` driver API. -But there are two important differences in behavior to a real UART controller: - -* Data transfer is only possible after the USB device stack has been initialized and started, - until then any data is discarded -* If device is connected to the host, it still needs an application - on the host side which requests the data - -The devicetree compatible property for CDC ACM UART is -:dtcompatible:`zephyr,cdc-acm-uart`. -CDC ACM support is automatically selected when USB device support is enabled -and a compatible node in the devicetree sources is present. If necessary, -CDC ACM support can be explicitly disabled by :kconfig:option:`CONFIG_USB_CDC_ACM`. -About four CDC ACM UART instances can be defined and used, -limited by the maximum number of supported endpoints on the controller. - -CDC ACM UART node is supposed to be child of a USB device controller node. -Since the designation of the controller nodes varies from vendor to vendor, -and our samples and application should be as generic as possible, -the default USB device controller is usually assigned an ``zephyr_udc0`` -node label. Often, CDC ACM UART is described in a devicetree overlay file -and looks like this: - -.. code-block:: devicetree - - &zephyr_udc0 { - cdc_acm_uart0: cdc_acm_uart0 { - compatible = "zephyr,cdc-acm-uart"; - label = "CDC_ACM_0"; - }; - }; - -Samples :ref:`usb_cdc-acm` and :ref:`usb_hid-cdc` have similar overlay files. -And since no special properties are present, it may seem overkill to use -devicetree to describe CDC ACM UART. The motivation behind using devicetree -is the easy interchangeability of a real UART controller and CDC ACM UART -in applications. - -Console over CDC ACM UART -************************* - -With the CDC ACM UART node from above and ``zephyr,console`` property of the -chosen node, we can describe that CDC ACM UART is to be used with the console. -A similar overlay file is used by :ref:`cdc-acm-console`. - -.. code-block:: devicetree - - / { - chosen { - zephyr,console = &cdc_acm_uart0; - }; - }; - - &zephyr_udc0 { - cdc_acm_uart0: cdc_acm_uart0 { - compatible = "zephyr,cdc-acm-uart"; - label = "CDC_ACM_0"; - }; - }; - -Before the application uses the console, it is recommended to wait for -the DTR signal: - -.. code-block:: c - - const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); - uint32_t dtr = 0; - - if (usb_enable(NULL)) { - return; - } - - while (!dtr) { - uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr); - k_sleep(K_MSEC(100)); - } - - printk("nuqneH\n"); - -CDC ACM UART as backend -*********************** - -As for the console sample, it is possible to configure CDC ACM UART as -backend for other subsystems by setting :ref:`devicetree-chosen-nodes` -properties. - -List of few Zephyr specific chosen properties which can be used to select -CDC ACM UART as backend for a subsystem or application: - -* ``zephyr,bt-c2h-uart`` used in Bluetooth, - for example see :ref:`bluetooth-hci-uart-sample` -* ``zephyr,ot-uart`` used in OpenThread, - for example see :ref:`coprocessor-sample` -* ``zephyr,shell-uart`` used by shell for serial backend, - for example see :zephyr_file:`samples/subsys/shell/shell_module` -* ``zephyr,uart-mcumgr`` used by :ref:`smp_svr_sample` diff --git a/doc/services/usb/uds_next.rst b/doc/services/usb/uds_next.rst deleted file mode 100644 index 7ca335a3f63..00000000000 --- a/doc/services/usb/uds_next.rst +++ /dev/null @@ -1,35 +0,0 @@ -.. _uds_next: - -USB device core support -####################### - -The new USB device support is experimental and under development. It consists -of low level USB device controller (UDC) driver API, USB device stack (core) -and different functions implementing specific classes. The device stack and -driver API bring multiple device support for the (rare) case that a board has -multiple USB device controllers. Device stack has support for multiple -configurations and a class instance can be added or removed at runtime to a -configuration. The stack provides a specific API for implementing the -functions (classes). This takes over the configuration of the class interfaces -and endpoints, and also the communication with the stack and driver API. -The stack can be enabled by the :kconfig:option:`CONFIG_USB_DEVICE_STACK_NEXT`. - -The first time there will be only one sample for the new USB support, -:ref:`usb_shell-app`, with all available USB support shell commands. -The sample is mainly to help test the capabilities of the stack and correct -implementation of the USB controller drivers. - -USB device stack core API reference -*********************************** - -.. doxygengroup:: usbd_api - -UDC driver API reference -************************ - -The new USB device controller (UDC) driver API implements the low level layer -to interface with USB device controller. -UDC driver API is experimental and is subject to change without notice, it -is described in :zephyr_file:`include/drivers/usb/udc.h`. - -.. doxygengroup:: udc_api diff --git a/doc/services/usb/uds_testing.rst b/doc/services/usb/uds_testing.rst deleted file mode 100644 index 34d80fddf47..00000000000 --- a/doc/services/usb/uds_testing.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. _usb_device_testing: - -Testing USB device support -########################## - -Testing over USPIP in native_posix -*********************************** - -A virtual USB controller implemented through USBIP might be used to test the USB -Device stack. Follow the general build procedure to build the USB sample for -the native_posix configuration. - -Run built sample with: - -.. code-block:: console - - west build -t run - -In a terminal window, run the following command to list USB devices: - -.. code-block:: console - - $ usbip list -r localhost - Exportable USB devices - ====================== - - 127.0.0.1 - 1-1: unknown vendor : unknown product (2fe3:0100) - : /sys/devices/pci0000:00/0000:00:01.2/usb1/1-1 - : (Defined at Interface level) (00/00/00) - : 0 - Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00) - -In a terminal window, run the following command to attach the USB device: - -.. code-block:: console - - $ sudo usbip attach -r localhost -b 1-1 - -The USB device should be connected to your Linux host, and verified with the following commands: - -.. code-block:: console - - $ sudo usbip port - Imported USB devices - ==================== - Port 00: at Full Speed(12Mbps) - unknown vendor : unknown product (2fe3:0100) - 7-1 -> usbip://localhost:3240/1-1 - -> remote bus/dev 001/002 - $ lsusb -d 2fe3:0100 - Bus 007 Device 004: ID 2fe3:0100 diff --git a/doc/services/usb/uhc.rst b/doc/services/usb/uhc.rst deleted file mode 100644 index 8bf81acd17c..00000000000 --- a/doc/services/usb/uhc.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. _uhc_api: - -USB host controller driver API -############################## - -The USB host controller (UHC) driver API implements the low level layer -to interface with the host controller. All USB host controller drivers -should implement the APIs described in :zephyr_file:`include/zephyr/drivers/usb/uhc.h`. - -UHC driver API is experimental and is subject to change without notice. - -Driver API reference -******************** - -.. doxygengroup:: uhc_api diff --git a/drivers/sensor/cxd5605/CMakeLists.txt b/drivers/sensor/cxd5605/CMakeLists.txt index 230e3cc5db5..156f73da994 100644 --- a/drivers/sensor/cxd5605/CMakeLists.txt +++ b/drivers/sensor/cxd5605/CMakeLists.txt @@ -3,3 +3,4 @@ zephyr_library() zephyr_library_sources(cxd5605.c) +zephyr_library_sources(cxd5605_lib_exports.c) diff --git a/drivers/sensor/cxd5605/Kconfig b/drivers/sensor/cxd5605/Kconfig index 91a46f7cdc7..28ada8e70c3 100644 --- a/drivers/sensor/cxd5605/Kconfig +++ b/drivers/sensor/cxd5605/Kconfig @@ -8,7 +8,7 @@ menuconfig CXD5605 bool "CXD5605R GNSS/GPS" depends on I2C - select CXD5605_LIB + imply CXD5605_LIB help Enable I2C based driver for the CXD5605 based GNSS/GPS @@ -20,4 +20,16 @@ config CXD5605_ALERT_INTERRUPTS This will set up interrupts to service the 1 pulse per second and allow the application to get a callback one time per second. +config CXD5605_INIT_SUSPENDED + bool "Allow the GNSS chip to come up in a suspended state" + help + This will initialize the CXD5605 into the sleep 2 state rather than + having it on. + +config CXD5605_OWN_THREAD + bool "Have the GNSS driver use its own thread" + help + If this option is selected, the CXD5605 driver will use its own thread, + otherwise it will use the kernel work queue. + endif # CXD5605 diff --git a/drivers/sensor/cxd5605/cxd5605.c b/drivers/sensor/cxd5605/cxd5605.c index 768e3bfcf91..c2b71b09693 100644 --- a/drivers/sensor/cxd5605/cxd5605.c +++ b/drivers/sensor/cxd5605/cxd5605.c @@ -34,7 +34,7 @@ #include "cxd5605.h" #include "cxd5605_lib.h" -extern char *strtok_r(char *str, const char *sep, char **state); +extern char *strtok_r(char *str, const char *sep, char **state); LOG_MODULE_REGISTER(CXD5605, CONFIG_SENSOR_LOG_LEVEL); @@ -43,97 +43,209 @@ LOG_MODULE_REGISTER(CXD5605, CONFIG_SENSOR_LOG_LEVEL); #define CXD5605_ADDRESS DT_N_S_soc_S_i2c_4000c400_S_sonycxd5605_24_REG_IDX_0_VAL_ADDRESS #define CXD5605_LLE_XFER_SIZE 2048 -#define MAXFIELDS 32 +#define MAXFIELDS 32 -#define COMMAND_STR_LENGTH 12 +#define COMMAND_STR_LENGTH 12 +#define NMEA_SENTENCE_ID_IDX 0 -struct cxd5605_config { - const struct i2c_dt_spec i2c_spec; - const struct gpio_dt_spec alert_gpio; - const struct gpio_dt_spec int_gpio; - const struct gpio_dt_spec pwr_gpio; - const struct gpio_dt_spec rst_gpio; - const struct gpio_dt_spec boot_rec_gpio; -}; - -struct drv_data { - struct gpio_callback gpio_cb; - gpio_flags_t mode; - int index; - int aux; -}; +K_SEM_DEFINE(cxd5605_data_sem, 0, 1); -static void driver_cxd5605_nmea_cb(struct gnss_global_data *pvt) -{ -#ifdef DEBUG - memcpy(&drv_data->pvt, pvt, sizeof(struct gnss_global_data)); - - printf("[Driver] %s:%d - gnss time: %d:%d:%d:%d\n", __func, __LINE__, - drv_data->pvt.time.gnss_hour, - drv_data->pvt.time.gnss_minute, - drv_data->pvt.time.gnss_second, - drv_data->pvt.time.gnss_nanosecond); - - printf("[Driver] %s:%d - position: lat %d, long %d, alt %d\n", - __func, __LINE__, - drv_data->pvt.position.latitude, - drv_data->pvt.position.longitude, - drv_data->pvt.position.altitude); - printf("[Driver] %s:%d - alt (MSL) %d\ntype %d, SIV %d, HAccuracy %d\n", - __func, __LINE__, - drv_data->pvt.position.altitude_MSL, - drv_data->pvt.position.fix_type, - drv_data->pvt.position.SIV, - drv_data->pvt.position.horizontal_accuracy); -#endif -} - -/** @brief response call back routine +/** @brief Local implementation of atof since atof and strod are not in + * minimal libc * - * This routine is called by the cxd5605 library when there is a response - * to a command. Right now there aren't many responses that need attention. - * We just have the version command that has a response to it. - * - * @param dev The pointer to the device structure for this driver - * @param the cxd5605_cmd_data struct for response - * @param the command we are working on - * @param and the ret value from that command - * - * @return nothing + * @param str Pointer to string representing float, [+/-][][.] * + * @return Converted double value */ -static void driver_cxd5605_resp_cb(struct cxd5605_data *drv_data, - struct cxd5605_cmd_data *cxd5605_cmd_data, - int cmd, int ret) +static double cxd_atod(const char *str) { -#ifdef DEBUG - printf("[driver] command %d err %d\n", cmd, ret); - printf("[driver] drv_data = 0x%0X", drv_data); -#endif + double ret = 0.0; + bool neg = false; - if (ret) { - return; + // remove leading space + while (isspace((int)*str)) str++; + + // get sign if present + if (*str && (*str == '-' || *str == '+')) { + if (*str == '-') { + neg = true; + } + str++; } - drv_data->got_data = true; - switch (cmd) { - /* All commands that returns data will be handled here */ - case CMD_VERSION: - memcpy(&drv_data->cxd5605_cmd_data.ver, - &cxd5605_cmd_data->ver, - sizeof(struct cxd5605_version)); -#ifdef DEBUG - printf("[driver] maj %d, minor %d patch %d\n", - drv_data->cxd5605_cmd_data.ver.major, - drv_data->cxd5605_cmd_data.ver.minor, - drv_data->cxd5605_cmd_data.ver.patch); -#endif - break; - default: - break; + // get decimal part + while (*str && isdigit((int)*str)) { + ret = ret * 10 + (*str - '0'); + str++; } + + // get fractional part + if (*str && *str == '.') { + double frac = 0.0; + double div = 1.0; + str++; + while (*str && isdigit((int)*str)) { + frac = frac * 10 + (*str - '0'); + str++; + div *= 10.0; + } + ret = ret + frac / div; + } + return neg ? (ret * -1.0) : ret; } +#define cxd_atoi(x) strtol(x, NULL, 10) + + +static void driver_cxd5605_nmea_cb(struct cxd5605_dev *cxd_dev, const char *nmea_sentence) +{ + struct cxd5605_data *drv_data = CONTAINER_OF(cxd_dev, struct cxd5605_data, cdev); + + /* Parse Raw NMEA Sentence*/ + LOG_DBG("%s", nmea_sentence); + + /* Count commas/fields */ + int field_count = 1; + const char *fields[32]; + + char *comma = strchr(nmea_sentence, ','); + fields[0] = nmea_sentence; + + while (comma && field_count < ARRAY_SIZE(fields)) { + fields[field_count] = comma + 1; + field_count++; + comma = strchr(comma + 1, ','); + } + + if (!strncmp("GGA", &fields[NMEA_SENTENCE_ID_IDX][3], 3)) { + if (field_count >= 11 && cxd_atoi(fields[GGA_QUALITY_INDICATOR_IDX]) == 1) { + uint32_t time = cxd_atod(fields[GGA_UTC_OF_POSITION_IDX]) * 100; + + drv_data->data.time.gnss_hour = (time / 1000000); + drv_data->data.time.gnss_minute = (time % 1000000) / 10000; + drv_data->data.time.gnss_second = (time % 10000) / 100; + drv_data->data.time.gnss_nanosecond = (time % 100) * 10000000; + drv_data->data.position.latitude = + cxd_atod(fields[GGA_LATITUDE_IDX]) * 100000; + if (fields[GGA_LATITUDE_DIR_IDX][0] == 'S') { + drv_data->data.position.latitude *= -1; + } + drv_data->data.position.longitude = + cxd_atod(fields[GGA_LONGITUDE_IDX]) * 100000; + if (fields[GGA_LONGITUDE_DIR_IDX][0] == 'W') { + drv_data->data.position.longitude *= -1; + } + drv_data->data.position.fix_type = + cxd_atoi(fields[GGA_QUALITY_INDICATOR_IDX]); + drv_data->data.position.SIV = cxd_atoi(fields[GGA_NUM_SATELLITE_IDX]); + drv_data->data.position.hDOP = + cxd_atod(fields[GGA_HDOP_IDX]) * 10; + drv_data->data.position.altitude_MSL = cxd_atod(fields[GGA_ALTITUDE_IDX]); + /* Subtract geoidal separation value from + * altitude (MSL) to arrive at the altitude + * (height above Ellipsoid) + */ + drv_data->data.position.altitude = + drv_data->data.position.altitude_MSL - + cxd_atod(fields[GGA_GEOIDAL_SEPARATION_IDX]); + } else { + drv_data->data.time.gnss_hour = 0; + drv_data->data.time.gnss_minute = 0; + drv_data->data.time.gnss_second = 0; + drv_data->data.time.gnss_nanosecond = 0; + drv_data->data.position.latitude = 0.0; + drv_data->data.position.longitude = 0.0; + drv_data->data.position.fix_type = 0; + drv_data->data.position.SIV = 0; + drv_data->data.position.hDOP = 0.0; + drv_data->data.position.altitude_MSL = 0.0; + drv_data->data.position.altitude = 0.0; + } + + } else if (!strncmp("GNS", &fields[NMEA_SENTENCE_ID_IDX][3], 3)) { + if (field_count < 11) { + LOG_WRN("$--GNS - field < 11 (%d)", field_count); + } + uint32_t t = cxd_atod(fields[GGA_UTC_OF_POSITION_IDX]) * 100; + + drv_data->data.time.gnss_hour = (t / 1000000); + drv_data->data.time.gnss_minute = (t % 1000000) / 10000; + drv_data->data.time.gnss_second = (t % 10000) / 100; + drv_data->data.time.gnss_nanosecond = (t % 100) * 10000000; + + drv_data->data.position.latitude = cxd_atod(fields[GNS_LATITUDE_IDX]) * 100000; + if (fields[GNS_LATITUDE_DIR_IDX][0] == 'S') { + drv_data->data.position.latitude *= -1; + } + drv_data->data.position.longitude = cxd_atod(fields[GNS_LONGITUDE_IDX]) * 100000; + if (fields[GNS_LONGITUDE_DIR_IDX][0] == 'W') { + drv_data->data.position.longitude *= -1; + } + + drv_data->data.position.SIV = cxd_atoi(fields[GNS_NUM_SATELLITE_IDX]); + drv_data->data.position.hDOP = cxd_atod(fields[GNS_HDOP_IDX]) * 10; + drv_data->data.position.altitude_MSL = cxd_atod(fields[GNS_ALTITUDE_IDX]); + /* Subtract geoidal separation value from altitude + * (MSL) to arrive at the altitude (height above + * Ellipsoid) + */ + drv_data->data.position.altitude = drv_data->data.position.altitude_MSL - + cxd_atod(fields[GNS_GEOIDAL_SEPARATION_IDX]); + } else if (!strncmp("GLL", &fields[NMEA_SENTENCE_ID_IDX][3], 3)) { + if (field_count < 6) { + LOG_WRN("$--GLL field < 6 (%d)", field_count); + } + uint32_t t = cxd_atod(fields[GLL_UTC_OF_POSITION_IDX]) * 100; + + drv_data->data.time.gnss_hour = (t / 1000000); + drv_data->data.time.gnss_minute = (t % 1000000) / 10000; + drv_data->data.time.gnss_second = (t % 10000) / 100; + drv_data->data.time.gnss_nanosecond = (t % 100) * 10000000; + + drv_data->data.position.latitude = cxd_atod(fields[GLL_LATITUDE_IDX]) * 100000; + if (fields[GLL_LATITUDE_DIR_IDX][0] == 'S') { + drv_data->data.position.latitude *= -1; + } + drv_data->data.position.longitude = cxd_atod(fields[GLL_LONGITUDE_IDX]) * 100000; + if (fields[GLL_LONGITUDE_DIR_IDX][0] == 'W') { + drv_data->data.position.longitude *= -1; + } + } else if (!strncmp("ZDA", &fields[NMEA_SENTENCE_ID_IDX][3], 3)) { + if (field_count < 7) { + LOG_WRN("$--ZDA field < 7 (%d)", field_count); + } + uint32_t t = cxd_atod(fields[ZDA_UTC_IDX]) * 100; + + drv_data->data.time.gnss_hour = (t / 1000000); + drv_data->data.time.gnss_minute = (t % 1000000) / 10000; + drv_data->data.time.gnss_second = (t % 10000) / 100; + drv_data->data.time.gnss_nanosecond = (t % 100) * 10000000; + + drv_data->data.time.gnss_day = cxd_atoi(fields[ZDA_DAY_IDX]); + drv_data->data.time.gnss_month = cxd_atoi(fields[ZDA_MONTH_IDX]); + drv_data->data.time.gnss_year = cxd_atoi(fields[ZDA_YEAR_IDX]); + } +} + +#if defined(CONFIG_CXD5605_OWN_THREAD) +static void cxd5605_thread(struct cxd5605_data *drv_data, void *b, void *c) +{ + while (1) { + k_sem_take(&drv_data->gpio_sem, K_FOREVER); + cxd5605_lib_process(&drv_data->cdev); + } +} +#else +static void data_interrupt_work(struct k_work *work) +{ + struct cxd5605_data *drv_data = CONTAINER_OF(work, struct cxd5605_data, work); + + cxd5605_lib_process(&drv_data->cdev); +} +#endif /* defined(CONFIG_CXD5605_OWN_THREAD) */ + +static int chip_init(const struct device *dev); + /** @brief Initial routine to call to get things running * * This routine does the usual things in that it sets some variables @@ -152,13 +264,10 @@ static int init(const struct device *dev) struct cxd5605_data *drv_data = dev->data; int result = 0; - drv_data->pvt.position.latitude = 0.0; - drv_data->pvt.position.longitude = 0.0; - drv_data->pvt.position.altitude_MSL = 0.0; - drv_data->pvt.position.altitude = 0.0; - - drv_data->cxd5605_cmd = -1; - drv_data->num_msg = 0; + drv_data->data.position.latitude = 0.0; + drv_data->data.position.longitude = 0.0; + drv_data->data.position.altitude_MSL = 0.0; + drv_data->data.position.altitude = 0.0; if (!device_is_ready(cfg->i2c_spec.bus)) { LOG_ERR("I2C dev %s not ready", cfg->i2c_spec.bus->name); @@ -168,13 +277,54 @@ static int init(const struct device *dev) /* save this driver instance for passing to other functions */ drv_data->cxd5605_dev = dev; +#if defined(CONFIG_CXD5605_OWN_THREAD) + k_thread_create(&drv_data->thread, drv_data->thread_stack, + 2048, + (k_thread_entry_t)cxd5605_thread, drv_data, + NULL, NULL, K_PRIO_COOP(CONFIG_CXD5605_THREAD_PRIORITY), + 0, K_NO_WAIT); +#else + k_work_init(&drv_data->work, data_interrupt_work); +#endif /* CONFIG_CXD5605_OWN_THREAD */ + +#if CONFIG_PM_DEVICE + if (pm_device_on_power_domain(dev) && !pm_device_is_powered(dev)) { + pm_device_init_off(dev); + } else { + chip_init(dev); +#if defined(CONFIG_CXD5605_INIT_SUSPENDED) + cxd5605_sleep(&drv_data->cdev, 2); + pm_device_init_suspended(dev) +#endif + } +#else + chip_init(dev); +#endif + return result; +} + +/** + * @brief Perform procedure to initialize the chip from poweroff + * + * @param dev The pointer to the device structure for this driver + * @return int + */ +static int chip_init(const struct device *dev) +{ + const struct cxd5605_config *cfg = dev->config; + struct cxd5605_data *drv_data = dev->data; + int result = 0; + + drv_data->data.position.latitude = 0.0; + drv_data->data.position.longitude = 0.0; + drv_data->data.position.altitude_MSL = 0.0; + drv_data->data.position.altitude = 0.0; + result = gpio_pin_configure_dt(&cfg->rst_gpio, GPIO_OUTPUT_HIGH); cxd5605_setup_interrupts(dev); /* setup shim callbacks */ - cxd5605_lib_init(dev); - cxd5605_register_resp_callback(dev, driver_cxd5605_resp_cb); - cxd5605_register_nmea_callback(dev, driver_cxd5605_nmea_cb); + cxd5605_init_handshake(&drv_data->cdev); return result; } @@ -208,45 +358,11 @@ int csv_split(char *string, char separator, char *fields[]) separates[2] = '\r'; separates[3] = 0; - while ((fields[field++] = (char *)strtok_r(string, separates, &string)) - && (field < MAXFIELDS)) { + while ((fields[field++] = (char *)strtok_r(string, separates, &string)) && + (field < MAXFIELDS)) { } - return (field-1); -} - -/** @brief wait for command response from the CXD5605 - * - * @param requires a struct device - * - * @return status 0 good -1 timeout - */ -static int cxd5605_wait_fetch(const struct device *dev) -{ - int ret = 0; - int data_timeout = 0; - - struct cxd5605_data *drv_data = dev->data; - -#ifdef CONFIG_PM_DEVICE - enum pm_device_state state; - (void)pm_device_state_get(dev, &state); - /* Do not allow sample fetching from suspended state */ - if (state == PM_DEVICE_STATE_SUSPENDED) { - return -EIO; - } -#endif - - drv_data->got_data = false; - while (drv_data->got_data != true) { - k_msleep(100); - data_timeout++; - if (data_timeout > 13) { - return -1; - } - } - - return ret; + return (field - 1); } /** @brief Callback routine for 1PPS interrupt. It will be called every second @@ -259,13 +375,33 @@ static int cxd5605_wait_fetch(const struct device *dev) * @return None * */ -static void callback_1pps(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) +static void callback_1pps(const struct device *dev, struct gpio_callback *gpio_cb, uint32_t pins) { struct cxd5605_data *drv_data = CONTAINER_OF(gpio_cb, struct cxd5605_data, one_pps_gpio_cb); - if (drv_data->pps_cb) + if (drv_data->pps_cb) { (drv_data->pps_cb)(); + } +} + +/** + * @brief Callback routine for the data ready interrupt + * + * @param dev Pointer to device structure for the driver instance. + * @param gpio_cb Pointer to gpio callback structure + * @param pins Mask of pins that triggers the callback handler + */ +static void callback_drdy(const struct device *dev, struct gpio_callback *gpio_cb, uint32_t pins) +{ + struct cxd5605_data *drv_data = CONTAINER_OF(gpio_cb, struct cxd5605_data, data_ready_gpio_cb); + +/*If thread, else work*/ +#if defined(CONFIG_CXD5605_OWN_THREAD) + k_sem_give(&drv_data->gpio_sem); +#else + k_work_submit(&drv_data->work); +#endif /* CONFIG_CXD5605_OWN_THREAD */ + } /** @brief Get a reading from CXD5605. @@ -277,37 +413,81 @@ static void callback_1pps(const struct device *dev, * @return Return a useful value for a particular channel, from the driver’s internal data * */ -static int cxd5605_channel_get(const struct device *dev, - enum sensor_channel chan, - struct sensor_value *val) +static int cxd5605_channel_get(const struct device *dev, enum sensor_channel chan, + struct sensor_value *val) { int32_t integral; int32_t frac; struct cxd5605_data *drv_data = dev->data; - switch (chan) { - case SENSOR_CHAN_POS_DX: - integral = (int)(drv_data->pvt.position.latitude)/10000000.0; - frac = drv_data->pvt.position.latitude - (integral*10000000); - frac = (frac / 60.0) * 100.0; + switch ((uint16_t)chan) { + case SENSOR_CHAN_GNSS_POSITION: + integral = drv_data->data.position.longitude / 10000000; + frac = drv_data->data.position.longitude - (integral * 10000000); + frac = (frac * 10) / 60; + val[1].val1 = integral; + val[1].val2 = frac; + case SENSOR_CHAN_GNSS_POSITION_LAT: + integral = drv_data->data.position.latitude / 10000000; + frac = drv_data->data.position.latitude - (integral * 10000000); + frac = (frac * 10) / 60; frac = (frac < 0) ? (frac * -1) : frac; val->val1 = integral; - val->val2 = frac / 10; + val->val2 = frac; break; - case SENSOR_CHAN_POS_DY: - integral = (int)(drv_data->pvt.position.longitude)/10000000.0; - frac = drv_data->pvt.position.longitude - (integral*10000000); - frac = (frac / 60.0) * 100.0; + case SENSOR_CHAN_GNSS_POSITION_LNG: + integral = drv_data->data.position.longitude / 10000000; + frac = drv_data->data.position.longitude - (integral * 10000000); + frac = (frac * 10) / 60; val->val1 = integral; - val->val2 = frac / 10; + val->val2 = frac; break; case SENSOR_CHAN_ALTITUDE: - val->val1 = (drv_data->pvt.position.altitude_MSL); + val->val1 = (drv_data->data.position.altitude_MSL); val->val2 = 0; break; + case SENSOR_CHAN_GNSS_TIME: + int days = drv_data->data.time.gnss_day - 1; + + /* GNSS time is since 1980*/ + days += (drv_data->data.time.gnss_year - 1980) * 365 + + (drv_data->data.time.gnss_year - 1980) / 4 + - (drv_data->data.time.gnss_year - 1900) / 100; + switch (drv_data->data.time.gnss_month) { + case 12: /* December */ + days += 30; + case 11: /* November */ + days += 31; + case 10: /* October */ + days += 30; + case 9: /* September */ + days += 31; + case 8: /* August */ + days += 31; + case 7: /* July */ + days += 30; + case 6: /* June */ + days += 31; + case 5: /* May */ + days += 30; + case 4: /* April */ + days += 31; + case 3: /* March */ + days += (!(drv_data->data.time.gnss_year % 4) + && (drv_data->data.time.gnss_year % 100) )? 29 : 28; + case 2: /* February */ + days += 31; + } + + val->val1 = days * 86400; + val->val1 += drv_data->data.time.gnss_hour * 3600; + val->val1 += drv_data->data.time.gnss_minute * 60; + val->val1 += drv_data->data.time.gnss_second; + val->val2 = drv_data->data.time.gnss_nanosecond / 1000; + default: return -ENOTSUP; } @@ -326,86 +506,95 @@ static int cxd5605_channel_get(const struct device *dev, * @return 0 if successful, negative errno code if failure. * */ -static int cxd5605_attr_get(const struct device *dev, - enum sensor_channel chan, - enum sensor_attribute attr, - struct sensor_value *val) +static int cxd5605_attr_get(const struct device *dev, enum sensor_channel chan, + enum sensor_attribute attr, struct sensor_value *val) { struct cxd5605_data *drv_data = dev->data; - if (chan == (enum sensor_channel)GNSS_CHANNEL_TIME) { - val->val1 = (int)((drv_data->pvt.time.gnss_hour * 10000) + - (drv_data->pvt.time.gnss_minute * 100) + - (drv_data->pvt.time.gnss_second)); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_TIME && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_SECOND) { + val->val1 = drv_data->data.time.gnss_second; + val->val2 = 0; + } + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_TIME && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_MINUTE) { + val->val1 = drv_data->data.time.gnss_minute; val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_TIME && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_DAY) { - val->val1 = (int)drv_data->pvt.time.gnss_day; + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_TIME && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_HOUR) { + val->val1 = drv_data->data.time.gnss_hour; val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_TIME && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_MONTH) { - val->val1 = (int)drv_data->pvt.time.gnss_month; + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_TIME && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_DAY) { + val->val1 = drv_data->data.time.gnss_day; val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_TIME && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_YEAR) { - val->val1 = (int)drv_data->pvt.time.gnss_year; + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_TIME && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_MONTH) { + val->val1 = drv_data->data.time.gnss_month; + val->val2 = 0; + } + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_TIME && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_YEAR) { + val->val1 = drv_data->data.time.gnss_year; val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_LATITUDE) { - val->val1 = (int)(drv_data->pvt.position.latitude); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_LATITUDE) { + val->val1 = (int)(drv_data->data.position.latitude); val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_LONGITUDE) { - val->val1 = (int)(drv_data->pvt.position.longitude); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_LONGITUDE) { + val->val1 = (int)(drv_data->data.position.longitude); val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_ALTITUDE_MSL) { - val->val1 = (int)(drv_data->pvt.position.altitude_MSL); - val->val2 = (int)((drv_data->pvt.position.altitude_MSL-val->val1) * 100); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_ALTITUDE_MSL) { + sensor_value_from_double(val, drv_data->data.position.altitude_MSL); + val->val1 = drv_data->data.position.altitude_MSL; + val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_ALTITUDE_HAE) { - val->val1 = (int)(drv_data->pvt.position.altitude); - val->val2 = (int)((drv_data->pvt.position.altitude-val->val1) * 100); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_ALTITUDE_HAE) { + val->val1 = drv_data->data.position.altitude; + val->val2 = 0; + } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_HDOP) { - val->val1 = (int)(drv_data->pvt.position.horizontal_accuracy / 10); - val->val2 = (int)(drv_data->pvt.position.horizontal_accuracy%10); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_HDOP) { + val->val1 = drv_data->data.position.hDOP / 10; + val->val2 = (drv_data->data.position.hDOP % 10) * 100000; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_SIV) { - val->val1 = (int)(drv_data->pvt.position.SIV); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_SIV) { + val->val1 = (int)(drv_data->data.position.SIV); val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_FIXTYPE) { - cxd5605_wait_fetch(dev); - val->val1 = (int)(drv_data->pvt.position.fix_type); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_FIXTYPE) { + val->val1 = (int)(drv_data->data.position.fix_type); val->val2 = 0; } - if (chan == (enum sensor_channel)GNSS_CHANNEL_VELOCITY && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_PDOP) { - val->val1 = (int)(drv_data->pvt.velocity.pDOP); - val->val2 = (int)((drv_data->pvt.velocity.pDOP-val->val1) * 100); + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_VELOCITY && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_PDOP) { + val->val1 = (int)(drv_data->data.velocity.pDOP); + val->val2 = (int)((drv_data->data.velocity.pDOP - val->val1) * 100); } - if (chan == (enum sensor_channel)GNSS_CHANNEL_POSITION && - attr == (enum sensor_attribute)GNSS_ATTRIBUTE_VER) { - if (val->val1 == 0) - val->val2 = (int)drv_data->cxd5605_cmd_data.ver.major; - else if (val->val1 == 1) - val->val2 = (int)drv_data->cxd5605_cmd_data.ver.minor; - else - val->val2 = (int)drv_data->cxd5605_cmd_data.ver.patch; + if (chan == (enum sensor_channel)SENSOR_CHAN_GNSS_POSITION && + attr == (enum sensor_attribute)SENSOR_ATTR_GNSS_VER) { + if (val->val1 == 0) { + val->val2 = (int)drv_data->ver.major; + } else if (val->val1 == 1) { + val->val2 = (int)drv_data->ver.minor; + } else { + val->val2 = (int)drv_data->ver.patch; + } } return 0; } @@ -420,10 +609,8 @@ static int cxd5605_attr_get(const struct device *dev, * @return 0 if successful, negative errno code if failure * */ -static int cxd5605_attr_set(const struct device *dev, - enum sensor_channel chan, - enum sensor_attribute attr, - const struct sensor_value *val) +static int cxd5605_attr_set(const struct device *dev, enum sensor_channel chan, + enum sensor_attribute attr, const struct sensor_value *val) { struct cxd5605_data *drv_data = dev->data; int result = 0; @@ -439,25 +626,20 @@ static int cxd5605_attr_set(const struct device *dev, return -ENOTSUP; } - drv_data->cxd5605_cmd = (int)attr; - LOG_DBG("[cxd5605:tx] - cmd (%d)\r\n", drv_data->cxd5605_cmd); - - switch (drv_data->cxd5605_cmd) { - + switch ((uint16_t)attr) { case SENSOR_ATTR_CXD5605_ASSIST_GEN_FUNCTION_CONTROL: - result = cxd5605_assist_gen_function_control(dev, val->val1); + result = cxd5605_assist_gen_function_control(&drv_data->cdev, val->val1); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_assist_gen_function_control error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_OPERATING_MODE: - result = cxd5605_operating_mode(dev, val[0].val1, val[0].val2, val[1].val1); + result = cxd5605_operating_mode(&drv_data->cdev, val[0].val1, val[0].val2, + val[1].val1); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_operating_mode error %d", result); return result; } drv_data->op_mode = val[0].val1; @@ -467,10 +649,9 @@ static int cxd5605_attr_set(const struct device *dev, case SENSOR_ATTR_CXD5605_PULSE: if (val->val1 > 0) { - result = cxd5605_pulse(dev, 1); + result = cxd5605_pulse(&drv_data->cdev, 1); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_pulse error %d", result); return result; } if (val->val2) { @@ -478,75 +659,67 @@ static int cxd5605_attr_set(const struct device *dev, drv_data->pps_cb = ((void (*)(void))val->val2); } } else { - result = cxd5605_pulse(dev, 0); + result = cxd5605_pulse(&drv_data->cdev, 0); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_pulse error %d", result); return result; } } break; case SENSOR_ATTR_CXD5605_COLD_START: - result = cxd5605_cold_start(dev); + result = cxd5605_cold_start(&drv_data->cdev); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_cold_start error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_WAKE_UP: - result = cxd5605_wake_up(dev); + result = cxd5605_wake_up(&drv_data->cdev); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_wake_up error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_SENTENCE_SELECT: - result = cxd5605_sentence_select(dev, val->val1); + result = cxd5605_sentence_select(&drv_data->cdev, val->val1); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_sentence_select error %d", result); return result; } drv_data->selected_sentences = val->val1; break; case SENSOR_ATTR_CXD5605_HOT_START: - result = cxd5605_hot_start(dev); + result = cxd5605_hot_start(&drv_data->cdev); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_hot_start error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_HOT_START_TTFF: - result = cxd5605_hot_start_ttff(dev); + result = cxd5605_hot_start_ttff(&drv_data->cdev); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_hot_start_ttff error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_STOP: - result = cxd5605_stop(dev); + result = cxd5605_stop(&drv_data->cdev); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_stop error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_WARM_START: - result = cxd5605_warm_start(dev); + result = cxd5605_warm_start(&drv_data->cdev); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_warm_start error %d", result); return result; } break; @@ -559,28 +732,25 @@ static int cxd5605_attr_set(const struct device *dev, min = val[2].val1; sec = val[2].val2; - result = cxd5605_time_set(dev, year, month, day, hour, min, sec); + result = cxd5605_time_set(&drv_data->cdev, year, month, day, hour, min, sec); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_time_set error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_SLEEP: - result = cxd5605_sleep(dev, val->val1); + result = cxd5605_sleep(&drv_data->cdev, val->val1); if (result > SEND_BUF_SIZE || result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("cxd5605_sleep error %d", result); return result; } break; case SENSOR_ATTR_CXD5605_VERSION: - result = cxd5605_version(dev); + result = cxd5605_version(&drv_data->cdev, &drv_data->ver); if (result < 0) { - LOG_ERR("[%s:%d] to_send buffer error %d", - __FILE__, __LINE__, result); + LOG_ERR("[cxd5605_version error %d", result); return result; } break; @@ -589,7 +759,12 @@ static int cxd5605_attr_set(const struct device *dev, return -ENOTSUP; } + return 0; +} +static int cxd5605_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + /* Does nothing */ return 0; } @@ -599,6 +774,7 @@ static const struct sensor_driver_api cxd5605_driver_api = { .attr_set = cxd5605_attr_set, .attr_get = cxd5605_attr_get, .channel_get = cxd5605_channel_get, + .sample_fetch = cxd5605_sample_fetch, }; /** @brief Setup 1PPS and Alert interrupt @@ -614,8 +790,9 @@ int cxd5605_setup_interrupts(const struct device *dev) struct cxd5605_data *drv_data = dev->data; const struct cxd5605_config *config = dev->config; const struct gpio_dt_spec *int_gpio = &config->int_gpio; + const struct gpio_dt_spec *alert_gpio = &config->alert_gpio; - if (config->alert_gpio.port) { + if (int_gpio->port) { /* setup 1pps interrupt */ result = gpio_pin_configure_dt(int_gpio, GPIO_INPUT); @@ -623,29 +800,47 @@ int cxd5605_setup_interrupts(const struct device *dev) return result; } - gpio_init_callback(&drv_data->one_pps_gpio_cb, - callback_1pps, - BIT(int_gpio->pin)); + gpio_init_callback(&drv_data->one_pps_gpio_cb, callback_1pps, BIT(int_gpio->pin)); + + result = gpio_add_callback(int_gpio->port, &drv_data->one_pps_gpio_cb); + + if (result < 0) { + return result; + } + + result = gpio_pin_interrupt_configure_dt(int_gpio, GPIO_INT_EDGE_RISING); + + if (result < 0) { + return result; + } + } + if (alert_gpio->port) { + /* setup drdy interrupt */ + result = gpio_pin_configure_dt(alert_gpio, GPIO_INPUT); + + if (result < 0) { + return result; + } + + gpio_init_callback(&drv_data->data_ready_gpio_cb, callback_drdy, BIT(alert_gpio->pin)); - result = gpio_add_callback(int_gpio->port, - &drv_data->one_pps_gpio_cb); + result = gpio_add_callback(alert_gpio->port, &drv_data->data_ready_gpio_cb); if (result < 0) { return result; } - result = gpio_pin_interrupt_configure_dt(int_gpio, - GPIO_INT_EDGE_RISING); + result = gpio_pin_interrupt_configure_dt(alert_gpio, GPIO_INT_EDGE_RISING); if (result < 0) { return result; } } + cxd5605_register_nmea_callback(&drv_data->cdev, driver_cxd5605_nmea_cb); return 0; } - /** @brief power mode action routine * * @param dev device structure @@ -655,8 +850,7 @@ int cxd5605_setup_interrupts(const struct device *dev) * */ #ifdef CONFIG_PM_DEVICE -static int cxd5605_driver_pm_action(const struct device *dev, - enum pm_device_action action) +static int cxd5605_driver_pm_action(const struct device *dev, enum pm_device_action action) { const struct cxd5605_config *config = dev->config; const struct gpio_dt_spec *rst_gpio = &config->rst_gpio; @@ -671,30 +865,30 @@ static int cxd5605_driver_pm_action(const struct device *dev, * domain this device belongs is resumed. */ result = gpio_pin_configure_dt(rst_gpio, GPIO_OUTPUT_HIGH); - k_msleep(3000); /* wait for GNSS chip to boot */ - result = init(dev); + k_msleep(3000); /* wait for GNSS chip to boot */ + result = chip_init(dev); if (result < 0) { printk("ERROR: I2C interface not working (CXD5605 driver)\n"); } if (drv_data->pps_cb) { - cxd5605_pulse(dev, 1); + cxd5605_pulse(&drv_data->cdev, 1); } - cxd5605_operating_mode(dev, drv_data->op_mode, drv_data->pos_cycle, \ + cxd5605_operating_mode(&drv_data->cdev, drv_data->op_mode, drv_data->pos_cycle, drv_data->sleep_time); - cxd5605_sentence_select(dev, drv_data->selected_sentences); + cxd5605_sentence_select(&drv_data->cdev, drv_data->selected_sentences); case PM_DEVICE_ACTION_SUSPEND: - cxd5605_sleep(dev, 0); + cxd5605_sleep(&drv_data->cdev, 0); break; case PM_DEVICE_ACTION_RESUME: - cxd5605_wake_up(dev); + cxd5605_wake_up(&drv_data->cdev); break; case PM_DEVICE_ACTION_TURN_OFF: /* * power off the device, used when the power * domain this device belongs is suspended. */ - cxd5605_sleep(dev, 2); + cxd5605_sleep(&drv_data->cdev, 2); gpio_pin_interrupt_configure_dt(&config->int_gpio, GPIO_INT_DISABLE); result = gpio_pin_configure_dt(rst_gpio, GPIO_OUTPUT_LOW); break; @@ -706,31 +900,23 @@ static int cxd5605_driver_pm_action(const struct device *dev, } #endif /* CONFIG_PM_DEVICE */ -#define CXD5605_DEFINE(inst) \ - static struct cxd5605_data cxd5605_prv_data_##inst; \ - static struct cxd5605_config cxd5605_config_##inst = { \ - .i2c_spec = I2C_DT_SPEC_INST_GET(inst), \ - .alert_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, \ - alert_gpios, { 0 }), \ - .int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, \ - int_gpios, { 0 }), \ - .pwr_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, \ - pwr_gpios, { 0 }), \ - .rst_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, \ - rst_gpios, { 0 }), \ - .boot_rec_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, \ - boot_rec_gpios, { 0 }) \ - }; \ - \ - PM_DEVICE_DT_INST_DEFINE(inst, cxd5605_driver_pm_action); \ - \ - DEVICE_DT_INST_DEFINE(inst, \ - &init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &cxd5605_prv_data_##inst, \ - &cxd5605_config_##inst, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ +#define CXD5605_DEFINE(inst) \ + static struct cxd5605_config cxd5605_config_##inst = { \ + .i2c_spec = I2C_DT_SPEC_INST_GET(inst), \ + .alert_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, alert_gpios, {0}), \ + .int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}), \ + .rst_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, rst_gpios, {0}), \ + .boot_rec_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, boot_rec_gpios, {0})}; \ + K_SEM_DEFINE(cxd5605_resp_sem_##inst, 0, 1); \ + static struct cxd5605_data cxd5605_prv_data_##inst = { \ + .cdev = CXD5605_DEV_DEFINE(&cxd5605_resp_sem_##inst, &cxd5605_config_##inst), \ + }; \ + \ + PM_DEVICE_DT_INST_DEFINE(inst, cxd5605_driver_pm_action); \ + \ + DEVICE_DT_INST_DEFINE(inst, &init, PM_DEVICE_DT_INST_GET(inst), &cxd5605_prv_data_##inst, \ + &cxd5605_config_##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ &cxd5605_driver_api); -DT_INST_FOREACH_STATUS_OKAY(CXD5605_DEFINE) +/* Current lib version only supports one instance */ +DT_INST_FOREACH_STATUS_OKAY(CXD5605_DEFINE); diff --git a/drivers/sensor/cxd5605/cxd5605.h b/drivers/sensor/cxd5605/cxd5605.h index 5670c7b936e..5a4b8723501 100644 --- a/drivers/sensor/cxd5605/cxd5605.h +++ b/drivers/sensor/cxd5605/cxd5605.h @@ -12,7 +12,44 @@ #include #include +#include +#include int cxd5605_setup_interrupts(const struct device *dev); + +struct cxd5605_data { + const struct device *cxd5605_dev; + struct cxd5605_dev cdev; + + struct gpio_callback data_ready_gpio_cb; + struct gpio_callback one_pps_gpio_cb; + + pps_func pps_cb; + struct gnss_global_data data; + struct cxd5605_version ver; + char version[32]; + + uint32_t op_mode; + uint32_t pos_cycle; + uint32_t sleep_time; + uint32_t selected_sentences; + +#if defined(CONFIG_CXD5605_OWN_THREAD) + K_KERNEL_STACK_MEMBER(thread_stack, 2048); + struct k_thread thread; + struct k_sem gpio_sem; +#else + struct k_work work; +#endif +}; + +struct cxd5605_config { + const struct i2c_dt_spec i2c_spec; + const struct gpio_dt_spec alert_gpio; + const struct gpio_dt_spec int_gpio; + const struct gpio_dt_spec rst_gpio; + const struct gpio_dt_spec boot_rec_gpio; +}; + #endif /* ZEPHYR_DRIVERS_SENSOR_CXD5605_CXD5605_H_ */ diff --git a/drivers/sensor/cxd5605/cxd5605_lib_exports.c b/drivers/sensor/cxd5605/cxd5605_lib_exports.c new file mode 100644 index 00000000000..cb05fdfb61b --- /dev/null +++ b/drivers/sensor/cxd5605/cxd5605_lib_exports.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2023 T-Mobile USA, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ +#define DT_DRV_COMPAT sony_cxd5605 +#include +#include +#include +#include "cxd5605.h" +#include + + +void cxd5605_pin_set(struct cxd5605_dev *cxd_dev, enum cxd_pin pin, int value) +{ + const struct cxd5605_config *cfg = cxd_dev->user_data; + + switch (pin) { + case cxd_rst_gpio: + gpio_pin_set_dt(&cfg->rst_gpio, value); + break; + case cxd_boot_rec_gpio: + gpio_pin_set_dt(&cfg->boot_rec_gpio, value); + break; + case cxd_alert_gpio: + gpio_pin_set_dt(&cfg->alert_gpio, value); + break; + default: + break; + } +} + +void cxd5605_pin_conf(struct cxd5605_dev *cxd_dev, enum cxd_pin pin, enum cxd_pin_dir inout) +{ + const struct cxd5605_config *cfg = cxd_dev->user_data; + + gpio_flags_t pincfg = inout ? GPIO_INPUT : GPIO_OUTPUT; + + switch (pin) { + case cxd_rst_gpio: + gpio_pin_configure_dt(&cfg->rst_gpio, pincfg); + break; + case cxd_boot_rec_gpio: + gpio_pin_configure_dt(&cfg->boot_rec_gpio, pincfg); + break; + case cxd_alert_gpio: + gpio_pin_configure_dt(&cfg->alert_gpio, pincfg); + break; + default: + break; + } +} + +void cxd5605_sem_give(cxd5605_sem sem) +{ + struct k_sem *ksem = sem; + + k_sem_give(ksem); +} + +int cxd5605_sem_take(cxd5605_sem sem, int timeout_ms) +{ + struct k_sem *ksem = sem; + + return k_sem_take(ksem, K_MSEC(timeout_ms)); +} + +int cxd5605_i2c_read(struct cxd5605_dev *cxd_dev, uint8_t *data, uint8_t num_bytes) +{ + const struct cxd5605_config *cfg = cxd_dev->user_data; + + return i2c_read_dt(&cfg->i2c_spec, data, num_bytes); +} + +int cxd5605_i2c_write(struct cxd5605_dev *cxd_dev, uint8_t *data, uint8_t num_bytes) +{ + const struct cxd5605_config *cfg = cxd_dev->user_data; + + return i2c_write_dt(&cfg->i2c_spec, data, num_bytes); +} + +void cxd5605_usleep(int us) +{ + k_usleep(us); +} diff --git a/dts/arm/nuvoton/npcx.dtsi b/dts/arm/nuvoton/npcx.dtsi deleted file mode 100644 index 3034afec328..00000000000 --- a/dts/arm/nuvoton/npcx.dtsi +++ /dev/null @@ -1,659 +0,0 @@ -/* - * Copyright (c) 2021 Nuvoton Technology Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -/* Macros for device tree declarations of npcx soc family */ -#include -#include -#include -#include -#include -#include -#include -#include - -/ { - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu0: cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-m4f"; - reg = <0>; - }; - }; - - def-io-conf-list { - compatible = "nuvoton,npcx-pinctrl-def"; - /* Change default functional pads to GPIOs - * no_spip - PIN95.97.A1.A3 - * no_fpip - PIN96.A0.A2.A4 - Internal flash only - * no_pwrgd - PIN72 - * no_lpc_espi - PIN46.47.51.52.53.54.55.57 - * no_peci_en - PIN81 - * npsl_in1_sl - PIND2 - * npsl_in2_sl - PIN00 - * no_ksi0-7 - PIN31.30.27.26.25.24.23.22 - * no_ks000-17 - PIN21.20.17.16.15.14.13.12.11.10.07.06.05.04. - * 82.83.03.B1 - */ - pinmux = <>; - }; - - /** Dummy pinctrl node. It will be initialized with defaults based on the SoC series. - * Then, the user can override the pin control options at the board level. - */ - pinctrl: pinctrl { - compatible = "nuvoton,npcx-pinctrl"; - status = "okay"; - }; - - /* Dummy node of IOs that have leakage current. The user can override - * 'leak-gpios' prop. at board DT file to save more power consumption. - */ - power_leakage_io: power-leakage-io { - compatible = "nuvoton,npcx-leakage-io"; - status = "okay"; - }; - - soc { - bbram: bb-ram@400af000 { - compatible = "nuvoton,npcx-bbram"; - reg = <0x400af000 0x80 - 0x400af100 0x1>; - reg-names = "memory", "status"; - }; - - pcc: clock-controller@4000d000 { - compatible = "nuvoton,npcx-pcc"; - /* Cells for bus type, clock control reg and bit */ - #clock-cells = <3>; - /* First reg region is Power Management Controller */ - /* Second reg region is Core Domain Clock Generator */ - reg = <0x4000d000 0x2000 - 0x400b5000 0x2000>; - reg-names = "pmc", "cdcg"; - }; - - scfg: scfg@400c3000 { - compatible = "nuvoton,npcx-scfg"; - /* First reg region is System Configuration Device */ - /* Second reg region is System Glue Device */ - reg = <0x400c3000 0x70 - 0x400a5000 0x2000>; - reg-names = "scfg", "glue"; - #alt-cells = <3>; - #lvol-cells = <2>; - }; - - mdc: mdc@4000c000 { - compatible = "syscon"; - reg = <0x4000c000 0xa>; - reg-io-width = <1>; - }; - - mdc_header: mdc@4000c00a { - compatible = "syscon"; - reg = <0x4000c00a 0x4>; - reg-io-width = <2>; - }; - - miwu0: miwu@400bb000 { - compatible = "nuvoton,npcx-miwu"; - reg = <0x400bb000 0x2000>; - index = <0>; - #miwu-cells = <2>; - }; - - miwu1: miwu@400bd000 { - compatible = "nuvoton,npcx-miwu"; - reg = <0x400bd000 0x2000>; - index = <1>; - #miwu-cells = <2>; - }; - - miwu2: miwu@400bf000 { - compatible = "nuvoton,npcx-miwu"; - reg = <0x400bf000 0x2000>; - index = <2>; - #miwu-cells = <2>; - }; - - gpio0: gpio@40081000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40081000 0x2000>; - gpio-controller; - index = <0x0>; - #gpio-cells=<2>; - }; - - gpio1: gpio@40083000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40083000 0x2000>; - gpio-controller; - index = <0x1>; - #gpio-cells=<2>; - }; - - gpio2: gpio@40085000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40085000 0x2000>; - gpio-controller; - index = <0x2>; - #gpio-cells=<2>; - }; - - gpio3: gpio@40087000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40087000 0x2000>; - gpio-controller; - index = <0x3>; - #gpio-cells=<2>; - }; - - gpio4: gpio@40089000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40089000 0x2000>; - gpio-controller; - index = <0x4>; - #gpio-cells=<2>; - }; - - gpio5: gpio@4008b000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x4008b000 0x2000>; - gpio-controller; - index = <0x5>; - #gpio-cells=<2>; - }; - - gpio6: gpio@4008d000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x4008d000 0x2000>; - gpio-controller; - index = <0x6>; - #gpio-cells=<2>; - }; - - gpio7: gpio@4008f000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x4008f000 0x2000>; - gpio-controller; - index = <0x7>; - #gpio-cells=<2>; - }; - - gpio8: gpio@40091000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40091000 0x2000>; - gpio-controller; - index = <0x8>; - #gpio-cells=<2>; - }; - - gpio9: gpio@40093000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40093000 0x2000>; - gpio-controller; - index = <0x9>; - #gpio-cells=<2>; - }; - - gpioa: gpio@40095000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40095000 0x2000>; - gpio-controller; - index = <0xA>; - #gpio-cells=<2>; - }; - - gpiob: gpio@40097000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40097000 0x2000>; - gpio-controller; - index = <0xB>; - #gpio-cells=<2>; - }; - - gpioc: gpio@40099000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x40099000 0x2000>; - gpio-controller; - index = <0xC>; - #gpio-cells=<2>; - }; - - gpiod: gpio@4009b000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x4009b000 0x2000>; - gpio-controller; - index = <0xD>; - #gpio-cells=<2>; - }; - - gpioe: gpio@4009d000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x4009d000 0x2000>; - gpio-controller; - index = <0xE>; - #gpio-cells=<2>; - }; - - gpiof: gpio@4009f000 { - compatible = "nuvoton,npcx-gpio"; - reg = <0x4009f000 0x2000>; - gpio-controller; - index = <0xF>; - #gpio-cells=<2>; - }; - - pwm0: pwm@40080000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x40080000 0x2000>; - pwm-channel = <0>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 0>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm1: pwm@40082000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x40082000 0x2000>; - pwm-channel = <1>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 1>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm2: pwm@40084000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x40084000 0x2000>; - pwm-channel = <2>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 2>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm3: pwm@40086000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x40086000 0x2000>; - pwm-channel = <3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 3>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm4: pwm@40088000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x40088000 0x2000>; - pwm-channel = <4>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 4>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm5: pwm@4008a000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x4008a000 0x2000>; - pwm-channel = <5>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 5>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm6: pwm@4008c000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x4008c000 0x2000>; - pwm-channel = <6>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 6>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm7: pwm@4008e000 { - compatible = "nuvoton,npcx-pwm"; - reg = <0x4008e000 0x2000>; - pwm-channel = <7>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL2 7>; - #pwm-cells = <3>; - status = "disabled"; - }; - - adc0: adc@400d1000 { - compatible = "nuvoton,npcx-adc"; - #io-channel-cells = <1>; - reg = <0x400d1000 0x2000>; - interrupts = <10 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB1 NPCX_PWDWN_CTL4 4>; - status = "disabled"; - }; - - twd0: watchdog@400d8000 { - compatible = "nuvoton,npcx-watchdog"; - reg = <0x400d8000 0x2000>; - t0-out = <&wui_t0out>; - }; - - espi0: espi@4000a000 { - compatible = "nuvoton,npcx-espi"; - reg = <0x4000a000 0x2000>; - interrupts = <18 3>; /* Interrupt for eSPI Bus */ - - /* clocks for eSPI modules */ - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL6 7>; - /* WUI maps for eSPI signals */ - espi-rst-wui = <&wui_espi_rst>; - - #address-cells = <1>; - #size-cells = <0>; - #vw-cells = <3>; - status = "disabled"; - }; - - shi0: shi@4000f000 { - compatible = "nuvoton,npcx-shi"; - reg = <0x4000f000 0x120>; - interrupts = <18 1>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 1>; - status = "disabled"; - buffer-rx-size = <128>; - buffer-tx-size = <128>; - }; - - host_sub: lpc@400c1000 { - compatible = "nuvoton,npcx-host-sub"; - /* host sub-module register address & size */ - reg = <0x400c1000 0x2000 - 0x40010000 0x2000 - 0x4000e000 0x2000 - 0x400c7000 0x2000 - 0x400c9000 0x2000 - 0x400cb000 0x2000>; - reg-names = "mswc", "shm", "c2h", "kbc", "pm_acpi", - "pm_hcmd"; - - /* host sub-module IRQ and priority */ - interrupts = <25 3>, /* KBC Input-Buf-Full (IBF) */ - <56 3>, /* KBC Output-Buf-Empty (OBE) */ - <26 3>, /* PMCH Input-Buf-Full (IBF) */ - <3 3>, /* PMCH Output-Buf-Empty (OBE) */ - <6 3>; /* Port80 FIFO Not Empty */ - interrupt-names = "kbc_ibf", "kbc_obe", "pmch_ibf", - "pmch_obe", "p80_fifo"; - - /* WUI map for accessing host sub-modules */ - host-acc-wui = <&wui_host_acc>; - - /* clocks for host sub-modules */ - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 3>, - <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 4>, - <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 5>, - <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 6>, - <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL5 7>; - }; - - /* I2c Controllers - Do not use them as i2c node directly */ - i2c_ctrl0: i2c@40009000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x40009000 0x1000>; - interrupts = <13 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL3 0>; - status = "disabled"; - }; - - i2c_ctrl1: i2c@4000b000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x4000b000 0x1000>; - interrupts = <14 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL3 1>; - status = "disabled"; - }; - - i2c_ctrl2: i2c@400c0000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x400c0000 0x1000>; - interrupts = <36 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL3 2>; - status = "disabled"; - }; - - i2c_ctrl3: i2c@400c2000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x400c2000 0x1000>; - interrupts = <37 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL3 3>; - status = "disabled"; - }; - - i2c_ctrl4: i2c@40008000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x40008000 0x1000>; - interrupts = <19 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL3 4>; - status = "disabled"; - }; - - i2c_ctrl5: i2c@40017000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x40017000 0x1000>; - interrupts = <20 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL7 0>; - status = "disabled"; - }; - - i2c_ctrl6: i2c@40018000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x40018000 0x1000>; - interrupts = <16 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL7 1>; - status = "disabled"; - }; - - i2c_ctrl7: i2c@40019000 { - compatible = "nuvoton,npcx-i2c-ctrl"; - reg = <0x40019000 0x1000>; - interrupts = <8 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB3 NPCX_PWDWN_CTL7 2>; - status = "disabled"; - }; - - tach1: tach@400e1000 { - compatible = "nuvoton,npcx-tach"; - reg = <0x400e1000 0x2000>; - clocks = <&pcc NPCX_CLOCK_BUS_LFCLK NPCX_PWDWN_CTL1 5>; - status = "disabled"; - }; - - tach2: tach@400e3000 { - compatible = "nuvoton,npcx-tach"; - reg = <0x400e3000 0x2000>; - clocks = <&pcc NPCX_CLOCK_BUS_LFCLK NPCX_PWDWN_CTL1 6>; - status = "disabled"; - }; - - ps2_ctrl0: ps2@400b1000 { - compatible = "nuvoton,npcx-ps2-ctrl"; - reg = <0x400b1000 0x1000>; - interrupts = <21 4>; - clocks = <&pcc NPCX_CLOCK_BUS_FREERUN NPCX_PWDWN_CTL1 3>; - - /* PS2 Channels - Please use them as PS2 node */ - ps2_channel0: io_ps2_channel0 { - compatible = "nuvoton,npcx-ps2-channel"; - channel = <0x00>; - status = "disabled"; - }; - - ps2_channel1: io_ps2_channel1 { - compatible = "nuvoton,npcx-ps2-channel"; - channel = <0x01>; - status = "disabled"; - }; - - ps2_channel2: io_ps2_channel2 { - compatible = "nuvoton,npcx-ps2-channel"; - channel = <0x02>; - status = "disabled"; - }; - - ps2_channel3: io_ps2_channel3 { - compatible = "nuvoton,npcx-ps2-channel"; - channel = <0x03>; - status = "disabled"; - }; - }; - - /* Dedicated SPI interface to access SPI flashes */ - spi_fiu0: spi@40020000 { - compatible = "nuvoton,npcx-spi-fiu"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x40020000 0x2000>; - clocks = <&pcc NPCX_CLOCK_BUS_FIU NPCX_PWDWN_CTL1 2>; - }; - - peci0: peci@400d4000 { - compatible = "nuvoton,npcx-peci"; - reg = <0x400d4000 0x1000>; - #address-cells = <1>; - #size-cells = <0>; - interrupts = <4 4>; - clocks = <&pcc NPCX_CLOCK_BUS_FMCLK NPCX_PWDWN_CTL4 5>; - status = "disabled"; - }; - - kbd: kbd@400a3000 { - compatible = "nuvoton,npcx-kbd"; - reg = <0x400a3000 0x2000>; - interrupts = <49 4>; - clocks = <&pcc NPCX_CLOCK_BUS_APB1 NPCX_PWDWN_CTL1 0>; - wui-maps = <&wui_io31 &wui_io30 &wui_io27 &wui_io26 - &wui_io25 &wui_io24 &wui_io23 &wui_io22>; - status = "disabled"; - }; - }; - - soc-if { - /* Soc specific peripheral interface phandles which don't contain - * 'reg' prop. Please overwrite 'status' prop. to 'okay' if you - * want to switch the interface from io to specific peripheral. - */ - host_uart: io_host_uart { - compatible = "nuvoton,npcx-host-uart"; - status = "disabled"; - }; - - i2c0_0: io_i2c_ctrl0_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x00>; - controller = <&i2c_ctrl0>; - status = "disabled"; - }; - - i2c1_0: io_i2c_ctrl1_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x10>; - controller = <&i2c_ctrl1>; - status = "disabled"; - }; - - i2c2_0: io_i2c_ctrl2_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x20>; - controller = <&i2c_ctrl2>; - status = "disabled"; - }; - - i2c3_0: io_i2c_ctrl3_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x30>; - controller = <&i2c_ctrl3>; - status = "disabled"; - }; - - i2c4_1: io_i2c_ctrl4_port1 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x41>; - controller = <&i2c_ctrl4>; - status = "disabled"; - }; - - i2c5_0: io_i2c_ctrl5_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x50>; - controller = <&i2c_ctrl5>; - status = "disabled"; - }; - - i2c5_1: io_i2c_ctrl5_port1 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x51>; - controller = <&i2c_ctrl5>; - status = "disabled"; - }; - - i2c6_0: io_i2c_ctrl6_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x60>; - controller = <&i2c_ctrl6>; - status = "disabled"; - }; - - i2c6_1: io_i2c_ctrl6_port1 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x61>; - controller = <&i2c_ctrl6>; - status = "disabled"; - }; - - i2c7_0: io_i2c_ctrl7_port0 { - compatible = "nuvoton,npcx-i2c-port"; - #address-cells = <1>; - #size-cells = <0>; - port = <0x70>; - controller = <&i2c_ctrl7>; - status = "disabled"; - }; - - power_ctrl_psl: power-ctrl-psl { - compatible = "nuvoton,npcx-power-psl"; - status = "disabled"; - }; - }; - - soc-id { - compatible = "nuvoton,npcx-soc-id"; - family-id = <0x20>; - }; - - booter-variant { - compatible = "nuvoton,npcx-booter-variant"; - }; -}; - -&nvic { - arm,num-irq-priority-bits = <3>; -}; diff --git a/dts/arm/nuvoton/npcx7.dtsi b/dts/arm/nuvoton/npcx7.dtsi deleted file mode 100644 index 00d74f93e81..00000000000 --- a/dts/arm/nuvoton/npcx7.dtsi +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2021 Nuvoton Technology Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* NPCX7 series pinmux mapping table */ -#include "npcx/npcx7/npcx7-alts-map.dtsi" -/* NPCX7 series mapping table between MIWU wui bits and source device */ -#include "npcx/npcx7/npcx7-miwus-wui-map.dtsi" -/* NPCX7 series mapping table between MIWU groups and interrupts */ -#include "npcx/npcx7/npcx7-miwus-int-map.dtsi" -/* NPCX7 series eSPI VW mapping table */ -#include "npcx/npcx7/npcx7-espi-vws-map.dtsi" -/* NPCX7 series low-voltage io controls mapping table */ -#include "npcx/npcx7/npcx7-lvol-ctrl-map.dtsi" - -/* Device tree declarations of npcx soc family */ -#include "npcx.dtsi" - -/ { - def-io-conf-list { - pinmux = <&alt0_gpio_no_spip - &alt0_gpio_no_fpip - &alt1_no_pwrgd - &alta_no_peci_en - &altd_npsl_in1_sl - &altd_npsl_in2_sl - &altd_psl_in3_sl - &altd_psl_in4_sl - &alt7_no_ksi0_sl - &alt7_no_ksi1_sl - &alt7_no_ksi2_sl - &alt7_no_ksi3_sl - &alt7_no_ksi4_sl - &alt7_no_ksi5_sl - &alt7_no_ksi6_sl - &alt7_no_ksi7_sl - &alt8_no_kso00_sl - &alt8_no_kso01_sl - &alt8_no_kso02_sl - &alt8_no_kso03_sl - &alt8_no_kso04_sl - &alt8_no_kso05_sl - &alt8_no_kso06_sl - &alt8_no_kso07_sl - &alt9_no_kso08_sl - &alt9_no_kso09_sl - &alt9_no_kso10_sl - &alt9_no_kso11_sl - &alt9_no_kso12_sl - &alt9_no_kso13_sl - &alt9_no_kso14_sl - &alt9_no_kso15_sl - &alta_no_kso16_sl - &alta_no_kso17_sl>; - }; - - soc { - /* Specific soc devices in npcx7 series */ - itims: timer@400bc000 { - compatible = "nuvoton,npcx-itim-timer"; - reg = <0x400bc000 0x2000 - 0x400be000 0x2000>; - reg-names = "evt_itim", "sys_itim"; - clocks = <&pcc NPCX_CLOCK_BUS_LFCLK NPCX_PWDWN_CTL4 3 - &pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL7 5>; - interrupts = <46 1>; /* Event timer interrupt */ - }; - - uart1: serial@400c4000 { - compatible = "nuvoton,npcx-uart"; - reg = <0x400C4000 0x2000>; - interrupts = <33 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL1 4>; - uart-rx = <&wui_cr_sin1>; - status = "disabled"; - }; - - uart2: serial@400c6000 { - compatible = "nuvoton,npcx-uart"; - reg = <0x400C6000 0x2000>; - interrupts = <32 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL7 6>; - uart-rx = <&wui_cr_sin2>; - status = "disabled"; - }; - - /* Default clock and power settings in npcx9 series */ - pcc: clock-controller@4000d000 { - clock-frequency = ; /* OFMCLK runs at 90MHz */ - core-prescaler = <6>; /* CORE_CLK runs at 15MHz */ - apb1-prescaler = <6>; /* APB1_CLK runs at 15MHz */ - apb2-prescaler = <6>; /* APB2_CLK runs at 15MHz */ - apb3-prescaler = <6>; /* APB3_CLK runs at 15MHz */ - ram-pd-depth = <12>; /* Valid bit-depth of RAM_PDn reg */ - }; - - /* Wake-up input source mapping for GPIOs in npcx7 series */ - gpio0: gpio@40081000 { - wui-maps = <&wui_io00 &wui_io01 &wui_io02 &wui_io03 - &wui_io04 &wui_io05 &wui_io06 &wui_io07>; - - lvol-maps = <&lvol_io00 &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio1: gpio@40083000 { - wui-maps = <&wui_io10 &wui_io11 &wui_none &wui_none - &wui_io14 &wui_io15 &wui_io16 &wui_io17>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio2: gpio@40085000 { - wui-maps = <&wui_io20 &wui_io21 &wui_io22 &wui_io23 - &wui_io24 &wui_io25 &wui_io26 &wui_io27>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio3: gpio@40087000 { - wui-maps = <&wui_io30 &wui_io31 &wui_none &wui_io33 - &wui_io34 &wui_none &wui_io36 &wui_io37>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_io33 - &lvol_io34 &lvol_none &lvol_io36 &lvol_io37>; - }; - - gpio4: gpio@40089000 { - wui-maps = <&wui_io40 &wui_io41 &wui_io42 &wui_io43 - &wui_io44 &wui_io45 &wui_io46 &wui_io47>; - - lvol-maps = <&lvol_io40 &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio5: gpio@4008b000 { - wui-maps = <&wui_io50 &wui_io51 &wui_io52 &wui_io53 - &wui_io54 &wui_io55 &wui_io56 &wui_io57>; - - lvol-maps = <&lvol_io50 &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio6: gpio@4008d000 { - wui-maps = <&wui_io60 &wui_io61 &wui_io62 &wui_io63 - &wui_io64 &wui_none &wui_none &wui_io67>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_io64 &lvol_none &lvol_none &lvol_none>; - }; - - gpio7: gpio@4008f000 { - wui-maps = <&wui_io70 &wui_none &wui_io72 &wui_io73 - &wui_io74 &wui_io75 &wui_io76 &wui_none>; - - lvol-maps = <&lvol_none &lvol_none &lvol_io72 &lvol_io73 - &lvol_io74 &lvol_io75 &lvol_none &lvol_none>; - }; - - gpio8: gpio@40091000 { - wui-maps = <&wui_io80 &wui_io81 &wui_io82 &wui_io83 - &wui_none &wui_none &wui_io86 &wui_io87>; - - lvol-maps = <&lvol_io80 &lvol_none &lvol_io82 &lvol_none - &lvol_none &lvol_none &lvol_io86 &lvol_io87>; - }; - - gpio9: gpio@40093000 { - wui-maps = <&wui_io90 &wui_io91 &wui_io92 &wui_io93 - &wui_io94 &wui_io95 &wui_io96 &wui_io97>; - - lvol-maps = <&lvol_io90 &lvol_io91 &lvol_io92 &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpioa: gpio@40095000 { - wui-maps = <&wui_ioa0 &wui_ioa1 &wui_ioa2 &wui_ioa3 - &wui_ioa4 &wui_ioa5 &wui_ioa6 &wui_ioa7>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpiob: gpio@40097000 { - wui-maps = <&wui_iob0 &wui_iob1 &wui_iob2 &wui_iob3 - &wui_iob4 &wui_iob5 &wui_none &wui_iob7>; - - lvol-maps = <&lvol_none &lvol_none &lvol_iob2 &lvol_iob3 - &lvol_iob4 &lvol_iob5 &lvol_none &lvol_none>; - }; - - gpioc: gpio@40099000 { - wui-maps = <&wui_ioc0 &wui_ioc1 &wui_ioc2 &wui_ioc3 - &wui_ioc4 &wui_ioc5 &wui_ioc6 &wui_ioc7>; - - lvol-maps = <&lvol_none &lvol_ioc1 &lvol_ioc2 &lvol_none - &lvol_none &lvol_ioc5 &lvol_ioc6 &lvol_ioc7>; - }; - - gpiod: gpio@4009b000 { - wui-maps = <&wui_iod0 &wui_iod1 &wui_iod2 &wui_iod3 - &wui_iod4 &wui_iod5 &wui_none &wui_iod7>; - - lvol-maps = <&lvol_iod0 &lvol_iod1 &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpioe: gpio@4009d000 { - wui-maps = <&wui_ioe0 &wui_ioe1 &wui_ioe2 &wui_ioe3 - &wui_ioe4 &wui_ioe5 &wui_none &wui_none>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_ioe3 - &lvol_ioe4 &lvol_none &lvol_none &lvol_none>; - }; - - gpiof: gpio@4009f000 { - wui-maps = <&wui_iof0 &wui_iof1 &wui_iof2 &wui_iof3 - &wui_iof4 &wui_iof5 &wui_none &wui_none>; - - lvol-maps = <&lvol_none &lvol_none &lvol_iof2 &lvol_iof3 - &lvol_iof4 &lvol_iof5 &lvol_none &lvol_none>; - }; - - /* ADC0 comparator configuration in npcx7 series */ - adc0: adc@400d1000 { - channel-count = <10>; - threshold-reg-offset = <0x14>; - threshold-count = <3>; - }; - }; - - soc-id { - chip-id = <0x07>; - revision-reg = <0x00007FFC 1>; - }; - - booter-variant { - hif-type-auto; - }; -}; diff --git a/dts/arm/nuvoton/npcx9.dtsi b/dts/arm/nuvoton/npcx9.dtsi deleted file mode 100644 index b24965fedb1..00000000000 --- a/dts/arm/nuvoton/npcx9.dtsi +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2021 Nuvoton Technology Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* NPCX9 series pinmux mapping table */ -#include "npcx/npcx9/npcx9-alts-map.dtsi" -/* NPCX9 series mapping table between MIWU wui bits and source device */ -#include "npcx/npcx9/npcx9-miwus-wui-map.dtsi" -/* NPCX9 series mapping table between MIWU groups and interrupts */ -#include "npcx/npcx9/npcx9-miwus-int-map.dtsi" -/* NPCX9 series eSPI VW mapping table */ -#include "npcx/npcx9/npcx9-espi-vws-map.dtsi" -/* NPCX9 series low-voltage io controls mapping table */ -#include "npcx/npcx9/npcx9-lvol-ctrl-map.dtsi" - -/* Device tree declarations of npcx soc family */ -#include "npcx.dtsi" - -/ { - def-io-conf-list { - pinmux = <&alt0_gpio_no_spip - &alt0_gpio_no_fpip - &alt1_no_pwrgd - &alta_no_peci_en - &altd_npsl_in1_sl - &altd_npsl_in2_sl - &altd_psl_in3_sl - &altd_psl_in4_sl - &alt7_no_ksi0_sl - &alt7_no_ksi1_sl - &alt7_no_ksi2_sl - &alt7_no_ksi3_sl - &alt7_no_ksi4_sl - &alt7_no_ksi5_sl - &alt7_no_ksi6_sl - &alt7_no_ksi7_sl - &alt8_no_kso00_sl - &alt8_no_kso01_sl - &alt8_no_kso02_sl - &alt8_no_kso03_sl - &alt8_no_kso04_sl - &alt8_no_kso05_sl - &alt8_no_kso06_sl - &alt8_no_kso07_sl - &alt9_no_kso08_sl - &alt9_no_kso09_sl - &alt9_no_kso10_sl - &alt9_no_kso11_sl - &alt9_no_kso12_sl - &alt9_no_kso13_sl - &alt9_no_kso14_sl - &alt9_no_kso15_sl - &alta_no_kso16_sl - &alta_no_kso17_sl - &altg_psl_gpo_sl>; - }; - - soc { - /* Specific soc devices in npcx9 series */ - itims: timer@400b0000 { - compatible = "nuvoton,npcx-itim-timer"; - reg = <0x400b0000 0x2000 - 0x400be000 0x2000>; - reg-names = "evt_itim", "sys_itim"; - clocks = <&pcc NPCX_CLOCK_BUS_LFCLK NPCX_PWDWN_CTL4 0 - &pcc NPCX_CLOCK_BUS_APB2 NPCX_PWDWN_CTL7 5>; - interrupts = <28 1>; /* Event timer interrupt */ - }; - - uart1: serial@400e0000 { - compatible = "nuvoton,npcx-uart"; - reg = <0x400E0000 0x2000>; - interrupts = <33 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL1 4>; - uart-rx = <&wui_cr_sin1>; - status = "disabled"; - }; - - uart2: serial@400e2000 { - compatible = "nuvoton,npcx-uart"; - reg = <0x400E2000 0x2000>; - interrupts = <32 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL7 6>; - uart-rx = <&wui_cr_sin2>; - status = "disabled"; - }; - - uart3: serial@400e4000 { - compatible = "nuvoton,npcx-uart"; - reg = <0x400E4000 0x2000>; - interrupts = <38 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL7 4>; - uart-rx = <&wui_cr_sin3>; - status = "disabled"; - }; - - uart4: serial@400e6000 { - compatible = "nuvoton,npcx-uart"; - reg = <0x400E6000 0x2000>; - interrupts = <39 3>; - clocks = <&pcc NPCX_CLOCK_BUS_APB4 NPCX_PWDWN_CTL7 3>; - uart-rx = <&wui_cr_sin4>; - status = "disabled"; - }; - - /* Default clock and power settings in npcx9 series */ - pcc: clock-controller@4000d000 { - clock-frequency = ; /* OFMCLK runs at 90MHz */ - core-prescaler = <6>; /* CORE_CLK runs at 15MHz */ - apb1-prescaler = <6>; /* APB1_CLK runs at 15MHz */ - apb2-prescaler = <6>; /* APB2_CLK runs at 15MHz */ - apb3-prescaler = <6>; /* APB3_CLK runs at 15MHz */ - apb4-prescaler = <6>; /* APB4_CLK runs at 15MHz */ - ram-pd-depth = <15>; /* Valid bit-depth of RAM_PDn reg */ - }; - - /* Wake-up input source mapping for GPIOs in npcx9 series */ - gpio0: gpio@40081000 { - wui-maps = <&wui_io00 &wui_io01 &wui_io02 &wui_io03 - &wui_io04 &wui_io05 &wui_io06 &wui_io07>; - - lvol-maps = <&lvol_io00 &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio1: gpio@40083000 { - wui-maps = <&wui_io10 &wui_io11 &wui_none &wui_none - &wui_io14 &wui_io15 &wui_io16 &wui_io17>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio2: gpio@40085000 { - wui-maps = <&wui_io20 &wui_io21 &wui_io22 &wui_io23 - &wui_io24 &wui_io25 &wui_io26 &wui_io27>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio3: gpio@40087000 { - wui-maps = <&wui_io30 &wui_io31 &wui_none &wui_io33 - &wui_io34 &wui_none &wui_io36 &wui_io37>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_io33 - &lvol_io34 &lvol_none &lvol_io36 &lvol_io37>; - }; - - gpio4: gpio@40089000 { - wui-maps = <&wui_io40 &wui_io41 &wui_io42 &wui_io43 - &wui_io44 &wui_io45 &wui_io46 &wui_io47>; - - lvol-maps = <&lvol_io40 &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio5: gpio@4008b000 { - wui-maps = <&wui_io50 &wui_io51 &wui_io52 &wui_io53 - &wui_io54 &wui_io55 &wui_io56 &wui_io57>; - - lvol-maps = <&lvol_io50 &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpio6: gpio@4008d000 { - wui-maps = <&wui_io60 &wui_io61 &wui_io62 &wui_io63 - &wui_io64 &wui_none &wui_io66 &wui_io67>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_io64 &lvol_none &lvol_io66 &lvol_none>; - }; - - gpio7: gpio@4008f000 { - wui-maps = <&wui_io70 &wui_none &wui_io72 &wui_io73 - &wui_io74 &wui_io75 &wui_io76 &wui_none>; - - lvol-maps = <&lvol_none &lvol_none &lvol_io72 &lvol_io73 - &lvol_io74 &lvol_io75 &lvol_none &lvol_none>; - }; - - gpio8: gpio@40091000 { - wui-maps = <&wui_io80 &wui_io81 &wui_io82 &wui_io83 - &wui_none &wui_none &wui_none &wui_io87>; - - lvol-maps = <&lvol_io80 &lvol_none &lvol_io82 &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_io87>; - }; - - gpio9: gpio@40093000 { - wui-maps = <&wui_io90 &wui_io91 &wui_io92 &wui_io93 - &wui_io94 &wui_io95 &wui_io96 &wui_io97>; - - lvol-maps = <&lvol_io90 &lvol_io91 &lvol_io92 &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpioa: gpio@40095000 { - wui-maps = <&wui_ioa0 &wui_ioa1 &wui_ioa2 &wui_ioa3 - &wui_ioa4 &wui_ioa5 &wui_ioa6 &wui_ioa7>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpiob: gpio@40097000 { - wui-maps = <&wui_iob0 &wui_iob1 &wui_iob2 &wui_iob3 - &wui_iob4 &wui_iob5 &wui_iob6 &wui_iob7>; - - lvol-maps = <&lvol_none &lvol_none &lvol_iob2 &lvol_iob3 - &lvol_iob4 &lvol_iob5 &lvol_none &lvol_none>; - }; - - gpioc: gpio@40099000 { - wui-maps = <&wui_ioc0 &wui_ioc1 &wui_ioc2 &wui_ioc3 - &wui_ioc4 &wui_ioc5 &wui_ioc6 &wui_ioc7>; - - lvol-maps = <&lvol_none &lvol_ioc1 &lvol_ioc2 &lvol_none - &lvol_none &lvol_ioc5 &lvol_ioc6 &lvol_ioc7>; - }; - - gpiod: gpio@4009b000 { - wui-maps = <&wui_iod0 &wui_iod1 &wui_iod2 &wui_iod3 - &wui_iod4 &wui_iod5 &wui_none &wui_none>; - - lvol-maps = <&lvol_iod0 &lvol_iod1 &lvol_none &lvol_none - &lvol_none &lvol_none &lvol_none &lvol_none>; - }; - - gpioe: gpio@4009d000 { - wui-maps = <&wui_ioe0 &wui_ioe1 &wui_ioe2 &wui_ioe3 - &wui_ioe4 &wui_ioe5 &wui_none &wui_none>; - - lvol-maps = <&lvol_none &lvol_none &lvol_none &lvol_ioe3 - &lvol_ioe4 &lvol_none &lvol_none &lvol_none>; - }; - - gpiof: gpio@4009f000 { - wui-maps = <&wui_iof0 &wui_iof1 &wui_iof2 &wui_iof3 - &wui_iof4 &wui_iof5 &wui_none &wui_none>; - - lvol-maps = <&lvol_none &lvol_none &lvol_iof2 &lvol_iof3 - &lvol_iof4 &lvol_iof5 &lvol_none &lvol_none>; - }; - - /* ADC0 comparator configuration in npcx9 series */ - adc0: adc@400d1000 { - channel-count = <12>; - threshold-reg-offset = <0x60>; - threshold-count = <6>; - }; - - sha0: sha@13c { - compatible = "nuvoton,npcx-sha"; - reg = <0x13c 0x3c>; - status = "disabled"; - }; - }; - - soc-id { - chip-id = <0x09>; - revision-reg = <0x0000FFFC 4>; - }; -}; diff --git a/dts/arm/silabs/efr32bg22-pinctrl.dtsi b/dts/arm/silabs/efr32bg22-pinctrl.dtsi deleted file mode 100644 index 388423e10d0..00000000000 --- a/dts/arm/silabs/efr32bg22-pinctrl.dtsi +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022 Silicon Labs - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -&pinctrl { - /* configuration for usart0 device, operating as SPI */ - usart0_default: usart0_default { - group1 { - psels = , - , - ; - }; - }; - - /* configuration for usart1 device, default state - operating as UART */ - usart1_default: usart1_default { - group1 { - /* configure PA.6 as UART_RX and PA.5 as UART_TX */ - psels = , - , - ; - }; - }; -}; diff --git a/dts/arm/silabs/efr32bg22c224f512im40.dtsi b/dts/arm/silabs/efr32bg22c224f512im40.dtsi deleted file mode 100644 index b9d15de4734..00000000000 --- a/dts/arm/silabs/efr32bg22c224f512im40.dtsi +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2021 Sateesh Kotapati - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -/ { - soc { - compatible = "silabs,efr32bg22c224f512im40", "silabs,efr32bg22", - "silabs,efr32", "simple-bus"; - }; -}; - -&sram0 { - reg = <0x20000000 DT_SIZE_K(32)>; -}; - -&flash0 { - reg = <0 DT_SIZE_K(512)>; -}; diff --git a/dts/arm/silabs/efr32mg.dtsi b/dts/arm/silabs/efr32mg.dtsi index 4403ec45bad..65611091edf 100644 --- a/dts/arm/silabs/efr32mg.dtsi +++ b/dts/arm/silabs/efr32mg.dtsi @@ -235,16 +235,6 @@ }; }; -/ { - pinctrl: pin-controller { - /* Pin controller is a "virtual" device since SiLabs SoCs do pin - * control in a distributed way (GPIO registers and PSEL - * registers on each peripheral). - */ - compatible = "silabs,gecko-pinctrl"; - }; -}; - &nvic { arm,num-irq-priority-bits = <3>; }; diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index a6c6d3b0366..e7258fbcf77 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/zephyr/bluetooth/hci.h b/include/zephyr/bluetooth/hci.h index 8dd7434e445..57842b83486 100644 --- a/include/zephyr/bluetooth/hci.h +++ b/include/zephyr/bluetooth/hci.h @@ -10,16 +10,2995 @@ #include #include +#include +#include +#include +#include #include #include +#include #include -#include #ifdef __cplusplus extern "C" { #endif +/* Special own address types for LL privacy (used in adv & scan parameters) */ +#define BT_HCI_OWN_ADDR_RPA_OR_PUBLIC 0x02 +#define BT_HCI_OWN_ADDR_RPA_OR_RANDOM 0x03 +#define BT_HCI_OWN_ADDR_RPA_MASK 0x02 + +#define BT_HCI_PEER_ADDR_RPA_UNRESOLVED 0xfe +#define BT_HCI_PEER_ADDR_ANONYMOUS 0xff + +#define BT_ENC_KEY_SIZE_MIN 0x07 +#define BT_ENC_KEY_SIZE_MAX 0x10 + +#define BT_HCI_ADV_HANDLE_INVALID 0xff +#define BT_HCI_SYNC_HANDLE_INVALID 0xffff +#define BT_HCI_PAWR_SUBEVENT_MAX 128 + +struct bt_hci_evt_hdr { + uint8_t evt; + uint8_t len; +} __packed; +#define BT_HCI_EVT_HDR_SIZE 2 + +#define BT_ACL_START_NO_FLUSH 0x00 +#define BT_ACL_CONT 0x01 +#define BT_ACL_START 0x02 +#define BT_ACL_COMPLETE 0x03 + +#define BT_ACL_POINT_TO_POINT 0x00 +#define BT_ACL_BROADCAST 0x01 + +#define BT_ACL_HANDLE_MASK BIT_MASK(12) + +#define bt_acl_handle(h) ((h) & BT_ACL_HANDLE_MASK) +#define bt_acl_flags(h) ((h) >> 12) +#define bt_acl_flags_pb(f) ((f) & BIT_MASK(2)) +#define bt_acl_flags_bc(f) ((f) >> 2) +#define bt_acl_handle_pack(h, f) ((h) | ((f) << 12)) + +struct bt_hci_acl_hdr { + uint16_t handle; + uint16_t len; +} __packed; +#define BT_HCI_ACL_HDR_SIZE 4 + +#define BT_ISO_START 0x00 +#define BT_ISO_CONT 0x01 +#define BT_ISO_SINGLE 0x02 +#define BT_ISO_END 0x03 + +#define bt_iso_handle(h) ((h) & 0x0fff) +#define bt_iso_flags(h) ((h) >> 12) +#define bt_iso_flags_pb(f) ((f) & 0x0003) +#define bt_iso_flags_ts(f) (((f) >> 2) & 0x0001) +#define bt_iso_pack_flags(pb, ts) \ + (((pb) & 0x0003) | (((ts) & 0x0001) << 2)) +#define bt_iso_handle_pack(h, pb, ts) \ + ((h) | (bt_iso_pack_flags(pb, ts) << 12)) +#define bt_iso_hdr_len(h) ((h) & BIT_MASK(14)) + +#define BT_ISO_DATA_VALID 0x00 +#define BT_ISO_DATA_INVALID 0x01 +#define BT_ISO_DATA_NOP 0x02 + +#define bt_iso_pkt_len(h) ((h) & 0x3fff) +#define bt_iso_pkt_flags(h) ((h) >> 14) +#define bt_iso_pkt_len_pack(h, f) ((h) | ((f) << 14)) + +struct bt_hci_iso_data_hdr { + uint16_t sn; + uint16_t slen; +} __packed; +#define BT_HCI_ISO_DATA_HDR_SIZE 4 + +struct bt_hci_iso_ts_data_hdr { + uint32_t ts; + struct bt_hci_iso_data_hdr data; +} __packed; +#define BT_HCI_ISO_TS_DATA_HDR_SIZE 8 + +struct bt_hci_iso_hdr { + uint16_t handle; /* 12 bit handle, 2 bit PB flags, 1 bit TS_Flag, 1 bit RFU */ + uint16_t len; /* 14 bits, 2 bits RFU */ +} __packed; +#define BT_HCI_ISO_HDR_SIZE 4 + +struct bt_hci_cmd_hdr { + uint16_t opcode; + uint8_t param_len; +} __packed; +#define BT_HCI_CMD_HDR_SIZE 3 + +/* Supported Commands */ +#define BT_CMD_TEST(cmd, octet, bit) (cmd[octet] & BIT(bit)) +#define BT_CMD_LE_STATES(cmd) BT_CMD_TEST(cmd, 28, 3) + +#define BT_FEAT_TEST(feat, page, octet, bit) (feat[page][octet] & BIT(bit)) + +#define BT_FEAT_BREDR(feat) !BT_FEAT_TEST(feat, 0, 4, 5) +#define BT_FEAT_LE(feat) BT_FEAT_TEST(feat, 0, 4, 6) +#define BT_FEAT_EXT_FEATURES(feat) BT_FEAT_TEST(feat, 0, 7, 7) +#define BT_FEAT_HOST_SSP(feat) BT_FEAT_TEST(feat, 1, 0, 0) +#define BT_FEAT_SC(feat) BT_FEAT_TEST(feat, 2, 1, 0) + +#define BT_FEAT_LMP_ESCO_CAPABLE(feat) BT_FEAT_TEST(feat, 0, 3, 7) +#define BT_FEAT_HV2_PKT(feat) BT_FEAT_TEST(feat, 0, 1, 4) +#define BT_FEAT_HV3_PKT(feat) BT_FEAT_TEST(feat, 0, 1, 5) +#define BT_FEAT_EV4_PKT(feat) BT_FEAT_TEST(feat, 0, 4, 0) +#define BT_FEAT_EV5_PKT(feat) BT_FEAT_TEST(feat, 0, 4, 1) +#define BT_FEAT_2EV3_PKT(feat) BT_FEAT_TEST(feat, 0, 5, 5) +#define BT_FEAT_3EV3_PKT(feat) BT_FEAT_TEST(feat, 0, 5, 6) +#define BT_FEAT_3SLOT_PKT(feat) BT_FEAT_TEST(feat, 0, 5, 7) + +/* LE features */ +#define BT_LE_FEAT_BIT_ENC 0 +#define BT_LE_FEAT_BIT_CONN_PARAM_REQ 1 +#define BT_LE_FEAT_BIT_EXT_REJ_IND 2 +#define BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG 3 +#define BT_LE_FEAT_BIT_PING 4 +#define BT_LE_FEAT_BIT_DLE 5 +#define BT_LE_FEAT_BIT_PRIVACY 6 +#define BT_LE_FEAT_BIT_EXT_SCAN 7 +#define BT_LE_FEAT_BIT_PHY_2M 8 +#define BT_LE_FEAT_BIT_SMI_TX 9 +#define BT_LE_FEAT_BIT_SMI_RX 10 +#define BT_LE_FEAT_BIT_PHY_CODED 11 +#define BT_LE_FEAT_BIT_EXT_ADV 12 +#define BT_LE_FEAT_BIT_PER_ADV 13 +#define BT_LE_FEAT_BIT_CHAN_SEL_ALGO_2 14 +#define BT_LE_FEAT_BIT_PWR_CLASS_1 15 +#define BT_LE_FEAT_BIT_MIN_USED_CHAN_PROC 16 +#define BT_LE_FEAT_BIT_CONN_CTE_REQ 17 +#define BT_LE_FEAT_BIT_CONN_CTE_RESP 18 +#define BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_TX 19 +#define BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_RX 20 +#define BT_LE_FEAT_BIT_ANT_SWITCH_TX_AOD 21 +#define BT_LE_FEAT_BIT_ANT_SWITCH_RX_AOA 22 +#define BT_LE_FEAT_BIT_RX_CTE 23 +#define BT_LE_FEAT_BIT_PAST_SEND 24 +#define BT_LE_FEAT_BIT_PAST_RECV 25 +#define BT_LE_FEAT_BIT_SCA_UPDATE 26 +#define BT_LE_FEAT_BIT_REMOTE_PUB_KEY_VALIDATE 27 +#define BT_LE_FEAT_BIT_CIS_CENTRAL 28 +#define BT_LE_FEAT_BIT_CIS_PERIPHERAL 29 +#define BT_LE_FEAT_BIT_ISO_BROADCASTER 30 +#define BT_LE_FEAT_BIT_SYNC_RECEIVER 31 +#define BT_LE_FEAT_BIT_ISO_CHANNELS 32 +#define BT_LE_FEAT_BIT_PWR_CTRL_REQ 33 +#define BT_LE_FEAT_BIT_PWR_CHG_IND 34 +#define BT_LE_FEAT_BIT_PATH_LOSS_MONITOR 35 +#define BT_LE_FEAT_BIT_PER_ADV_ADI_SUPP 36 +#define BT_LE_FEAT_BIT_CONN_SUBRATING 37 +#define BT_LE_FEAT_BIT_CONN_SUBRATING_HOST_SUPP 38 +#define BT_LE_FEAT_BIT_CHANNEL_CLASSIFICATION 39 + +#define BT_LE_FEAT_BIT_PAWR_ADVERTISER 43 +#define BT_LE_FEAT_BIT_PAWR_SCANNER 44 + +#define BT_LE_FEAT_TEST(feat, n) (feat[(n) >> 3] & \ + BIT((n) & 7)) + +#define BT_FEAT_LE_ENCR(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_ENC) +#define BT_FEAT_LE_CONN_PARAM_REQ_PROC(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONN_PARAM_REQ) +#define BT_FEAT_LE_PER_INIT_FEAT_XCHG(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PER_INIT_FEAT_XCHG) +#define BT_FEAT_LE_DLE(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_DLE) +#define BT_FEAT_LE_PHY_2M(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PHY_2M) +#define BT_FEAT_LE_PHY_CODED(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PHY_CODED) +#define BT_FEAT_LE_PRIVACY(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PRIVACY) +#define BT_FEAT_LE_EXT_ADV(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_EXT_ADV) +#define BT_FEAT_LE_EXT_PER_ADV(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PER_ADV) +#define BT_FEAT_LE_CONNECTION_CTE_REQ(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONN_CTE_REQ) +#define BT_FEAT_LE_CONNECTION_CTE_RESP(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONN_CTE_RESP) +#define BT_FEAT_LE_CONNECTIONLESS_CTE_TX(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_TX) +#define BT_FEAT_LE_CONNECTIONLESS_CTE_RX(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONNECTIONLESS_CTE_RX) +#define BT_FEAT_LE_ANT_SWITCH_TX_AOD(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_ANT_SWITCH_TX_AOD) +#define BT_FEAT_LE_ANT_SWITCH_RX_AOA(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_ANT_SWITCH_RX_AOA) +#define BT_FEAT_LE_RX_CTE(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_RX_CTE) +#define BT_FEAT_LE_PAST_SEND(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PAST_SEND) +#define BT_FEAT_LE_PAST_RECV(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PAST_RECV) +#define BT_FEAT_LE_CIS_CENTRAL(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CIS_CENTRAL) +#define BT_FEAT_LE_CIS_PERIPHERAL(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CIS_PERIPHERAL) +#define BT_FEAT_LE_ISO_BROADCASTER(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_ISO_BROADCASTER) +#define BT_FEAT_LE_SYNC_RECEIVER(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_SYNC_RECEIVER) +#define BT_FEAT_LE_ISO_CHANNELS(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_ISO_CHANNELS) +#define BT_FEAT_LE_PWR_CTRL_REQ(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PWR_CTRL_REQ) +#define BT_FEAT_LE_PWR_CHG_IND(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PWR_CHG_IND) +#define BT_FEAT_LE_PATH_LOSS_MONITOR(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PATH_LOSS_MONITOR) +#define BT_FEAT_LE_PER_ADV_ADI_SUPP(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PER_ADV_ADI_SUPP) +#define BT_FEAT_LE_CONN_SUBRATING(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONN_SUBRATING) +#define BT_FEAT_LE_CONN_SUBRATING_HOST_SUPP(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CONN_SUBRATING_HOST_SUPP) +#define BT_FEAT_LE_CHANNEL_CLASSIFICATION(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_CHANNEL_CLASSIFICATION) +#define BT_FEAT_LE_PAWR_ADVERTISER(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PAWR_ADVERTISER) +#define BT_FEAT_LE_PAWR_SCANNER(feat) BT_LE_FEAT_TEST(feat, \ + BT_LE_FEAT_BIT_PAWR_SCANNER) + +#define BT_FEAT_LE_CIS(feat) (BT_FEAT_LE_CIS_CENTRAL(feat) | \ + BT_FEAT_LE_CIS_PERIPHERAL(feat)) +#define BT_FEAT_LE_BIS(feat) (BT_FEAT_LE_ISO_BROADCASTER(feat) | \ + BT_FEAT_LE_SYNC_RECEIVER(feat)) +#define BT_FEAT_LE_ISO(feat) (BT_FEAT_LE_CIS(feat) | \ + BT_FEAT_LE_BIS(feat)) + +/* LE States */ +#define BT_LE_STATES_PER_CONN_ADV(states) (states & 0x0000004000000000) + +/* Bonding/authentication types */ +#define BT_HCI_NO_BONDING 0x00 +#define BT_HCI_NO_BONDING_MITM 0x01 +#define BT_HCI_DEDICATED_BONDING 0x02 +#define BT_HCI_DEDICATED_BONDING_MITM 0x03 +#define BT_HCI_GENERAL_BONDING 0x04 +#define BT_HCI_GENERAL_BONDING_MITM 0x05 + +/* + * MITM protection is enabled in SSP authentication requirements octet when + * LSB bit is set. + */ +#define BT_MITM 0x01 + +/* I/O capabilities */ +#define BT_IO_DISPLAY_ONLY 0x00 +#define BT_IO_DISPLAY_YESNO 0x01 +#define BT_IO_KEYBOARD_ONLY 0x02 +#define BT_IO_NO_INPUT_OUTPUT 0x03 + +/* SCO packet types */ +#define HCI_PKT_TYPE_HV1 0x0020 +#define HCI_PKT_TYPE_HV2 0x0040 +#define HCI_PKT_TYPE_HV3 0x0080 + +/* eSCO packet types */ +#define HCI_PKT_TYPE_ESCO_HV1 0x0001 +#define HCI_PKT_TYPE_ESCO_HV2 0x0002 +#define HCI_PKT_TYPE_ESCO_HV3 0x0004 +#define HCI_PKT_TYPE_ESCO_EV3 0x0008 +#define HCI_PKT_TYPE_ESCO_EV4 0x0010 +#define HCI_PKT_TYPE_ESCO_EV5 0x0020 +#define HCI_PKT_TYPE_ESCO_2EV3 0x0040 +#define HCI_PKT_TYPE_ESCO_3EV3 0x0080 +#define HCI_PKT_TYPE_ESCO_2EV5 0x0100 +#define HCI_PKT_TYPE_ESCO_3EV5 0x0200 + + +#define ESCO_PKT_MASK (HCI_PKT_TYPE_ESCO_HV1 | \ + HCI_PKT_TYPE_ESCO_HV2 | \ + HCI_PKT_TYPE_ESCO_HV3) +#define SCO_PKT_MASK (HCI_PKT_TYPE_HV1 | \ + HCI_PKT_TYPE_HV2 | \ + HCI_PKT_TYPE_HV3) +#define EDR_ESCO_PKT_MASK (HCI_PKT_TYPE_ESCO_2EV3 | \ + HCI_PKT_TYPE_ESCO_3EV3 | \ + HCI_PKT_TYPE_ESCO_2EV5 | \ + HCI_PKT_TYPE_ESCO_3EV5) + +/* HCI BR/EDR link types */ +#define BT_HCI_SCO 0x00 +#define BT_HCI_ACL 0x01 +#define BT_HCI_ESCO 0x02 + +/* OpCode Group Fields */ +#define BT_OGF_LINK_CTRL 0x01 +#define BT_OGF_BASEBAND 0x03 +#define BT_OGF_INFO 0x04 +#define BT_OGF_STATUS 0x05 +#define BT_OGF_LE 0x08 +#define BT_OGF_VS 0x3f + +/* Construct OpCode from OGF and OCF */ +#define BT_OP(ogf, ocf) ((ocf) | ((ogf) << 10)) + +/* Invalid opcode */ +#define BT_OP_NOP 0x0000 + +/* Obtain OGF from OpCode */ +#define BT_OGF(opcode) (((opcode) >> 10) & BIT_MASK(6)) +/* Obtain OCF from OpCode */ +#define BT_OCF(opcode) ((opcode) & BIT_MASK(10)) + +#define BT_HCI_OP_INQUIRY BT_OP(BT_OGF_LINK_CTRL, 0x0001) +struct bt_hci_op_inquiry { + uint8_t lap[3]; + uint8_t length; + uint8_t num_rsp; +} __packed; + +#define BT_HCI_OP_INQUIRY_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x0002) + +#define BT_HCI_OP_CONNECT BT_OP(BT_OGF_LINK_CTRL, 0x0005) +struct bt_hci_cp_connect { + bt_addr_t bdaddr; + uint16_t packet_type; + uint8_t pscan_rep_mode; + uint8_t reserved; + uint16_t clock_offset; + uint8_t allow_role_switch; +} __packed; + +#define BT_HCI_OP_DISCONNECT BT_OP(BT_OGF_LINK_CTRL, 0x0006) +struct bt_hci_cp_disconnect { + uint16_t handle; + uint8_t reason; +} __packed; + +#define BT_HCI_OP_CONNECT_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x0008) +struct bt_hci_cp_connect_cancel { + bt_addr_t bdaddr; +} __packed; +struct bt_hci_rp_connect_cancel { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_ACCEPT_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x0009) +struct bt_hci_cp_accept_conn_req { + bt_addr_t bdaddr; + uint8_t role; +} __packed; + +#define BT_HCI_OP_SETUP_SYNC_CONN BT_OP(BT_OGF_LINK_CTRL, 0x0028) +struct bt_hci_cp_setup_sync_conn { + uint16_t handle; + uint32_t tx_bandwidth; + uint32_t rx_bandwidth; + uint16_t max_latency; + uint16_t content_format; + uint8_t retrans_effort; + uint16_t pkt_type; +} __packed; + +#define BT_HCI_OP_ACCEPT_SYNC_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x0029) +struct bt_hci_cp_accept_sync_conn_req { + bt_addr_t bdaddr; + uint32_t tx_bandwidth; + uint32_t rx_bandwidth; + uint16_t max_latency; + uint16_t content_format; + uint8_t retrans_effort; + uint16_t pkt_type; +} __packed; + +#define BT_HCI_OP_REJECT_CONN_REQ BT_OP(BT_OGF_LINK_CTRL, 0x000a) +struct bt_hci_cp_reject_conn_req { + bt_addr_t bdaddr; + uint8_t reason; +} __packed; + +#define BT_HCI_OP_LINK_KEY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000b) +struct bt_hci_cp_link_key_reply { + bt_addr_t bdaddr; + uint8_t link_key[16]; +} __packed; + +#define BT_HCI_OP_LINK_KEY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000c) +struct bt_hci_cp_link_key_neg_reply { + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_PIN_CODE_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000d) +struct bt_hci_cp_pin_code_reply { + bt_addr_t bdaddr; + uint8_t pin_len; + uint8_t pin_code[16]; +} __packed; +struct bt_hci_rp_pin_code_reply { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_PIN_CODE_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x000e) +struct bt_hci_cp_pin_code_neg_reply { + bt_addr_t bdaddr; +} __packed; +struct bt_hci_rp_pin_code_neg_reply { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_AUTH_REQUESTED BT_OP(BT_OGF_LINK_CTRL, 0x0011) +struct bt_hci_cp_auth_requested { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_SET_CONN_ENCRYPT BT_OP(BT_OGF_LINK_CTRL, 0x0013) +struct bt_hci_cp_set_conn_encrypt { + uint16_t handle; + uint8_t encrypt; +} __packed; + +#define BT_HCI_OP_REMOTE_NAME_REQUEST BT_OP(BT_OGF_LINK_CTRL, 0x0019) +struct bt_hci_cp_remote_name_request { + bt_addr_t bdaddr; + uint8_t pscan_rep_mode; + uint8_t reserved; + uint16_t clock_offset; +} __packed; + +#define BT_HCI_OP_REMOTE_NAME_CANCEL BT_OP(BT_OGF_LINK_CTRL, 0x001a) +struct bt_hci_cp_remote_name_cancel { + bt_addr_t bdaddr; +} __packed; +struct bt_hci_rp_remote_name_cancel { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_READ_REMOTE_FEATURES BT_OP(BT_OGF_LINK_CTRL, 0x001b) +struct bt_hci_cp_read_remote_features { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_READ_REMOTE_EXT_FEATURES BT_OP(BT_OGF_LINK_CTRL, 0x001c) +struct bt_hci_cp_read_remote_ext_features { + uint16_t handle; + uint8_t page; +} __packed; + +#define BT_HCI_OP_READ_REMOTE_VERSION_INFO BT_OP(BT_OGF_LINK_CTRL, 0x001d) +struct bt_hci_cp_read_remote_version_info { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_IO_CAPABILITY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002b) +struct bt_hci_cp_io_capability_reply { + bt_addr_t bdaddr; + uint8_t capability; + uint8_t oob_data; + uint8_t authentication; +} __packed; + +#define BT_HCI_OP_USER_CONFIRM_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002c) +#define BT_HCI_OP_USER_CONFIRM_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002d) +struct bt_hci_cp_user_confirm_reply { + bt_addr_t bdaddr; +} __packed; +struct bt_hci_rp_user_confirm_reply { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_USER_PASSKEY_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002e) +struct bt_hci_cp_user_passkey_reply { + bt_addr_t bdaddr; + uint32_t passkey; +} __packed; + +#define BT_HCI_OP_USER_PASSKEY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x002f) +struct bt_hci_cp_user_passkey_neg_reply { + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_OP_IO_CAPABILITY_NEG_REPLY BT_OP(BT_OGF_LINK_CTRL, 0x0034) +struct bt_hci_cp_io_capability_neg_reply { + bt_addr_t bdaddr; + uint8_t reason; +} __packed; + +#define BT_HCI_OP_SET_EVENT_MASK BT_OP(BT_OGF_BASEBAND, 0x0001) +struct bt_hci_cp_set_event_mask { + uint8_t events[8]; +} __packed; + +#define BT_HCI_OP_RESET BT_OP(BT_OGF_BASEBAND, 0x0003) + +#define BT_HCI_OP_WRITE_LOCAL_NAME BT_OP(BT_OGF_BASEBAND, 0x0013) +struct bt_hci_write_local_name { + uint8_t local_name[248]; +} __packed; + +#define BT_HCI_OP_READ_CONN_ACCEPT_TIMEOUT BT_OP(BT_OGF_BASEBAND, 0x0015) +struct bt_hci_rp_read_conn_accept_timeout { + uint8_t status; + uint16_t conn_accept_timeout; +} __packed; + +#define BT_HCI_OP_WRITE_CONN_ACCEPT_TIMEOUT BT_OP(BT_OGF_BASEBAND, 0x0016) +struct bt_hci_cp_write_conn_accept_timeout { + uint16_t conn_accept_timeout; +} __packed; + +struct bt_hci_rp_write_conn_accept_timeout { + uint8_t status; +} __packed; + +#define BT_HCI_OP_WRITE_PAGE_TIMEOUT BT_OP(BT_OGF_BASEBAND, 0x0018) + +#define BT_HCI_OP_WRITE_SCAN_ENABLE BT_OP(BT_OGF_BASEBAND, 0x001a) +#define BT_BREDR_SCAN_DISABLED 0x00 +#define BT_BREDR_SCAN_INQUIRY 0x01 +#define BT_BREDR_SCAN_PAGE 0x02 + +#define BT_HCI_OP_WRITE_CLASS_OF_DEVICE BT_OP(BT_OGF_BASEBAND, 0x0024) +struct bt_hci_cp_write_class_of_device { + uint8_t class_of_device[3]; +} __packed; + +#define BT_TX_POWER_LEVEL_CURRENT 0x00 +#define BT_TX_POWER_LEVEL_MAX 0x01 +#define BT_HCI_OP_READ_TX_POWER_LEVEL BT_OP(BT_OGF_BASEBAND, 0x002d) +struct bt_hci_cp_read_tx_power_level { + uint16_t handle; + uint8_t type; +} __packed; + +struct bt_hci_rp_read_tx_power_level { + uint8_t status; + uint16_t handle; + int8_t tx_power_level; +} __packed; + +#define BT_HCI_CTL_TO_HOST_FLOW_DISABLE 0x00 +#define BT_HCI_CTL_TO_HOST_FLOW_ENABLE 0x01 +#define BT_HCI_OP_SET_CTL_TO_HOST_FLOW BT_OP(BT_OGF_BASEBAND, 0x0031) +struct bt_hci_cp_set_ctl_to_host_flow { + uint8_t flow_enable; +} __packed; + +#define BT_HCI_OP_HOST_BUFFER_SIZE BT_OP(BT_OGF_BASEBAND, 0x0033) +struct bt_hci_cp_host_buffer_size { + uint16_t acl_mtu; + uint8_t sco_mtu; + uint16_t acl_pkts; + uint16_t sco_pkts; +} __packed; + +struct bt_hci_handle_count { + uint16_t handle; + uint16_t count; +} __packed; + +#define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035) +struct bt_hci_cp_host_num_completed_packets { + uint8_t num_handles; + struct bt_hci_handle_count h[0]; +} __packed; + +#define BT_HCI_OP_WRITE_INQUIRY_MODE BT_OP(BT_OGF_BASEBAND, 0x0045) +struct bt_hci_cp_write_inquiry_mode { + uint8_t mode; +} __packed; + +#define BT_HCI_OP_WRITE_SSP_MODE BT_OP(BT_OGF_BASEBAND, 0x0056) +struct bt_hci_cp_write_ssp_mode { + uint8_t mode; +} __packed; + +#define BT_HCI_OP_SET_EVENT_MASK_PAGE_2 BT_OP(BT_OGF_BASEBAND, 0x0063) +struct bt_hci_cp_set_event_mask_page_2 { + uint8_t events_page_2[8]; +} __packed; + +#define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x006d) +struct bt_hci_cp_write_le_host_supp { + uint8_t le; + uint8_t simul; +} __packed; + +#define BT_HCI_OP_WRITE_SC_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x007a) +struct bt_hci_cp_write_sc_host_supp { + uint8_t sc_support; +} __packed; + +#define BT_HCI_OP_READ_AUTH_PAYLOAD_TIMEOUT BT_OP(BT_OGF_BASEBAND, 0x007b) +struct bt_hci_cp_read_auth_payload_timeout { + uint16_t handle; +} __packed; + +struct bt_hci_rp_read_auth_payload_timeout { + uint8_t status; + uint16_t handle; + uint16_t auth_payload_timeout; +} __packed; + +#define BT_HCI_OP_WRITE_AUTH_PAYLOAD_TIMEOUT BT_OP(BT_OGF_BASEBAND, 0x007c) +struct bt_hci_cp_write_auth_payload_timeout { + uint16_t handle; + uint16_t auth_payload_timeout; +} __packed; + +struct bt_hci_rp_write_auth_payload_timeout { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_CONFIGURE_DATA_PATH BT_OP(BT_OGF_BASEBAND, 0x0083) +struct bt_hci_cp_configure_data_path { + uint8_t data_path_dir; + uint8_t data_path_id; + uint8_t vs_config_len; + uint8_t vs_config[0]; +} __packed; + +struct bt_hci_rp_configure_data_path { + uint8_t status; +} __packed; + +/* HCI version from Assigned Numbers */ +#define BT_HCI_VERSION_1_0B 0 +#define BT_HCI_VERSION_1_1 1 +#define BT_HCI_VERSION_1_2 2 +#define BT_HCI_VERSION_2_0 3 +#define BT_HCI_VERSION_2_1 4 +#define BT_HCI_VERSION_3_0 5 +#define BT_HCI_VERSION_4_0 6 +#define BT_HCI_VERSION_4_1 7 +#define BT_HCI_VERSION_4_2 8 +#define BT_HCI_VERSION_5_0 9 +#define BT_HCI_VERSION_5_1 10 +#define BT_HCI_VERSION_5_2 11 +#define BT_HCI_VERSION_5_3 12 +#define BT_HCI_VERSION_5_4 13 + +#define BT_HCI_OP_READ_LOCAL_VERSION_INFO BT_OP(BT_OGF_INFO, 0x0001) +struct bt_hci_rp_read_local_version_info { + uint8_t status; + uint8_t hci_version; + uint16_t hci_revision; + uint8_t lmp_version; + uint16_t manufacturer; + uint16_t lmp_subversion; +} __packed; + +#define BT_HCI_OP_READ_SUPPORTED_COMMANDS BT_OP(BT_OGF_INFO, 0x0002) +struct bt_hci_rp_read_supported_commands { + uint8_t status; + uint8_t commands[64]; +} __packed; + +#define BT_HCI_OP_READ_LOCAL_EXT_FEATURES BT_OP(BT_OGF_INFO, 0x0004) +struct bt_hci_cp_read_local_ext_features { + uint8_t page; +}; +struct bt_hci_rp_read_local_ext_features { + uint8_t status; + uint8_t page; + uint8_t max_page; + uint8_t ext_features[8]; +} __packed; + +#define BT_HCI_OP_READ_LOCAL_FEATURES BT_OP(BT_OGF_INFO, 0x0003) +struct bt_hci_rp_read_local_features { + uint8_t status; + uint8_t features[8]; +} __packed; + +#define BT_HCI_OP_READ_BUFFER_SIZE BT_OP(BT_OGF_INFO, 0x0005) +struct bt_hci_rp_read_buffer_size { + uint8_t status; + uint16_t acl_max_len; + uint8_t sco_max_len; + uint16_t acl_max_num; + uint16_t sco_max_num; +} __packed; + +#define BT_HCI_OP_READ_BD_ADDR BT_OP(BT_OGF_INFO, 0x0009) +struct bt_hci_rp_read_bd_addr { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +/* logic transport type bits as returned when reading supported codecs */ +#define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_ACL BIT(0) +#define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_SCO BIT(1) +#define BT_HCI_CODEC_TRANSPORT_MASK_LE_CIS BIT(2) +#define BT_HCI_CODEC_TRANSPORT_MASK_LE_BIS BIT(3) + +/* logic transport types for reading codec capabilities and controller delays */ +#define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_ACL 0x00 +#define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_SCO 0x01 +#define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_CIS 0x02 +#define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_BIS 0x03 + +/* audio datapath directions */ +#define BT_HCI_DATAPATH_DIR_HOST_TO_CTLR 0x00 +#define BT_HCI_DATAPATH_DIR_CTLR_TO_HOST 0x01 + +/* audio datapath IDs */ +#define BT_HCI_DATAPATH_ID_HCI 0x00 +#define BT_HCI_DATAPATH_ID_VS 0x01 +#define BT_HCI_DATAPATH_ID_VS_END 0xfe + +/* coding format assigned numbers, used for codec IDs */ +#define BT_HCI_CODING_FORMAT_ULAW_LOG 0x00 +#define BT_HCI_CODING_FORMAT_ALAW_LOG 0x01 +#define BT_HCI_CODING_FORMAT_CVSD 0x02 +#define BT_HCI_CODING_FORMAT_TRANSPARENT 0x03 +#define BT_HCI_CODING_FORMAT_LINEAR_PCM 0x04 +#define BT_HCI_CODING_FORMAT_MSBC 0x05 +#define BT_HCI_CODING_FORMAT_VS 0xFF + + +#define BT_HCI_OP_READ_CODECS BT_OP(BT_OGF_INFO, 0x000b) +struct bt_hci_std_codec_info { + uint8_t codec_id; +} __packed; +struct bt_hci_std_codecs { + uint8_t num_codecs; + struct bt_hci_std_codec_info codec_info[0]; +} __packed; +struct bt_hci_vs_codec_info { + uint16_t company_id; + uint16_t codec_id; +} __packed; +struct bt_hci_vs_codecs { + uint8_t num_codecs; + struct bt_hci_vs_codec_info codec_info[0]; +} __packed; +struct bt_hci_rp_read_codecs { + uint8_t status; + /* other fields filled in dynamically */ + uint8_t codecs[0]; +} __packed; + +#define BT_HCI_OP_READ_CODECS_V2 BT_OP(BT_OGF_INFO, 0x000d) +struct bt_hci_std_codec_info_v2 { + uint8_t codec_id; + uint8_t transports; /* bitmap */ +} __packed; +struct bt_hci_std_codecs_v2 { + uint8_t num_codecs; + struct bt_hci_std_codec_info_v2 codec_info[0]; +} __packed; +struct bt_hci_vs_codec_info_v2 { + uint16_t company_id; + uint16_t codec_id; + uint8_t transports; /* bitmap */ +} __packed; +struct bt_hci_vs_codecs_v2 { + uint8_t num_codecs; + struct bt_hci_vs_codec_info_v2 codec_info[0]; +} __packed; +struct bt_hci_rp_read_codecs_v2 { + uint8_t status; + /* other fields filled in dynamically */ + uint8_t codecs[0]; +} __packed; + +struct bt_hci_cp_codec_id { + uint8_t coding_format; + uint16_t company_id; + uint16_t vs_codec_id; +} __packed; + +#define BT_HCI_OP_READ_CODEC_CAPABILITIES BT_OP(BT_OGF_INFO, 0x000e) +struct bt_hci_cp_read_codec_capabilities { + struct bt_hci_cp_codec_id codec_id; + uint8_t transport; + uint8_t direction; +} __packed; +struct bt_hci_codec_capability_info { + uint8_t length; + uint8_t data[0]; +} __packed; +struct bt_hci_rp_read_codec_capabilities { + uint8_t status; + uint8_t num_capabilities; + /* other fields filled in dynamically */ + uint8_t capabilities[0]; +} __packed; + +#define BT_HCI_OP_READ_CTLR_DELAY BT_OP(BT_OGF_INFO, 0x000f) +struct bt_hci_cp_read_ctlr_delay { + struct bt_hci_cp_codec_id codec_id; + uint8_t transport; + uint8_t direction; + uint8_t codec_config_len; + uint8_t codec_config[0]; +} __packed; +struct bt_hci_rp_read_ctlr_delay { + uint8_t status; + uint8_t min_ctlr_delay[3]; + uint8_t max_ctlr_delay[3]; +} __packed; + +#define BT_HCI_OP_READ_RSSI BT_OP(BT_OGF_STATUS, 0x0005) +struct bt_hci_cp_read_rssi { + uint16_t handle; +} __packed; +struct bt_hci_rp_read_rssi { + uint8_t status; + uint16_t handle; + int8_t rssi; +} __packed; + +#define BT_HCI_ENCRYPTION_KEY_SIZE_MIN 7 +#define BT_HCI_ENCRYPTION_KEY_SIZE_MAX 16 + +#define BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE BT_OP(BT_OGF_STATUS, 0x0008) +struct bt_hci_cp_read_encryption_key_size { + uint16_t handle; +} __packed; +struct bt_hci_rp_read_encryption_key_size { + uint8_t status; + uint16_t handle; + uint8_t key_size; +} __packed; + +/* BLE */ + +#define BT_HCI_OP_LE_SET_EVENT_MASK BT_OP(BT_OGF_LE, 0x0001) +struct bt_hci_cp_le_set_event_mask { + uint8_t events[8]; +} __packed; + +#define BT_HCI_OP_LE_READ_BUFFER_SIZE BT_OP(BT_OGF_LE, 0x0002) +struct bt_hci_rp_le_read_buffer_size { + uint8_t status; + uint16_t le_max_len; + uint8_t le_max_num; +} __packed; + +#define BT_HCI_OP_LE_READ_LOCAL_FEATURES BT_OP(BT_OGF_LE, 0x0003) +struct bt_hci_rp_le_read_local_features { + uint8_t status; + uint8_t features[8]; +} __packed; + +#define BT_HCI_OP_LE_SET_RANDOM_ADDRESS BT_OP(BT_OGF_LE, 0x0005) +struct bt_hci_cp_le_set_random_address { + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_ADV_IND 0x00 +#define BT_HCI_ADV_DIRECT_IND 0x01 +#define BT_HCI_ADV_SCAN_IND 0x02 +#define BT_HCI_ADV_NONCONN_IND 0x03 +#define BT_HCI_ADV_DIRECT_IND_LOW_DUTY 0x04 +#define BT_HCI_ADV_SCAN_RSP 0x04 + +#define BT_LE_ADV_INTERVAL_MIN 0x0020 +#define BT_LE_ADV_INTERVAL_MAX 0x4000 +#define BT_LE_ADV_INTERVAL_DEFAULT 0x0800 + +#define BT_LE_ADV_CHAN_MAP_CHAN_37 0x01 +#define BT_LE_ADV_CHAN_MAP_CHAN_38 0x02 +#define BT_LE_ADV_CHAN_MAP_CHAN_39 0x04 +#define BT_LE_ADV_CHAN_MAP_ALL 0x07 + +#define BT_LE_ADV_FP_NO_FILTER 0x00 +#define BT_LE_ADV_FP_FILTER_SCAN_REQ 0x01 +#define BT_LE_ADV_FP_FILTER_CONN_IND 0x02 +#define BT_LE_ADV_FP_FILTER_BOTH 0x03 + +#define BT_HCI_OP_LE_SET_ADV_PARAM BT_OP(BT_OGF_LE, 0x0006) +struct bt_hci_cp_le_set_adv_param { + uint16_t min_interval; + uint16_t max_interval; + uint8_t type; + uint8_t own_addr_type; + bt_addr_le_t direct_addr; + uint8_t channel_map; + uint8_t filter_policy; +} __packed; + +#define BT_HCI_OP_LE_READ_ADV_CHAN_TX_POWER BT_OP(BT_OGF_LE, 0x0007) +struct bt_hci_rp_le_read_chan_tx_power { + uint8_t status; + int8_t tx_power_level; +} __packed; + +#define BT_HCI_OP_LE_SET_ADV_DATA BT_OP(BT_OGF_LE, 0x0008) +struct bt_hci_cp_le_set_adv_data { + uint8_t len; + uint8_t data[31]; +} __packed; + +#define BT_HCI_OP_LE_SET_SCAN_RSP_DATA BT_OP(BT_OGF_LE, 0x0009) +struct bt_hci_cp_le_set_scan_rsp_data { + uint8_t len; + uint8_t data[31]; +} __packed; + +#define BT_HCI_LE_ADV_DISABLE 0x00 +#define BT_HCI_LE_ADV_ENABLE 0x01 + +#define BT_HCI_OP_LE_SET_ADV_ENABLE BT_OP(BT_OGF_LE, 0x000a) +struct bt_hci_cp_le_set_adv_enable { + uint8_t enable; +} __packed; + +/* Scan types */ +#define BT_HCI_OP_LE_SET_SCAN_PARAM BT_OP(BT_OGF_LE, 0x000b) +#define BT_HCI_LE_SCAN_PASSIVE 0x00 +#define BT_HCI_LE_SCAN_ACTIVE 0x01 + +#define BT_HCI_LE_SCAN_FP_BASIC_NO_FILTER 0x00 +#define BT_HCI_LE_SCAN_FP_BASIC_FILTER 0x01 +#define BT_HCI_LE_SCAN_FP_EXT_NO_FILTER 0x02 +#define BT_HCI_LE_SCAN_FP_EXT_FILTER 0x03 + +struct bt_hci_cp_le_set_scan_param { + uint8_t scan_type; + uint16_t interval; + uint16_t window; + uint8_t addr_type; + uint8_t filter_policy; +} __packed; + +#define BT_HCI_OP_LE_SET_SCAN_ENABLE BT_OP(BT_OGF_LE, 0x000c) + +#define BT_HCI_LE_SCAN_DISABLE 0x00 +#define BT_HCI_LE_SCAN_ENABLE 0x01 + +#define BT_HCI_LE_SCAN_FILTER_DUP_DISABLE 0x00 +#define BT_HCI_LE_SCAN_FILTER_DUP_ENABLE 0x01 + +struct bt_hci_cp_le_set_scan_enable { + uint8_t enable; + uint8_t filter_dup; +} __packed; + +#define BT_HCI_OP_LE_CREATE_CONN BT_OP(BT_OGF_LE, 0x000d) + +#define BT_HCI_LE_CREATE_CONN_FP_NO_FILTER 0x00 +#define BT_HCI_LE_CREATE_CONN_FP_FILTER 0x01 + +struct bt_hci_cp_le_create_conn { + uint16_t scan_interval; + uint16_t scan_window; + uint8_t filter_policy; + bt_addr_le_t peer_addr; + uint8_t own_addr_type; + uint16_t conn_interval_min; + uint16_t conn_interval_max; + uint16_t conn_latency; + uint16_t supervision_timeout; + uint16_t min_ce_len; + uint16_t max_ce_len; +} __packed; + +#define BT_HCI_OP_LE_CREATE_CONN_CANCEL BT_OP(BT_OGF_LE, 0x000e) + +#define BT_HCI_OP_LE_READ_FAL_SIZE BT_OP(BT_OGF_LE, 0x000f) +struct bt_hci_rp_le_read_fal_size { + uint8_t status; + uint8_t fal_size; +} __packed; + +#define BT_HCI_OP_LE_CLEAR_FAL BT_OP(BT_OGF_LE, 0x0010) + +#define BT_HCI_OP_LE_ADD_DEV_TO_FAL BT_OP(BT_OGF_LE, 0x0011) +struct bt_hci_cp_le_add_dev_to_fal { + bt_addr_le_t addr; +} __packed; + +#define BT_HCI_OP_LE_REM_DEV_FROM_FAL BT_OP(BT_OGF_LE, 0x0012) +struct bt_hci_cp_le_rem_dev_from_fal { + bt_addr_le_t addr; +} __packed; + +#define BT_HCI_OP_LE_CONN_UPDATE BT_OP(BT_OGF_LE, 0x0013) +struct hci_cp_le_conn_update { + uint16_t handle; + uint16_t conn_interval_min; + uint16_t conn_interval_max; + uint16_t conn_latency; + uint16_t supervision_timeout; + uint16_t min_ce_len; + uint16_t max_ce_len; +} __packed; + +#define BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF BT_OP(BT_OGF_LE, 0x0014) +struct bt_hci_cp_le_set_host_chan_classif { + uint8_t ch_map[5]; +} __packed; + +#define BT_HCI_OP_LE_READ_CHAN_MAP BT_OP(BT_OGF_LE, 0x0015) +struct bt_hci_cp_le_read_chan_map { + uint16_t handle; +} __packed; +struct bt_hci_rp_le_read_chan_map { + uint8_t status; + uint16_t handle; + uint8_t ch_map[5]; +} __packed; + +#define BT_HCI_OP_LE_READ_REMOTE_FEATURES BT_OP(BT_OGF_LE, 0x0016) +struct bt_hci_cp_le_read_remote_features { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_ENCRYPT BT_OP(BT_OGF_LE, 0x0017) +struct bt_hci_cp_le_encrypt { + uint8_t key[16]; + uint8_t plaintext[16]; +} __packed; +struct bt_hci_rp_le_encrypt { + uint8_t status; + uint8_t enc_data[16]; +} __packed; + +#define BT_HCI_OP_LE_RAND BT_OP(BT_OGF_LE, 0x0018) +struct bt_hci_rp_le_rand { + uint8_t status; + uint8_t rand[8]; +} __packed; + +#define BT_HCI_OP_LE_START_ENCRYPTION BT_OP(BT_OGF_LE, 0x0019) +struct bt_hci_cp_le_start_encryption { + uint16_t handle; + uint64_t rand; + uint16_t ediv; + uint8_t ltk[16]; +} __packed; + +#define BT_HCI_OP_LE_LTK_REQ_REPLY BT_OP(BT_OGF_LE, 0x001a) +struct bt_hci_cp_le_ltk_req_reply { + uint16_t handle; + uint8_t ltk[16]; +} __packed; +struct bt_hci_rp_le_ltk_req_reply { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_LTK_REQ_NEG_REPLY BT_OP(BT_OGF_LE, 0x001b) +struct bt_hci_cp_le_ltk_req_neg_reply { + uint16_t handle; +} __packed; +struct bt_hci_rp_le_ltk_req_neg_reply { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_READ_SUPP_STATES BT_OP(BT_OGF_LE, 0x001c) +struct bt_hci_rp_le_read_supp_states { + uint8_t status; + uint8_t le_states[8]; +} __packed; + +#define BT_HCI_OP_LE_RX_TEST BT_OP(BT_OGF_LE, 0x001d) +struct bt_hci_cp_le_rx_test { + uint8_t rx_ch; +} __packed; + +#define BT_HCI_TEST_PKT_PAYLOAD_PRBS9 0x00 +#define BT_HCI_TEST_PKT_PAYLOAD_11110000 0x01 +#define BT_HCI_TEST_PKT_PAYLOAD_10101010 0x02 +#define BT_HCI_TEST_PKT_PAYLOAD_PRBS15 0x03 +#define BT_HCI_TEST_PKT_PAYLOAD_11111111 0x04 +#define BT_HCI_TEST_PKT_PAYLOAD_00000000 0x05 +#define BT_HCI_TEST_PKT_PAYLOAD_00001111 0x06 +#define BT_HCI_TEST_PKT_PAYLOAD_01010101 0x07 + +#define BT_HCI_OP_LE_TX_TEST BT_OP(BT_OGF_LE, 0x001e) +struct bt_hci_cp_le_tx_test { + uint8_t tx_ch; + uint8_t test_data_len; + uint8_t pkt_payload; +} __packed; + +#define BT_HCI_OP_LE_TEST_END BT_OP(BT_OGF_LE, 0x001f) +struct bt_hci_rp_le_test_end { + uint8_t status; + uint16_t rx_pkt_count; +} __packed; + +#define BT_HCI_OP_LE_CONN_PARAM_REQ_REPLY BT_OP(BT_OGF_LE, 0x0020) +struct bt_hci_cp_le_conn_param_req_reply { + uint16_t handle; + uint16_t interval_min; + uint16_t interval_max; + uint16_t latency; + uint16_t timeout; + uint16_t min_ce_len; + uint16_t max_ce_len; +} __packed; +struct bt_hci_rp_le_conn_param_req_reply { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY BT_OP(BT_OGF_LE, 0x0021) +struct bt_hci_cp_le_conn_param_req_neg_reply { + uint16_t handle; + uint8_t reason; +} __packed; +struct bt_hci_rp_le_conn_param_req_neg_reply { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_SET_DATA_LEN BT_OP(BT_OGF_LE, 0x0022) +struct bt_hci_cp_le_set_data_len { + uint16_t handle; + uint16_t tx_octets; + uint16_t tx_time; +} __packed; +struct bt_hci_rp_le_set_data_len { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_READ_DEFAULT_DATA_LEN BT_OP(BT_OGF_LE, 0x0023) +struct bt_hci_rp_le_read_default_data_len { + uint8_t status; + uint16_t max_tx_octets; + uint16_t max_tx_time; +} __packed; + +#define BT_HCI_OP_LE_WRITE_DEFAULT_DATA_LEN BT_OP(BT_OGF_LE, 0x0024) +struct bt_hci_cp_le_write_default_data_len { + uint16_t max_tx_octets; + uint16_t max_tx_time; +} __packed; + +#define BT_HCI_OP_LE_P256_PUBLIC_KEY BT_OP(BT_OGF_LE, 0x0025) + +#define BT_HCI_OP_LE_GENERATE_DHKEY BT_OP(BT_OGF_LE, 0x0026) +struct bt_hci_cp_le_generate_dhkey { + uint8_t key[64]; +} __packed; + + +#define BT_HCI_OP_LE_GENERATE_DHKEY_V2 BT_OP(BT_OGF_LE, 0x005e) + +#define BT_HCI_LE_KEY_TYPE_GENERATED 0x00 +#define BT_HCI_LE_KEY_TYPE_DEBUG 0x01 + +struct bt_hci_cp_le_generate_dhkey_v2 { + uint8_t key[64]; + uint8_t key_type; +} __packed; + + +#define BT_HCI_OP_LE_ADD_DEV_TO_RL BT_OP(BT_OGF_LE, 0x0027) +struct bt_hci_cp_le_add_dev_to_rl { + bt_addr_le_t peer_id_addr; + uint8_t peer_irk[16]; + uint8_t local_irk[16]; +} __packed; + +#define BT_HCI_OP_LE_REM_DEV_FROM_RL BT_OP(BT_OGF_LE, 0x0028) +struct bt_hci_cp_le_rem_dev_from_rl { + bt_addr_le_t peer_id_addr; +} __packed; + +#define BT_HCI_OP_LE_CLEAR_RL BT_OP(BT_OGF_LE, 0x0029) + +#define BT_HCI_OP_LE_READ_RL_SIZE BT_OP(BT_OGF_LE, 0x002a) +struct bt_hci_rp_le_read_rl_size { + uint8_t status; + uint8_t rl_size; +} __packed; + +#define BT_HCI_OP_LE_READ_PEER_RPA BT_OP(BT_OGF_LE, 0x002b) +struct bt_hci_cp_le_read_peer_rpa { + bt_addr_le_t peer_id_addr; +} __packed; +struct bt_hci_rp_le_read_peer_rpa { + uint8_t status; + bt_addr_t peer_rpa; +} __packed; + +#define BT_HCI_OP_LE_READ_LOCAL_RPA BT_OP(BT_OGF_LE, 0x002c) +struct bt_hci_cp_le_read_local_rpa { + bt_addr_le_t peer_id_addr; +} __packed; +struct bt_hci_rp_le_read_local_rpa { + uint8_t status; + bt_addr_t local_rpa; +} __packed; + +#define BT_HCI_ADDR_RES_DISABLE 0x00 +#define BT_HCI_ADDR_RES_ENABLE 0x01 + +#define BT_HCI_OP_LE_SET_ADDR_RES_ENABLE BT_OP(BT_OGF_LE, 0x002d) +struct bt_hci_cp_le_set_addr_res_enable { + uint8_t enable; +} __packed; + +#define BT_HCI_OP_LE_SET_RPA_TIMEOUT BT_OP(BT_OGF_LE, 0x002e) +struct bt_hci_cp_le_set_rpa_timeout { + uint16_t rpa_timeout; +} __packed; + +#define BT_HCI_OP_LE_READ_MAX_DATA_LEN BT_OP(BT_OGF_LE, 0x002f) +struct bt_hci_rp_le_read_max_data_len { + uint8_t status; + uint16_t max_tx_octets; + uint16_t max_tx_time; + uint16_t max_rx_octets; + uint16_t max_rx_time; +} __packed; + +#define BT_HCI_LE_PHY_1M 0x01 +#define BT_HCI_LE_PHY_2M 0x02 +#define BT_HCI_LE_PHY_CODED 0x03 + +#define BT_HCI_OP_LE_READ_PHY BT_OP(BT_OGF_LE, 0x0030) +struct bt_hci_cp_le_read_phy { + uint16_t handle; +} __packed; +struct bt_hci_rp_le_read_phy { + uint8_t status; + uint16_t handle; + uint8_t tx_phy; + uint8_t rx_phy; +} __packed; + +#define BT_HCI_LE_PHY_TX_ANY BIT(0) +#define BT_HCI_LE_PHY_RX_ANY BIT(1) + +#define BT_HCI_LE_PHY_PREFER_1M BIT(0) +#define BT_HCI_LE_PHY_PREFER_2M BIT(1) +#define BT_HCI_LE_PHY_PREFER_CODED BIT(2) + +#define BT_HCI_OP_LE_SET_DEFAULT_PHY BT_OP(BT_OGF_LE, 0x0031) +struct bt_hci_cp_le_set_default_phy { + uint8_t all_phys; + uint8_t tx_phys; + uint8_t rx_phys; +} __packed; + +#define BT_HCI_LE_PHY_CODED_ANY 0x00 +#define BT_HCI_LE_PHY_CODED_S2 0x01 +#define BT_HCI_LE_PHY_CODED_S8 0x02 + +#define BT_HCI_OP_LE_SET_PHY BT_OP(BT_OGF_LE, 0x0032) +struct bt_hci_cp_le_set_phy { + uint16_t handle; + uint8_t all_phys; + uint8_t tx_phys; + uint8_t rx_phys; + uint16_t phy_opts; +} __packed; + +#define BT_HCI_LE_MOD_INDEX_STANDARD 0x00 +#define BT_HCI_LE_MOD_INDEX_STABLE 0x01 + +#define BT_HCI_LE_RX_PHY_1M 0x01 +#define BT_HCI_LE_RX_PHY_2M 0x02 +#define BT_HCI_LE_RX_PHY_CODED 0x03 + +#define BT_HCI_OP_LE_ENH_RX_TEST BT_OP(BT_OGF_LE, 0x0033) +struct bt_hci_cp_le_enh_rx_test { + uint8_t rx_ch; + uint8_t phy; + uint8_t mod_index; +} __packed; + +#define BT_HCI_LE_TX_PHY_1M 0x01 +#define BT_HCI_LE_TX_PHY_2M 0x02 +#define BT_HCI_LE_TX_PHY_CODED_S8 0x03 +#define BT_HCI_LE_TX_PHY_CODED_S2 0x04 + +#define BT_HCI_OP_LE_ENH_TX_TEST BT_OP(BT_OGF_LE, 0x0034) +struct bt_hci_cp_le_enh_tx_test { + uint8_t tx_ch; + uint8_t test_data_len; + uint8_t pkt_payload; + uint8_t phy; +} __packed; + +#define BT_HCI_OP_LE_SET_ADV_SET_RANDOM_ADDR BT_OP(BT_OGF_LE, 0x0035) +struct bt_hci_cp_le_set_adv_set_random_addr { + uint8_t handle; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_LE_ADV_PROP_CONN BIT(0) +#define BT_HCI_LE_ADV_PROP_SCAN BIT(1) +#define BT_HCI_LE_ADV_PROP_DIRECT BIT(2) +#define BT_HCI_LE_ADV_PROP_HI_DC_CONN BIT(3) +#define BT_HCI_LE_ADV_PROP_LEGACY BIT(4) +#define BT_HCI_LE_ADV_PROP_ANON BIT(5) +#define BT_HCI_LE_ADV_PROP_TX_POWER BIT(6) + +#define BT_HCI_LE_PRIM_ADV_INTERVAL_MIN 0x000020 +#define BT_HCI_LE_PRIM_ADV_INTERVAL_MAX 0xFFFFFF + +#define BT_HCI_LE_ADV_SCAN_REQ_ENABLE 1 +#define BT_HCI_LE_ADV_SCAN_REQ_DISABLE 0 + +#define BT_HCI_LE_ADV_TX_POWER_NO_PREF 0x7F + +#define BT_HCI_LE_ADV_HANDLE_MAX 0xEF + +#define BT_HCI_LE_EXT_ADV_SID_INVALID 0xFF + +#define BT_HCI_OP_LE_SET_EXT_ADV_PARAM BT_OP(BT_OGF_LE, 0x0036) +struct bt_hci_cp_le_set_ext_adv_param { + uint8_t handle; + uint16_t props; + uint8_t prim_min_interval[3]; + uint8_t prim_max_interval[3]; + uint8_t prim_channel_map; + uint8_t own_addr_type; + bt_addr_le_t peer_addr; + uint8_t filter_policy; + int8_t tx_power; + uint8_t prim_adv_phy; + uint8_t sec_adv_max_skip; + uint8_t sec_adv_phy; + uint8_t sid; + uint8_t scan_req_notify_enable; +} __packed; +struct bt_hci_rp_le_set_ext_adv_param { + uint8_t status; + int8_t tx_power; +} __packed; + +#define BT_HCI_LE_EXT_ADV_OP_INTERM_FRAG 0x00 +#define BT_HCI_LE_EXT_ADV_OP_FIRST_FRAG 0x01 +#define BT_HCI_LE_EXT_ADV_OP_LAST_FRAG 0x02 +#define BT_HCI_LE_EXT_ADV_OP_COMPLETE_DATA 0x03 +#define BT_HCI_LE_EXT_ADV_OP_UNCHANGED_DATA 0x04 + +#define BT_HCI_LE_EXT_ADV_FRAG_ENABLED 0x00 +#define BT_HCI_LE_EXT_ADV_FRAG_DISABLED 0x01 + +#define BT_HCI_LE_EXT_ADV_FRAG_MAX_LEN 251 + +#define BT_HCI_OP_LE_SET_EXT_ADV_DATA BT_OP(BT_OGF_LE, 0x0037) +struct bt_hci_cp_le_set_ext_adv_data { + uint8_t handle; + uint8_t op; + uint8_t frag_pref; + uint8_t len; + uint8_t data[0]; +} __packed; + +#define BT_HCI_OP_LE_SET_EXT_SCAN_RSP_DATA BT_OP(BT_OGF_LE, 0x0038) +struct bt_hci_cp_le_set_ext_scan_rsp_data { + uint8_t handle; + uint8_t op; + uint8_t frag_pref; + uint8_t len; + uint8_t data[0]; +} __packed; + +#define BT_HCI_OP_LE_SET_EXT_ADV_ENABLE BT_OP(BT_OGF_LE, 0x0039) +struct bt_hci_ext_adv_set { + uint8_t handle; + uint16_t duration; + uint8_t max_ext_adv_evts; +} __packed; + +struct bt_hci_cp_le_set_ext_adv_enable { + uint8_t enable; + uint8_t set_num; + struct bt_hci_ext_adv_set s[0]; +} __packed; + +#define BT_HCI_OP_LE_READ_MAX_ADV_DATA_LEN BT_OP(BT_OGF_LE, 0x003a) +struct bt_hci_rp_le_read_max_adv_data_len { + uint8_t status; + uint16_t max_adv_data_len; +} __packed; + +#define BT_HCI_OP_LE_READ_NUM_ADV_SETS BT_OP(BT_OGF_LE, 0x003b) +struct bt_hci_rp_le_read_num_adv_sets { + uint8_t status; + uint8_t num_sets; +} __packed; + +#define BT_HCI_OP_LE_REMOVE_ADV_SET BT_OP(BT_OGF_LE, 0x003c) +struct bt_hci_cp_le_remove_adv_set { + uint8_t handle; +} __packed; + +#define BT_HCI_OP_CLEAR_ADV_SETS BT_OP(BT_OGF_LE, 0x003d) + +#define BT_HCI_LE_PER_ADV_INTERVAL_MIN 0x0006 +#define BT_HCI_LE_PER_ADV_INTERVAL_MAX 0xFFFF + +#define BT_HCI_OP_LE_SET_PER_ADV_PARAM BT_OP(BT_OGF_LE, 0x003e) +struct bt_hci_cp_le_set_per_adv_param { + uint8_t handle; + uint16_t min_interval; + uint16_t max_interval; + uint16_t props; +} __packed; + +#define BT_HCI_LE_PER_ADV_OP_INTERM_FRAG 0x00 +#define BT_HCI_LE_PER_ADV_OP_FIRST_FRAG 0x01 +#define BT_HCI_LE_PER_ADV_OP_LAST_FRAG 0x02 +#define BT_HCI_LE_PER_ADV_OP_COMPLETE_DATA 0x03 + +#define BT_HCI_LE_PER_ADV_FRAG_MAX_LEN 252 + +#define BT_HCI_OP_LE_SET_PER_ADV_DATA BT_OP(BT_OGF_LE, 0x003f) +struct bt_hci_cp_le_set_per_adv_data { + uint8_t handle; + uint8_t op; + uint8_t len; + uint8_t data[0]; +} __packed; + +#define BT_HCI_LE_SET_PER_ADV_ENABLE_ENABLE BIT(0) +#define BT_HCI_LE_SET_PER_ADV_ENABLE_ADI BIT(1) + +#define BT_HCI_OP_LE_SET_PER_ADV_ENABLE BT_OP(BT_OGF_LE, 0x0040) +struct bt_hci_cp_le_set_per_adv_enable { + uint8_t enable; + uint8_t handle; +} __packed; + +#define BT_HCI_OP_LE_SET_EXT_SCAN_PARAM BT_OP(BT_OGF_LE, 0x0041) +struct bt_hci_ext_scan_phy { + uint8_t type; + uint16_t interval; + uint16_t window; +} __packed; + +#define BT_HCI_LE_EXT_SCAN_PHY_1M BIT(0) +#define BT_HCI_LE_EXT_SCAN_PHY_2M BIT(1) +#define BT_HCI_LE_EXT_SCAN_PHY_CODED BIT(2) + +struct bt_hci_cp_le_set_ext_scan_param { + uint8_t own_addr_type; + uint8_t filter_policy; + uint8_t phys; + struct bt_hci_ext_scan_phy p[0]; +} __packed; + +/* Extends BT_HCI_LE_SCAN_FILTER_DUP */ +#define BT_HCI_LE_EXT_SCAN_FILTER_DUP_ENABLE_RESET 0x02 + +#define BT_HCI_OP_LE_SET_EXT_SCAN_ENABLE BT_OP(BT_OGF_LE, 0x0042) +struct bt_hci_cp_le_set_ext_scan_enable { + uint8_t enable; + uint8_t filter_dup; + uint16_t duration; + uint16_t period; +} __packed; + +#define BT_HCI_OP_LE_EXT_CREATE_CONN BT_OP(BT_OGF_LE, 0x0043) +#define BT_HCI_OP_LE_EXT_CREATE_CONN_V2 BT_OP(BT_OGF_LE, 0x0085) +struct bt_hci_ext_conn_phy { + uint16_t scan_interval; + uint16_t scan_window; + uint16_t conn_interval_min; + uint16_t conn_interval_max; + uint16_t conn_latency; + uint16_t supervision_timeout; + uint16_t min_ce_len; + uint16_t max_ce_len; +} __packed; + +struct bt_hci_cp_le_ext_create_conn { + uint8_t filter_policy; + uint8_t own_addr_type; + bt_addr_le_t peer_addr; + uint8_t phys; + struct bt_hci_ext_conn_phy p[0]; +} __packed; + +struct bt_hci_cp_le_ext_create_conn_v2 { + uint8_t adv_handle; + uint8_t subevent; + uint8_t filter_policy; + uint8_t own_addr_type; + bt_addr_le_t peer_addr; + uint8_t phys; + struct bt_hci_ext_conn_phy p[0]; +} __packed; + +#define BT_HCI_OP_LE_SET_PER_ADV_SUBEVENT_DATA BT_OP(BT_OGF_LE, 0x0082) +struct bt_hci_cp_le_set_pawr_subevent_data_element { + uint8_t subevent; + uint8_t response_slot_start; + uint8_t response_slot_count; + uint8_t subevent_data_length; + uint8_t subevent_data[0]; +} __packed; + +struct bt_hci_cp_le_set_pawr_subevent_data { + uint8_t adv_handle; + uint8_t num_subevents; + struct bt_hci_cp_le_set_pawr_subevent_data_element subevents[0]; +} __packed; + + +#define BT_HCI_OP_LE_SET_PER_ADV_RESPONSE_DATA BT_OP(BT_OGF_LE, 0x0083) +struct bt_hci_cp_le_set_pawr_response_data { + uint16_t sync_handle; + uint16_t request_event; + uint8_t request_subevent; + uint8_t response_subevent; + uint8_t response_slot; + uint8_t response_data_length; + uint8_t response_data[0]; +} __packed; + +#define BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT BT_OP(BT_OGF_LE, 0x0084) +struct bt_hci_cp_le_set_pawr_sync_subevent { + uint16_t sync_handle; + uint16_t periodic_adv_properties; + uint8_t num_subevents; + uint8_t subevents[0]; +} __packed; + + +#define BT_HCI_OP_LE_SET_PER_ADV_PARAM_V2 BT_OP(BT_OGF_LE, 0x0086) +struct bt_hci_cp_le_set_per_adv_param_v2 { + uint8_t handle; + uint16_t min_interval; + uint16_t max_interval; + uint16_t props; + uint8_t num_subevents; + uint8_t subevent_interval; + uint8_t response_slot_delay; + uint8_t response_slot_spacing; + uint8_t num_response_slots; +} __packed; + + +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST BIT(0) +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED BIT(1) +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE BIT(2) + +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING 0 +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOA BIT(0) +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_1US BIT(1) +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_AOD_2US BIT(2) +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_CTE BIT(3) +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ONLY_CTE BIT(4) +/* Constants to check correctness of CTE type */ +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS 5 +#define BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE \ + (~BIT_MASK(BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_ALLOWED_BITS)) + +#define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC BT_OP(BT_OGF_LE, 0x0044) +struct bt_hci_cp_le_per_adv_create_sync { + uint8_t options; + uint8_t sid; + bt_addr_le_t addr; + uint16_t skip; + uint16_t sync_timeout; + uint8_t cte_type; +} __packed; + +#define BT_HCI_OP_LE_PER_ADV_CREATE_SYNC_CANCEL BT_OP(BT_OGF_LE, 0x0045) + +#define BT_HCI_OP_LE_PER_ADV_TERMINATE_SYNC BT_OP(BT_OGF_LE, 0x0046) +struct bt_hci_cp_le_per_adv_terminate_sync { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_ADD_DEV_TO_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0047) +struct bt_hci_cp_le_add_dev_to_per_adv_list { + bt_addr_le_t addr; + uint8_t sid; +} __packed; + +#define BT_HCI_OP_LE_REM_DEV_FROM_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0048) +struct bt_hci_cp_le_rem_dev_from_per_adv_list { + bt_addr_le_t addr; + uint8_t sid; +} __packed; + +#define BT_HCI_OP_LE_CLEAR_PER_ADV_LIST BT_OP(BT_OGF_LE, 0x0049) + +#define BT_HCI_OP_LE_READ_PER_ADV_LIST_SIZE BT_OP(BT_OGF_LE, 0x004a) +struct bt_hci_rp_le_read_per_adv_list_size { + uint8_t status; + uint8_t list_size; +} __packed; + +#define BT_HCI_OP_LE_READ_TX_POWER BT_OP(BT_OGF_LE, 0x004b) +struct bt_hci_rp_le_read_tx_power { + uint8_t status; + int8_t min_tx_power; + int8_t max_tx_power; +} __packed; + +#define BT_HCI_OP_LE_READ_RF_PATH_COMP BT_OP(BT_OGF_LE, 0x004c) +struct bt_hci_rp_le_read_rf_path_comp { + uint8_t status; + int16_t tx_path_comp; + int16_t rx_path_comp; +} __packed; + +#define BT_HCI_OP_LE_WRITE_RF_PATH_COMP BT_OP(BT_OGF_LE, 0x004d) +struct bt_hci_cp_le_write_rf_path_comp { + int16_t tx_path_comp; + int16_t rx_path_comp; +} __packed; + +#define BT_HCI_LE_PRIVACY_MODE_NETWORK 0x00 +#define BT_HCI_LE_PRIVACY_MODE_DEVICE 0x01 + +#define BT_HCI_OP_LE_SET_PRIVACY_MODE BT_OP(BT_OGF_LE, 0x004e) +struct bt_hci_cp_le_set_privacy_mode { + bt_addr_le_t id_addr; + uint8_t mode; +} __packed; + +#define BT_HCI_LE_TEST_CTE_DISABLED 0x00 +#define BT_HCI_LE_TEST_CTE_TYPE_ANY 0x00 +#define BT_HCI_LE_TEST_SLOT_DURATION_ANY 0x00 +#define BT_HCI_LE_TEST_SWITCH_PATTERN_LEN_ANY 0x00 + +#define BT_HCI_OP_LE_RX_TEST_V3 BT_OP(BT_OGF_LE, 0x004f) +struct bt_hci_cp_le_rx_test_v3 { + uint8_t rx_ch; + uint8_t phy; + uint8_t mod_index; + uint8_t expected_cte_len; + uint8_t expected_cte_type; + uint8_t slot_durations; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +#define BT_HCI_OP_LE_TX_TEST_V3 BT_OP(BT_OGF_LE, 0x0050) + +struct bt_hci_cp_le_tx_test_v3 { + uint8_t tx_ch; + uint8_t test_data_len; + uint8_t pkt_payload; + uint8_t phy; + uint8_t cte_len; + uint8_t cte_type; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +/* Min and max Constant Tone Extension length in 8us units */ +#define BT_HCI_LE_CTE_LEN_MIN 0x2 +#define BT_HCI_LE_CTE_LEN_MAX 0x14 + +#define BT_HCI_LE_AOA_CTE 0x0 +#define BT_HCI_LE_AOD_CTE_1US 0x1 +#define BT_HCI_LE_AOD_CTE_2US 0x2 +#define BT_HCI_LE_NO_CTE 0xFF + +#define BT_HCI_LE_CTE_COUNT_MIN 0x1 +#define BT_HCI_LE_CTE_COUNT_MAX 0x10 + +#define BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS BT_OP(BT_OGF_LE, 0x0051) +struct bt_hci_cp_le_set_cl_cte_tx_params { + uint8_t handle; + uint8_t cte_len; + uint8_t cte_type; + uint8_t cte_count; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +#define BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE BT_OP(BT_OGF_LE, 0x0052) +struct bt_hci_cp_le_set_cl_cte_tx_enable { + uint8_t handle; + uint8_t cte_enable; +} __packed; + +#define BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US 0x1 +#define BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US 0x2 + +#define BT_HCI_LE_SAMPLE_CTE_ALL 0x0 +#define BT_HCI_LE_SAMPLE_CTE_COUNT_MIN 0x1 +#define BT_HCI_LE_SAMPLE_CTE_COUNT_MAX 0x10 + +#define BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE BT_OP(BT_OGF_LE, 0x0053) +struct bt_hci_cp_le_set_cl_cte_sampling_enable { + uint16_t sync_handle; + uint8_t sampling_enable; + uint8_t slot_durations; + uint8_t max_sampled_cte; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +struct bt_hci_rp_le_set_cl_cte_sampling_enable { + uint8_t status; + uint16_t sync_handle; +} __packed; + +#define BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS BT_OP(BT_OGF_LE, 0x0054) +struct bt_hci_cp_le_set_conn_cte_rx_params { + uint16_t handle; + uint8_t sampling_enable; + uint8_t slot_durations; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +struct bt_hci_rp_le_set_conn_cte_rx_params { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_LE_AOA_CTE_RSP BIT(0) +#define BT_HCI_LE_AOD_CTE_RSP_1US BIT(1) +#define BT_HCI_LE_AOD_CTE_RSP_2US BIT(2) + +#define BT_HCI_LE_SWITCH_PATTERN_LEN_MIN 0x2 +#define BT_HCI_LE_SWITCH_PATTERN_LEN_MAX 0x4B + +#define BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS BT_OP(BT_OGF_LE, 0x0055) +struct bt_hci_cp_le_set_conn_cte_tx_params { + uint16_t handle; + uint8_t cte_types; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +struct bt_hci_rp_le_set_conn_cte_tx_params { + uint8_t status; + uint16_t handle; +} __packed; + +/* Interval between consecutive CTE request procedure starts in number of connection events. */ +#define BT_HCI_REQUEST_CTE_ONCE 0x0 +#define BT_HCI_REQUEST_CTE_INTERVAL_MIN 0x1 +#define BT_HCI_REQUEST_CTE_INTERVAL_MAX 0xFFFF + +#define BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE BT_OP(BT_OGF_LE, 0x0056) +struct bt_hci_cp_le_conn_cte_req_enable { + uint16_t handle; + uint8_t enable; + uint16_t cte_request_interval; + uint8_t requested_cte_length; + uint8_t requested_cte_type; +} __packed; + +struct bt_hci_rp_le_conn_cte_req_enable { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_CONN_CTE_RSP_ENABLE BT_OP(BT_OGF_LE, 0x0057) +struct bt_hci_cp_le_conn_cte_rsp_enable { + uint16_t handle; + uint8_t enable; +} __packed; + +struct bt_hci_rp_le_conn_cte_rsp_enable { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_LE_1US_AOD_TX BIT(0) +#define BT_HCI_LE_1US_AOD_RX BIT(1) +#define BT_HCI_LE_1US_AOA_RX BIT(2) + +#define BT_HCI_LE_NUM_ANT_MIN 0x1 +#define BT_HCI_LE_NUM_ANT_MAX 0x4B + +#define BT_HCI_LE_MAX_SWITCH_PATTERN_LEN_MIN 0x2 +#define BT_HCI_LE_MAX_SWITCH_PATTERN_LEN_MAX 0x4B + +#define BT_HCI_LE_MAX_CTE_LEN_MIN 0x2 +#define BT_HCI_LE_MAX_CTE_LEN_MAX 0x14 + +#define BT_HCI_OP_LE_READ_ANT_INFO BT_OP(BT_OGF_LE, 0x0058) +struct bt_hci_rp_le_read_ant_info { + uint8_t status; + uint8_t switch_sample_rates; + uint8_t num_ant; + uint8_t max_switch_pattern_len; + uint8_t max_cte_len; +}; + +#define BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_ENABLE BIT(0) +#define BT_HCI_LE_SET_PER_ADV_RECV_ENABLE_FILTER_DUPLICATE BIT(1) + +#define BT_HCI_OP_LE_SET_PER_ADV_RECV_ENABLE BT_OP(BT_OGF_LE, 0x0059) +struct bt_hci_cp_le_set_per_adv_recv_enable { + uint16_t handle; + uint8_t enable; +} __packed; + +#define BT_HCI_OP_LE_PER_ADV_SYNC_TRANSFER BT_OP(BT_OGF_LE, 0x005a) +struct bt_hci_cp_le_per_adv_sync_transfer { + uint16_t conn_handle; + uint16_t service_data; + uint16_t sync_handle; +} __packed; + +struct bt_hci_rp_le_per_adv_sync_transfer { + uint8_t status; + uint16_t conn_handle; +} __packed; + +#define BT_HCI_OP_LE_PER_ADV_SET_INFO_TRANSFER BT_OP(BT_OGF_LE, 0x005b) +struct bt_hci_cp_le_per_adv_set_info_transfer { + uint16_t conn_handle; + uint16_t service_data; + uint8_t adv_handle; +} __packed; + +struct bt_hci_rp_le_per_adv_set_info_transfer { + uint8_t status; + uint16_t conn_handle; +} __packed; + +#define BT_HCI_LE_PAST_MODE_NO_SYNC 0x00 +#define BT_HCI_LE_PAST_MODE_NO_REPORTS 0x01 +#define BT_HCI_LE_PAST_MODE_SYNC 0x02 +#define BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES 0x03 + +#define BT_HCI_LE_PAST_CTE_TYPE_NO_AOA BIT(0) +#define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_1US BIT(1) +#define BT_HCI_LE_PAST_CTE_TYPE_NO_AOD_2US BIT(2) +#define BT_HCI_LE_PAST_CTE_TYPE_NO_CTE BIT(3) +#define BT_HCI_LE_PAST_CTE_TYPE_ONLY_CTE BIT(4) + +#define BT_HCI_OP_LE_PAST_PARAM BT_OP(BT_OGF_LE, 0x005c) +struct bt_hci_cp_le_past_param { + uint16_t conn_handle; + uint8_t mode; + uint16_t skip; + uint16_t timeout; + uint8_t cte_type; +} __packed; + +struct bt_hci_rp_le_past_param { + uint8_t status; + uint16_t conn_handle; +} __packed; + +#define BT_HCI_OP_LE_DEFAULT_PAST_PARAM BT_OP(BT_OGF_LE, 0x005d) +struct bt_hci_cp_le_default_past_param { + uint8_t mode; + uint16_t skip; + uint16_t timeout; + uint8_t cte_type; +} __packed; + +struct bt_hci_rp_le_default_past_param { + uint8_t status; +} __packed; + +#define BT_HCI_OP_LE_READ_BUFFER_SIZE_V2 BT_OP(BT_OGF_LE, 0x0060) +struct bt_hci_rp_le_read_buffer_size_v2 { + uint8_t status; + uint16_t acl_max_len; + uint8_t acl_max_num; + uint16_t iso_max_len; + uint8_t iso_max_num; +} __packed; + +#define BT_HCI_OP_LE_READ_ISO_TX_SYNC BT_OP(BT_OGF_LE, 0x0061) +struct bt_hci_cp_le_read_iso_tx_sync { + uint16_t handle; +} __packed; + +struct bt_hci_rp_le_read_iso_tx_sync { + uint8_t status; + uint16_t handle; + uint16_t seq; + uint32_t timestamp; + uint8_t offset[3]; +} __packed; + +#define BT_HCI_ISO_CIG_ID_MAX 0xFE +#define BT_HCI_ISO_CIS_COUNT_MAX 0x1F +#define BT_HCI_ISO_SDU_INTERVAL_MIN 0x0000FF +#define BT_HCI_ISO_SDU_INTERVAL_MAX 0x0FFFFF +#define BT_HCI_ISO_WORST_CASE_SCA_VALID_MASK 0x07 +#define BT_HCI_ISO_PACKING_VALID_MASK 0x01 +#define BT_HCI_ISO_FRAMING_VALID_MASK 0x01 +#define BT_HCI_ISO_MAX_TRANSPORT_LATENCY_MIN 0x0005 +#define BT_HCI_ISO_MAX_TRANSPORT_LATENCY_MAX 0x0FA0 +#define BT_HCI_ISO_CIS_ID_VALID_MAX 0xEF +#define BT_HCI_ISO_MAX_SDU_VALID_MASK 0x0FFF +#define BT_HCI_ISO_PHY_VALID_MASK 0x07 +#define BT_HCI_ISO_INTERVAL_MIN 0x0004 +#define BT_HCI_ISO_INTERVAL_MAX 0x0C80 + +#define BT_HCI_OP_LE_SET_CIG_PARAMS BT_OP(BT_OGF_LE, 0x0062) +struct bt_hci_cis_params { + uint8_t cis_id; + uint16_t c_sdu; + uint16_t p_sdu; + uint8_t c_phy; + uint8_t p_phy; + uint8_t c_rtn; + uint8_t p_rtn; +} __packed; + +struct bt_hci_cp_le_set_cig_params { + uint8_t cig_id; + uint8_t c_interval[3]; + uint8_t p_interval[3]; + uint8_t sca; + uint8_t packing; + uint8_t framing; + uint16_t c_latency; + uint16_t p_latency; + uint8_t num_cis; + struct bt_hci_cis_params cis[0]; +} __packed; + +struct bt_hci_rp_le_set_cig_params { + uint8_t status; + uint8_t cig_id; + uint8_t num_handles; + uint16_t handle[0]; +} __packed; + +#define BT_HCI_OP_LE_SET_CIG_PARAMS_TEST BT_OP(BT_OGF_LE, 0x0063) +struct bt_hci_cis_params_test { + uint8_t cis_id; + uint8_t nse; + uint16_t c_sdu; + uint16_t p_sdu; + uint16_t c_pdu; + uint16_t p_pdu; + uint8_t c_phy; + uint8_t p_phy; + uint8_t c_bn; + uint8_t p_bn; +} __packed; + +struct bt_hci_cp_le_set_cig_params_test { + uint8_t cig_id; + uint8_t c_interval[3]; + uint8_t p_interval[3]; + uint8_t c_ft; + uint8_t p_ft; + uint16_t iso_interval; + uint8_t sca; + uint8_t packing; + uint8_t framing; + uint8_t num_cis; + struct bt_hci_cis_params_test cis[0]; +} __packed; + +struct bt_hci_rp_le_set_cig_params_test { + uint8_t status; + uint8_t cig_id; + uint8_t num_handles; + uint16_t handle[0]; +} __packed; + +#define BT_HCI_OP_LE_CREATE_CIS BT_OP(BT_OGF_LE, 0x0064) +struct bt_hci_cis { + uint16_t cis_handle; + uint16_t acl_handle; +} __packed; + +struct bt_hci_cp_le_create_cis { + uint8_t num_cis; + struct bt_hci_cis cis[0]; +} __packed; + +#define BT_HCI_OP_LE_REMOVE_CIG BT_OP(BT_OGF_LE, 0x0065) +struct bt_hci_cp_le_remove_cig { + uint8_t cig_id; +} __packed; + +struct bt_hci_rp_le_remove_cig { + uint8_t status; + uint8_t cig_id; +} __packed; + +#define BT_HCI_OP_LE_ACCEPT_CIS BT_OP(BT_OGF_LE, 0x0066) +struct bt_hci_cp_le_accept_cis { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_REJECT_CIS BT_OP(BT_OGF_LE, 0x0067) +struct bt_hci_cp_le_reject_cis { + uint16_t handle; + uint8_t reason; +} __packed; + +struct bt_hci_rp_le_reject_cis { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_CREATE_BIG BT_OP(BT_OGF_LE, 0x0068) +struct bt_hci_cp_le_create_big { + uint8_t big_handle; + uint8_t adv_handle; + uint8_t num_bis; + uint8_t sdu_interval[3]; + uint16_t max_sdu; + uint16_t max_latency; + uint8_t rtn; + uint8_t phy; + uint8_t packing; + uint8_t framing; + uint8_t encryption; + uint8_t bcode[16]; +} __packed; + +#define BT_HCI_OP_LE_CREATE_BIG_TEST BT_OP(BT_OGF_LE, 0x0069) +struct bt_hci_cp_le_create_big_test { + uint8_t big_handle; + uint8_t adv_handle; + uint8_t num_bis; + uint8_t sdu_interval[3]; + uint16_t iso_interval; + uint8_t nse; + uint16_t max_sdu; + uint16_t max_pdu; + uint8_t phy; + uint8_t packing; + uint8_t framing; + uint8_t bn; + uint8_t irc; + uint8_t pto; + uint8_t encryption; + uint8_t bcode[16]; +} __packed; + +#define BT_HCI_OP_LE_TERMINATE_BIG BT_OP(BT_OGF_LE, 0x006a) +struct bt_hci_cp_le_terminate_big { + uint8_t big_handle; + uint8_t reason; +} __packed; + +#define BT_HCI_OP_LE_BIG_CREATE_SYNC BT_OP(BT_OGF_LE, 0x006b) +struct bt_hci_cp_le_big_create_sync { + uint8_t big_handle; + uint16_t sync_handle; + uint8_t encryption; + uint8_t bcode[16]; + uint8_t mse; + uint16_t sync_timeout; + uint8_t num_bis; + uint8_t bis[0]; +} __packed; + +#define BT_HCI_OP_LE_BIG_TERMINATE_SYNC BT_OP(BT_OGF_LE, 0x006c) +struct bt_hci_cp_le_big_terminate_sync { + uint8_t big_handle; +} __packed; + +struct bt_hci_rp_le_big_terminate_sync { + uint8_t status; + uint8_t big_handle; +} __packed; + +#define BT_HCI_OP_LE_REQ_PEER_SC BT_OP(BT_OGF_LE, 0x006d) +struct bt_hci_cp_le_req_peer_sca { + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_SETUP_ISO_PATH BT_OP(BT_OGF_LE, 0x006e) +struct bt_hci_cp_le_setup_iso_path { + uint16_t handle; + uint8_t path_dir; + uint8_t path_id; + struct bt_hci_cp_codec_id codec_id; + uint8_t controller_delay[3]; + uint8_t codec_config_len; + uint8_t codec_config[0]; +} __packed; + +struct bt_hci_rp_le_setup_iso_path { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_REMOVE_ISO_PATH BT_OP(BT_OGF_LE, 0x006f) +struct bt_hci_cp_le_remove_iso_path { + uint16_t handle; + uint8_t path_dir; +} __packed; + +struct bt_hci_rp_le_remove_iso_path { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_ISO_TEST_ZERO_SIZE_SDU 0 +#define BT_HCI_ISO_TEST_VARIABLE_SIZE_SDU 1 +#define BT_HCI_ISO_TEST_MAX_SIZE_SDU 2 + +#define BT_HCI_OP_LE_ISO_TRANSMIT_TEST BT_OP(BT_OGF_LE, 0x0070) +struct bt_hci_cp_le_iso_transmit_test { + uint16_t handle; + uint8_t payload_type; +} __packed; + +struct bt_hci_rp_le_iso_transmit_test { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_ISO_RECEIVE_TEST BT_OP(BT_OGF_LE, 0x0071) +struct bt_hci_cp_le_iso_receive_test { + uint16_t handle; + uint8_t payload_type; +} __packed; + +struct bt_hci_rp_le_iso_receive_test { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_OP_LE_ISO_READ_TEST_COUNTERS BT_OP(BT_OGF_LE, 0x0072) +struct bt_hci_cp_le_read_test_counters { + uint16_t handle; +} __packed; + +struct bt_hci_rp_le_read_test_counters { + uint8_t status; + uint16_t handle; + uint32_t received_cnt; + uint32_t missed_cnt; + uint32_t failed_cnt; +} __packed; + +#define BT_HCI_OP_LE_ISO_TEST_END BT_OP(BT_OGF_LE, 0x0073) +struct bt_hci_cp_le_iso_test_end { + uint16_t handle; +} __packed; + +struct bt_hci_rp_le_iso_test_end { + uint8_t status; + uint16_t handle; + uint32_t received_cnt; + uint32_t missed_cnt; + uint32_t failed_cnt; +} __packed; + +#define BT_HCI_OP_LE_SET_HOST_FEATURE BT_OP(BT_OGF_LE, 0x0074) +struct bt_hci_cp_le_set_host_feature { + uint8_t bit_number; + uint8_t bit_value; +} __packed; + +struct bt_hci_rp_le_set_host_feature { + uint8_t status; +} __packed; + +#define BT_HCI_OP_LE_READ_ISO_LINK_QUALITY BT_OP(BT_OGF_LE, 0x0075) +struct bt_hci_cp_le_read_iso_link_quality { + uint16_t handle; +} __packed; + +struct bt_hci_rp_le_read_iso_link_quality { + uint8_t status; + uint16_t handle; + uint32_t tx_unacked_packets; + uint32_t tx_flushed_packets; + uint32_t tx_last_subevent_packets; + uint32_t retransmitted_packets; + uint32_t crc_error_packets; + uint32_t rx_unreceived_packets; + uint32_t duplicate_packets; +} __packed; + +#define BT_HCI_OP_LE_TX_TEST_V4 BT_OP(BT_OGF_LE, 0x007B) + +struct bt_hci_cp_le_tx_test_v4 { + uint8_t tx_ch; + uint8_t test_data_len; + uint8_t pkt_payload; + uint8_t phy; + uint8_t cte_len; + uint8_t cte_type; + uint8_t switch_pattern_len; + uint8_t ant_ids[0]; +} __packed; + +#define BT_HCI_TX_TEST_POWER_MIN -0x7F +#define BT_HCI_TX_TEST_POWER_MAX 0x14 + +#define BT_HCI_TX_TEST_POWER_MIN_SET 0x7E +#define BT_HCI_TX_TEST_POWER_MAX_SET 0x7F + +/* Helper structure for Tx power parameter in the HCI Tx Test v4 command. + * Previous parameter of this command is variable size so having separated structure + * for this parameter helps in command parameters unpacking. + */ +struct bt_hci_cp_le_tx_test_v4_tx_power { + int8_t tx_power; +} __packed; + +/* Event definitions */ + +#define BT_HCI_EVT_UNKNOWN 0x00 +#define BT_HCI_EVT_VENDOR 0xff + +#define BT_HCI_EVT_INQUIRY_COMPLETE 0x01 +struct bt_hci_evt_inquiry_complete { + uint8_t status; +} __packed; + +#define BT_HCI_EVT_CONN_COMPLETE 0x03 +struct bt_hci_evt_conn_complete { + uint8_t status; + uint16_t handle; + bt_addr_t bdaddr; + uint8_t link_type; + uint8_t encr_enabled; +} __packed; + +#define BT_HCI_EVT_CONN_REQUEST 0x04 +struct bt_hci_evt_conn_request { + bt_addr_t bdaddr; + uint8_t dev_class[3]; + uint8_t link_type; +} __packed; + +#define BT_HCI_EVT_DISCONN_COMPLETE 0x05 +struct bt_hci_evt_disconn_complete { + uint8_t status; + uint16_t handle; + uint8_t reason; +} __packed; + +#define BT_HCI_EVT_AUTH_COMPLETE 0x06 +struct bt_hci_evt_auth_complete { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_EVT_REMOTE_NAME_REQ_COMPLETE 0x07 +struct bt_hci_evt_remote_name_req_complete { + uint8_t status; + bt_addr_t bdaddr; + uint8_t name[248]; +} __packed; + +#define BT_HCI_EVT_ENCRYPT_CHANGE 0x08 +struct bt_hci_evt_encrypt_change { + uint8_t status; + uint16_t handle; + uint8_t encrypt; +} __packed; + +#define BT_HCI_EVT_REMOTE_FEATURES 0x0b +struct bt_hci_evt_remote_features { + uint8_t status; + uint16_t handle; + uint8_t features[8]; +} __packed; + +#define BT_HCI_EVT_REMOTE_VERSION_INFO 0x0c +struct bt_hci_evt_remote_version_info { + uint8_t status; + uint16_t handle; + uint8_t version; + uint16_t manufacturer; + uint16_t subversion; +} __packed; + +#define BT_HCI_EVT_CMD_COMPLETE 0x0e +struct bt_hci_evt_cmd_complete { + uint8_t ncmd; + uint16_t opcode; +} __packed; + +struct bt_hci_evt_cc_status { + uint8_t status; +} __packed; + +#define BT_HCI_EVT_CMD_STATUS 0x0f +struct bt_hci_evt_cmd_status { + uint8_t status; + uint8_t ncmd; + uint16_t opcode; +} __packed; + +#define BT_HCI_EVT_HARDWARE_ERROR 0x10 +struct bt_hci_evt_hardware_error { + uint8_t hardware_code; +} __packed; + +#define BT_HCI_EVT_ROLE_CHANGE 0x12 +struct bt_hci_evt_role_change { + uint8_t status; + bt_addr_t bdaddr; + uint8_t role; +} __packed; + +#define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13 +struct bt_hci_evt_num_completed_packets { + uint8_t num_handles; + struct bt_hci_handle_count h[0]; +} __packed; + +#define BT_HCI_EVT_PIN_CODE_REQ 0x16 +struct bt_hci_evt_pin_code_req { + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_EVT_LINK_KEY_REQ 0x17 +struct bt_hci_evt_link_key_req { + bt_addr_t bdaddr; +} __packed; + +/* Link Key types */ +#define BT_LK_COMBINATION 0x00 +#define BT_LK_LOCAL_UNIT 0x01 +#define BT_LK_REMOTE_UNIT 0x02 +#define BT_LK_DEBUG_COMBINATION 0x03 +#define BT_LK_UNAUTH_COMBINATION_P192 0x04 +#define BT_LK_AUTH_COMBINATION_P192 0x05 +#define BT_LK_CHANGED_COMBINATION 0x06 +#define BT_LK_UNAUTH_COMBINATION_P256 0x07 +#define BT_LK_AUTH_COMBINATION_P256 0x08 + +#define BT_HCI_EVT_LINK_KEY_NOTIFY 0x18 +struct bt_hci_evt_link_key_notify { + bt_addr_t bdaddr; + uint8_t link_key[16]; + uint8_t key_type; +} __packed; + +/* Overflow link types */ +#define BT_OVERFLOW_LINK_SYNCH 0x00 +#define BT_OVERFLOW_LINK_ACL 0x01 +#define BT_OVERFLOW_LINK_ISO 0x02 + +#define BT_HCI_EVT_DATA_BUF_OVERFLOW 0x1a +struct bt_hci_evt_data_buf_overflow { + uint8_t link_type; +} __packed; + +#define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI 0x22 +struct bt_hci_evt_inquiry_result_with_rssi { + bt_addr_t addr; + uint8_t pscan_rep_mode; + uint8_t reserved; + uint8_t cod[3]; + uint16_t clock_offset; + int8_t rssi; +} __packed; + +#define BT_HCI_EVT_REMOTE_EXT_FEATURES 0x23 +struct bt_hci_evt_remote_ext_features { + uint8_t status; + uint16_t handle; + uint8_t page; + uint8_t max_page; + uint8_t features[8]; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED_V2 0x24 +struct bt_hci_evt_le_per_adv_sync_established_v2 { + uint8_t status; + uint16_t handle; + uint8_t sid; + bt_addr_le_t adv_addr; + uint8_t phy; + uint16_t interval; + uint8_t clock_accuracy; + uint8_t num_subevents; + uint8_t subevent_interval; + uint8_t response_slot_delay; + uint8_t response_slot_spacing; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT_V2 0x25 +struct bt_hci_evt_le_per_advertising_report_v2 { + uint16_t handle; + int8_t tx_power; + int8_t rssi; + uint8_t cte_type; + uint16_t periodic_event_counter; + uint8_t subevent; + uint8_t data_status; + uint8_t length; + uint8_t data[0]; +} __packed; + +#define BT_HCI_EVT_LE_PAST_RECEIVED_V2 0x26 +struct bt_hci_evt_le_past_received_v2 { + uint8_t status; + uint16_t conn_handle; + uint16_t service_data; + uint16_t sync_handle; + uint8_t adv_sid; + bt_addr_le_t addr; + uint8_t phy; + uint16_t interval; + uint8_t clock_accuracy; + uint8_t num_subevents; + uint8_t subevent_interval; + uint8_t response_slot_delay; + uint8_t response_slot_spacing; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADV_SUBEVENT_DATA_REQUEST 0x27 +struct bt_hci_evt_le_per_adv_subevent_data_request { + uint8_t adv_handle; + uint8_t subevent_start; + uint8_t subevent_data_count; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADV_RESPONSE_REPORT 0x28 + +struct bt_hci_evt_le_per_adv_response { + int8_t tx_power; + int8_t rssi; + uint8_t cte_type; + uint8_t response_slot; + uint8_t data_status; + uint8_t data_length; + uint8_t data[0]; +} __packed; + +struct bt_hci_evt_le_per_adv_response_report { + uint8_t adv_handle; + uint8_t subevent; + uint8_t tx_status; + uint8_t num_responses; + struct bt_hci_evt_le_per_adv_response responses[0]; +} __packed; + +#define BT_HCI_EVT_LE_ENH_CONN_COMPLETE_V2 0x29 +struct bt_hci_evt_le_enh_conn_complete_v2 { + uint8_t status; + uint16_t handle; + uint8_t role; + bt_addr_le_t peer_addr; + bt_addr_t local_rpa; + bt_addr_t peer_rpa; + uint16_t interval; + uint16_t latency; + uint16_t supv_timeout; + uint8_t clock_accuracy; + uint8_t adv_handle; + uint16_t sync_handle; +} __packed; + +#define BT_HCI_EVT_SYNC_CONN_COMPLETE 0x2c +struct bt_hci_evt_sync_conn_complete { + uint8_t status; + uint16_t handle; + bt_addr_t bdaddr; + uint8_t link_type; + uint8_t tx_interval; + uint8_t retansmission_window; + uint16_t rx_pkt_length; + uint16_t tx_pkt_length; + uint8_t air_mode; +} __packed; + +#define BT_HCI_EVT_EXTENDED_INQUIRY_RESULT 0x2f +struct bt_hci_evt_extended_inquiry_result { + uint8_t num_reports; + bt_addr_t addr; + uint8_t pscan_rep_mode; + uint8_t reserved; + uint8_t cod[3]; + uint16_t clock_offset; + int8_t rssi; + uint8_t eir[240]; +} __packed; + +#define BT_HCI_EVT_ENCRYPT_KEY_REFRESH_COMPLETE 0x30 +struct bt_hci_evt_encrypt_key_refresh_complete { + uint8_t status; + uint16_t handle; +} __packed; + +#define BT_HCI_EVT_IO_CAPA_REQ 0x31 +struct bt_hci_evt_io_capa_req { + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_EVT_IO_CAPA_RESP 0x32 +struct bt_hci_evt_io_capa_resp { + bt_addr_t bdaddr; + uint8_t capability; + uint8_t oob_data; + uint8_t authentication; +} __packed; + +#define BT_HCI_EVT_USER_CONFIRM_REQ 0x33 +struct bt_hci_evt_user_confirm_req { + bt_addr_t bdaddr; + uint32_t passkey; +} __packed; + +#define BT_HCI_EVT_USER_PASSKEY_REQ 0x34 +struct bt_hci_evt_user_passkey_req { + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_EVT_SSP_COMPLETE 0x36 +struct bt_hci_evt_ssp_complete { + uint8_t status; + bt_addr_t bdaddr; +} __packed; + +#define BT_HCI_EVT_USER_PASSKEY_NOTIFY 0x3b +struct bt_hci_evt_user_passkey_notify { + bt_addr_t bdaddr; + uint32_t passkey; +} __packed; + +#define BT_HCI_EVT_LE_META_EVENT 0x3e +struct bt_hci_evt_le_meta_event { + uint8_t subevent; +} __packed; + +#define BT_HCI_EVT_AUTH_PAYLOAD_TIMEOUT_EXP 0x57 +struct bt_hci_evt_auth_payload_timeout_exp { + uint16_t handle; +} __packed; + +#define BT_HCI_ROLE_CENTRAL 0x00 +#define BT_HCI_ROLE_PERIPHERAL 0x01 + +#define BT_HCI_EVT_LE_CONN_COMPLETE 0x01 +struct bt_hci_evt_le_conn_complete { + uint8_t status; + uint16_t handle; + uint8_t role; + bt_addr_le_t peer_addr; + uint16_t interval; + uint16_t latency; + uint16_t supv_timeout; + uint8_t clock_accuracy; +} __packed; + +#define BT_HCI_LE_RSSI_NOT_AVAILABLE 0x7F + +#define BT_HCI_EVT_LE_ADVERTISING_REPORT 0x02 +struct bt_hci_evt_le_advertising_info { + uint8_t evt_type; + bt_addr_le_t addr; + uint8_t length; + uint8_t data[0]; +} __packed; +struct bt_hci_evt_le_advertising_report { + uint8_t num_reports; + struct bt_hci_evt_le_advertising_info adv_info[0]; +} __packed; + +#define BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE 0x03 +struct bt_hci_evt_le_conn_update_complete { + uint8_t status; + uint16_t handle; + uint16_t interval; + uint16_t latency; + uint16_t supv_timeout; +} __packed; + +#define BT_HCI_EVT_LE_REMOTE_FEAT_COMPLETE 0x04 +struct bt_hci_evt_le_remote_feat_complete { + uint8_t status; + uint16_t handle; + uint8_t features[8]; +} __packed; + +#define BT_HCI_EVT_LE_LTK_REQUEST 0x05 +struct bt_hci_evt_le_ltk_request { + uint16_t handle; + uint64_t rand; + uint16_t ediv; +} __packed; + +#define BT_HCI_EVT_LE_CONN_PARAM_REQ 0x06 +struct bt_hci_evt_le_conn_param_req { + uint16_t handle; + uint16_t interval_min; + uint16_t interval_max; + uint16_t latency; + uint16_t timeout; +} __packed; + +#define BT_HCI_EVT_LE_DATA_LEN_CHANGE 0x07 +struct bt_hci_evt_le_data_len_change { + uint16_t handle; + uint16_t max_tx_octets; + uint16_t max_tx_time; + uint16_t max_rx_octets; + uint16_t max_rx_time; +} __packed; + +#define BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE 0x08 +struct bt_hci_evt_le_p256_public_key_complete { + uint8_t status; + uint8_t key[64]; +} __packed; + +#define BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE 0x09 +struct bt_hci_evt_le_generate_dhkey_complete { + uint8_t status; + uint8_t dhkey[32]; +} __packed; + +#define BT_HCI_EVT_LE_ENH_CONN_COMPLETE 0x0a +struct bt_hci_evt_le_enh_conn_complete { + uint8_t status; + uint16_t handle; + uint8_t role; + bt_addr_le_t peer_addr; + bt_addr_t local_rpa; + bt_addr_t peer_rpa; + uint16_t interval; + uint16_t latency; + uint16_t supv_timeout; + uint8_t clock_accuracy; +} __packed; + +#define BT_HCI_EVT_LE_DIRECT_ADV_REPORT 0x0b +struct bt_hci_evt_le_direct_adv_info { + uint8_t evt_type; + bt_addr_le_t addr; + bt_addr_le_t dir_addr; + int8_t rssi; +} __packed; +struct bt_hci_evt_le_direct_adv_report { + uint8_t num_reports; + struct bt_hci_evt_le_direct_adv_info direct_adv_info[0]; +} __packed; + +#define BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE 0x0c +struct bt_hci_evt_le_phy_update_complete { + uint8_t status; + uint16_t handle; + uint8_t tx_phy; + uint8_t rx_phy; +} __packed; + +#define BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT 0x0d + +#define BT_HCI_LE_ADV_EVT_TYPE_CONN BIT(0) +#define BT_HCI_LE_ADV_EVT_TYPE_SCAN BIT(1) +#define BT_HCI_LE_ADV_EVT_TYPE_DIRECT BIT(2) +#define BT_HCI_LE_ADV_EVT_TYPE_SCAN_RSP BIT(3) +#define BT_HCI_LE_ADV_EVT_TYPE_LEGACY BIT(4) + +#define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS(ev_type) (((ev_type) >> 5) & 0x03) +#define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_COMPLETE 0 +#define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_PARTIAL 1 +#define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_INCOMPLETE 2 +#define BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_RX_FAILED 0xFF + +struct bt_hci_evt_le_ext_advertising_info { + uint16_t evt_type; + bt_addr_le_t addr; + uint8_t prim_phy; + uint8_t sec_phy; + uint8_t sid; + int8_t tx_power; + int8_t rssi; + uint16_t interval; + bt_addr_le_t direct_addr; + uint8_t length; + uint8_t data[0]; +} __packed; +struct bt_hci_evt_le_ext_advertising_report { + uint8_t num_reports; + struct bt_hci_evt_le_ext_advertising_info adv_info[0]; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADV_SYNC_ESTABLISHED 0x0e +struct bt_hci_evt_le_per_adv_sync_established { + uint8_t status; + uint16_t handle; + uint8_t sid; + bt_addr_le_t adv_addr; + uint8_t phy; + uint16_t interval; + uint8_t clock_accuracy; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADVERTISING_REPORT 0x0f +struct bt_hci_evt_le_per_advertising_report { + uint16_t handle; + int8_t tx_power; + int8_t rssi; + uint8_t cte_type; + uint8_t data_status; + uint8_t length; + uint8_t data[0]; +} __packed; + +#define BT_HCI_EVT_LE_PER_ADV_SYNC_LOST 0x10 +struct bt_hci_evt_le_per_adv_sync_lost { + uint16_t handle; +} __packed; + +#define BT_HCI_EVT_LE_SCAN_TIMEOUT 0x11 + +#define BT_HCI_EVT_LE_ADV_SET_TERMINATED 0x12 +struct bt_hci_evt_le_adv_set_terminated { + uint8_t status; + uint8_t adv_handle; + uint16_t conn_handle; + uint8_t num_completed_ext_adv_evts; +} __packed; + +#define BT_HCI_EVT_LE_SCAN_REQ_RECEIVED 0x13 +struct bt_hci_evt_le_scan_req_received { + uint8_t handle; + bt_addr_le_t addr; +} __packed; + +#define BT_HCI_LE_CHAN_SEL_ALGO_1 0x00 +#define BT_HCI_LE_CHAN_SEL_ALGO_2 0x01 + +#define BT_HCI_EVT_LE_CHAN_SEL_ALGO 0x14 +struct bt_hci_evt_le_chan_sel_algo { + uint16_t handle; + uint8_t chan_sel_algo; +} __packed; + +#define BT_HCI_LE_CTE_CRC_OK 0x0 +#define BT_HCI_LE_CTE_CRC_ERR_CTE_BASED_TIME 0x1 +#define BT_HCI_LE_CTE_CRC_ERR_CTE_BASED_OTHER 0x2 +#define BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES 0xFF + +#define B_HCI_LE_CTE_REPORT_SAMPLE_COUNT_MIN 0x9 +#define B_HCI_LE_CTE_REPORT_SAMPLE_COUNT_MAX 0x52 + +#define BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE 0x80 + +#define BT_HCI_EVT_LE_CONNECTIONLESS_IQ_REPORT 0x15 +struct bt_hci_le_iq_sample { + int8_t i; + int8_t q; +}; + +struct bt_hci_evt_le_connectionless_iq_report { + uint16_t sync_handle; + uint8_t chan_idx; + int16_t rssi; + uint8_t rssi_ant_id; + uint8_t cte_type; + uint8_t slot_durations; + uint8_t packet_status; + uint16_t per_evt_counter; + uint8_t sample_count; + struct bt_hci_le_iq_sample sample[0]; +} __packed; + +#define BT_HCI_EVT_LE_CONNECTION_IQ_REPORT 0x16 +struct bt_hci_evt_le_connection_iq_report { + uint16_t conn_handle; + uint8_t rx_phy; + uint8_t data_chan_idx; + int16_t rssi; + uint8_t rssi_ant_id; + uint8_t cte_type; + uint8_t slot_durations; + uint8_t packet_status; + uint16_t conn_evt_counter; + uint8_t sample_count; + struct bt_hci_le_iq_sample sample[0]; +} __packed; + +#define BT_HCI_CTE_REQ_STATUS_RSP_WITHOUT_CTE 0x0 + +#define BT_HCI_EVT_LE_CTE_REQUEST_FAILED 0x17 +struct bt_hci_evt_le_cte_req_failed { + /* According to BT 5.3 Core Spec the status field may have following + * values: + * - BT_HCI_CTE_REQ_STATUS_RSP_WITHOUT_CTE when received LL_CTE_RSP_PDU without CTE. + * - Other Controller error code for peer rejected request. + */ + uint8_t status; + uint16_t conn_handle; +} __packed; + +#define BT_HCI_EVT_LE_PAST_RECEIVED 0x18 +struct bt_hci_evt_le_past_received { + uint8_t status; + uint16_t conn_handle; + uint16_t service_data; + uint16_t sync_handle; + uint8_t adv_sid; + bt_addr_le_t addr; + uint8_t phy; + uint16_t interval; + uint8_t clock_accuracy; +} __packed; + +#define BT_HCI_EVT_LE_CIS_ESTABLISHED 0x19 +struct bt_hci_evt_le_cis_established { + uint8_t status; + uint16_t conn_handle; + uint8_t cig_sync_delay[3]; + uint8_t cis_sync_delay[3]; + uint8_t c_latency[3]; + uint8_t p_latency[3]; + uint8_t c_phy; + uint8_t p_phy; + uint8_t nse; + uint8_t c_bn; + uint8_t p_bn; + uint8_t c_ft; + uint8_t p_ft; + uint16_t c_max_pdu; + uint16_t p_max_pdu; + uint16_t interval; +} __packed; + +#define BT_HCI_EVT_LE_CIS_REQ 0x1a +struct bt_hci_evt_le_cis_req { + uint16_t acl_handle; + uint16_t cis_handle; + uint8_t cig_id; + uint8_t cis_id; +} __packed; + +#define BT_HCI_EVT_LE_BIG_COMPLETE 0x1b +struct bt_hci_evt_le_big_complete { + uint8_t status; + uint8_t big_handle; + uint8_t sync_delay[3]; + uint8_t latency[3]; + uint8_t phy; + uint8_t nse; + uint8_t bn; + uint8_t pto; + uint8_t irc; + uint16_t max_pdu; + uint16_t iso_interval; + uint8_t num_bis; + uint16_t handle[0]; +} __packed; + +#define BT_HCI_EVT_LE_BIG_TERMINATE 0x1c +struct bt_hci_evt_le_big_terminate { + uint8_t big_handle; + uint8_t reason; +} __packed; + +#define BT_HCI_EVT_LE_BIG_SYNC_ESTABLISHED 0x1d +struct bt_hci_evt_le_big_sync_established { + uint8_t status; + uint8_t big_handle; + uint8_t latency[3]; + uint8_t nse; + uint8_t bn; + uint8_t pto; + uint8_t irc; + uint16_t max_pdu; + uint16_t iso_interval; + uint8_t num_bis; + uint16_t handle[0]; +} __packed; + +#define BT_HCI_EVT_LE_BIG_SYNC_LOST 0x1e +struct bt_hci_evt_le_big_sync_lost { + uint8_t big_handle; + uint8_t reason; +} __packed; + +#define BT_HCI_EVT_LE_REQ_PEER_SCA_COMPLETE 0x1f +struct bt_hci_evt_le_req_peer_sca_complete { + uint8_t status; + uint16_t handle; + uint8_t sca; +} __packed; + +#define BT_HCI_EVT_LE_BIGINFO_ADV_REPORT 0x22 +struct bt_hci_evt_le_biginfo_adv_report { + uint16_t sync_handle; + uint8_t num_bis; + uint8_t nse; + uint16_t iso_interval; + uint8_t bn; + uint8_t pto; + uint8_t irc; + uint16_t max_pdu; + uint8_t sdu_interval[3]; + uint16_t max_sdu; + uint8_t phy; + uint8_t framing; + uint8_t encryption; +} __packed; + +/* Event mask bits */ + +#define BT_EVT_BIT(n) (1ULL << (n)) + +#define BT_EVT_MASK_INQUIRY_COMPLETE BT_EVT_BIT(0) +#define BT_EVT_MASK_CONN_COMPLETE BT_EVT_BIT(2) +#define BT_EVT_MASK_CONN_REQUEST BT_EVT_BIT(3) +#define BT_EVT_MASK_DISCONN_COMPLETE BT_EVT_BIT(4) +#define BT_EVT_MASK_AUTH_COMPLETE BT_EVT_BIT(5) +#define BT_EVT_MASK_REMOTE_NAME_REQ_COMPLETE BT_EVT_BIT(6) +#define BT_EVT_MASK_ENCRYPT_CHANGE BT_EVT_BIT(7) +#define BT_EVT_MASK_REMOTE_FEATURES BT_EVT_BIT(10) +#define BT_EVT_MASK_REMOTE_VERSION_INFO BT_EVT_BIT(11) +#define BT_EVT_MASK_HARDWARE_ERROR BT_EVT_BIT(15) +#define BT_EVT_MASK_ROLE_CHANGE BT_EVT_BIT(17) +#define BT_EVT_MASK_PIN_CODE_REQ BT_EVT_BIT(21) +#define BT_EVT_MASK_LINK_KEY_REQ BT_EVT_BIT(22) +#define BT_EVT_MASK_LINK_KEY_NOTIFY BT_EVT_BIT(23) +#define BT_EVT_MASK_DATA_BUFFER_OVERFLOW BT_EVT_BIT(25) +#define BT_EVT_MASK_INQUIRY_RESULT_WITH_RSSI BT_EVT_BIT(33) +#define BT_EVT_MASK_REMOTE_EXT_FEATURES BT_EVT_BIT(34) +#define BT_EVT_MASK_SYNC_CONN_COMPLETE BT_EVT_BIT(43) +#define BT_EVT_MASK_EXTENDED_INQUIRY_RESULT BT_EVT_BIT(46) +#define BT_EVT_MASK_ENCRYPT_KEY_REFRESH_COMPLETE BT_EVT_BIT(47) +#define BT_EVT_MASK_IO_CAPA_REQ BT_EVT_BIT(48) +#define BT_EVT_MASK_IO_CAPA_RESP BT_EVT_BIT(49) +#define BT_EVT_MASK_USER_CONFIRM_REQ BT_EVT_BIT(50) +#define BT_EVT_MASK_USER_PASSKEY_REQ BT_EVT_BIT(51) +#define BT_EVT_MASK_SSP_COMPLETE BT_EVT_BIT(53) +#define BT_EVT_MASK_USER_PASSKEY_NOTIFY BT_EVT_BIT(58) +#define BT_EVT_MASK_LE_META_EVENT BT_EVT_BIT(61) + +/* Page 2 */ +#define BT_EVT_MASK_NUM_COMPLETE_DATA_BLOCKS BT_EVT_BIT(8) +#define BT_EVT_MASK_TRIGG_CLOCK_CAPTURE BT_EVT_BIT(14) +#define BT_EVT_MASK_SYNCH_TRAIN_COMPLETE BT_EVT_BIT(15) +#define BT_EVT_MASK_SYNCH_TRAIN_RX BT_EVT_BIT(16) +#define BT_EVT_MASK_CL_PER_BC_RX BT_EVT_BIT(17) +#define BT_EVT_MASK_CL_PER_BC_TIMEOUT BT_EVT_BIT(18) +#define BT_EVT_MASK_TRUNC_PAGE_COMPLETE BT_EVT_BIT(19) +#define BT_EVT_MASK_PER_PAGE_RSP_TIMEOUT BT_EVT_BIT(20) +#define BT_EVT_MASK_CL_PER_BC_CH_MAP_CHANGE BT_EVT_BIT(21) +#define BT_EVT_MASK_INQUIRY_RSP_NOT BT_EVT_BIT(22) +#define BT_EVT_MASK_AUTH_PAYLOAD_TIMEOUT_EXP BT_EVT_BIT(23) +#define BT_EVT_MASK_SAM_STATUS_CHANGE BT_EVT_BIT(24) + +#define BT_EVT_MASK_LE_CONN_COMPLETE BT_EVT_BIT(0) +#define BT_EVT_MASK_LE_ADVERTISING_REPORT BT_EVT_BIT(1) +#define BT_EVT_MASK_LE_CONN_UPDATE_COMPLETE BT_EVT_BIT(2) +#define BT_EVT_MASK_LE_REMOTE_FEAT_COMPLETE BT_EVT_BIT(3) +#define BT_EVT_MASK_LE_LTK_REQUEST BT_EVT_BIT(4) +#define BT_EVT_MASK_LE_CONN_PARAM_REQ BT_EVT_BIT(5) +#define BT_EVT_MASK_LE_DATA_LEN_CHANGE BT_EVT_BIT(6) +#define BT_EVT_MASK_LE_P256_PUBLIC_KEY_COMPLETE BT_EVT_BIT(7) +#define BT_EVT_MASK_LE_GENERATE_DHKEY_COMPLETE BT_EVT_BIT(8) +#define BT_EVT_MASK_LE_ENH_CONN_COMPLETE BT_EVT_BIT(9) +#define BT_EVT_MASK_LE_DIRECT_ADV_REPORT BT_EVT_BIT(10) +#define BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE BT_EVT_BIT(11) +#define BT_EVT_MASK_LE_EXT_ADVERTISING_REPORT BT_EVT_BIT(12) +#define BT_EVT_MASK_LE_PER_ADV_SYNC_ESTABLISHED BT_EVT_BIT(13) +#define BT_EVT_MASK_LE_PER_ADVERTISING_REPORT BT_EVT_BIT(14) +#define BT_EVT_MASK_LE_PER_ADV_SYNC_LOST BT_EVT_BIT(15) +#define BT_EVT_MASK_LE_SCAN_TIMEOUT BT_EVT_BIT(16) +#define BT_EVT_MASK_LE_ADV_SET_TERMINATED BT_EVT_BIT(17) +#define BT_EVT_MASK_LE_SCAN_REQ_RECEIVED BT_EVT_BIT(18) +#define BT_EVT_MASK_LE_CHAN_SEL_ALGO BT_EVT_BIT(19) +#define BT_EVT_MASK_LE_CONNECTIONLESS_IQ_REPORT BT_EVT_BIT(20) +#define BT_EVT_MASK_LE_CONNECTION_IQ_REPORT BT_EVT_BIT(21) +#define BT_EVT_MASK_LE_CTE_REQUEST_FAILED BT_EVT_BIT(22) +#define BT_EVT_MASK_LE_PAST_RECEIVED BT_EVT_BIT(23) +#define BT_EVT_MASK_LE_CIS_ESTABLISHED BT_EVT_BIT(24) +#define BT_EVT_MASK_LE_CIS_REQ BT_EVT_BIT(25) +#define BT_EVT_MASK_LE_BIG_COMPLETE BT_EVT_BIT(26) +#define BT_EVT_MASK_LE_BIG_TERMINATED BT_EVT_BIT(27) +#define BT_EVT_MASK_LE_BIG_SYNC_ESTABLISHED BT_EVT_BIT(28) +#define BT_EVT_MASK_LE_BIG_SYNC_LOST BT_EVT_BIT(29) +#define BT_EVT_MASK_LE_REQ_PEER_SCA_COMPLETE BT_EVT_BIT(30) +#define BT_EVT_MASK_LE_PATH_LOSS_THRESHOLD BT_EVT_BIT(31) +#define BT_EVT_MASK_LE_TRANSMIT_POWER_REPORTING BT_EVT_BIT(32) +#define BT_EVT_MASK_LE_BIGINFO_ADV_REPORT BT_EVT_BIT(33) + +#define BT_EVT_MASK_LE_PER_ADV_SYNC_ESTABLISHED_V2 BT_EVT_BIT(35) +#define BT_EVT_MASK_LE_PER_ADVERTISING_REPORT_V2 BT_EVT_BIT(36) +#define BT_EVT_MASK_LE_PAST_RECEIVED_V2 BT_EVT_BIT(37) +#define BT_EVT_MASK_LE_PER_ADV_SUBEVENT_DATA_REQ BT_EVT_BIT(38) +#define BT_EVT_MASK_LE_PER_ADV_RESPONSE_REPORT BT_EVT_BIT(39) +#define BT_EVT_MASK_LE_ENH_CONN_COMPLETE_V2 BT_EVT_BIT(40) + /** Allocate a HCI command buffer. * * This function allocates a new buffer for a HCI command. It is given diff --git a/include/zephyr/drivers/fuel_gauge.h b/include/zephyr/drivers/fuel_gauge.h index 89d4b9a66d6..b30bf37df7b 100644 --- a/include/zephyr/drivers/fuel_gauge.h +++ b/include/zephyr/drivers/fuel_gauge.h @@ -112,6 +112,23 @@ enum fuel_gauge_property { FUEL_GAUGE_PROP_MAX = UINT16_MAX, }; +/* + * Values retrieved from SBS v1.1 Spec (http://sbs-forum.org/specs/sbdat110.pdf) + * Section 5.1.21 + */ + +#define FUEL_GAUGE_STATUS_FLAGS_OVER_CHARGED_ALARM 0x8000 +#define FUEL_GAUGE_STATUS_FLAGS_TERMINATE_CHARGE_ALARM 0x4000 +#define FUEL_GAUGE_STATUS_FLAGS_OVER_TEMP_ALARM 0x1000 +#define FUEL_GAUGE_STATUS_FLAGS_TERMINATE_DISCHARGE_ALARM 0x0800 +#define FUEL_GAUGE_STATUS_FLAGS_REMAINING_CAPACITY_ALARM 0x0200 +#define FUEL_GAUGE_STATUS_FLAGS_REMAINING_TIME_ALARM 0x0100 + +#define FUEL_GAUGE_STATUS_FLAGS_INITIALIZED 0x0080 +#define FUEL_GAUGE_STATUS_FLAGS_DISCHARGING 0x0040 +#define FUEL_GAUGE_STATUS_FLAGS_FULLY_CHARGED 0x0020 +#define FUEL_GAUGE_STATUS_FLAGS_FULLY_DISCHARGED 0x0010 + typedef uint16_t fuel_gauge_prop_t; struct fuel_gauge_get_property { diff --git a/include/zephyr/drivers/sensor/cxd5605.h b/include/zephyr/drivers/sensor/cxd5605.h index 7ac6c9d7248..a98892c2b5f 100644 --- a/include/zephyr/drivers/sensor/cxd5605.h +++ b/include/zephyr/drivers/sensor/cxd5605.h @@ -15,13 +15,6 @@ extern "C" { #include #include -#define READ_BYTES_SIZE 128 -#define CXD5605_PACKET_SIZE 74 -#define CXD5605_PACKET_DATA_SIZE 70 - -#define NMEA_SENTENCE_ID_IDX 0 -#define NMEA_SENTENCE_ID_LEN 6 - enum power_mode_t { GNSS_NORMAL_PWR_MODE, GNSS_LOW_PWR_MODE @@ -98,10 +91,11 @@ enum gll_nmea_fieldpos { GLL_MODE_INDICATOR_IDX }; -struct cxd5605_version { - uint32_t major; - uint32_t minor; - uint32_t patch; +enum zda_nmea_fieldpos { + ZDA_UTC_IDX = 1, + ZDA_DAY_IDX, + ZDA_MONTH_IDX, + ZDA_YEAR_IDX }; struct cxd5605_gtr { @@ -116,63 +110,8 @@ struct cxd5605_assisted { uint32_t qzss_available; }; -struct cxd5605_cmd_data { - struct cxd5605_version ver; -}; - -struct cxd5605_packet { - uint8_t preamble; - uint8_t packet_type; - uint8_t data_size; - uint8_t data[CXD5605_PACKET_DATA_SIZE]; - uint8_t checksum; -}; - -struct cxd5605_binary_data { - uint8_t preamble; - uint8_t control_type; - uint8_t data_length_upper; - uint8_t data_length_lower; - uint8_t data[CXD5605_PACKET_DATA_SIZE]; - uint8_t checksum_upper; - uint8_t checksum_lower; - uint8_t fixed_value1; - uint8_t fixed_value2; -}; - typedef void (*pps_func)(void); -struct cxd5605_data { - const struct device *cxd5605_dev; - - struct gpio_callback data_ready_gpio_cb; - struct gpio_callback one_pps_gpio_cb; - struct gpio_callback gpio_cb; - - pps_func pps_cb; - struct gnss_global_data pvt; - struct cxd5605_cmd_data cxd5605_cmd_data; - char version[32]; - uint16_t bin_data_ptr; - uint16_t bin_data_len; - uint16_t bytes_remaining; - uint16_t copy_length; - - int cxd5605_cmd; - int num_msg; - - uint32_t i2c_error_count; - - bool got_data; - bool lib_got_data; - int command; - - uint32_t op_mode; - uint32_t pos_cycle; - uint32_t sleep_time; - uint32_t selected_sentences; -}; - /** a mask for the under temp alert bit in the status word*/ #ifdef __cplusplus diff --git a/include/zephyr/drivers/sensor/gnss.h b/include/zephyr/drivers/sensor/gnss.h index 3d04b9be286..db294daca8e 100644 --- a/include/zephyr/drivers/sensor/gnss.h +++ b/include/zephyr/drivers/sensor/gnss.h @@ -6,6 +6,7 @@ #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_GNSS_H_ #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_GNSS_H_ +#include struct gnss_global_time { uint32_t time_of_week; /* ms */ @@ -40,8 +41,8 @@ struct gnss_global_position { int32_t latitude; /*Degrees * 10^-7 (more accurate than floats)*/ int32_t altitude; int32_t altitude_MSL; - uint32_t horizontal_accuracy; /* mm * 10^-1 (i.e. 0.1mm) */ - uint32_t vertical_accuracy; /* mm * 10^-1 (i.e. 0.1mm) */ + uint32_t hDOP; + uint32_t vDOP; } __packed; struct gnss_global_velocity { @@ -70,99 +71,105 @@ struct gnss_global_data { /* driver sensor channels */ enum gnss_channel { - GNSS_CHANNEL_NONE, - GNSS_CHANNEL_TIME, - GNSS_CHANNEL_POSITION, - GNSS_CHANNEL_VELOCITY, - - /** All channels. */ - GNSS_CHANNEL_ALL, + /* GNSS Time */ + SENSOR_CHAN_GNSS_TIME = SENSOR_CHAN_PRIV_START, + /* GNSS Latitude */ + SENSOR_CHAN_GNSS_POSITION_LAT, + /* GNSS Longitude */ + SENSOR_CHAN_GNSS_POSITION_LNG, + /* GNSS Position (Lat,Lng) */ + SENSOR_CHAN_GNSS_POSITION, + /* GNSS Velocity */ + SENSOR_CHAN_GNSS_VELOCITY, /** * Number of all common sensor channels. */ - GNSS_CHANNEL_COMMON_COUNT, + SENSOR_CHAN_GNSS_COMMON_COUNT, /** * This and higher values are sensor specific. * Refer to the sensor header file. */ - GNSS_CHANNEL_PRIV_START = GNSS_CHANNEL_COMMON_COUNT, + SENSOR_CHAN_GNSS_PRIV_START = SENSOR_CHAN_GNSS_COMMON_COUNT, /** * Maximum value describing a sensor channel type. */ - GNSS_CHANNEL_MAX = INT16_MAX, + SENSOR_CHAN_GNSS_MAX = INT16_MAX, }; /* driver sensor attributes */ enum gnss_attribute { - GNSS_ATTRIBUTE_UPDATE_PERIOD, - GNSS_ATTRIBUTE_SEARCH_PERIOD, - GNSS_ATTRIBUTE_SLEEP_DURATION, + SENSOR_ATTR_GNSS_UPDATE_PERIOD = SENSOR_ATTR_PRIV_START, + SENSOR_ATTR_GNSS_SEARCH_PERIOD, + SENSOR_ATTR_GNSS_SLEEP_DURATION, - GNSS_ATTRIBUTE_NAV_MEASUREMENT_RATE, - GNSS_ATTRIBUTE_NAV_SOLUTION_RATE, - GNSS_ATTRIBUTE_NAV_TIMEREF, + SENSOR_ATTR_GNSS_NAV_MEASUREMENT_RATE, + SENSOR_ATTR_GNSS_NAV_SOLUTION_RATE, + SENSOR_ATTR_GNSS_NAV_TIMEREF, GNSS_ATTRIBUTE_NAV_SETTINGS, - GNSS_ATTRIBUTE_NAV_MSG_PVT_RATE, - GNSS_ATTRIBUTE_NAV_MSG_SOL_RATE, - GNSS_ATTRIBUTE_NAV_MSG_STATUS_RATE, + SENSOR_ATTR_GNSS_NAV_MSG_PVT_RATE, + SENSOR_ATTR_GNSS_NAV_MSG_SOL_RATE, + SENSOR_ATTR_GNSS_NAV_MSG_STATUS_RATE, - GNSS_ATTRIBUTE_INFO_ID, - GNSS_ATTRIBUTE_INFO_HW_STATUS, - GNSS_ATTRIBUTE_INFO_HW2_STATUS, - GNSS_ATTRIBUTE_INFO_IO_STATUS, - GNSS_ATTRIBUTE_INFO_GNSS_STATUS, + SENSOR_ATTR_GNSS_INFO_ID, + SENSOR_ATTR_GNSS_INFO_HW_STATUS, + SENSOR_ATTR_GNSS_INFO_HW2_STATUS, + SENSOR_ATTR_GNSS_INFO_IO_STATUS, + SENSOR_ATTR_GNSS_INFO_GNSS_STATUS, - GNSS_ATTRIBUTE_INFO_VERSION_HW, - GNSS_ATTRIBUTE_INFO_VERSION_SW, - GNSS_ATTRIBUTE_INFO_VERSION_PROTO, + SENSOR_ATTR_GNSS_INFO_VERSION_HW, + SENSOR_ATTR_GNSS_INFO_VERSION_SW, + SENSOR_ATTR_GNSS_INFO_VERSION_PROTO, - GNSS_ATTRIBUTE_PORT_UART, - GNSS_ATTRIBUTE_PORT_I2C, - GNSS_ATTRIBUTE_PORT_USB, + SENSOR_ATTR_GNSS_PORT_UART, + SENSOR_ATTR_GNSS_PORT_I2C, + SENSOR_ATTR_GNSS_PORT_USB, - GNSS_ATTRIBUTE_NAV_STATUS, + SENSOR_ATTR_GNSS_NAV_STATUS, - GNSS_ATTRIBUTE_PM_STATUS, - GNSS_ATTRIBUTE_PM_MODE, - GNSS_ATTRIBUTE_PM_SLEEP, + SENSOR_ATTR_GNSS_PM_STATUS, + SENSOR_ATTR_GNSS_PM_MODE, + SENSOR_ATTR_GNSS_PM_SLEEP, - GNSS_ATTRIBUTE_TIMEPULSE_STATUS, + SENSOR_ATTR_GNSS_TIMEPULSE_STATUS, - GNSS_ATTRIBUTE_SAVE, + SENSOR_ATTR_GNSS_SAVE, - GNSS_ATTRIBUTE_LATITUDE, - GNSS_ATTRIBUTE_LONGITUDE, - GNSS_ATTRIBUTE_ALTITUDE_MSL, - GNSS_ATTRIBUTE_ALTITUDE_HAE, - GNSS_ATTRIBUTE_HDOP, - GNSS_ATTRIBUTE_FIXTYPE, - GNSS_ATTRIBUTE_SIV, + SENSOR_ATTR_GNSS_LATITUDE, + SENSOR_ATTR_GNSS_LONGITUDE, + SENSOR_ATTR_GNSS_ALTITUDE_MSL, + SENSOR_ATTR_GNSS_ALTITUDE_HAE, + SENSOR_ATTR_GNSS_HDOP, + SENSOR_ATTR_GNSS_FIXTYPE, + SENSOR_ATTR_GNSS_SIV, - GNSS_ATTRIBUTE_DAY, - GNSS_ATTRIBUTE_MONTH, - GNSS_ATTRIBUTE_YEAR, + SENSOR_ATTR_GNSS_DAY, + SENSOR_ATTR_GNSS_MONTH, + SENSOR_ATTR_GNSS_YEAR, + SENSOR_ATTR_GNSS_HOUR, + SENSOR_ATTR_GNSS_MINUTE, + SENSOR_ATTR_GNSS_SECOND, - GNSS_ATTRIBUTE_PDOP, - GNSS_ATTRIBUTE_VER, + SENSOR_ATTR_GNSS_PDOP, + SENSOR_ATTR_GNSS_VER, /** * Number of all common sensor attributes. */ - GNSS_ATTRIBUTE_COMMON_COUNT, + SENSOR_ATTR_GNSS_COMMON_COUNT, /** * This and higher values are sensor specific. * Refer to the sensor header file. */ - GNSS_ATTRIBUTE_PRIV_START = GNSS_ATTRIBUTE_COMMON_COUNT, + SENSOR_ATTR_GNSS_PRIV_START = SENSOR_ATTR_GNSS_COMMON_COUNT, /** * Maximum value describing a sensor attribute type. */ - GNSS_ATTRIBUTE_MAX = INT16_MAX, + SENSOR_ATTR_GNSS_MAX = INT16_MAX, }; #endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_GNSS_H_ */ diff --git a/samples/modules/nanopb/sample.yaml b/samples/modules/nanopb/sample.yaml index 255998ff223..2ea497b0f10 100644 --- a/samples/modules/nanopb/sample.yaml +++ b/samples/modules/nanopb/sample.yaml @@ -17,4 +17,3 @@ tests: integration_platforms: - native_posix - native_posix_64 - platform_exclude: tmo_dev_edge \ No newline at end of file diff --git a/samples/sensor/cxd5605_hot/src/main.c b/samples/sensor/cxd5605_hot/src/main.c index e149c2d7c65..3ac0e2f56a6 100644 --- a/samples/sensor/cxd5605_hot/src/main.c +++ b/samples/sensor/cxd5605_hot/src/main.c @@ -123,8 +123,8 @@ int main(void) case ST_WAIT_FOR_FIX: k_msleep(1000); sensor_attr_get(cxd5605, - GNSS_CHANNEL_POSITION, - GNSS_ATTRIBUTE_FIXTYPE, + SENSOR_CHAN_GNSS_POSITION, + SENSOR_ATTR_GNSS_FIXTYPE, &temp_flags); if (temp_flags.val1 >= 1) { temp_flags.val1 = 0; diff --git a/samples/subsys/nvs/sample.yaml b/samples/subsys/nvs/sample.yaml index b1f237c6ef2..e2249e9f3eb 100644 --- a/samples/subsys/nvs/sample.yaml +++ b/samples/subsys/nvs/sample.yaml @@ -5,7 +5,7 @@ tests: sample.nvs.basic: tags: nvs depends_on: nvs - platform_exclude: qemu_x86 tmo_dev_edge + platform_exclude: qemu_x86 integration_platforms: - nrf52dk_nrf52832 harness: console diff --git a/samples/subsys/shell/shell_module/boards/efm32pg_stk3402a.conf b/samples/subsys/shell/shell_module/boards/efm32pg_stk3402a.conf deleted file mode 100644 index 08247ce7b94..00000000000 --- a/samples/subsys/shell/shell_module/boards/efm32pg_stk3402a.conf +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2022 T-Mobile USA, Inc. -# -# SPDX-License-Identifier: Apache-2.0 - -CONFIG_SHELL=y -CONFIG_GPIO_SHELL=y -CONFIG_DEVICE_SHELL=y -CONFIG_I2C=y -CONFIG_REBOOT=y -CONFIG_LED=y -CONFIG_LED_PWM=y -CONFIG_LED_SHELL=y -CONFIG_PWM=y -CONFIG_PWM_SHELL=y -CONFIG_PWM_GECKO=y diff --git a/samples/subsys/task_wdt/sample.yaml b/samples/subsys/task_wdt/sample.yaml index be1a0f6b732..c3ebffebf42 100644 --- a/samples/subsys/task_wdt/sample.yaml +++ b/samples/subsys/task_wdt/sample.yaml @@ -21,4 +21,3 @@ tests: platform_exclude: - s32z270dc2_rtu0_r52 - s32z270dc2_rtu1_r52 - - tmo_dev_edge \ No newline at end of file diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index 53cf1eb2e65..0d99bed5e54 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -315,6 +315,16 @@ function(ExternalZephyrProject_Cmake) get_target_property(${ZCMAKE_APPLICATION}_BOARD ${ZCMAKE_APPLICATION} BOARD) get_target_property(${ZCMAKE_APPLICATION}_MAIN_APP ${ZCMAKE_APPLICATION} MAIN_APP) + # Update ROOT variables with relative paths to use absolute paths based on + # the source application directory. + foreach(type MODULE_EXT BOARD SOC ARCH SCA) + if(DEFINED CACHE{${type}_ROOT} AND NOT IS_ABSOLUTE $CACHE{${type}_ROOT}) + set(rel_path $CACHE{${type}_ROOT}) + cmake_path(ABSOLUTE_PATH rel_path BASE_DIRECTORY "${APP_DIR}" NORMALIZE OUTPUT_VARIABLE abs_path) + set(${type}_ROOT ${abs_path} CACHE PATH "Sysbuild adjusted absolute path" FORCE) + endif() + endforeach() + get_cmake_property(sysbuild_cache CACHE_VARIABLES) foreach(var_name ${sysbuild_cache}) if(NOT "${var_name}" MATCHES "^(CMAKE_.*|BOARD)$") diff --git a/subsys/net/l2/ieee802154/ieee802154_radio_utils.h b/subsys/net/l2/ieee802154/ieee802154_radio_utils.h deleted file mode 100644 index 1c1b4a12de5..00000000000 --- a/subsys/net/l2/ieee802154/ieee802154_radio_utils.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2016 Intel Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief IEEE 802.15.4 low level radio helper utilities - * - * All references to the spec refer to IEEE 802.15.4-2020. - */ - -#ifndef __IEEE802154_RADIO_UTILS_H__ -#define __IEEE802154_RADIO_UTILS_H__ - -#include "ieee802154_utils.h" - -/** - * @brief Radio driver sending function that radio drivers should implement - * - * @param iface A valid pointer on a network interface to send from - * @param pkt A valid pointer on a packet to send - * - * @return 0 on success, negative value otherwise - */ -extern int ieee802154_radio_send(struct net_if *iface, - struct net_pkt *pkt, - struct net_buf *frag); - -static inline bool prepare_for_ack(struct ieee802154_context *ctx, - struct net_pkt *pkt, - struct net_buf *frag) -{ - if (ieee802154_is_ar_flag_set(frag)) { - struct ieee802154_fcf_seq *fs; - - fs = (struct ieee802154_fcf_seq *)frag->data; - - ctx->ack_seq = fs->sequence; - ctx->ack_received = false; - k_sem_init(&ctx->ack_lock, 0, K_SEM_MAX_LIMIT); - - return true; - } - - return false; -} - -static inline int wait_for_ack(struct net_if *iface, - bool ack_required) -{ - struct ieee802154_context *ctx = net_if_l2_data(iface); - - - if (!ack_required || - (ieee802154_get_hw_capabilities(iface) & IEEE802154_HW_TX_RX_ACK)) { - return 0; - } - - if (k_sem_take(&ctx->ack_lock, K_MSEC(10)) == 0) { - /* - * We reinit the semaphore in case handle_ack() - * got called multiple times. - */ - k_sem_init(&ctx->ack_lock, 0, K_SEM_MAX_LIMIT); - } - - ctx->ack_seq = 0U; - - return ctx->ack_received ? 0 : -EIO; -} - -static inline int handle_ack(struct ieee802154_context *ctx, - struct net_pkt *pkt) -{ - if (pkt->buffer->len == IEEE802154_ACK_PKT_LENGTH) { - uint8_t len = IEEE802154_ACK_PKT_LENGTH; - struct ieee802154_fcf_seq *fs; - - fs = ieee802154_validate_fc_seq(net_pkt_data(pkt), NULL, &len); - if (!fs || fs->sequence != ctx->ack_seq) { - return NET_CONTINUE; - } - - ctx->ack_received = true; - k_sem_give(&ctx->ack_lock); - - return NET_OK; - } - - return NET_CONTINUE; -} - -#endif /* __IEEE802154_RADIO_UTILS_H__ */ diff --git a/subsys/shell/modules/kernel_service.c b/subsys/shell/modules/kernel_service.c index 531384c714b..065cdcb4b96 100644 --- a/subsys/shell/modules/kernel_service.c +++ b/subsys/shell/modules/kernel_service.c @@ -164,7 +164,12 @@ static int cmd_kernel_threads(const struct shell *sh, shell_print(sh, "Scheduler: %u since last call", sys_clock_elapsed()); shell_print(sh, "Threads:"); + +#ifdef CONFIG_SMP + k_thread_foreach_unlocked(shell_tdata_dump, (void *)sh); +#else k_thread_foreach(shell_tdata_dump, (void *)sh); +#endif return 0; } @@ -208,7 +213,11 @@ static int cmd_kernel_stacks(const struct shell *sh, memset(pad, ' ', MAX((THREAD_MAX_NAM_LEN - strlen("IRQ 00")), 1)); +#ifdef CONFIG_SMP + k_thread_foreach_unlocked(shell_stack_dump, (void *)sh); +#else k_thread_foreach(shell_stack_dump, (void *)sh); +#endif /* Placeholder logic for interrupt stack until we have better * kernel support, including dumping arch-specific exception-related diff --git a/tests/benchmarks/sched/testcase.yaml b/tests/benchmarks/sched/testcase.yaml index bb02493074c..6ec2987d335 100644 --- a/tests/benchmarks/sched/testcase.yaml +++ b/tests/benchmarks/sched/testcase.yaml @@ -13,4 +13,3 @@ tests: regex: - "unpend\\s+\\d* ready\\s+\\d* switch\\s+\\d* pend\\s+\\d* tot\\s+\\d* \\(avg\\s+\\d*\\)" - "fin" - platform_exclude: tmo_dev_edge diff --git a/tests/drivers/counter/counter_basic_api/testcase.yaml b/tests/drivers/counter/counter_basic_api/testcase.yaml index 7f508029300..f31fa8f3af9 100644 --- a/tests/drivers/counter/counter_basic_api/testcase.yaml +++ b/tests/drivers/counter/counter_basic_api/testcase.yaml @@ -5,7 +5,7 @@ tests: - counter depends_on: counter min_ram: 16 - platform_exclude: nucleo_f302r8 tmo_dev_edge + platform_exclude: nucleo_f302r8 timeout: 600 drivers.counter.basic_api.nrf_zli: tags: diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 7624b59538e..942589ec3ec 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -34,7 +34,6 @@ tests: and dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions")) integration_platforms: - qemu_x86 - platform_exclude: tmo_dev_edge drivers.flash.common.tfm_ns: build_only: true filter: (CONFIG_FLASH_HAS_DRIVER_ENABLED and CONFIG_TRUSTED_EXECUTION_NONSECURE diff --git a/tests/drivers/gpio/gpio_basic_api/boards/efm32pg_stk3402a.overlay b/tests/drivers/gpio/gpio_basic_api/boards/efm32pg_stk3402a.overlay deleted file mode 100644 index fd96377e639..00000000000 --- a/tests/drivers/gpio/gpio_basic_api/boards/efm32pg_stk3402a.overlay +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2022 T-Mobile USA, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - resources { - compatible = "test-gpio-basic-api"; - out-gpios = <&gpioa 3 0>; - in-gpios = <&gpioa 4 0>; - }; -}; diff --git a/tests/drivers/regulator/fixed/boards/efm32pg_stk3402a.overlay b/tests/drivers/regulator/fixed/boards/efm32pg_stk3402a.overlay deleted file mode 100644 index 9d90707bc01..00000000000 --- a/tests/drivers/regulator/fixed/boards/efm32pg_stk3402a.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2022 T-Mobile USA, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "test_common.dtsi" - -/ { - regulator { - enable-gpios = <&gpioa 3 GPIO_ACTIVE_HIGH>; - }; - resources { - check-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; - }; -}; diff --git a/tests/kernel/mem_slab/mslab/testcase.yaml b/tests/kernel/mem_slab/mslab/testcase.yaml index 4b7f30b8c24..c941019277e 100644 --- a/tests/kernel/mem_slab/mslab/testcase.yaml +++ b/tests/kernel/mem_slab/mslab/testcase.yaml @@ -3,4 +3,3 @@ tests: tags: - kernel - memory_slabs - platform_exclude: tmo_dev_edge diff --git a/tests/kernel/usage/thread_runtime_stats/testcase.yaml b/tests/kernel/usage/thread_runtime_stats/testcase.yaml index 4ed4dc85a8f..30d67c3741c 100644 --- a/tests/kernel/usage/thread_runtime_stats/testcase.yaml +++ b/tests/kernel/usage/thread_runtime_stats/testcase.yaml @@ -16,4 +16,3 @@ tests: integration_platforms: - qemu_x86 - mps2_an385 - platform_exclude: tmo_dev_edge \ No newline at end of file diff --git a/tests/kernel/workq/work_queue/testcase.yaml b/tests/kernel/workq/work_queue/testcase.yaml index b24f59d7df9..a75e33ad0cc 100644 --- a/tests/kernel/workq/work_queue/testcase.yaml +++ b/tests/kernel/workq/work_queue/testcase.yaml @@ -4,4 +4,3 @@ tests: tags: - kernel - workqueue - platform_exclude: tmo_dev_edge \ No newline at end of file diff --git a/tests/lib/cmsis_dsp/filtering/testcase.yaml b/tests/lib/cmsis_dsp/filtering/testcase.yaml index 6280662a46c..80705309a45 100644 --- a/tests/lib/cmsis_dsp/filtering/testcase.yaml +++ b/tests/lib/cmsis_dsp/filtering/testcase.yaml @@ -108,7 +108,6 @@ tests: extra_args: CONF_FILE=prj_base.conf extra_configs: - CONFIG_CMSIS_DSP_TEST_FILTERING_MISC=y - platform_exclude: tmo_dev_edge libraries.cmsis_dsp.filtering.misc.fpu: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and TOOLCHAIN_HAS_NEWLIB == 1) or CONFIG_ARCH_POSIX @@ -124,4 +123,3 @@ tests: extra_configs: - CONFIG_CMSIS_DSP_TEST_FILTERING_MISC=y - CONFIG_FPU=y - platform_exclude: tmo_dev_edge diff --git a/tests/subsys/dsp/basicmath/testcase.yaml b/tests/subsys/dsp/basicmath/testcase.yaml index 8e097decc74..e99c6d09a0c 100644 --- a/tests/subsys/dsp/basicmath/testcase.yaml +++ b/tests/subsys/dsp/basicmath/testcase.yaml @@ -9,7 +9,6 @@ tests: tags: zdsp min_flash: 128 min_ram: 64 - platform_exclude: tmo_dev_edge zdsp.basicmath.fpu: filter: (CONFIG_CPU_HAS_FPU and TOOLCHAIN_HAS_NEWLIB == 1) or CONFIG_ARCH_POSIX integration_platforms: @@ -22,7 +21,6 @@ tests: - CONFIG_FPU=y min_flash: 128 min_ram: 64 - platform_exclude: tmo_dev_edge zdsp.basicmath.arcmwdt: filter: CONFIG_ISA_ARCV2 toolchain_allow: arcmwdt diff --git a/tests/subsys/jwt/testcase.yaml b/tests/subsys/jwt/testcase.yaml index 113672f9411..a09a34a898c 100644 --- a/tests/subsys/jwt/testcase.yaml +++ b/tests/subsys/jwt/testcase.yaml @@ -9,4 +9,3 @@ tests: filter: CONFIG_ENTROPY_HAS_DRIVER integration_platforms: - frdm_k64f - platform_exclude: tmo_dev_edge diff --git a/tests/subsys/logging/log_backend_init/testcase.yaml b/tests/subsys/logging/log_backend_init/testcase.yaml index a6abe3cb1a3..a8f9144f7ec 100644 --- a/tests/subsys/logging/log_backend_init/testcase.yaml +++ b/tests/subsys/logging/log_backend_init/testcase.yaml @@ -6,4 +6,3 @@ tests: - log_core - logging filter: not CONFIG_LOG_MODE_IMMEDIATE - platform_exclude: tmo_dev_edge diff --git a/tests/subsys/logging/log_core_additional/testcase.yaml b/tests/subsys/logging/log_core_additional/testcase.yaml index ac256200019..a4919fc8ad6 100644 --- a/tests/subsys/logging/log_core_additional/testcase.yaml +++ b/tests/subsys/logging/log_core_additional/testcase.yaml @@ -4,7 +4,6 @@ tests: extra_args: CONF_FILE=prj.conf integration_platforms: - native_posix - platform_exclude: tmo_dev_edge logging.add.sync: tags: logging extra_args: CONF_FILE=log_sync.conf diff --git a/tests/subsys/logging/log_timestamp/testcase.yaml b/tests/subsys/logging/log_timestamp/testcase.yaml index b6f100ca22d..973bb04eb47 100644 --- a/tests/subsys/logging/log_timestamp/testcase.yaml +++ b/tests/subsys/logging/log_timestamp/testcase.yaml @@ -15,4 +15,3 @@ tests: - timestamp extra_configs: - CONFIG_LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP=y - platform_exclude: tmo_dev_edge \ No newline at end of file diff --git a/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml b/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml index 1a4e7d13ec0..0b198c71297 100644 --- a/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml +++ b/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml @@ -1,6 +1,6 @@ tests: portability.cmsis_rtos_v2: - platform_exclude: m2gl025_miv tmo_dev_edge + platform_exclude: m2gl025_miv tags: cmsis_rtos min_ram: 32 min_flash: 34 diff --git a/tests/subsys/rtio/rtio_api/testcase.yaml b/tests/subsys/rtio/rtio_api/testcase.yaml index 1fd63f722e7..7f9f7b9028f 100644 --- a/tests/subsys/rtio/rtio_api/testcase.yaml +++ b/tests/subsys/rtio/rtio_api/testcase.yaml @@ -25,7 +25,6 @@ tests: - userspace integration_platforms: - qemu_x86 - platform_exclude: tmo_dev_edge rtio.api.userspace.submit_sem: filter: CONFIG_ARCH_HAS_USERSPACE extra_configs: @@ -36,4 +35,3 @@ tests: - userspace integration_platforms: - qemu_x86 - platform_exclude: tmo_dev_edge \ No newline at end of file diff --git a/west.yml b/west.yml index ba7d6715d2e..f7c45b5e11a 100644 --- a/west.yml +++ b/west.yml @@ -126,7 +126,7 @@ manifest: - name: cxd5605_lib path: modules/hal/sony/cxd5605 url: https://github.com/tmobile/DevEdge-IoTDevKit-Sony-cxd5605.git - revision: fd99bda2a06a9f7659b19a11534c5e1f83ffb6f1 + revision: aa915e3d29acdfc554dd9ffa53284fa11064d16a groups: - hal - name: edtt From 382ca5818a9fe278c49e09789b3c34be2adca3eb Mon Sep 17 00:00:00 2001 From: Jared Baumann Date: Thu, 29 Jun 2023 19:39:52 +0000 Subject: [PATCH 2/2] samples: Readd SX9328 sample Added back the SX9328 sample. Signed-off-by: Jared Baumann --- samples/net/mqtt_publisher/overlay-1sc.conf | 5 + samples/sensor/sx9328/CMakeLists.txt | 8 ++ samples/sensor/sx9328/README.rst | 31 ++++++ samples/sensor/sx9328/README.txt | 5 + samples/sensor/sx9328/prj.conf | 3 + samples/sensor/sx9328/sample.yaml | 8 ++ samples/sensor/sx9328/src/main.c | 106 ++++++++++++++++++++ 7 files changed, 166 insertions(+) create mode 100644 samples/net/mqtt_publisher/overlay-1sc.conf create mode 100644 samples/sensor/sx9328/CMakeLists.txt create mode 100644 samples/sensor/sx9328/README.rst create mode 100644 samples/sensor/sx9328/README.txt create mode 100644 samples/sensor/sx9328/prj.conf create mode 100644 samples/sensor/sx9328/sample.yaml create mode 100644 samples/sensor/sx9328/src/main.c diff --git a/samples/net/mqtt_publisher/overlay-1sc.conf b/samples/net/mqtt_publisher/overlay-1sc.conf new file mode 100644 index 00000000000..cbba0a780fa --- /dev/null +++ b/samples/net/mqtt_publisher/overlay-1sc.conf @@ -0,0 +1,5 @@ +CONFIG_NET_OFFLOAD=y +CONFIG_NET_SOCKETS_OFFLOAD=y +CONFIG_NET_NATIVE=n +CONFIG_MODEM=y +CONFIG_MODEM_MURATA_1SC=y diff --git a/samples/sensor/sx9328/CMakeLists.txt b/samples/sensor/sx9328/CMakeLists.txt new file mode 100644 index 00000000000..c84d95d6d2c --- /dev/null +++ b/samples/sensor/sx9328/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(sx9328) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/sx9328/README.rst b/samples/sensor/sx9328/README.rst new file mode 100644 index 00000000000..175f6e4f687 --- /dev/null +++ b/samples/sensor/sx9328/README.rst @@ -0,0 +1,31 @@ +.. _sx9328_sample: + +SX9328 SAR proximity sensor. +############################ + +Overview +******** + +This sample reads the proximity flags from the SX9328 proximity sensor and +displays the results. + +The SX9328 is a capacitive SAR sensor capable of +human sensing, as well as capacitive sensing of object. By default the sensor +has three sensing classes: "table", "body", and "proximity". Proximity simply +indicates whether any object is detected close to the sensor, "table" +indicates proximity to a low permitivity object, and "body" indicates proximity +to a high permitivity objects. + +By default, this sample prints flags on triggers. To poll, simply disable +CONFIG_SX9328_TRIGGER. + +Note: this sample does not use the Smart SAR mode. + +Sample Output +============= + +.. code-block:: console + + prox is 1 + bdy_prox is 0 + tbl_prox is 1 diff --git a/samples/sensor/sx9328/README.txt b/samples/sensor/sx9328/README.txt new file mode 100644 index 00000000000..aa62bbebecc --- /dev/null +++ b/samples/sensor/sx9328/README.txt @@ -0,0 +1,5 @@ +Title: SX9328 + +Description: + +A simple example using the SX9328 SAR proximity sensor. diff --git a/samples/sensor/sx9328/prj.conf b/samples/sensor/sx9328/prj.conf new file mode 100644 index 00000000000..a4c01bf4db1 --- /dev/null +++ b/samples/sensor/sx9328/prj.conf @@ -0,0 +1,3 @@ +CONFIG_I2C=y +CONFIG_GPIO=y +CONFIG_SENSOR=y diff --git a/samples/sensor/sx9328/sample.yaml b/samples/sensor/sx9328/sample.yaml new file mode 100644 index 00000000000..3fd8f69ab50 --- /dev/null +++ b/samples/sensor/sx9328/sample.yaml @@ -0,0 +1,8 @@ +sample: + name: SX9328 Sensor Sample +tests: + sample.sensor.sx9328: + harness: sensor + tags: sensors + depends_on: i2c gpio + filter: dt_compat_enabled("semtech,sx9328") diff --git a/samples/sensor/sx9328/src/main.c b/samples/sensor/sx9328/src/main.c new file mode 100644 index 00000000000..7b7a8b7cc62 --- /dev/null +++ b/samples/sensor/sx9328/src/main.c @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023 T-Mobile USA, Inc. + * Copyright (c) 2016 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_SX9328_TRIGGER + +static void sensor_trigger_handler(const struct device *dev, + const struct sensor_trigger *trig) +{ + struct sensor_value prox_value; + int ret; + + ret = sensor_sample_fetch(dev); + if (ret) { + printk("sensor_sample_fetch failed ret %d\n", ret); + return; + } + + sensor_channel_get(dev, SENSOR_CHAN_PROX, &prox_value); + printk("prox is %d\n", prox_value.val1); + sensor_channel_get(dev, SENSOR_CHAN_SX9328_BDY_PRX, &prox_value); + printk("bdy_prox is %d\n", prox_value.val1); + sensor_channel_get(dev, SENSOR_CHAN_SX9328_TBL_PRX, &prox_value); + printk("tbl_prox is %d\n", prox_value.val1); +} + +static void setup_trigger(const struct device *dev) +{ + int ret; + struct sensor_trigger trig = { + .type = SENSOR_TRIG_NEAR_FAR, + }; + + ret = sensor_trigger_set(dev, &trig, sensor_trigger_handler); + if (ret) { + printk("sensor_trigger_set err %d\n", ret); + } + + struct sensor_trigger trig2 = { + .type = SENSOR_TRIG_SX9328_NEAR_FAR_TBL_BDY, + }; + + ret = sensor_trigger_set(dev, &trig2, sensor_trigger_handler); + if (ret) { + printk("sensor_trigger_set err %d\n", ret); + } +} + +void do_main(const struct device *dev) +{ + setup_trigger(dev); + + while (1) { + k_sleep(K_MSEC(1000)); + } +} + +#else /* CONFIG_SX9328_TRIGGER */ + +static void do_main(const struct device *dev) +{ + int ret; + struct sensor_value prox_value; + + while (1) { + ret = sensor_sample_fetch(dev); + if (ret) { + printk("sensor_sample_fetch failed ret %d\n", ret); + return; + } + + ret = sensor_channel_get(dev, SENSOR_CHAN_PROX, &prox_value); + printk("prox is %d\n", prox_value.val1); + sensor_channel_get(dev, SENSOR_CHAN_SX9328_BDY_PRX, &prox_value); + printk("bdy_prox is %d\n", prox_value.val1); + sensor_channel_get(dev, SENSOR_CHAN_SX9328_TBL_PRX, &prox_value); + printk("tbl_prox is %d\n", prox_value.val1); + + k_sleep(K_MSEC(1000)); + } +} + +#endif /* CONFIG_SX9328_TRIGGER */ + +void main(void) +{ + const struct device *const dev = DEVICE_DT_GET_ONE(semtech_sx9328); + + if (!device_is_ready(dev)) { + printk("sensor: device not ready.\n"); + return; + } + + printk("device is %p, name is %s\n", dev, dev->name); + + do_main(dev); +}