Compare commits
139 Commits
v3.0-branc
...
v2.7.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f826560aa | ||
|
|
21008182be | ||
|
|
5e578e5967 | ||
|
|
88487a2dee | ||
|
|
f2cae5145d | ||
|
|
9366238a33 | ||
|
|
33f30745a5 | ||
|
|
275dc8275f | ||
|
|
ae757fb704 | ||
|
|
5e1dc921b0 | ||
|
|
5ccffff5b0 | ||
|
|
dd460a9410 | ||
|
|
7e5ac1bfe6 | ||
|
|
f215361e1c | ||
|
|
7e7d71ebda | ||
|
|
6939183a58 | ||
|
|
6f045c1166 | ||
|
|
d9eb21aa1e | ||
|
|
2b8079aa38 | ||
|
|
81136cbc79 | ||
|
|
42276f5bbd | ||
|
|
36bec3599d | ||
|
|
587ad45686 | ||
|
|
169b85c1e3 | ||
|
|
a9aba82522 | ||
|
|
e7df33e8b7 | ||
|
|
29b52a81c9 | ||
|
|
af4c3bc983 | ||
|
|
257df9a236 | ||
|
|
b60b5b97a2 | ||
|
|
8a97c83040 | ||
|
|
42144217be | ||
|
|
4ba168dc4d | ||
|
|
d760c5e322 | ||
|
|
7b880f11f8 | ||
|
|
592c6b1db2 | ||
|
|
f52dce1ee3 | ||
|
|
7f3562bfe4 | ||
|
|
fcc69bf015 | ||
|
|
c140604510 | ||
|
|
d229d45ddd | ||
|
|
8790789c5f | ||
|
|
7bc1deeeae | ||
|
|
6c4fc0226d | ||
|
|
31dbdca2ab | ||
|
|
3bceb73861 | ||
|
|
79bf23c5ac | ||
|
|
7fec8b280d | ||
|
|
706104bdf8 | ||
|
|
a39340a1f8 | ||
|
|
7a2b9586fa | ||
|
|
708ba30959 | ||
|
|
903b5d78d8 | ||
|
|
2df7257bec | ||
|
|
9f903eeb50 | ||
|
|
886d04860f | ||
|
|
311aeef4d5 | ||
|
|
8dacd0f873 | ||
|
|
2d0d093627 | ||
|
|
0689e106c6 | ||
|
|
0d81d97bb0 | ||
|
|
cb2ea25e14 | ||
|
|
50d357d77e | ||
|
|
9877834c95 | ||
|
|
ea2bbb8b9e | ||
|
|
b0667a80b1 | ||
|
|
e2ae4ec78c | ||
|
|
1f09c9269d | ||
|
|
aa8c3fa22e | ||
|
|
5a5eaa3c58 | ||
|
|
efd77e0958 | ||
|
|
b3affe6b94 | ||
|
|
5969c3b941 | ||
|
|
6db7778c81 | ||
|
|
bd6523195c | ||
|
|
701c560901 | ||
|
|
b24bbad815 | ||
|
|
a7baa3628d | ||
|
|
7aee51ea82 | ||
|
|
7c62429a75 | ||
|
|
82f3165b79 | ||
|
|
e858321f83 | ||
|
|
d2c5f05b1b | ||
|
|
708951ecd2 | ||
|
|
ad2b77e7f8 | ||
|
|
eb85f9a47e | ||
|
|
9ad64e8809 | ||
|
|
cf112e2a06 | ||
|
|
0ad4b4438a | ||
|
|
f7d0ae5e6c | ||
|
|
a084ec5483 | ||
|
|
c3fac651ee | ||
|
|
30eadf758a | ||
|
|
1a42926317 | ||
|
|
30b24920e8 | ||
|
|
41654b0dba | ||
|
|
17c5a7c89e | ||
|
|
0d4db6b952 | ||
|
|
e24df5272a | ||
|
|
a3e8f83e6b | ||
|
|
e8929c3360 | ||
|
|
7597eef8b3 | ||
|
|
9ff7cb60fc | ||
|
|
71420c6b76 | ||
|
|
519f412ce8 | ||
|
|
c0e44d9462 | ||
|
|
47f4ddafdd | ||
|
|
1a15d367e2 | ||
|
|
7ac8c2f51b | ||
|
|
4c52fb9fd1 | ||
|
|
cb657057b3 | ||
|
|
69996900c8 | ||
|
|
70979b9047 | ||
|
|
e601ca8e11 | ||
|
|
369d5d038f | ||
|
|
27a2271093 | ||
|
|
f4a03dfa32 | ||
|
|
192cad6cda | ||
|
|
1e2c698e95 | ||
|
|
0c0a990c4b | ||
|
|
dbf08a18c3 | ||
|
|
6c4d190493 | ||
|
|
5d0100e12c | ||
|
|
b11983d71a | ||
|
|
8691e3e0d2 | ||
|
|
c1fa585917 | ||
|
|
8a9c1e7721 | ||
|
|
8a0dc430b2 | ||
|
|
e6638715d9 | ||
|
|
5b78f62138 | ||
|
|
01be872f01 | ||
|
|
317749e1e8 | ||
|
|
7d3606a74a | ||
|
|
08917e0708 | ||
|
|
b868419ac7 | ||
|
|
16efab0493 | ||
|
|
916dbab23a | ||
|
|
62680344a6 | ||
|
|
d8ee47459c |
3
.github/workflows/devicetree_checks.yml
vendored
3
.github/workflows/devicetree_checks.yml
vendored
@@ -22,6 +22,9 @@ jobs:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
exclude:
|
||||
- os: macos-latest
|
||||
python-version: 3.6
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
3
.github/workflows/west_cmds.yml
vendored
3
.github/workflows/west_cmds.yml
vendored
@@ -23,6 +23,9 @@ jobs:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
exclude:
|
||||
- os: macos-latest
|
||||
python-version: 3.6
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
2
VERSION
2
VERSION
@@ -2,4 +2,4 @@ VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 7
|
||||
PATCHLEVEL = 0
|
||||
VERSION_TWEAK = 0
|
||||
EXTRAVERSION = rc3
|
||||
EXTRAVERSION =
|
||||
|
||||
@@ -278,7 +278,7 @@ void z_arm_configure_dynamic_mpu_regions(struct k_thread *thread)
|
||||
|
||||
__ASSERT((uintptr_t)&z_priv_stacks_ram_start <= guard_start,
|
||||
"Guard start: (0x%lx) below privilege stacks boundary: (%p)",
|
||||
guard_start, &z_priv_stacks_ram_start);
|
||||
guard_start, z_priv_stacks_ram_start);
|
||||
} else
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
{
|
||||
|
||||
@@ -14,6 +14,13 @@ config QEMU_TARGET
|
||||
Mark all QEMU targets with this variable for checking whether we are
|
||||
running in an emulated environment.
|
||||
|
||||
config NET_DRIVERS
|
||||
bool
|
||||
default y if QEMU_TARGET && NETWORKING
|
||||
help
|
||||
When building for a qemu target then NET_DRIVERS will be default
|
||||
enabled to allow for easy use of SLIP or PPP
|
||||
|
||||
# Note: $BOARD_DIR might be a glob pattern
|
||||
|
||||
choice
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
-prop=nsim_isa_vec64=1
|
||||
-dcache=65536,64,2,a
|
||||
-dcache_feature=2
|
||||
-dcache_uncached_region
|
||||
-dcache_mem_cycles=2
|
||||
-icache=65536,64,4,a
|
||||
-icache_feature=2
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
-prop=nsim_isa_vec64=1
|
||||
-dcache=65536,64,2,a
|
||||
-dcache_feature=2
|
||||
-dcache_uncached_region
|
||||
-dcache_mem_cycles=2
|
||||
-icache=65536,64,4,a
|
||||
-icache_feature=2
|
||||
|
||||
@@ -11,7 +11,6 @@ CONFIG_HW_STACK_PROTECTION=y
|
||||
# enable peripherals
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_CONSOLE=y
|
||||
|
||||
# enable sam-ba bootloader on legacy mode
|
||||
CONFIG_BOOTLOADER_BOSSA=y
|
||||
|
||||
@@ -255,9 +255,9 @@ Debugging
|
||||
STM32U5 support is not currently supported in openocd. As a temporary workaround,
|
||||
user can use `STMicroelectronics customized version of OpenOCD`_ to debug the
|
||||
the B_U585I_IOT02A Discovery kit.
|
||||
For this you need to fetch this repo and build openocd following the instructions
|
||||
provided in the README of the project. Then, build zephyr project indicating the
|
||||
openocd location in west build command.
|
||||
For this you need to fetch this repo, checkout branch "openocd-cubeide-r3" and
|
||||
build openocd following the instructions provided in the README of the project.
|
||||
Then, build zephyr project indicating the openocd location in west build command.
|
||||
|
||||
Here is an example for the :ref:`blinky-sample` application.
|
||||
|
||||
@@ -269,24 +269,18 @@ Here is an example for the :ref:`blinky-sample` application.
|
||||
|
||||
Then, indicate openocd as the chosen runner in flash and debug commands:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: b_u585i_iot02a
|
||||
:gen-args: -r openocd
|
||||
:goals: flash
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: nucleo_u575zi_q
|
||||
:gen-args: -r openocd
|
||||
:goals: debug
|
||||
.. code-block:: console
|
||||
|
||||
$ west flash -r openocd
|
||||
$ west debug -r openocd
|
||||
|
||||
|
||||
.. _B U585I IOT02A Discovery kit website:
|
||||
https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html
|
||||
|
||||
.. _B U585I IOT02A board User Manual:
|
||||
https://www.st.com/resource/en/user_manual/dm00698410.pdf
|
||||
https://www.st.com/resource/en/user_manual/um2839-discovery-kit-for-iot-node-with-stm32u5-series-stmicroelectronics.pdf
|
||||
|
||||
.. _STM32U585 on www.st.com:
|
||||
https://www.st.com/en/microcontrollers-microprocessors/stm32u575-585.html
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
CONFIG_SOC_LPC54114_M0=y
|
||||
CONFIG_SOC_SERIES_LPC54XXX=y
|
||||
CONFIG_BOARD_LPCXPRESSO54114_M0=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_USE_SEGGER_RTT=y
|
||||
CONFIG_SERIAL=n
|
||||
CONFIG_CORTEX_M_SYSTICK=y
|
||||
|
||||
@@ -13,9 +13,6 @@ CONFIG_HW_STACK_PROTECTION=y
|
||||
# enable GPIO
|
||||
CONFIG_GPIO=y
|
||||
|
||||
# enable console
|
||||
CONFIG_CONSOLE=y
|
||||
|
||||
# additional board options
|
||||
CONFIG_GPIO_AS_PINRESET=y
|
||||
CONFIG_NFCT_PINS_AS_GPIOS=y
|
||||
|
||||
@@ -12,4 +12,10 @@ config SPI_STM32_INTERRUPT
|
||||
default y
|
||||
depends on SPI
|
||||
|
||||
# FIXME: LSE not working as LPTIM clock source. Use LSI instead.
|
||||
choice STM32_LPTIM_CLOCK
|
||||
default STM32_LPTIM_CLOCK_LSI
|
||||
depends on STM32_LPTIM_TIMER
|
||||
endchoice
|
||||
|
||||
endif # BOARD_NUCLEO_L073RZ
|
||||
|
||||
@@ -240,9 +240,9 @@ Debugging
|
||||
STM32U5 support is not currently supported in openocd. As a temporary workaround,
|
||||
user can use `STMicroelectronics customized version of OpenOCD`_ to debug the
|
||||
the Nucleo U575ZI Q.
|
||||
For this you need to fetch this repo and build openocd following the instructions
|
||||
provided in the README of the project. Then, build zephyr project indicating the
|
||||
openocd location in west build command.
|
||||
For this you need to fetch this repo, checkout branch "openocd-cubeide-r3" and
|
||||
build openocd following the instructions provided in the README of the project.
|
||||
Then, build zephyr project indicating the openocd location in west build command.
|
||||
|
||||
Here is an example for the :ref:`blinky-sample` application.
|
||||
|
||||
@@ -254,17 +254,11 @@ Here is an example for the :ref:`blinky-sample` application.
|
||||
|
||||
Then, indicate openocd as the chosen runner in flash and debug commands:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: nucleo_u575zi_q
|
||||
:gen-args: -r openocd
|
||||
:goals: flash
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: nucleo_u575zi_q
|
||||
:gen-args: -r openocd
|
||||
:goals: debug
|
||||
.. code-block:: console
|
||||
|
||||
$ west flash -r openocd
|
||||
$ west debug -r openocd
|
||||
|
||||
|
||||
.. _STM32 Nucleo-144 board User Manual:
|
||||
|
||||
@@ -12,6 +12,3 @@ CONFIG_HW_STACK_PROTECTION=y
|
||||
|
||||
# Enable GPIO
|
||||
CONFIG_GPIO=y
|
||||
|
||||
# Enable console
|
||||
CONFIG_CONSOLE=y
|
||||
|
||||
BIN
boards/x86/acrn/doc/ACRN-Hybrid.png
Normal file
BIN
boards/x86/acrn/doc/ACRN-Hybrid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
@@ -5,6 +5,28 @@ Zephyr's is capable of running as a guest under the x86 ACRN
|
||||
hypervisor (see https://projectacrn.org/). The process for getting
|
||||
this to work is somewhat involved, however.
|
||||
|
||||
ACRN hypervisor supports a hybrid scenario where Zephyr runs in a so-
|
||||
called "pre-launched" mode. This means Zephyr will access the ACRN
|
||||
hypervisor directly without involving the SOS VM. This is the most
|
||||
practical user scenario in the real world because Zephyr's real-time
|
||||
and safety capability can be assured without influence from other
|
||||
VMs. The following figure from ACRN's official documentation shows
|
||||
how a hybrid scenario works:
|
||||
|
||||
.. figure:: ACRN-Hybrid.png
|
||||
:align: center
|
||||
:alt: ACRN Hybrid User Scenario
|
||||
:figclass: align-center
|
||||
:width: 80%
|
||||
|
||||
ACRN Hybrid User Scenario
|
||||
|
||||
In this tutorial, we will show you how to build a minimal running instance of Zephyr
|
||||
and ACRN hypervisor to demonstrate that it works successfully. To learn more about
|
||||
other features of ACRN, such as building and using the SOS VM or other guest VMs,
|
||||
please refer to the Getting Started Guide for ACRN:
|
||||
https://projectacrn.github.io/latest/tutorials/using_hybrid_mode_on_nuc.html
|
||||
|
||||
Build your Zephyr App
|
||||
*********************
|
||||
|
||||
@@ -15,6 +37,10 @@ normally would, selecting an appropriate board:
|
||||
|
||||
west build -b acrn_ehl_crb samples/hello_world
|
||||
|
||||
In this tutorial, we will use the Intel Elkhart Lake Reference Board
|
||||
(`EHL`_ CRB) since it is one of the suggested platform for this
|
||||
type of scenario. Use ``acrn_ehl_crb`` as the target board parameter.
|
||||
|
||||
Note the kconfig output in ``build/zephyr/.config``, you will need to
|
||||
reference that to configure ACRN later.
|
||||
|
||||
@@ -31,6 +57,9 @@ First you need the source code, clone from:
|
||||
|
||||
git clone https://github.com/projectacrn/acrn-hypervisor
|
||||
|
||||
We suggest that you use versions v2.5.1 or later of the ACRN hypervisor
|
||||
as they have better support for SMP in Zephyr.
|
||||
|
||||
Like Zephyr, ACRN favors build-time configuration management instead
|
||||
of runtime probing or control. Unlike Zephyr, ACRN has single large
|
||||
configuration files instead of small easily-merged configuration
|
||||
@@ -102,10 +131,51 @@ many CPUs in the ``<cpu_affinity>`` tag. For example:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<cpu_affinity>
|
||||
<pcpu_id>0</pcpu_id>
|
||||
<pcpu_id>1</pcpu_id>
|
||||
</cpu_affinity>
|
||||
<vm id="0">
|
||||
<vm_type>SAFETY_VM</vm_type>
|
||||
<name>ACRN PRE-LAUNCHED VM0</name>
|
||||
<guest_flags>
|
||||
<guest_flag>0</guest_flag>
|
||||
</guest_flags>
|
||||
<cpu_affinity>
|
||||
<pcpu_id>0</pcpu_id>
|
||||
<pcpu_id>1</pcpu_id>
|
||||
</cpu_affinity>
|
||||
...
|
||||
<clos>
|
||||
<vcpu_clos>0</vcpu_clos>
|
||||
<vcpu_clos>0</vcpu_clos>
|
||||
</clos>
|
||||
...
|
||||
</vm>
|
||||
|
||||
To use SMP, we have to change the pcpu_id of VM0 to 0 and 1.
|
||||
This configures ACRN to run Zephyr on CPU0 and CPU1. The ACRN hypervisor
|
||||
and Zephyr application will not boot successfully without this change.
|
||||
If you plan to run Zephyr with one CPU only, you can skip it.
|
||||
|
||||
Since Zephyr is using CPU0 and CPU1, we also have to change
|
||||
VM1's configuration so it runs on CPU2 and CPU3. If your ACRN set up has
|
||||
additional VMs, you should change their configurations as well.
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<vm id="1">
|
||||
<vm_type>SOS_VM</vm_type>
|
||||
<name>ACRN SOS VM</name>
|
||||
<guest_flags>
|
||||
<guest_flag>0</guest_flag>
|
||||
</guest_flags>
|
||||
<cpu_affinity>
|
||||
<pcpu_id>2</pcpu_id>
|
||||
<pcpu_id>3</pcpu_id>
|
||||
</cpu_affinity>
|
||||
<clos>
|
||||
<vcpu_clos>0</vcpu_clos>
|
||||
<vcpu_clos>0</vcpu_clos>
|
||||
</clos>
|
||||
...
|
||||
</vm>
|
||||
|
||||
Note that these indexes are physical CPUs on the host. When
|
||||
configuring multiple guests, you probably don't want to overlap these
|
||||
@@ -228,3 +298,6 @@ command:
|
||||
----- Entering VM 0 Shell -----
|
||||
*** Booting Zephyr OS build v2.6.0-rc1-324-g1a03783861ad ***
|
||||
Hello World! acrn
|
||||
|
||||
|
||||
.. _EHL: https://www.intel.com/content/www/us/en/products/docs/processors/embedded/enhanced-for-iot-platform-brief.html
|
||||
|
||||
@@ -489,10 +489,7 @@ zephyr_boilerplate_watch(CONF_FILE)
|
||||
|
||||
if(DTC_OVERLAY_FILE)
|
||||
# DTC_OVERLAY_FILE has either been specified on the cmake CLI or is already
|
||||
# in the CMakeCache.txt. This has precedence over the environment
|
||||
# variable DTC_OVERLAY_FILE
|
||||
elseif(DEFINED ENV{DTC_OVERLAY_FILE})
|
||||
set(DTC_OVERLAY_FILE $ENV{DTC_OVERLAY_FILE})
|
||||
# in the CMakeCache.txt.
|
||||
elseif(APP_BOARD_DTS)
|
||||
set(DTC_OVERLAY_FILE ${APP_BOARD_DTS})
|
||||
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/${BOARD}.overlay)
|
||||
|
||||
@@ -8,14 +8,14 @@ external organization. Several of these are available.
|
||||
|
||||
.. _toolchain_gnuarmemb:
|
||||
|
||||
GNU ARM Embedded
|
||||
GNU Arm Embedded
|
||||
****************
|
||||
|
||||
.. warning::
|
||||
|
||||
Do not install the toolchain into a path with spaces.
|
||||
|
||||
#. Download and install a `GNU ARM Embedded`_ build for your operating system
|
||||
#. Download and install a `GNU Arm Embedded`_ build for your operating system
|
||||
and extract it on your file system.
|
||||
|
||||
.. note::
|
||||
@@ -61,6 +61,57 @@ GNU ARM Embedded
|
||||
- Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``gnuarmemb``.
|
||||
- Set :envvar:`GNUARMEMB_TOOLCHAIN_PATH` to the brew installation directory (something like ``/usr/local``)
|
||||
|
||||
.. _toolchain_armclang:
|
||||
|
||||
Arm Compiler 6
|
||||
**************
|
||||
|
||||
#. Download and install a development suite containing the `Arm Compiler 6`_
|
||||
for your operating system.
|
||||
|
||||
#. :ref:`Set these environment variables <env_vars>`:
|
||||
|
||||
- Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``armclang``.
|
||||
- Set :envvar:`ARMCLANG_TOOLCHAIN_PATH` to the toolchain installation
|
||||
directory.
|
||||
|
||||
#. The Arm Compiler 6 needs the :envvar:`ARMLMD_LICENSE_FILE` environment
|
||||
variable to point to your license file or server.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# Linux, macOS, license file:
|
||||
export ARMLMD_LICENSE_FILE=/<path>/license_armds.dat
|
||||
# Linux, macOS, license server:
|
||||
export ARMLMD_LICENSE_FILE=8224@myserver
|
||||
|
||||
# Windows, license file:
|
||||
> set ARMLMD_LICENSE_FILE=c:\<path>\license_armds.dat
|
||||
# Windows, license server:
|
||||
> set ARMLMD_LICENSE_FILE=8224@myserver
|
||||
|
||||
#. If the Arm Compiler 6 was installed as part of an Arm Development Studio, then
|
||||
you must set the :envvar:`ARM_PRODUCT_DEF` to point to the product definition file:
|
||||
See also: `Product and toolkit configuration <https://developer.arm.com/tools-and-software/software-development-tools/license-management/resources/product-and-toolkit-configuration>`_.
|
||||
For example if the Arm Development Studio is installed in:
|
||||
``/opt/armds-2020-1`` with a Gold license, then set :envvar:`ARM_PRODUCT_DEF`
|
||||
to point to ``/opt/armds-2020-1/gold.elmap``.
|
||||
|
||||
.. note::
|
||||
|
||||
The Arm Compiler 6 uses ``armlink`` for linking. This is incompatible
|
||||
with Zephyr's linker script template, which works with GNU ld. Zephyr's
|
||||
Arm Compiler 6 support Zephyr's CMake linker script generator, which
|
||||
supports generating scatter files. Basic scatter file support is in
|
||||
place, but there are still areas covered in ld templates which are not
|
||||
fully supported by the CMake linker script generator.
|
||||
|
||||
Some Zephyr subsystems or modules may also contain C or assembly code
|
||||
that relies on GNU intrinsics and have not yet been updated to work fully
|
||||
with ``armclang``.
|
||||
|
||||
Intel oneAPI Toolkit
|
||||
*********************
|
||||
|
||||
@@ -159,5 +210,6 @@ You can build toolchains from source code using crosstool-NG.
|
||||
$ echo $XTOOLS_TOOLCHAIN_PATH
|
||||
/Volumes/CrossToolNGNew/build/output/
|
||||
|
||||
.. _GNU ARM Embedded: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
|
||||
.. _GNU Arm Embedded: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
|
||||
.. _crosstool-ng site: http://crosstool-ng.org
|
||||
.. _Arm Compiler 6: https://developer.arm.com/tools-and-software/embedded/arm-compiler/downloads/version-6
|
||||
|
||||
@@ -41,7 +41,7 @@ Legend:
|
||||
+---------------------------------------------------------------------+------------+-------------+--------+------------+
|
||||
| Hardware floating point unit (FPU) | Y | Y | N | TBD |
|
||||
+---------------------------------------------------------------------+------------+-------------+--------+------------+
|
||||
| Symmetric multiprocessing (SMP) support, switch-based | N/A | Y | TBD | WIP |
|
||||
| Symmetric multiprocessing (SMP) support, switch-based | N/A | Y | TBD | Y |
|
||||
+---------------------------------------------------------------------+------------+-------------+--------+------------+
|
||||
| Hardware-assisted stack checking | Y | Y | TBD | N |
|
||||
+---------------------------------------------------------------------+------------+-------------+--------+------------+
|
||||
|
||||
@@ -36,11 +36,21 @@ In order to use MCUboot with Zephyr you need to take the following into account:
|
||||
|
||||
1. You will need to define the flash partitions required by MCUboot; see
|
||||
:ref:`flash_map_api` for details.
|
||||
2. Your application's :file:`.conf` file needs to enable the
|
||||
2. You will have to specify your flash parition as the chosen code partition
|
||||
|
||||
.. code-block:: devicetree
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,code-partition = &slot0_partition;
|
||||
};
|
||||
};
|
||||
|
||||
3. Your application's :file:`.conf` file needs to enable the
|
||||
:kconfig:`CONFIG_BOOTLOADER_MCUBOOT` Kconfig option in order for Zephyr to
|
||||
be built in an MCUboot-compatible manner
|
||||
3. You need to build and flash MCUboot itself on your device
|
||||
4. You might need to take precautions to avoid mass erasing the flash and also
|
||||
4. You need to build and flash MCUboot itself on your device
|
||||
5. You might need to take precautions to avoid mass erasing the flash and also
|
||||
to flash the Zephyr application image at the correct offset (right after the
|
||||
bootloader)
|
||||
|
||||
|
||||
@@ -210,7 +210,6 @@ Here are some ways to set it:
|
||||
(``-DDTC_OVERLAY_FILE="file1.overlay;file2.overlay"``)
|
||||
#. with the CMake ``set()`` command in the application ``CMakeLists.txt``,
|
||||
before including zephyr's :file:`boilerplate.cmake` file
|
||||
#. using a ``DTC_OVERLAY_FILE`` environment variable (deprecated)
|
||||
#. create a ``boards/<BOARD>_<revision>.overlay`` file in the application
|
||||
folder for the current board revision. This requires that the board supports
|
||||
multiple revisions, see :ref:`porting_board_revisions`.
|
||||
|
||||
@@ -254,6 +254,8 @@ channels (e.g. ADC or DAC channels) for conversion.
|
||||
|
||||
.. doxygengroup:: devicetree-io-channels
|
||||
|
||||
.. _devicetree-pinctrl-api:
|
||||
|
||||
Pinctrl (pin control)
|
||||
=====================
|
||||
|
||||
|
||||
@@ -202,10 +202,11 @@ in an asynchronous manner.
|
||||
.. note::
|
||||
A message queue can be used to transfer large data items, if desired.
|
||||
However, this can increase interrupt latency as interrupts are locked
|
||||
while a data item is written or read. It is usually preferable to transfer
|
||||
large data items by exchanging a pointer to the data item, rather than the
|
||||
data item itself. The kernel's memory map and memory pool object types
|
||||
can be helpful for data transfers of this sort.
|
||||
while a data item is written or read. The time to write or read a data item
|
||||
increases linearly with its size since the item is copied in its entirety
|
||||
to or from the buffer in memory. For this reason, it is usually preferable
|
||||
to transfer large data items by exchanging a pointer to the data item,
|
||||
rather than the data item itself.
|
||||
|
||||
A synchronous transfer can be achieved by using the kernel's mailbox
|
||||
object type.
|
||||
|
||||
@@ -164,8 +164,7 @@ Use a pipe to send streams of data between threads.
|
||||
.. note::
|
||||
A pipe can be used to transfer long streams of data if desired. However
|
||||
it is often preferable to send pointers to large data items to avoid
|
||||
copying the data. The kernel's memory map and memory pool object types
|
||||
can be helpful for data transfers of this sort.
|
||||
copying the data.
|
||||
|
||||
Configuration Options
|
||||
*********************
|
||||
|
||||
@@ -32,12 +32,12 @@ A stack must be initialized before it can be used. This sets its queue to empty.
|
||||
A data value can be **added** to a stack by a thread or an ISR.
|
||||
The value is given directly to a waiting thread, if one exists;
|
||||
otherwise the value is added to the LIFO's queue.
|
||||
The kernel does *not* detect attempts to add a data value to a stack
|
||||
that has already reached its maximum quantity of queued values.
|
||||
|
||||
.. note::
|
||||
Adding a data value to a stack that is already full will result in
|
||||
array overflow, and lead to unpredictable behavior.
|
||||
If :kconfig:`CONFIG_NO_RUNTIME_CHECKS` is enabled, the kernel will *not* detect
|
||||
and prevent attempts to add a data value to a stack that has already reached
|
||||
its maximum quantity of queued values. Adding a data value to a stack that is
|
||||
already full will result in array overflow, and lead to unpredictable behavior.
|
||||
|
||||
A data value may be **removed** from a stack by a thread.
|
||||
If the stack's queue is empty a thread may choose to wait for it to be given.
|
||||
|
||||
@@ -113,7 +113,7 @@ an extra 72 bytes of stack space where the callee-saved FP context can
|
||||
be saved.
|
||||
|
||||
`Lazy Stacking
|
||||
<http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0298a/DAFGGBJD.html>`_
|
||||
<https://developer.arm.com/documentation/dai0298/a>`_
|
||||
is currently enabled in Zephyr applications on ARM Cortex-M
|
||||
architecture, minimizing interrupt latency, when the floating
|
||||
point context is active.
|
||||
|
||||
@@ -39,6 +39,15 @@ The kernel's scheduler selects the highest priority ready thread
|
||||
to be the current thread. When multiple ready threads of the same priority
|
||||
exist, the scheduler chooses the one that has been waiting longest.
|
||||
|
||||
A thread's relative priority is primarily determined by its static priority.
|
||||
However, when both earliest-deadline-first scheduling is enabled
|
||||
(:kconfig:`CONFIG_SCHED_DEADLINE`) and a choice of threads have equal
|
||||
static priority, then the thread with the earlier deadline is considered
|
||||
to have the higher priority. Thus, when earliest-deadline-first scheduling is
|
||||
enabled, two threads are only considered to have the same priority when both
|
||||
their static priorities and deadlines are equal. The routine
|
||||
:c:func:`k_thread_deadline_set` is used to set a thread's deadline.
|
||||
|
||||
.. note::
|
||||
Execution of ISRs takes precedence over thread execution,
|
||||
so the execution of the current thread may be replaced by an ISR
|
||||
|
||||
@@ -37,6 +37,13 @@ Any number of threads may wait on an unavailable semaphore simultaneously.
|
||||
When the semaphore is given, it is taken by the highest priority thread
|
||||
that has waited longest.
|
||||
|
||||
.. note::
|
||||
You may initialize a "full" semaphore (count equal to limit) to limit the number
|
||||
of threads able to execute the critical section at the same time. You may also
|
||||
initialize an empty semaphore (count equal to 0, with a limit greater than 0)
|
||||
to create a gate through which no waiting thread may pass until the semaphore
|
||||
is incremented. All standard use cases of the common semaphore are supported.
|
||||
|
||||
.. note::
|
||||
The kernel does allow an ISR to take a semaphore, however the ISR must
|
||||
not attempt to wait if the semaphore is unavailable.
|
||||
|
||||
@@ -245,6 +245,10 @@ A thread's initial priority value can be altered up or down after the thread
|
||||
has been started. Thus it is possible for a preemptible thread to become
|
||||
a cooperative thread, and vice versa, by changing its priority.
|
||||
|
||||
.. note::
|
||||
The scheduler does not make heuristic decisions to re-prioritize threads.
|
||||
Thread priorities are set and changed only at the application's request.
|
||||
|
||||
The kernel supports a virtually unlimited number of thread priority levels.
|
||||
The configuration options :kconfig:`CONFIG_NUM_COOP_PRIORITIES` and
|
||||
:kconfig:`CONFIG_NUM_PREEMPT_PRIORITIES` specify the number of priority
|
||||
@@ -269,9 +273,10 @@ When enabled (see :kconfig:`CONFIG_NUM_METAIRQ_PRIORITIES`), there is a special
|
||||
subclass of cooperative priorities at the highest (numerically lowest)
|
||||
end of the priority space: meta-IRQ threads. These are scheduled
|
||||
according to their normal priority, but also have the special ability
|
||||
to preempt all other threads (and other meta-irq threads) at lower
|
||||
to preempt all other threads (and other meta-IRQ threads) at lower
|
||||
priorities, even if those threads are cooperative and/or have taken a
|
||||
scheduler lock.
|
||||
scheduler lock. Meta-IRQ threads are still threads, however,
|
||||
and can still be interrupted by any hardware interrupt.
|
||||
|
||||
This behavior makes the act of unblocking a meta-IRQ thread (by any
|
||||
means, e.g. creating it, calling k_sem_give(), etc.) into the
|
||||
@@ -284,7 +289,7 @@ run before the current CPU returns into application code.
|
||||
|
||||
Unlike similar features in other OSes, meta-IRQ threads are true
|
||||
threads and run on their own stack (which must be allocated normally),
|
||||
not the per-CPU interrupt stack. Design work to enable the use of the
|
||||
not the per-CPU interrupt stack. Design work to enable the use of the
|
||||
IRQ stack on supported architectures is pending.
|
||||
|
||||
Note that because this breaks the promise made to cooperative
|
||||
|
||||
61
doc/reference/usb/hid.rst
Normal file
61
doc/reference/usb/hid.rst
Normal file
@@ -0,0 +1,61 @@
|
||||
.. _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/usb/class/hid.h`
|
||||
and :zephyr_file:`include/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 types reference
|
||||
*******************
|
||||
|
||||
.. doxygengroup:: usb_hid_types
|
||||
|
||||
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
|
||||
@@ -1,252 +1,13 @@
|
||||
.. _usb_api:
|
||||
|
||||
USB device stack
|
||||
################
|
||||
USB device support
|
||||
##################
|
||||
|
||||
.. contents::
|
||||
:depth: 2
|
||||
:local:
|
||||
:backlinks: top
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
USB Vendor and Product identifiers
|
||||
**********************************
|
||||
|
||||
The USB Vendor ID for the Zephyr project is 0x2FE3. The default USB Product
|
||||
ID for the Zephyr project is 0x100. The USB bcdDevice Device Release Number
|
||||
represents the Zephyr kernel major and minor versions as a binary coded
|
||||
decimal value. When a vendor integrates the Zephyr USB subsystem into a
|
||||
product, the vendor must use the USB Vendor and Product ID assigned to them.
|
||||
A vendor integrating the Zephyr USB subsystem in a product must not use the
|
||||
Vendor ID of the Zephyr project.
|
||||
|
||||
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.
|
||||
|
||||
Each USB sample has its own unique Product ID.
|
||||
When adding a new sample, add a new entry in :file:`samples/subsys/usb/usb_pid.Kconfig`
|
||||
and a Kconfig file inside your sample subdirectory.
|
||||
The following Product IDs are currently used:
|
||||
|
||||
* :kconfig:`CONFIG_USB_PID_CDC_ACM_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_CDC_ACM_COMPOSITE_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_HID_CDC_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_CONSOLE_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_DFU_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_HID_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_HID_MOUSE_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_MASS_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_TESTUSB_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_WEBUSB_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_BLE_HCI_H4_SAMPLE`
|
||||
|
||||
USB device controller drivers
|
||||
*****************************
|
||||
|
||||
The 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 file usb_dc.h. This allows the integration of
|
||||
new USB device controllers to be done without changing the upper layers.
|
||||
|
||||
USB Device Controller API
|
||||
=========================
|
||||
|
||||
.. doxygengroup:: _usb_device_controller_api
|
||||
|
||||
USB device core layer
|
||||
*********************
|
||||
|
||||
The USB Device core layer is a hardware independent interface between USB
|
||||
device controller driver and USB device class drivers or customer applications.
|
||||
It's a port of the LPCUSB device stack. It provides the following
|
||||
functionalities:
|
||||
|
||||
* 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 are described in the usb_device.h file.
|
||||
* Uses the APIs provided by the device controller drivers to interact with
|
||||
the USB device controller.
|
||||
|
||||
|
||||
USB Device Core Layer API
|
||||
=========================
|
||||
|
||||
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
|
||||
|
||||
USB device class drivers
|
||||
************************
|
||||
|
||||
Zephyr USB Device Stack supports many standard classes, such as HID, MSC
|
||||
Ethernet over USB, DFU, Bluetooth.
|
||||
|
||||
Implementing non standard USB class
|
||||
===================================
|
||||
|
||||
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 USB loopback application:
|
||||
|
||||
.. literalinclude:: ../../../subsys/usb/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/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/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/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:
|
||||
|
||||
Testing USB over USP/IP in native_posix
|
||||
***************************************
|
||||
|
||||
Virtual USB controller implemented through USB/IP might be used to test USB
|
||||
Device stack. Follow general build procedure to build 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 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: <Port in Use> 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
|
||||
|
||||
USB Human Interface Devices (HID) support
|
||||
*****************************************
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
.. doxygengroup:: usb_hid_items
|
||||
|
||||
.. doxygengroup:: usb_hid_types
|
||||
|
||||
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
|
||||
********************
|
||||
|
||||
USB HID devices like mouse, keyboard, or any other specific device use this API.
|
||||
|
||||
.. doxygengroup:: usb_hid_device_api
|
||||
udc.rst
|
||||
uds.rst
|
||||
uds_testing.rst
|
||||
hid.rst
|
||||
uds_cdc_acm.rst
|
||||
|
||||
17
doc/reference/usb/udc.rst
Normal file
17
doc/reference/usb/udc.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
.. _udc_api:
|
||||
|
||||
USB device controller driver API
|
||||
################################
|
||||
|
||||
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/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
|
||||
148
doc/reference/usb/uds.rst
Normal file
148
doc/reference/usb/uds.rst
Normal file
@@ -0,0 +1,148 @@
|
||||
.. _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/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<usb-samples>` 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/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/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/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/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.
|
||||
|
||||
When adding a new sample, add a new entry in :file:`samples/subsys/usb/usb_pid.Kconfig`
|
||||
and a Kconfig file inside your sample subdirectory.
|
||||
The following Product IDs are currently used:
|
||||
|
||||
* :kconfig:`CONFIG_USB_PID_CDC_ACM_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_CDC_ACM_COMPOSITE_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_HID_CDC_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_CONSOLE_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_DFU_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_HID_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_HID_MOUSE_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_MASS_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_TESTUSB_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_WEBUSB_SAMPLE`
|
||||
* :kconfig:`CONFIG_USB_PID_BLE_HCI_H4_SAMPLE`
|
||||
|
||||
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
|
||||
108
doc/reference/usb/uds_cdc_acm.rst
Normal file
108
doc/reference/usb/uds_cdc_acm.rst
Normal file
@@ -0,0 +1,108 @@
|
||||
.. _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:`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`.
|
||||
If USB device support is enabled in the application, as in the console sample,
|
||||
:kconfig:`CONFIG_USB_UART_CONSOLE` must be enabled,
|
||||
which does nothing but change the initialization time of the console driver.
|
||||
|
||||
.. 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 *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`
|
||||
50
doc/reference/usb/uds_testing.rst
Normal file
50
doc/reference/usb/uds_testing.rst
Normal file
@@ -0,0 +1,50 @@
|
||||
.. _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: <Port in Use> 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
|
||||
@@ -4,9 +4,9 @@ Memory Protection Design
|
||||
########################
|
||||
|
||||
Zephyr's memory protection design is geared towards microcontrollers with MPU
|
||||
(Memory Protection Unit) hardware. We do support some architectures which have
|
||||
a paged MMU (Memory Management Unit), but in that case the MMU is used like
|
||||
an MPU with an identity page table.
|
||||
(Memory Protection Unit) hardware. We do support some architectures, such as x86,
|
||||
which have a paged MMU (Memory Management Unit), but in that case the MMU is
|
||||
used like an MPU with an identity page table.
|
||||
|
||||
All of the discussion below will be using MPU terminology; systems with MMUs
|
||||
can be considered to have an MPU with an unlimited number of programmable
|
||||
@@ -46,7 +46,7 @@ text/ro-data, this is sufficient for the boot time configuration.
|
||||
Hardware Stack Overflow
|
||||
***********************
|
||||
|
||||
``CONFIG_HW_STACK_PROTECTION`` is an optional feature which detects stack
|
||||
:kconfig:`CONFIG_HW_STACK_PROTECTION` is an optional feature which detects stack
|
||||
buffer overflows when the system is running in supervisor mode. This
|
||||
catches issues when the entire stack buffer has overflowed, and not
|
||||
individual stack frames, use compiler-assisted :kconfig:`CONFIG_STACK_CANARIES`
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -784,6 +784,24 @@ Possible overflow in mempool
|
||||
CVE-2021
|
||||
========
|
||||
|
||||
CVE-2021-3319
|
||||
-------------
|
||||
|
||||
DOS: Incorrect 802154 Frame Validation for Omitted Source / Dest Addresses
|
||||
|
||||
Improper processing of omitted source and destination addresses in
|
||||
ieee802154 frame validation (ieee802154_validate_frame)
|
||||
|
||||
This has been fixed in main for v2.5.0
|
||||
|
||||
- `CVE-2020-3319 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3319>`_
|
||||
|
||||
- `Zephyr project bug tracker GHSA-94jg-2p6q-5364
|
||||
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-94jg-2p6q-5364>`_
|
||||
|
||||
- `PR31908 fix for main
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/31908>`_
|
||||
|
||||
CVE-2021-3320
|
||||
-------------------
|
||||
Mismatch between validation and handling of 802154 ACK frames, where
|
||||
@@ -938,6 +956,36 @@ This has been fixed in main for v2.6.0
|
||||
- `PR 33418 fix for 1.14.2
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/33418>`_
|
||||
|
||||
CVE-2021-3436
|
||||
-------------
|
||||
|
||||
Bluetooth: Possible to overwrite an existing bond during keys
|
||||
distribution phase when the identity address of the bond is known
|
||||
|
||||
During the distribution of the identity address information we don’t
|
||||
check for an existing bond with the same identity address.This means
|
||||
that a duplicate entry will be created in RAM while the newest entry
|
||||
will overwrite the existing one in persistent storage.
|
||||
|
||||
This has been fixed in main for v2.6.0
|
||||
|
||||
- `CVE-2021-3436 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3436>`_
|
||||
|
||||
- `Zephyr project bug tracker GHSA-j76f-35mc-4h63
|
||||
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-j76f-35mc-4h63>`_
|
||||
|
||||
- `PR 33266 fix for main
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/33266>`_
|
||||
|
||||
- `PR 33432 fix for 2.5
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/33432>`_
|
||||
|
||||
- `PR 33433 fix for 2.4
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/33433>`_
|
||||
|
||||
- `PR 33718 fix for 1.14.2
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/33718>`_
|
||||
|
||||
CVE-2021-3454
|
||||
-------------
|
||||
|
||||
@@ -989,7 +1037,70 @@ This has been fixed in main for v2.6.0
|
||||
- `PR 36105 fix for 2.4
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/36105>`_
|
||||
|
||||
CVE-2021-3510
|
||||
-------------
|
||||
|
||||
Zephyr JSON decoder incorrectly decodes array of array
|
||||
|
||||
When using JSON_OBJ_DESCR_ARRAY_ARRAY, the subarray is has the token
|
||||
type JSON_TOK_LIST_START, but then assigns to the object part of the
|
||||
union. arr_parse then takes the offset of the array-object (which has
|
||||
nothing todo with the list) treats it as relative to the parent
|
||||
object, and stores the length of the subarray in there.
|
||||
|
||||
This has been fixed in main for v2.7.0
|
||||
|
||||
- `CVE-2021-3510 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3510>`_
|
||||
|
||||
- `Zephyr project bug tracker GHSA-289f-7mw3-2qf4
|
||||
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-289f-7mw3-2qf4>`_
|
||||
|
||||
- `PR 36340 fix for main
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/36340>`_
|
||||
|
||||
- `PR 37816 fix for 2.6
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/37816>`_
|
||||
|
||||
CVE-2021-3581
|
||||
-------------
|
||||
|
||||
Under embargo until 2021/09/04
|
||||
HCI data not properly checked leads to memory overflow in the Bluetooth stack
|
||||
|
||||
In the process of setting SCAN_RSP through the HCI command, the Zephyr
|
||||
Bluetooth protocol stack did not effectively check the length of the
|
||||
incoming HCI data. Causes memory overflow, and then the data in the
|
||||
memory is overwritten, and may even cause arbitrary code execution.
|
||||
|
||||
This has been fixed in main for v2.6.0
|
||||
|
||||
- `CVE-2021-3581 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3581>`_
|
||||
|
||||
- `Zephyr project bug tracker GHSA-8q65-5gqf-fmw5
|
||||
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-8q65-5gqf-fmw5>`_
|
||||
|
||||
- `PR 35935 fix for main
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/35935>`_
|
||||
|
||||
- `PR 35984 fix for 2.5
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/35984>`_
|
||||
|
||||
- `PR 35985 fix for 2.4
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/35985>`_
|
||||
|
||||
- `PR 35985 fix for 1.14
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/35985>`_
|
||||
|
||||
CVE-2021-3625
|
||||
-------------
|
||||
|
||||
Buffer overflow in Zephyr USB DFU DNLOAD
|
||||
|
||||
This has been fixed in main for v2.6.0
|
||||
|
||||
- `CVE-2021-3625 <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3625>`_
|
||||
|
||||
- `Zephyr project bug tracker GHSA-c3gr-hgvr-f363
|
||||
<https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-c3gr-hgvr-f363>`_
|
||||
|
||||
- `PR 36694 fix for main
|
||||
<https://github.com/zephyrproject-rtos/zephyr/pull/36694>`_
|
||||
|
||||
@@ -49,8 +49,8 @@ add_subdirectory_ifdef(CONFIG_PM_CPU_OPS pm_cpu_ops)
|
||||
|
||||
add_subdirectory_ifdef(CONFIG_FLASH_HAS_DRIVER_ENABLED flash)
|
||||
add_subdirectory_ifdef(CONFIG_SERIAL_HAS_DRIVER serial)
|
||||
add_subdirectory_ifdef(CONFIG_BT bluetooth)
|
||||
add_subdirectory_ifdef(CONFIG_NETWORKING net)
|
||||
add_subdirectory_ifdef(CONFIG_BT_DRIVERS bluetooth)
|
||||
add_subdirectory_ifdef(CONFIG_NET_DRIVERS net)
|
||||
add_subdirectory_ifdef(CONFIG_NET_L2_ETHERNET ethernet)
|
||||
add_subdirectory_ifdef(CONFIG_ENTROPY_HAS_DRIVER entropy)
|
||||
add_subdirectory_ifdef(CONFIG_SYS_CLOCK_EXISTS timer)
|
||||
|
||||
@@ -409,18 +409,10 @@ static int start_read(const struct device *dev,
|
||||
return err;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SOC_SERIES_STM32G0X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32G4X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32H7X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32L0X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32L4X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32L5X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32WBX) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32WLX)
|
||||
#if defined(CONFIG_SOC_SERIES_STM32G0X)
|
||||
/*
|
||||
* Errata: Writing ADC_CFGR1 register while ADEN bit is set
|
||||
* resets RES[1:0] bitfield. We need to disable and enable adc.
|
||||
* On all those stm32 devices it is allowed to write these bits only when ADEN = 0.
|
||||
*/
|
||||
if (LL_ADC_IsEnabled(adc) == 1UL) {
|
||||
LL_ADC_Disable(adc);
|
||||
@@ -436,6 +428,15 @@ static int start_read(const struct device *dev,
|
||||
LL_ADC_SetResolution(adc, resolution);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SOC_SERIES_STM32L0X
|
||||
/*
|
||||
* setting OVS bits is conditioned to ADC state: ADC must be disabled
|
||||
* or enabled without conversion on going : disable it, it will stop
|
||||
*/
|
||||
LL_ADC_Disable(adc);
|
||||
while (LL_ADC_IsEnabled(adc) == 1UL) {
|
||||
}
|
||||
#endif /* CONFIG_SOC_SERIES_STM32L0X */
|
||||
#if defined(CONFIG_SOC_SERIES_STM32G0X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32G4X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32H7X) || \
|
||||
@@ -444,13 +445,7 @@ static int start_read(const struct device *dev,
|
||||
defined(CONFIG_SOC_SERIES_STM32L5X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32WBX) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32WLX)
|
||||
/*
|
||||
* setting OVS bits is conditioned to ADC state: ADC must be disabled
|
||||
* or enabled without conversion on going : disable it, it will stop
|
||||
*/
|
||||
LL_ADC_Disable(adc);
|
||||
while (LL_ADC_IsEnabled(adc) == 1UL) {
|
||||
}
|
||||
|
||||
switch (sequence->oversampling) {
|
||||
case 0:
|
||||
LL_ADC_SetOverSamplingScope(adc, LL_ADC_OVS_DISABLE);
|
||||
|
||||
@@ -9,9 +9,13 @@
|
||||
|
||||
# Controller support is an HCI driver in itself, so these HCI driver
|
||||
# options are only applicable if controller support hasn't been enabled.
|
||||
menu "Bluetooth Drivers"
|
||||
menuconfig BT_DRIVERS
|
||||
bool "Bluetooth Drivers"
|
||||
default y
|
||||
depends on BT && !BT_CTLR
|
||||
|
||||
if BT_DRIVERS
|
||||
|
||||
if BT_HCI
|
||||
source "drivers/bluetooth/hci/Kconfig"
|
||||
endif
|
||||
@@ -20,4 +24,4 @@ if BT_CUSTOM
|
||||
# Insert here any custom (non-HCI) offload drives
|
||||
endif
|
||||
|
||||
endmenu
|
||||
endif # BT_DRIVERS
|
||||
|
||||
@@ -26,16 +26,12 @@ zephyr_library_sources_ifdef(CONFIG_ETH_SAM_GMAC eth_sam_gmac.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_DSA_KSZ8XXX dsa_ksz8xxx.c)
|
||||
|
||||
if(CONFIG_ETH_NATIVE_POSIX)
|
||||
zephyr_library_named(drivers__ethernet__native_posix)
|
||||
zephyr_library_compile_definitions(
|
||||
NO_POSIX_CHEATS
|
||||
_BSD_SOURCE
|
||||
_DEFAULT_SOURCE
|
||||
)
|
||||
zephyr_library_sources(
|
||||
eth_native_posix.c
|
||||
eth_native_posix_adapt.c
|
||||
)
|
||||
set(native_posix_source_files eth_native_posix.c eth_native_posix_adapt.c)
|
||||
set_source_files_properties(${native_posix_source_files}
|
||||
PROPERTIES COMPILE_DEFINITIONS
|
||||
"NO_POSIX_CHEATS;_BSD_SOURCE;_DEFAULT_SOURCE"
|
||||
)
|
||||
zephyr_library_sources(${native_posix_source_files})
|
||||
endif()
|
||||
|
||||
add_subdirectory(phy)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_library()
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_PHY_GENERIC_MII phy_mii.c)
|
||||
|
||||
@@ -692,7 +692,8 @@ GPIO_DEVICE_INIT_STM32(k, K);
|
||||
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpiok), okay) */
|
||||
|
||||
|
||||
#if defined(CONFIG_SOC_SERIES_STM32F1X)
|
||||
#if defined(CONFIG_SOC_SERIES_STM32F1X) && \
|
||||
!defined(CONFIG_GPIO_STM32_SWJ_ENABLE)
|
||||
|
||||
static int gpio_stm32_afio_init(const struct device *dev)
|
||||
{
|
||||
@@ -716,6 +717,6 @@ static int gpio_stm32_afio_init(const struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_DEVICE_DEFINE("gpio_stm32_afio", gpio_stm32_afio_init, NULL, PRE_KERNEL_2, 0);
|
||||
SYS_DEVICE_DEFINE("gpio_stm32_afio", gpio_stm32_afio_init, NULL, PRE_KERNEL_1, 0);
|
||||
|
||||
#endif /* CONFIG_SOC_SERIES_STM32F1X */
|
||||
#endif /* CONFIG_SOC_SERIES_STM32F1X && !CONFIG_GPIO_STM32_SWJ_ENABLE */
|
||||
|
||||
@@ -164,6 +164,33 @@ static const struct i2c_pin i2c_pin_regs[] = {
|
||||
{ &GPDMRA, &GPDMRA, 0x10, 0x20},
|
||||
};
|
||||
|
||||
static int i2c_parsing_return_value(const struct device *dev)
|
||||
{
|
||||
struct i2c_it8xxx2_data *data = DEV_DATA(dev);
|
||||
const struct i2c_it8xxx2_config *config = DEV_CFG(dev);
|
||||
|
||||
if (!data->err)
|
||||
return 0;
|
||||
|
||||
/* Connection timed out */
|
||||
if (data->err == ETIMEDOUT)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
if (config->port < I2C_STANDARD_PORT_COUNT) {
|
||||
/* The device does not respond ACK */
|
||||
if (data->err == HOSTA_NACK)
|
||||
return -ENXIO;
|
||||
else
|
||||
return -EIO;
|
||||
} else {
|
||||
/* The device does not respond ACK */
|
||||
if (data->err == E_HOSTA_ACK)
|
||||
return -ENXIO;
|
||||
else
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
static int i2c_get_line_levels(const struct device *dev)
|
||||
{
|
||||
const struct i2c_it8xxx2_config *config = DEV_CFG(dev);
|
||||
@@ -835,7 +862,7 @@ static int i2c_it8xxx2_transfer(const struct device *dev, struct i2c_msg *msgs,
|
||||
/* Unlock mutex of i2c controller */
|
||||
k_mutex_unlock(&data->mutex);
|
||||
|
||||
return data->err;
|
||||
return i2c_parsing_return_value(dev);
|
||||
}
|
||||
|
||||
static void i2c_it8xxx2_isr(void *arg)
|
||||
|
||||
@@ -27,12 +27,12 @@ struct i2s_nrfx_drv_data {
|
||||
const uint32_t *last_tx_buffer;
|
||||
enum i2s_state state;
|
||||
enum i2s_dir active_dir;
|
||||
bool stop; /* stop after the current (TX or RX) block */
|
||||
bool discard_rx; /* discard further RX blocks */
|
||||
volatile bool next_tx_buffer_needed;
|
||||
bool tx_configured : 1;
|
||||
bool rx_configured : 1;
|
||||
bool stop : 1; /* stop after the current (TX or RX) block */
|
||||
bool discard_rx : 1; /* discard further RX blocks */
|
||||
bool request_clock : 1;
|
||||
volatile bool next_tx_buffer_needed;
|
||||
};
|
||||
|
||||
struct i2s_nrfx_drv_cfg {
|
||||
@@ -81,6 +81,7 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
|
||||
uint32_t best_diff = UINT32_MAX;
|
||||
uint8_t r, best_r = 0;
|
||||
nrf_i2s_mck_t best_mck_cfg = 0;
|
||||
uint32_t best_mck = 0;
|
||||
|
||||
for (r = 0; r < ARRAY_SIZE(ratios); ++r) {
|
||||
/* Only multiples of the frame width can be used as ratios. */
|
||||
@@ -110,6 +111,7 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
|
||||
|
||||
if (diff < best_diff) {
|
||||
best_mck_cfg = mck_factor * 4096;
|
||||
best_mck = actual_mck;
|
||||
best_r = r;
|
||||
/* Stop if an exact match is found. */
|
||||
if (diff == 0) {
|
||||
@@ -150,6 +152,7 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
|
||||
|
||||
if (diff < best_diff) {
|
||||
best_mck_cfg = dividers[d].divider_enum;
|
||||
best_mck = mck_freq;
|
||||
best_r = r;
|
||||
/* Stop if an exact match is found. */
|
||||
if (diff == 0) {
|
||||
@@ -173,6 +176,8 @@ static void find_suitable_clock(const struct i2s_nrfx_drv_cfg *drv_cfg,
|
||||
|
||||
config->mck_setup = best_mck_cfg;
|
||||
config->ratio = ratios[best_r].ratio_enum;
|
||||
LOG_INF("I2S MCK frequency: %u, actual PCM rate: %u",
|
||||
best_mck, best_mck / ratios[best_r].ratio_val);
|
||||
}
|
||||
|
||||
static bool get_next_tx_buffer(struct i2s_nrfx_drv_data *drv_data,
|
||||
@@ -465,9 +470,7 @@ static int i2s_nrfx_configure(const struct device *dev, enum i2s_dir dir,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (i2s_cfg->channels == 2 ||
|
||||
(i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK)
|
||||
== I2S_FMT_DATA_FORMAT_I2S) {
|
||||
if (i2s_cfg->channels == 2) {
|
||||
nrfx_cfg.channels = NRF_I2S_CHANNELS_STEREO;
|
||||
} else if (i2s_cfg->channels == 1) {
|
||||
nrfx_cfg.channels = NRF_I2S_CHANNELS_LEFT;
|
||||
@@ -878,8 +881,8 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
|
||||
#define I2S_CLK_SRC(idx) DT_STRING_TOKEN(I2S(idx), clock_source)
|
||||
|
||||
#define I2S_NRFX_DEVICE(idx) \
|
||||
static void *tx_msgs[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
|
||||
static void *rx_msgs[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
|
||||
static void *tx_msgs##idx[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
|
||||
static void *rx_msgs##idx[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
|
||||
static struct i2s_nrfx_drv_data i2s_nrfx_data##idx = { \
|
||||
.state = I2S_STATE_READY, \
|
||||
}; \
|
||||
@@ -889,11 +892,11 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
|
||||
nrfx_isr, nrfx_i2s_irq_handler, 0); \
|
||||
irq_enable(DT_IRQN(I2S(idx))); \
|
||||
k_msgq_init(&i2s_nrfx_data##idx.tx_queue, \
|
||||
(char *)tx_msgs, sizeof(void *), \
|
||||
CONFIG_I2S_NRFX_TX_BLOCK_COUNT); \
|
||||
(char *)tx_msgs##idx, sizeof(void *), \
|
||||
ARRAY_SIZE(tx_msgs##idx)); \
|
||||
k_msgq_init(&i2s_nrfx_data##idx.rx_queue, \
|
||||
(char *)rx_msgs, sizeof(void *), \
|
||||
CONFIG_I2S_NRFX_RX_BLOCK_COUNT); \
|
||||
(char *)rx_msgs##idx, sizeof(void *), \
|
||||
ARRAY_SIZE(rx_msgs##idx)); \
|
||||
init_clock_manager(dev); \
|
||||
return 0; \
|
||||
} \
|
||||
|
||||
@@ -10,7 +10,6 @@ config MODEM_QUECTEL_BG9X
|
||||
select MODEM_IFACE_UART
|
||||
select MODEM_SOCKET
|
||||
select NET_SOCKETS_OFFLOAD
|
||||
imply GPIO
|
||||
help
|
||||
Choose this setting to enable quectel BG9x LTE-CatM1/NB-IoT modem
|
||||
driver.
|
||||
|
||||
@@ -11,7 +11,6 @@ config MODEM_UBLOX_SARA
|
||||
select MODEM_SOCKET
|
||||
select NET_OFFLOAD
|
||||
select NET_SOCKETS_OFFLOAD
|
||||
imply GPIO
|
||||
help
|
||||
Choose this setting to enable u-blox SARA-R4 LTE-CatM1/NB-IoT modem
|
||||
driver.
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# Misc network drivers configuration options
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menuconfig NET_DRIVERS
|
||||
bool "Network Drivers"
|
||||
|
||||
if NET_DRIVERS
|
||||
|
||||
#
|
||||
# PPP options
|
||||
#
|
||||
@@ -90,8 +95,7 @@ endif # NET_PPP
|
||||
# SLIP options
|
||||
#
|
||||
menuconfig SLIP
|
||||
bool "SLIP driver"
|
||||
depends on (!QEMU_TARGET || NET_QEMU_SLIP)
|
||||
bool "SLIP driver" if !QEMU_TARGET
|
||||
depends on NET_NATIVE
|
||||
select UART_PIPE
|
||||
select UART_INTERRUPT_DRIVEN
|
||||
@@ -149,3 +153,5 @@ module-help = Sets log level for network loopback driver.
|
||||
source "subsys/net/Kconfig.template.log_config.net"
|
||||
|
||||
endif
|
||||
|
||||
endif # NET_DRIVERS
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_library()
|
||||
|
||||
# Board initialization
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_CC13XX_CC26XX pinmux_cc13xx_cc26xx.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_ESP32 pinmux_esp32.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_HSDK pinmux_hsdk.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_INTEL_S1000 pinmux_intel_s1000.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_ITE_IT8XXX2 pinmux_ite_it8xxx2.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_LPC11U6X pinmux_lpc11u6x.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_MCUX pinmux_mcux.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_MCUX_LPC pinmux_mcux_lpc.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_RV32M1 pinmux_rv32m1.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_SAM0 pinmux_sam0.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_SIFIVE pinmux_sifive.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_STM32 pinmux_stm32.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_TELINK_B91 pinmux_b91.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_PINMUX_XEC pinmux_mchp_xec.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_TELINK_B91 pinmux_b91.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_CC13XX_CC26XX pinmux_cc13xx_cc26xx.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_ESP32 pinmux_esp32.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_HSDK pinmux_hsdk.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_INTEL_S1000 pinmux_intel_s1000.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_ITE_IT8XXX2 pinmux_ite_it8xxx2.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_LPC11U6X pinmux_lpc11u6x.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_MCUX pinmux_mcux.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_MCUX_LPC pinmux_mcux_lpc.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_RV32M1 pinmux_rv32m1.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_SAM0 pinmux_sam0.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_SIFIVE pinmux_sifive.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_STM32 pinmux_stm32.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_XEC pinmux_mchp_xec.c)
|
||||
|
||||
@@ -169,10 +169,13 @@ static int pwm_nrfx_pin_set(const struct device *dev, uint32_t pwm,
|
||||
pulse_cycles /= 2;
|
||||
}
|
||||
|
||||
/* Check if period_cycle is either matching currently used, or
|
||||
/* Check if period_cycles is either matching currently used, or
|
||||
* possible to use with our prescaler options.
|
||||
* Don't do anything if the period length happens to be zero.
|
||||
* In such case, pulse cycles will be right below limited to 0
|
||||
* and this will result in making the channel inactive.
|
||||
*/
|
||||
if (period_cycles != data->period_cycles) {
|
||||
if (period_cycles != 0 && period_cycles != data->period_cycles) {
|
||||
int ret = pwm_period_check_and_set(config, data, channel,
|
||||
period_cycles);
|
||||
if (ret) {
|
||||
|
||||
@@ -485,7 +485,6 @@ static int fdc2x1x_device_pm_ctrl(const struct device *dev,
|
||||
enum pm_device_action action)
|
||||
{
|
||||
int ret;
|
||||
struct fdc2x1x_data *data = dev->data;
|
||||
const struct fdc2x1x_config *cfg = dev->config;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
@@ -613,7 +612,6 @@ static int fdc2x1x_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
struct fdc2x1x_data *data = dev->data;
|
||||
enum pm_device_state state;
|
||||
|
||||
(void)pm_device_state_get(dev, &state);
|
||||
|
||||
@@ -1432,15 +1432,20 @@ struct bt_hci_cp_le_ext_create_conn {
|
||||
#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_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 options;
|
||||
uint8_t sid;
|
||||
bt_addr_le_t addr;
|
||||
uint16_t skip;
|
||||
|
||||
@@ -177,6 +177,10 @@ struct bt_l2cap_le_chan {
|
||||
* @ref BT_L2CAP_SDU_RX_MTU by the stack.
|
||||
*/
|
||||
struct bt_l2cap_le_endpoint rx;
|
||||
|
||||
/** Pending RX MTU on ECFC reconfigure, used internally by stack */
|
||||
uint16_t pending_rx_mtu;
|
||||
|
||||
/** Channel Transmission Endpoint */
|
||||
struct bt_l2cap_le_endpoint tx;
|
||||
/** Channel Transmission queue */
|
||||
@@ -316,6 +320,16 @@ struct bt_l2cap_chan_ops {
|
||||
* references to the channel object.
|
||||
*/
|
||||
void (*released)(struct bt_l2cap_chan *chan);
|
||||
|
||||
/** @brief Channel reconfigured callback
|
||||
*
|
||||
* If this callback is provided it will be called whenever peer or
|
||||
* local device requested reconfiguration. Application may check
|
||||
* updated MTU and MPS values by inspecting chan->le endpoints.
|
||||
*
|
||||
* @param chan The channel which was reconfigured
|
||||
*/
|
||||
void (*reconfigured)(struct bt_l2cap_chan *chan);
|
||||
};
|
||||
|
||||
/** @def BT_L2CAP_CHAN_SEND_RESERVE
|
||||
@@ -414,6 +428,20 @@ int bt_l2cap_br_server_register(struct bt_l2cap_server *server);
|
||||
int bt_l2cap_ecred_chan_connect(struct bt_conn *conn,
|
||||
struct bt_l2cap_chan **chans, uint16_t psm);
|
||||
|
||||
/** @brief Reconfigure Enhanced Credit Based L2CAP channels
|
||||
*
|
||||
* Reconfigure up to 5 L2CAP channels. Channels must be from the same bt_conn.
|
||||
* Once reconfiguration is completed each channel reconfigured() callback will
|
||||
* be called. MTU cannot be decreased on any of provided channels.
|
||||
*
|
||||
* @param chans Array of channel objects. Null-terminated. Elements after the
|
||||
* first 5 are silently ignored.
|
||||
* @param mtu Channel MTU to reconfigure to.
|
||||
*
|
||||
* @return 0 in case of success or negative value in case of error.
|
||||
*/
|
||||
int bt_l2cap_ecred_chan_reconfigure(struct bt_l2cap_chan **chans, uint16_t mtu);
|
||||
|
||||
/** @brief Connect L2CAP channel
|
||||
*
|
||||
* Connect L2CAP channel by PSM, once the connection is completed channel
|
||||
|
||||
148
include/device.h
148
include/device.h
@@ -479,48 +479,8 @@ device_required_handles_get(const struct device *dev,
|
||||
if (rv != NULL) {
|
||||
size_t i = 0;
|
||||
|
||||
while (rv[i] != DEVICE_HANDLE_SEP) {
|
||||
++i;
|
||||
}
|
||||
*count = i;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the set of handles that this device supports.
|
||||
*
|
||||
* The set of supported devices is inferred from devicetree, and does not
|
||||
* include any software constructs that may depend on the device.
|
||||
*
|
||||
* @param dev the device for which supports are desired.
|
||||
*
|
||||
* @param count pointer to a place to store the number of devices provided at
|
||||
* the returned pointer. The value is not set if the call returns a null
|
||||
* pointer. The value may be set to zero.
|
||||
*
|
||||
* @return a pointer to a sequence of @p *count device handles, or a null
|
||||
* pointer if @p dh does not provide dependency information.
|
||||
*/
|
||||
static inline const device_handle_t *
|
||||
device_supported_handles_get(const struct device *dev,
|
||||
size_t *count)
|
||||
{
|
||||
const device_handle_t *rv = dev->handles;
|
||||
size_t region = 0;
|
||||
size_t i = 0;
|
||||
|
||||
if (rv != NULL) {
|
||||
/* Fast forward to supporting devices */
|
||||
while (region != 2) {
|
||||
if (*rv == DEVICE_HANDLE_SEP) {
|
||||
region++;
|
||||
}
|
||||
rv++;
|
||||
}
|
||||
/* Count supporting devices */
|
||||
while (rv[i] != DEVICE_HANDLE_ENDS) {
|
||||
while ((rv[i] != DEVICE_HANDLE_ENDS)
|
||||
&& (rv[i] != DEVICE_HANDLE_SEP)) {
|
||||
++i;
|
||||
}
|
||||
*count = i;
|
||||
@@ -566,42 +526,6 @@ int device_required_foreach(const struct device *dev,
|
||||
device_visitor_callback_t visitor_cb,
|
||||
void *context);
|
||||
|
||||
/**
|
||||
* @brief Visit every device that @p dev directly supports.
|
||||
*
|
||||
* Zephyr maintains information about which devices are directly supported by
|
||||
* another device; for example an I2C controller will support an I2C-based
|
||||
* sensor driver. Supported devices can derive from statically-defined
|
||||
* devicetree relationships.
|
||||
*
|
||||
* This API supports operating on the set of supported devices. Example uses
|
||||
* include iterating over the devices connected to a regulator when it is
|
||||
* powered on.
|
||||
*
|
||||
* There is no guarantee on the order in which required devices are visited.
|
||||
*
|
||||
* If the @p visitor function returns a negative value iteration is halted,
|
||||
* and the returned value from the visitor is returned from this function.
|
||||
*
|
||||
* @note This API is not available to unprivileged threads.
|
||||
*
|
||||
* @param dev a device of interest. The devices that this device supports
|
||||
* will be used as the set of devices to visit. This parameter must not be
|
||||
* null.
|
||||
*
|
||||
* @param visitor_cb the function that should be invoked on each device in the
|
||||
* support set. This parameter must not be null.
|
||||
*
|
||||
* @param context state that is passed through to the visitor function. This
|
||||
* parameter may be null if @p visitor tolerates a null @p context.
|
||||
*
|
||||
* @return The number of devices that were visited if all visits succeed, or
|
||||
* the negative value returned from the first visit that did not succeed.
|
||||
*/
|
||||
int device_supported_foreach(const struct device *dev,
|
||||
device_visitor_callback_t visitor_cb,
|
||||
void *context);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the device structure for a driver by name
|
||||
*
|
||||
@@ -762,6 +686,50 @@ static inline bool device_is_ready(const struct device *dev)
|
||||
Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
|
||||
Z_DEVICE_DEFINE_PM_SLOT(dev_name)
|
||||
|
||||
/* Helper macros needed for CONFIG_DEVICE_HANDLE_PADDING. These should
|
||||
* be deleted when that option is removed.
|
||||
*
|
||||
* This is implemented "by hand" -- rather than using a helper macro
|
||||
* like UTIL_LISTIFY() -- because we need to allow users to wrap
|
||||
* DEVICE_DT_DEFINE with UTIL_LISTIFY, like this:
|
||||
*
|
||||
* #define DEFINE_FOO_DEVICE(...) DEVICE_DT_DEFINE(...)
|
||||
* UTIL_LISTIFY(N, DEFINE_FOO_DEVICE)
|
||||
*
|
||||
* If Z_DEVICE_HANDLE_PADDING uses UTIL_LISTIFY, this type of code
|
||||
* would fail, because the UTIL_LISTIFY token within the
|
||||
* Z_DEVICE_DEFINE_HANDLES expansion would not be expanded again,
|
||||
* since it appears in a context where UTIL_LISTIFY is already being
|
||||
* expanded. Standard C does not reexpand macros appearing in their
|
||||
* own expansion; this would lead to infinite recursions in general.
|
||||
*/
|
||||
#define Z_DEVICE_HANDLE_PADDING \
|
||||
Z_DEVICE_HANDLE_PADDING_(CONFIG_DEVICE_HANDLE_PADDING)
|
||||
#define Z_DEVICE_HANDLE_PADDING_(count) \
|
||||
Z_DEVICE_HANDLE_PADDING__(count)
|
||||
#define Z_DEVICE_HANDLE_PADDING__(count) \
|
||||
Z_DEVICE_HANDLE_PADDING_ ## count
|
||||
#define Z_DEVICE_HANDLE_PADDING_10 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_9
|
||||
#define Z_DEVICE_HANDLE_PADDING_9 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_8
|
||||
#define Z_DEVICE_HANDLE_PADDING_8 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_7
|
||||
#define Z_DEVICE_HANDLE_PADDING_7 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_6
|
||||
#define Z_DEVICE_HANDLE_PADDING_6 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_5
|
||||
#define Z_DEVICE_HANDLE_PADDING_5 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_4
|
||||
#define Z_DEVICE_HANDLE_PADDING_4 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_3
|
||||
#define Z_DEVICE_HANDLE_PADDING_3 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_2
|
||||
#define Z_DEVICE_HANDLE_PADDING_2 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_1
|
||||
#define Z_DEVICE_HANDLE_PADDING_1 \
|
||||
DEVICE_HANDLE_ENDS, Z_DEVICE_HANDLE_PADDING_0
|
||||
#define Z_DEVICE_HANDLE_PADDING_0 EMPTY
|
||||
|
||||
/* Initial build provides a record that associates the device object
|
||||
* with its devicetree ordinal, and provides the dependency ordinals.
|
||||
@@ -770,26 +738,6 @@ static inline bool device_is_ready(const struct device *dev)
|
||||
* in a distinct pass1 section (which will be replaced by
|
||||
* postprocessing).
|
||||
*
|
||||
* Before processing in gen_handles.py, the array format is:
|
||||
* {
|
||||
* DEVICE_ORDINAL (or DEVICE_HANDLE_NULL if not a devicetree node),
|
||||
* List of devicetree dependency ordinals (if any),
|
||||
* DEVICE_HANDLE_SEP,
|
||||
* List of injected dependency ordinals (if any),
|
||||
* DEVICE_HANDLE_SEP,
|
||||
* List of devicetree supporting ordinals (if any),
|
||||
* }
|
||||
*
|
||||
* After processing in gen_handles.py, the format is updated to:
|
||||
* {
|
||||
* List of existing devicetree dependency handles (if any),
|
||||
* DEVICE_HANDLE_SEP,
|
||||
* List of injected dependency ordinals (if any),
|
||||
* DEVICE_HANDLE_SEP,
|
||||
* List of existing devicetree support handles (if any),
|
||||
* DEVICE_HANDLE_NULL padding to original length (at least one)
|
||||
* }
|
||||
*
|
||||
* It is also (experimentally) necessary to provide explicit alignment
|
||||
* on each object. Otherwise x86-64 builds will introduce padding
|
||||
* between objects in the same input section in individual object
|
||||
@@ -818,9 +766,7 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
|
||||
)) \
|
||||
DEVICE_HANDLE_SEP, \
|
||||
Z_DEVICE_EXTRA_HANDLES(__VA_ARGS__) \
|
||||
DEVICE_HANDLE_SEP, \
|
||||
COND_CODE_1(DT_NODE_EXISTS(node_id), \
|
||||
(DT_SUPPORTS_DEP_ORDS(node_id)), ()) \
|
||||
Z_DEVICE_HANDLE_PADDING \
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief reserved-memory Devicetree macro public API header file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_DEVICETREE_MEMORY_H_
|
||||
#define ZEPHYR_INCLUDE_DEVICETREE_MEMORY_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup devicetree-reserved Devicetree reserved-memory API
|
||||
* @ingroup devicetree
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the pointer to the reserved-memory region
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* n: node {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(n)) // (uint8_t *) 0x42000000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @return pointer to the beginning of the reserved-memory region
|
||||
*/
|
||||
#define DT_RESERVED_MEM_GET_PTR(node_id) _DT_RESERVED_START(node_id)
|
||||
|
||||
/**
|
||||
* @brief Get the size of the reserved-memory region
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* n: node {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(n)) // 0x1000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @return the size of the reserved-memory region
|
||||
*/
|
||||
#define DT_RESERVED_MEM_GET_SIZE(node_id) DT_REG_SIZE(node_id)
|
||||
|
||||
/**
|
||||
* @brief Get the pointer to the reserved-memory region from a memory-reserved
|
||||
* phandle
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* res0: res {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* label = "res0";
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* n: node {
|
||||
* memory-region = <&res0>;
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(n), memory_region) // (uint8_t *) 0x42000000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @param ph phandle to reserved-memory region
|
||||
*
|
||||
* @return pointer to the beginning of the reserved-memory region
|
||||
*/
|
||||
#define DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(node_id, ph) \
|
||||
DT_RESERVED_MEM_GET_PTR(DT_PHANDLE(node_id, ph))
|
||||
|
||||
/**
|
||||
* @brief Get the size of the reserved-memory region from a memory-reserved
|
||||
* phandle
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* res0: res {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* label = "res0";
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* n: node {
|
||||
* memory-region = <&res0>;
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(n), memory_region) // (uint8_t *) 0x42000000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @param ph phandle to reserved-memory region
|
||||
*
|
||||
* @return size of the reserved-memory region
|
||||
*/
|
||||
#define DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(node_id, ph) \
|
||||
DT_RESERVED_MEM_GET_SIZE(DT_PHANDLE(node_id, ph))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_DEVICETREE_MEMORY_H_ */
|
||||
@@ -34,26 +34,23 @@ extern "C" {
|
||||
* @brief Non-volatile Storage File system structure
|
||||
*
|
||||
* @param offset File system offset in flash
|
||||
* @param ate_wra: Allocation table entry write address. Addresses are stored
|
||||
* as uint32_t: high 2 bytes are sector, low 2 bytes are offset in sector,
|
||||
* @param data_wra: Data write address.
|
||||
* @param sector_size File system is divided into sectors each sector should be
|
||||
* multiple of pagesize
|
||||
* @param sector_count Amount of sectors in the file systems
|
||||
* @param write_block_size Alignment size
|
||||
* @param ate_wra Allocation table entry write address. Addresses are stored as uint32_t:
|
||||
* high 2 bytes correspond to the sector, low 2 bytes are the offset in the sector
|
||||
* @param data_wra Data write address
|
||||
* @param sector_size File system is split into sectors, each sector must be multiple of pagesize
|
||||
* @param sector_count Number of sectors in the file systems
|
||||
* @param ready Flag indicating if the filesystem is initialized
|
||||
* @param nvs_lock Mutex
|
||||
* @param flash_device Flash Device
|
||||
* @param flash_device Flash Device runtime structure
|
||||
* @param flash_parameters Flash memory parameters structure
|
||||
*/
|
||||
struct nvs_fs {
|
||||
off_t offset; /* filesystem offset in flash */
|
||||
uint32_t ate_wra; /* next alloc table entry write address */
|
||||
uint32_t data_wra; /* next data write address */
|
||||
uint16_t sector_size; /* filesystem is divided into sectors,
|
||||
* sector size should be multiple of pagesize
|
||||
*/
|
||||
uint16_t sector_count; /* amount of sectors in the filesystem */
|
||||
bool ready; /* is the filesystem initialized ? */
|
||||
|
||||
off_t offset;
|
||||
uint32_t ate_wra;
|
||||
uint32_t data_wra;
|
||||
uint16_t sector_size;
|
||||
uint16_t sector_count;
|
||||
bool ready;
|
||||
struct k_mutex nvs_lock;
|
||||
const struct device *flash_device;
|
||||
const struct flash_parameters *flash_parameters;
|
||||
@@ -102,10 +99,10 @@ int nvs_clear(struct nvs_fs *fs);
|
||||
* @param data Pointer to the data to be written
|
||||
* @param len Number of bytes to be written
|
||||
*
|
||||
* @return Number of bytes written. On success, it will be equal to the number
|
||||
* of bytes requested to be written. On error returns -ERRNO code.
|
||||
* @return Number of bytes written. On success, it will be equal to the number of bytes requested
|
||||
* to be written. When a rewrite of the same data already stored is attempted, nothing is written
|
||||
* to flash, thus 0 is returned. On error, returns negative value of errno.h defined error codes.
|
||||
*/
|
||||
|
||||
ssize_t nvs_write(struct nvs_fs *fs, uint16_t id, const void *data, size_t len);
|
||||
|
||||
/**
|
||||
@@ -130,10 +127,10 @@ int nvs_delete(struct nvs_fs *fs, uint16_t id);
|
||||
* @param data Pointer to data buffer
|
||||
* @param len Number of bytes to be read
|
||||
*
|
||||
* @return Number of bytes read. On success, it will be equal to the number
|
||||
* of bytes requested to be read. When the return value is larger than the
|
||||
* number of bytes requested to read this indicates not all bytes were read,
|
||||
* and more data is available. On error returns -ERRNO code.
|
||||
* @return Number of bytes read. On success, it will be equal to the number of bytes requested
|
||||
* to be read. When the return value is larger than the number of bytes requested to read this
|
||||
* indicates not all bytes were read, and more data is available. On error, returns negative
|
||||
* value of errno.h defined error codes.
|
||||
*/
|
||||
ssize_t nvs_read(struct nvs_fs *fs, uint16_t id, void *data, size_t len);
|
||||
|
||||
@@ -146,15 +143,14 @@ ssize_t nvs_read(struct nvs_fs *fs, uint16_t id, void *data, size_t len);
|
||||
* @param id Id of the entry to be read
|
||||
* @param data Pointer to data buffer
|
||||
* @param len Number of bytes to be read
|
||||
* @param cnt History counter: 0: latest entry, 1:one before latest ...
|
||||
* @param cnt History counter: 0: latest entry, 1: one before latest ...
|
||||
*
|
||||
* @return Number of bytes read. On success, it will be equal to the number
|
||||
* of bytes requested to be read. When the return value is larger than the
|
||||
* number of bytes requested to read this indicates not all bytes were read,
|
||||
* and more data is available. On error returns -ERRNO code.
|
||||
* @return Number of bytes read. On success, it will be equal to the number of bytes requested
|
||||
* to be read. When the return value is larger than the number of bytes requested to read this
|
||||
* indicates not all bytes were read, and more data is available. On error, returns negative
|
||||
* value of errno.h defined error codes.
|
||||
*/
|
||||
ssize_t nvs_read_hist(struct nvs_fs *fs, uint16_t id, void *data, size_t len,
|
||||
uint16_t cnt);
|
||||
ssize_t nvs_read_hist(struct nvs_fs *fs, uint16_t id, void *data, size_t len, uint16_t cnt);
|
||||
|
||||
/**
|
||||
* @brief nvs_calc_free_space
|
||||
@@ -163,10 +159,9 @@ ssize_t nvs_read_hist(struct nvs_fs *fs, uint16_t id, void *data, size_t len,
|
||||
*
|
||||
* @param fs Pointer to file system
|
||||
*
|
||||
* @return Number of bytes free. On success, it will be equal to the number
|
||||
* of bytes that can still be written to the file system. Calculating the
|
||||
* free space is a time consuming operation, especially on spi flash.
|
||||
* On error returns -ERRNO code.
|
||||
* @return Number of bytes free. On success, it will be equal to the number of bytes that can
|
||||
* still be written to the file system. Calculating the free space is a time consuming operation,
|
||||
* especially on spi flash. On error, returns negative value of errno.h defined error codes.
|
||||
*/
|
||||
ssize_t nvs_calc_free_space(struct nvs_fs *fs);
|
||||
|
||||
|
||||
@@ -743,7 +743,7 @@ __syscall void k_thread_priority_set(k_tid_t thread, int prio);
|
||||
* integers. The number of cycles between the "first" deadline in the
|
||||
* scheduler queue and the "last" deadline must be less than 2^31 (i.e
|
||||
* a signed non-negative quantity). Failure to adhere to this rule
|
||||
* may result in scheduled threads running in an incorrect dealine
|
||||
* may result in scheduled threads running in an incorrect deadline
|
||||
* order.
|
||||
*
|
||||
* @note Despite the API naming, the scheduler makes no guarantees the
|
||||
|
||||
@@ -46,14 +46,122 @@
|
||||
/**
|
||||
* @brief Generate region definitions for all the reserved memory regions
|
||||
*/
|
||||
#define DT_RESERVED_MEM_REGIONS() _RESERVED_REGION_APPLY(_RESERVED_REGION_DECLARE)
|
||||
#define LINKER_DT_RESERVED_MEM_REGIONS() _RESERVED_REGION_APPLY(_RESERVED_REGION_DECLARE)
|
||||
|
||||
/**
|
||||
* @brief Generate section definitions for all the reserved memory regions
|
||||
*/
|
||||
#define DT_RESERVED_MEM_SECTIONS() _RESERVED_REGION_APPLY(_RESERVED_SECTION_DECLARE)
|
||||
#define LINKER_DT_RESERVED_MEM_SECTIONS() _RESERVED_REGION_APPLY(_RESERVED_SECTION_DECLARE)
|
||||
|
||||
/**
|
||||
* @brief Generate linker script symbols for all the reserved memory regions
|
||||
*/
|
||||
#define DT_RESERVED_MEM_SYMBOLS() _RESERVED_REGION_APPLY(_RESERVED_SYMBOL_DECLARE)
|
||||
#define LINKER_DT_RESERVED_MEM_SYMBOLS() _RESERVED_REGION_APPLY(_RESERVED_SYMBOL_DECLARE)
|
||||
|
||||
/**
|
||||
* @brief Get the pointer to the reserved-memory region
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* n: node {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* LINKER_DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(n)) // (uint8_t *) 0x42000000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @return pointer to the beginning of the reserved-memory region
|
||||
*/
|
||||
#define LINKER_DT_RESERVED_MEM_GET_PTR(node_id) _DT_RESERVED_START(node_id)
|
||||
|
||||
/**
|
||||
* @brief Get the size of the reserved-memory region
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* n: node {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* LINKER_DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(n)) // 0x1000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @return the size of the reserved-memory region
|
||||
*/
|
||||
#define LINKER_DT_RESERVED_MEM_GET_SIZE(node_id) DT_REG_SIZE(node_id)
|
||||
|
||||
/**
|
||||
* @brief Get the pointer to the reserved-memory region from a memory-reserved
|
||||
* phandle
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* res0: res {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* label = "res0";
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* n: node {
|
||||
* memory-region = <&res0>;
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* LINKER_DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(n), \
|
||||
* memory_region) // (uint8_t *) 0x42000000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @param ph phandle to reserved-memory region
|
||||
*
|
||||
* @return pointer to the beginning of the reserved-memory region
|
||||
*/
|
||||
#define LINKER_DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(node_id, ph) \
|
||||
LINKER_DT_RESERVED_MEM_GET_PTR(DT_PHANDLE(node_id, ph))
|
||||
|
||||
/**
|
||||
* @brief Get the size of the reserved-memory region from a memory-reserved
|
||||
* phandle
|
||||
*
|
||||
* Example devicetree fragment:
|
||||
*
|
||||
* reserved: reserved-memory {
|
||||
* compatible = "reserved-memory";
|
||||
* ...
|
||||
* res0: res {
|
||||
* reg = <0x42000000 0x1000>;
|
||||
* label = "res0";
|
||||
* };
|
||||
* };
|
||||
*
|
||||
* n: node {
|
||||
* memory-region = <&res0>;
|
||||
* };
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* LINKER_DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(n), \
|
||||
* memory_region) // (uint8_t *) 0x42000000
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @param ph phandle to reserved-memory region
|
||||
*
|
||||
* @return size of the reserved-memory region
|
||||
*/
|
||||
#define LINKER_DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(node_id, ph) \
|
||||
LINKER_DT_RESERVED_MEM_GET_SIZE(DT_PHANDLE(node_id, ph))
|
||||
|
||||
@@ -259,7 +259,7 @@ extern char _vector_start[];
|
||||
extern char _vector_end[];
|
||||
|
||||
#if DT_NODE_HAS_STATUS(_NODE_RESERVED, okay)
|
||||
DT_RESERVED_MEM_SYMBOLS()
|
||||
LINKER_DT_RESERVED_MEM_SYMBOLS()
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SW_VECTOR_RELAY
|
||||
|
||||
@@ -542,7 +542,7 @@ static inline uint32_t log_msg2_get_total_wlen(const struct log_msg2_desc desc)
|
||||
*
|
||||
* @return Length in 32 bit words.
|
||||
*/
|
||||
static inline uint32_t log_msg2_generic_get_wlen(union mpsc_pbuf_generic *item)
|
||||
static inline uint32_t log_msg2_generic_get_wlen(const union mpsc_pbuf_generic *item)
|
||||
{
|
||||
union log_msg2_generic *generic_msg = (union log_msg2_generic *)item;
|
||||
|
||||
|
||||
@@ -50,6 +50,38 @@ extern "C" {
|
||||
/** RFC 1034 Section 3.1, RFC 6763 Section 7.2 */
|
||||
#define DNS_SD_DOMAIN_MAX_SIZE 63
|
||||
|
||||
/**
|
||||
* Minimum number of segments in a fully-qualified name
|
||||
*
|
||||
* This reqpresents FQN's of the form below
|
||||
* ```
|
||||
* <sn>._tcp.<domain>.
|
||||
* ```
|
||||
* Currently sub-types and service domains are unsupported and only the
|
||||
* "local" domain is supported. Specifically, that excludes the following:
|
||||
* ```
|
||||
* <sub>._sub.<sn>._tcp.<servicedomain>.<parentdomain>.
|
||||
* ```
|
||||
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6763">RFC 6763</a>, Section 7.2.
|
||||
*/
|
||||
#define DNS_SD_MIN_LABELS 3
|
||||
/**
|
||||
* Maximum number of segments in a fully-qualified name
|
||||
*
|
||||
* This reqpresents FQN's of the form below
|
||||
* ```
|
||||
* <instance>.<sn>._tcp.<domain>.
|
||||
* ```
|
||||
*
|
||||
* Currently sub-types and service domains are unsupported and only the
|
||||
* "local" domain is supported. Specifically, that excludes the following:
|
||||
* ```
|
||||
* <sub>._sub.<sn>._tcp.<servicedomain>.<parentdomain>.
|
||||
* ```
|
||||
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6763">RFC 6763</a>, Section 7.2.
|
||||
*/
|
||||
#define DNS_SD_MAX_LABELS 4
|
||||
|
||||
/**
|
||||
* @brief Register a service for DNS Service Discovery
|
||||
*
|
||||
@@ -209,6 +241,12 @@ struct dns_sd_rec {
|
||||
* @internal
|
||||
*/
|
||||
extern const char dns_sd_empty_txt[1];
|
||||
/**
|
||||
* @brief Wildcard Port specifier for DNS-SD
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
extern const uint16_t dns_sd_port_zero;
|
||||
|
||||
/** @endcond */
|
||||
|
||||
@@ -223,6 +261,32 @@ static inline size_t dns_sd_txt_size(const struct dns_sd_rec *rec)
|
||||
return rec->text_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if @a rec is a DNS-SD Service Type Enumeration
|
||||
*
|
||||
* DNS-SD Service Type Enumeration is used by network tooling to
|
||||
* acquire a list of all mDNS-advertised services belonging to a
|
||||
* particular host on a particular domain.
|
||||
*
|
||||
* For example, for the domain '.local', the equivalent query
|
||||
* would be '_services._dns-sd._udp.local'.
|
||||
*
|
||||
* Currently, only the '.local' domain is supported.
|
||||
*
|
||||
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6763#section-9">Service Type Enumeration, RFC 6763</a>.
|
||||
*
|
||||
* @param rec the record to in question
|
||||
* @return true if @a rec is a DNS-SD Service Type Enumeration
|
||||
*/
|
||||
bool dns_sd_is_service_type_enumeration(const struct dns_sd_rec *rec);
|
||||
|
||||
/**
|
||||
* @brief Create a wildcard filter for DNS-SD records
|
||||
*
|
||||
* @param filter a pointer to the filter to use
|
||||
*/
|
||||
void dns_sd_create_wildcard_filter(struct dns_sd_rec *filter);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,7 @@ struct mpsc_pbuf_buffer;
|
||||
*
|
||||
* @return Size of the packet in 32 bit words.
|
||||
*/
|
||||
typedef uint32_t (*mpsc_pbuf_get_wlen)(union mpsc_pbuf_generic *packet);
|
||||
typedef uint32_t (*mpsc_pbuf_get_wlen)(const union mpsc_pbuf_generic *packet);
|
||||
|
||||
/** @brief Callback called when packet is dropped.
|
||||
*
|
||||
@@ -77,8 +77,8 @@ typedef uint32_t (*mpsc_pbuf_get_wlen)(union mpsc_pbuf_generic *packet);
|
||||
*
|
||||
* @param packet Packet that is being dropped.
|
||||
*/
|
||||
typedef void (*mpsc_pbuf_notify_drop)(struct mpsc_pbuf_buffer *buffer,
|
||||
union mpsc_pbuf_generic *packet);
|
||||
typedef void (*mpsc_pbuf_notify_drop)(const struct mpsc_pbuf_buffer *buffer,
|
||||
const union mpsc_pbuf_generic *packet);
|
||||
|
||||
/** @brief MPSC packet buffer structure. */
|
||||
struct mpsc_pbuf_buffer {
|
||||
@@ -179,7 +179,7 @@ void mpsc_pbuf_commit(struct mpsc_pbuf_buffer *buffer,
|
||||
* and data on remaining bits.
|
||||
*/
|
||||
void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
|
||||
union mpsc_pbuf_generic word);
|
||||
const union mpsc_pbuf_generic word);
|
||||
|
||||
/** @brief Put a packet consisting of a word and a pointer.
|
||||
* *
|
||||
@@ -194,7 +194,8 @@ void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
|
||||
* @param data User data.
|
||||
*/
|
||||
void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
|
||||
union mpsc_pbuf_generic word, void *data);
|
||||
const union mpsc_pbuf_generic word,
|
||||
const void *data);
|
||||
|
||||
/** @brief Put a packet into a buffer.
|
||||
*
|
||||
@@ -203,18 +204,20 @@ void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
|
||||
*
|
||||
* @param buffer Buffer.
|
||||
*
|
||||
* @param data First word of data must contain MPSC_PBUF_HDR with valid set.
|
||||
* @param data First word of data must contain MPSC_PBUF_HDR with valid bit set.
|
||||
*
|
||||
* @param wlen Packet size in words.
|
||||
*/
|
||||
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer,
|
||||
uint32_t *data, size_t wlen);
|
||||
const uint32_t *data, size_t wlen);
|
||||
|
||||
/** @brief Claim the first pending packet.
|
||||
*
|
||||
* @param buffer Buffer.
|
||||
*
|
||||
* @return Pointer to the claimed packet or null if none available.
|
||||
*/
|
||||
union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer);
|
||||
const union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer);
|
||||
|
||||
/** @brief Free a packet.
|
||||
*
|
||||
|
||||
@@ -156,6 +156,18 @@
|
||||
*/
|
||||
#define sys_port_trace_k_thread_abort(thread)
|
||||
|
||||
/**
|
||||
* @brief Called when a thread enters the k_thread_abort routine
|
||||
* @param thread Thread object
|
||||
*/
|
||||
#define sys_port_trace_k_thread_abort_enter(thread)
|
||||
|
||||
/**
|
||||
* @brief Called when a thread exits the k_thread_abort routine
|
||||
* @param thread Thread object
|
||||
*/
|
||||
#define sys_port_trace_k_thread_abort_exit(thread)
|
||||
|
||||
/**
|
||||
* @brief Called when setting priority of a thread
|
||||
* @param thread Thread object
|
||||
|
||||
@@ -288,6 +288,22 @@ config WAITQ_DUMB
|
||||
|
||||
endchoice # WAITQ_ALGORITHM
|
||||
|
||||
config DEVICE_HANDLE_PADDING
|
||||
int "Number of additional device handles to use for padding"
|
||||
default 0
|
||||
range 0 10
|
||||
help
|
||||
This is a "fudge factor" which works around build system
|
||||
limitations. It is safe to ignore unless you get a specific
|
||||
build system error about it.
|
||||
|
||||
The option's value is the number of superfluous device handle
|
||||
values which are introduced into the array pointed to by each
|
||||
device's 'handles' member during the first linker pass.
|
||||
|
||||
Each handle uses 2 bytes, so a value of 3 would use an extra
|
||||
6 bytes of ROM for every device.
|
||||
|
||||
menu "Kernel Debugging and Metrics"
|
||||
|
||||
config INIT_STACKS
|
||||
|
||||
@@ -162,11 +162,14 @@ bool z_device_ready(const struct device *dev)
|
||||
return dev->state->initialized && (dev->state->init_res == 0U);
|
||||
}
|
||||
|
||||
static int device_visitor(const device_handle_t *handles,
|
||||
size_t handle_count,
|
||||
device_visitor_callback_t visitor_cb,
|
||||
void *context)
|
||||
int device_required_foreach(const struct device *dev,
|
||||
device_visitor_callback_t visitor_cb,
|
||||
void *context)
|
||||
{
|
||||
size_t handle_count = 0;
|
||||
const device_handle_t *handles =
|
||||
device_required_handles_get(dev, &handle_count);
|
||||
|
||||
/* Iterate over fixed devices */
|
||||
for (size_t i = 0; i < handle_count; ++i) {
|
||||
device_handle_t dh = handles[i];
|
||||
@@ -180,25 +183,3 @@ static int device_visitor(const device_handle_t *handles,
|
||||
|
||||
return handle_count;
|
||||
}
|
||||
|
||||
int device_required_foreach(const struct device *dev,
|
||||
device_visitor_callback_t visitor_cb,
|
||||
void *context)
|
||||
{
|
||||
size_t handle_count = 0;
|
||||
const device_handle_t *handles =
|
||||
device_required_handles_get(dev, &handle_count);
|
||||
|
||||
return device_visitor(handles, handle_count, visitor_cb, context);
|
||||
}
|
||||
|
||||
int device_supported_foreach(const struct device *dev,
|
||||
device_visitor_callback_t visitor_cb,
|
||||
void *context)
|
||||
{
|
||||
size_t handle_count = 0;
|
||||
const device_handle_t *handles =
|
||||
device_supported_handles_get(dev, &handle_count);
|
||||
|
||||
return device_visitor(handles, handle_count, visitor_cb, context);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ void z_timer_expiration_handler(struct _timeout *t)
|
||||
{
|
||||
struct k_timer *timer = CONTAINER_OF(t, struct k_timer, timeout);
|
||||
struct k_thread *thread;
|
||||
k_spinlock_key_t key = k_spin_lock(&lock);
|
||||
|
||||
/*
|
||||
* if the timer is periodic, start it again; don't add _TICK_ALIGN
|
||||
@@ -46,27 +47,23 @@ void z_timer_expiration_handler(struct _timeout *t)
|
||||
}
|
||||
|
||||
if (!IS_ENABLED(CONFIG_MULTITHREADING)) {
|
||||
k_spin_unlock(&lock, key);
|
||||
return;
|
||||
}
|
||||
|
||||
thread = z_waitq_head(&timer->wait_q);
|
||||
|
||||
if (thread == NULL) {
|
||||
k_spin_unlock(&lock, key);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupts _DO NOT_ have to be locked in this specific
|
||||
* instance of thread unpending because a) this is the only
|
||||
* place a thread can be taken off this pend queue, and b) the
|
||||
* only place a thread can be put on the pend queue is at
|
||||
* thread level, which of course cannot interrupt the current
|
||||
* context.
|
||||
*/
|
||||
z_unpend_thread_no_timeout(thread);
|
||||
|
||||
arch_thread_return_value_set(thread, 0);
|
||||
|
||||
k_spin_unlock(&lock, key);
|
||||
|
||||
z_ready_thread(thread);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ static union mpsc_pbuf_generic *drop_item_locked(struct mpsc_pbuf_buffer *buffer
|
||||
}
|
||||
|
||||
void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer,
|
||||
union mpsc_pbuf_generic item)
|
||||
const union mpsc_pbuf_generic item)
|
||||
{
|
||||
bool cont;
|
||||
uint32_t free_wlen;
|
||||
@@ -305,7 +305,8 @@ void mpsc_pbuf_commit(struct mpsc_pbuf_buffer *buffer,
|
||||
}
|
||||
|
||||
void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
|
||||
union mpsc_pbuf_generic item, void *data)
|
||||
const union mpsc_pbuf_generic item,
|
||||
const void *data)
|
||||
{
|
||||
static const size_t l =
|
||||
(sizeof(item) + sizeof(data)) / sizeof(uint32_t);
|
||||
@@ -327,7 +328,7 @@ void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
|
||||
void **p =
|
||||
(void **)&buffer->buf[buffer->tmp_wr_idx + 1];
|
||||
|
||||
*p = data;
|
||||
*p = (void *)data;
|
||||
buffer->tmp_wr_idx =
|
||||
idx_inc(buffer, buffer->tmp_wr_idx, l);
|
||||
buffer->wr_idx = idx_inc(buffer, buffer->wr_idx, l);
|
||||
@@ -352,7 +353,7 @@ void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer,
|
||||
} while (cont);
|
||||
}
|
||||
|
||||
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, uint32_t *data,
|
||||
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, const uint32_t *data,
|
||||
size_t wlen)
|
||||
{
|
||||
bool cont;
|
||||
@@ -395,7 +396,7 @@ void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, uint32_t *data,
|
||||
} while (cont);
|
||||
}
|
||||
|
||||
union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer)
|
||||
const union mpsc_pbuf_generic *mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer)
|
||||
{
|
||||
union mpsc_pbuf_generic *item;
|
||||
bool cont;
|
||||
|
||||
@@ -3,6 +3,4 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
zephyr_library()
|
||||
|
||||
zephyr_include_directories(.)
|
||||
|
||||
@@ -209,7 +209,8 @@ static void create_sync(void)
|
||||
|
||||
printk("Creating Periodic Advertising Sync...");
|
||||
bt_addr_le_copy(&sync_create_param.addr, &per_addr);
|
||||
sync_create_param.options = 0;
|
||||
|
||||
sync_create_param.options = BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT;
|
||||
sync_create_param.sid = per_sid;
|
||||
sync_create_param.skip = 0;
|
||||
sync_create_param.timeout = 0xa;
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
DT_RESERVED_MEM_REGIONS()
|
||||
LINKER_DT_RESERVED_MEM_REGIONS()
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
DT_RESERVED_MEM_SECTIONS()
|
||||
LINKER_DT_RESERVED_MEM_SECTIONS()
|
||||
}
|
||||
|
||||
#include <arch/arm64/scripts/linker.ld>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <devicetree/memory.h>
|
||||
#include <linker/linker-defs.h>
|
||||
|
||||
/* Variables placed in reserved sections */
|
||||
@@ -18,17 +17,17 @@ void main(void)
|
||||
uint32_t res_size_outer, res_size_inner;
|
||||
|
||||
res_ptr_outer =
|
||||
DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
|
||||
memory_region);
|
||||
LINKER_DT_RESERVED_MEM_GET_PTR_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
|
||||
memory_region);
|
||||
res_size_outer =
|
||||
DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
|
||||
memory_region);
|
||||
LINKER_DT_RESERVED_MEM_GET_SIZE_BY_PHANDLE(DT_NODELABEL(sample_driver_outer),
|
||||
memory_region);
|
||||
|
||||
printk("Reserved memory address for the outer driver: %p\n", res_ptr_outer);
|
||||
printk("Reserved memory size for the outer driver: %d\n", res_size_outer);
|
||||
|
||||
res_ptr_inner = DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(res1));
|
||||
res_size_inner = DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(res1));
|
||||
res_ptr_inner = LINKER_DT_RESERVED_MEM_GET_PTR(DT_NODELABEL(res1));
|
||||
res_size_inner = LINKER_DT_RESERVED_MEM_GET_SIZE(DT_NODELABEL(res1));
|
||||
|
||||
printk("Reserved memory address for the inner driver: %p\n", res_ptr_inner);
|
||||
printk("Reserved memory size for the inner driver: %d\n", res_size_inner);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
CONFIG_GPIO=y
|
||||
|
||||
CONFIG_PM=y
|
||||
CONFIG_PM_DEVICE=y
|
||||
CONFIG_PM_DEVICE_RUNTIME=y
|
||||
|
||||
@@ -34,7 +34,7 @@ LEDs). The sample can be built and executed for the TWR-KE18F as
|
||||
follows:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/subsys/canbus/canopen
|
||||
:zephyr-app: samples/modules/canopennode
|
||||
:board: twr_ke18f
|
||||
:goals: build flash
|
||||
:compact:
|
||||
@@ -53,7 +53,7 @@ LED indicators (red and green LEDs)
|
||||
The sample can be built and executed for the FRDM-K64F as follows:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/subsys/canbus/canopen
|
||||
:zephyr-app: samples/modules/canopennode
|
||||
:board: frdm_k64f
|
||||
:goals: build flash
|
||||
:compact:
|
||||
@@ -66,7 +66,7 @@ Building and Running for boards without storage partition
|
||||
The sample can be built for boards without a flash storage partition by using a different configuration file:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/subsys/canbus/canopen
|
||||
:zephyr-app: samples/modules/canopennode
|
||||
:board: <your_board_name>
|
||||
:conf: "prj_no_storage.conf"
|
||||
:goals: build flash
|
||||
@@ -352,7 +352,7 @@ for the FRDM-K64F as follows:
|
||||
#. Rebuild the CANopen sample with MCUboot support:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/subsys/canbus/canopen
|
||||
:zephyr-app: samples/modules/canopennode
|
||||
:board: frdm_k64f
|
||||
:goals: build
|
||||
:gen-args: -DCONFIG_BOOTLOADER_MCUBOOT=y
|
||||
@@ -392,20 +392,20 @@ for the FRDM-K64F as follows:
|
||||
Modifying the Object Dictionary
|
||||
*******************************
|
||||
The CANopen object dictionary used in this sample application can be
|
||||
found under :zephyr_file:`samples/subsys/canbus/canopen/objdict` in
|
||||
found under :zephyr_file:`samples/modules/canopennode/objdict` in
|
||||
the Zephyr tree. The object dictionary can be modified using any
|
||||
object dictionary editor supporting CANopenNode object dictionary code
|
||||
generation.
|
||||
|
||||
A popular choice is the EDS editor from the `libedssharp`_
|
||||
project. With that, the
|
||||
:zephyr_file:`samples/subsys/canbus/canopen/objdict/objdicts.xml`
|
||||
:zephyr_file:`samples/modules/canopennode/objdict/objdicts.xml`
|
||||
project file can be opened and modified, and new implementation files
|
||||
(:zephyr_file:`samples/subsys/canbus/canopen/objdict/CO_OD.h` and
|
||||
:zephyr_file:`samples/subsys/canbus/canopen/objdict/CO_OD.c`) can be
|
||||
(:zephyr_file:`samples/modules/canopennode/objdict/CO_OD.h` and
|
||||
:zephyr_file:`samples/modules/canopennode/objdict/CO_OD.c`) can be
|
||||
generated. The EDS editor can also export an updated Electronic Data
|
||||
Sheet (EDS) file
|
||||
(:zephyr_file:`samples/subsys/canbus/canopen/objdict/objdicts.eds`).
|
||||
(:zephyr_file:`samples/modules/canopennode/objdict/objdicts.eds`).
|
||||
|
||||
.. _CANopenNode:
|
||||
https://github.com/CANopenNode/CANopenNode
|
||||
|
||||
@@ -1018,7 +1018,7 @@ The counter can be reset by writing the value 0.</description>
|
||||
</CANopenObject>
|
||||
</CANopenObjectList>
|
||||
<other>
|
||||
<file fileName="objdict.xml" fileCreator="" fileCreationDate="09-18-2019" fileCreationTime="2:52PM" fileModifedBy="" fileMotifcationDate="02-20-2020" fileModificationTime="12:28PM" fileVersion="1" fileRevision="1" exportFolder="/home/hebad/Projects/zephyrproject/zephyr/samples/subsys/canbus/canopen/objdict" EdsFile="/home/hebad/Projects/zephyrproject/zephyr/samples/subsys/canbus/canopen/objdict/objdict.eds" />
|
||||
<file fileName="objdict.xml" fileCreator="" fileCreationDate="09-18-2019" fileCreationTime="2:52PM" fileModifedBy="" fileMotifcationDate="02-20-2020" fileModificationTime="12:28PM" fileVersion="1" fileRevision="1" exportFolder="samples/modules/canopennode/objdict" EdsFile="samples/modules/canopennode/objdict/objdict.eds" />
|
||||
<DeviceIdentity>
|
||||
<vendorName />
|
||||
<vendorNumber>0</vendorNumber>
|
||||
|
||||
@@ -14,6 +14,7 @@ CONFIG_NET_CONNECTION_MANAGER=y
|
||||
|
||||
# PPP networking support
|
||||
CONFIG_NET_NATIVE=y
|
||||
CONFIG_NET_DRIVERS=y
|
||||
CONFIG_NET_PPP=y
|
||||
CONFIG_NET_L2_PPP=y
|
||||
CONFIG_NET_L2_PPP_TIMEOUT=10000
|
||||
|
||||
@@ -6,6 +6,7 @@ CONFIG_MODEM=y
|
||||
CONFIG_MODEM_GSM_PPP=y
|
||||
|
||||
# PPP networking support
|
||||
CONFIG_NET_DRIVERS=y
|
||||
CONFIG_NET_PPP=y
|
||||
CONFIG_NET_L2_PPP=y
|
||||
CONFIG_NET_NATIVE=y
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
CONFIG_NET_DRIVERS=y
|
||||
CONFIG_NET_PPP=y
|
||||
CONFIG_NET_L2_PPP=y
|
||||
CONFIG_NET_STATISTICS_PPP=y
|
||||
|
||||
@@ -36,9 +36,6 @@ static void trigger_handler(const struct device *dev,
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static void pm_info(enum pm_device_state state, int status)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
ARG_UNUSED(arg);
|
||||
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
printk("Enter ACTIVE_STATE ");
|
||||
@@ -49,6 +46,8 @@ static void pm_info(enum pm_device_state state, int status)
|
||||
case PM_DEVICE_STATE_OFF:
|
||||
printk("Enter OFF_STATE ");
|
||||
break;
|
||||
default:
|
||||
printk("Unknown power state");
|
||||
}
|
||||
|
||||
if (status) {
|
||||
|
||||
@@ -4,6 +4,7 @@ sample:
|
||||
tests:
|
||||
sample.mgmt.osdp.control_panel:
|
||||
tags: osdp
|
||||
depends_on: gpio
|
||||
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and CONFIG_SERIAL
|
||||
harness: osdp
|
||||
integration_platforms:
|
||||
|
||||
@@ -4,6 +4,7 @@ sample:
|
||||
tests:
|
||||
sample.mgmt.osdp.peripheral_device:
|
||||
tags: osdp
|
||||
depends_on: gpio
|
||||
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and CONFIG_SERIAL
|
||||
harness: osdp
|
||||
integration_platforms:
|
||||
|
||||
@@ -18,6 +18,7 @@ CONFIG_MODEM_GSM_PPP=y
|
||||
CONFIG_MODEM_GSM_APN="<Your Access Point Network>"
|
||||
|
||||
# PPP networking support
|
||||
CONFIG_NET_DRIVERS=y
|
||||
CONFIG_NET_NATIVE=y
|
||||
CONFIG_NET_PPP=y
|
||||
CONFIG_NET_L2_PPP=y
|
||||
|
||||
@@ -2,5 +2,6 @@ sample:
|
||||
name: Modbus RTU Client Sample
|
||||
tests:
|
||||
sample.modbus.rtu_client:
|
||||
platform_allow: nrf52840dk_nrf52840 frdm_k64f
|
||||
tags: uart modbus
|
||||
depends_on: gpio, arduino_serial
|
||||
depends_on: gpio arduino_serial
|
||||
|
||||
@@ -2,8 +2,9 @@ sample:
|
||||
name: Modbus RTU Server Sample
|
||||
tests:
|
||||
sample.modbus.rtu_server:
|
||||
platform_allow: nrf52840dk_nrf52840 frdm_k64f
|
||||
tags: uart modbus
|
||||
filter: dt_compat_enabled_with_alias("gpio-leds", "led0") and
|
||||
dt_compat_enabled_with_alias("gpio-leds", "led1") and
|
||||
dt_compat_enabled_with_alias("gpio-leds", "led2")
|
||||
depends_on: gpio, arduino_serial
|
||||
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and
|
||||
dt_enabled_alias_with_parent_compat("led1", "gpio-leds") and
|
||||
dt_enabled_alias_with_parent_compat("led2", "gpio-leds")
|
||||
depends_on: gpio arduino_serial
|
||||
|
||||
@@ -109,7 +109,6 @@ const static struct modbus_iface_param server_param = {
|
||||
|
||||
static int init_modbus_server(void)
|
||||
{
|
||||
const uint32_t mb_rtu_br = 19200;
|
||||
const char iface_name[] = {DT_PROP(DT_INST(0, zephyr_modbus_serial), label)};
|
||||
int iface;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ sample:
|
||||
name: Modbus TCP to serial line gateway sample
|
||||
tests:
|
||||
sample.modbus.tcp_gateway:
|
||||
platform_allow: frdm_k64f
|
||||
tags: modbus
|
||||
depends_on: gpio, netif, arduino_serial
|
||||
depends_on: gpio netif arduino_serial
|
||||
integration_platforms:
|
||||
- frdm_k64f
|
||||
|
||||
@@ -2,8 +2,9 @@ sample:
|
||||
name: Modbus TCP Server Sample
|
||||
tests:
|
||||
sample.modbus.tcp_server:
|
||||
platform_allow: frdm_k64f
|
||||
tags: modbus
|
||||
filter: dt_compat_enabled_with_alias("gpio-leds", "led0") and
|
||||
dt_compat_enabled_with_alias("gpio-leds", "led1") and
|
||||
dt_compat_enabled_with_alias("gpio-leds", "led2")
|
||||
depends_on: gpio, netif
|
||||
filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds") and
|
||||
dt_enabled_alias_with_parent_compat("led1", "gpio-leds") and
|
||||
dt_enabled_alias_with_parent_compat("led2", "gpio-leds")
|
||||
depends_on: gpio netif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _usb-samples:
|
||||
|
||||
USB Samples
|
||||
###############
|
||||
USB device support samples
|
||||
##########################
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
@@ -246,19 +246,15 @@ def main():
|
||||
hvi = 1
|
||||
handle.dev_deps = []
|
||||
handle.ext_deps = []
|
||||
handle.dev_sups = []
|
||||
hdls = handle.dev_deps
|
||||
deps = handle.dev_deps
|
||||
while hvi < len(hv):
|
||||
h = hv[hvi]
|
||||
if h == DEVICE_HANDLE_ENDS:
|
||||
break
|
||||
if h == DEVICE_HANDLE_SEP:
|
||||
if hdls == handle.dev_deps:
|
||||
hdls = handle.ext_deps
|
||||
else:
|
||||
hdls = handle.dev_sups
|
||||
deps = handle.ext_deps
|
||||
else:
|
||||
hdls.append(h)
|
||||
deps.append(h)
|
||||
n = edt
|
||||
hvi += 1
|
||||
|
||||
@@ -271,7 +267,6 @@ def main():
|
||||
for sn in used_nodes:
|
||||
# Where we're storing the final set of nodes: these are all used
|
||||
sn.__depends = set()
|
||||
sn.__supports = set()
|
||||
|
||||
deps = set(sn.depends_on)
|
||||
debug("\nNode: %s\nOrig deps:\n\t%s" % (sn.path, "\n\t".join([dn.path for dn in deps])))
|
||||
@@ -284,16 +279,7 @@ def main():
|
||||
# forward the dependency up one level
|
||||
for ddn in dn.depends_on:
|
||||
deps.add(ddn)
|
||||
debug("Final deps:\n\t%s\n" % ("\n\t".join([ _dn.path for _dn in sn.__depends])))
|
||||
|
||||
sups = set(sn.required_by)
|
||||
debug("\nOrig sups:\n\t%s" % ("\n\t".join([dn.path for dn in sups])))
|
||||
while len(sups) > 0:
|
||||
dn = sups.pop()
|
||||
if dn in used_nodes:
|
||||
# this is used
|
||||
sn.__supports.add(dn)
|
||||
debug("\nFinal sups:\n\t%s" % ("\n\t".join([dn.path for dn in sn.__supports])))
|
||||
debug("final deps:\n\t%s\n" % ("\n\t".join([ _dn.path for _dn in sn.__depends])))
|
||||
|
||||
with open(args.output_source, "w") as fp:
|
||||
fp.write('#include <device.h>\n')
|
||||
@@ -304,7 +290,6 @@ def main():
|
||||
assert hs, "no hs for %s" % (dev.sym.name,)
|
||||
dep_paths = []
|
||||
ext_paths = []
|
||||
sup_paths = []
|
||||
hdls = []
|
||||
|
||||
sn = hs.node
|
||||
@@ -315,32 +300,26 @@ def main():
|
||||
dep_paths.append(dn.path)
|
||||
else:
|
||||
dep_paths.append('(%s)' % dn.path)
|
||||
|
||||
# Force separator to signal start of injected dependencies
|
||||
hdls.append(DEVICE_HANDLE_SEP)
|
||||
if len(hs.ext_deps) > 0:
|
||||
# TODO: map these to something smaller?
|
||||
ext_paths.extend(map(str, hs.ext_deps))
|
||||
hdls.append(DEVICE_HANDLE_SEP)
|
||||
hdls.extend(hs.ext_deps)
|
||||
|
||||
# Force separator to signal start of supported devices
|
||||
hdls.append(DEVICE_HANDLE_SEP)
|
||||
if len(hs.dev_sups) > 0:
|
||||
for dn in sn.required_by:
|
||||
if dn in sn.__supports:
|
||||
sup_paths.append(dn.path)
|
||||
else:
|
||||
sup_paths.append('(%s)' % dn.path)
|
||||
hdls.extend(dn.__device.dev_handle for dn in sn.__supports)
|
||||
|
||||
# When CONFIG_USERSPACE is enabled the pre-built elf is
|
||||
# also used to get hashes that identify kernel objects by
|
||||
# address. We can't allow the size of any object in the
|
||||
# final elf to change. We also must make sure at least one
|
||||
# DEVICE_HANDLE_ENDS is inserted.
|
||||
assert len(hdls) < len(hs.handles), "%s no DEVICE_HANDLE_ENDS inserted" % (dev.sym.name,)
|
||||
while len(hdls) < len(hs.handles):
|
||||
padding = len(hs.handles) - len(hdls)
|
||||
assert padding > 0, \
|
||||
(f"device {dev.sym.name}: "
|
||||
"linker pass 1 left no room to insert DEVICE_HANDLE_ENDS. "
|
||||
"To work around, increase CONFIG_DEVICE_HANDLE_PADDING by " +
|
||||
str(1 + (-padding)))
|
||||
while padding > 0:
|
||||
hdls.append(DEVICE_HANDLE_ENDS)
|
||||
padding -= 1
|
||||
assert len(hdls) == len(hs.handles), "%s handle overflow" % (dev.sym.name,)
|
||||
|
||||
lines = [
|
||||
@@ -349,14 +328,9 @@ def main():
|
||||
]
|
||||
|
||||
if len(dep_paths) > 0:
|
||||
lines.append(' * Direct Dependencies:')
|
||||
lines.append(' * - %s' % ('\n * - '.join(dep_paths)))
|
||||
lines.append(' * - %s' % ('\n * - '.join(dep_paths)))
|
||||
if len(ext_paths) > 0:
|
||||
lines.append(' * Injected Dependencies:')
|
||||
lines.append(' * - %s' % ('\n * - '.join(ext_paths)))
|
||||
if len(sup_paths) > 0:
|
||||
lines.append(' * Supported:')
|
||||
lines.append(' * - %s' % ('\n * - '.join(sup_paths)))
|
||||
lines.append(' * + %s' % ('\n * + '.join(ext_paths)))
|
||||
|
||||
lines.extend([
|
||||
' */',
|
||||
|
||||
@@ -436,6 +436,16 @@ class Handler:
|
||||
proc.kill()
|
||||
self.terminated = True
|
||||
|
||||
def add_missing_testscases(self, harness):
|
||||
"""
|
||||
If testsuite was broken by some error (e.g. timeout) it is necessary to
|
||||
add information about next testcases, which were not be
|
||||
performed due to this error.
|
||||
"""
|
||||
for c in self.instance.testcase.cases:
|
||||
if c not in harness.tests:
|
||||
harness.tests[c] = "BLOCK"
|
||||
|
||||
|
||||
class BinaryHandler(Handler):
|
||||
def __init__(self, instance, type_str):
|
||||
@@ -590,6 +600,7 @@ class BinaryHandler(Handler):
|
||||
else:
|
||||
self.set_state("timeout", handler_time)
|
||||
self.instance.reason = "Timeout"
|
||||
self.add_missing_testscases(harness)
|
||||
|
||||
self.record(harness)
|
||||
|
||||
@@ -859,9 +870,7 @@ class DeviceHandler(Handler):
|
||||
handler_time = time.time() - start_time
|
||||
|
||||
if out_state in ["timeout", "flash_error"]:
|
||||
for c in self.instance.testcase.cases:
|
||||
if c not in harness.tests:
|
||||
harness.tests[c] = "BLOCK"
|
||||
self.add_missing_testscases(harness)
|
||||
|
||||
if out_state == "timeout":
|
||||
self.instance.reason = "Timeout"
|
||||
@@ -1152,6 +1161,7 @@ class QEMUHandler(Handler):
|
||||
self.instance.reason = "Timeout"
|
||||
else:
|
||||
self.instance.reason = "Exited with {}".format(self.returncode)
|
||||
self.add_missing_testscases(harness)
|
||||
|
||||
def get_fifo(self):
|
||||
return self.fifo_fn
|
||||
@@ -1986,7 +1996,7 @@ class CMake():
|
||||
log.write(log_msg)
|
||||
|
||||
if log_msg:
|
||||
res = re.findall("region `(FLASH|RAM|ICCM|DCCM|SRAM)' overflowed by", log_msg)
|
||||
res = re.findall("region `(FLASH|ROM|RAM|ICCM|DCCM|SRAM)' overflowed by", log_msg)
|
||||
if res and not self.overflow_as_errors:
|
||||
logger.debug("Test skipped due to {} Overflow".format(res[0]))
|
||||
self.instance.status = "skipped"
|
||||
@@ -2108,7 +2118,7 @@ class CMake():
|
||||
|
||||
else:
|
||||
logger.error("Cmake script failure: %s" % (args[0]))
|
||||
results = {"returncode": p.returncode}
|
||||
results = {"returncode": p.returncode, "returnmsg": out}
|
||||
|
||||
return results
|
||||
|
||||
@@ -2898,7 +2908,7 @@ class TestSuite(DisablePyTestCollectionMixin):
|
||||
|
||||
try:
|
||||
if result['returncode']:
|
||||
raise TwisterRuntimeError("E: Variable ZEPHYR_TOOLCHAIN_VARIANT is not defined")
|
||||
raise TwisterRuntimeError(f"E: {result['returnmsg']}")
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
sys.exit(2)
|
||||
|
||||
@@ -10,6 +10,7 @@ config SOC_NRF5340_CPUAPP
|
||||
select CPU_HAS_FPU
|
||||
select ARMV8_M_DSP
|
||||
select HAS_HW_NRF_CC312
|
||||
select HAS_HW_NRF_COMP
|
||||
select HAS_HW_NRF_CLOCK
|
||||
select HAS_HW_NRF_DPPIC
|
||||
select HAS_HW_NRF_EGU0
|
||||
@@ -24,6 +25,7 @@ config SOC_NRF5340_CPUAPP
|
||||
select HAS_HW_NRF_I2S
|
||||
select HAS_HW_NRF_IPC
|
||||
select HAS_HW_NRF_KMU
|
||||
select HAS_HW_NRF_LPCOMP
|
||||
select HAS_HW_NRF_NFCT
|
||||
select HAS_HW_NRF_NVMC_PE
|
||||
select HAS_HW_NRF_PDM
|
||||
@@ -76,6 +78,7 @@ config SOC_NRF5340_CPUNET
|
||||
select HAS_HW_NRF_CCM
|
||||
select HAS_HW_NRF_CCM_LFLEN_8BIT
|
||||
select HAS_HW_NRF_DPPIC
|
||||
select HAS_HW_NRF_ECB
|
||||
select HAS_HW_NRF_EGU0
|
||||
select HAS_HW_NRF_GPIO0
|
||||
select HAS_HW_NRF_GPIO1
|
||||
@@ -91,6 +94,10 @@ config SOC_NRF5340_CPUNET
|
||||
select HAS_HW_NRF_RTC1
|
||||
select HAS_HW_NRF_SPIM0
|
||||
select HAS_HW_NRF_SPIS0
|
||||
select HAS_HW_NRF_SWI0
|
||||
select HAS_HW_NRF_SWI1
|
||||
select HAS_HW_NRF_SWI2
|
||||
select HAS_HW_NRF_SWI3
|
||||
select HAS_HW_NRF_TEMP
|
||||
select HAS_HW_NRF_TIMER0
|
||||
select HAS_HW_NRF_TIMER1
|
||||
|
||||
@@ -112,6 +112,8 @@ if(CONFIG_BT_LL_SW_SPLIT)
|
||||
)
|
||||
endif()
|
||||
if(CONFIG_BT_CONN OR
|
||||
(CONFIG_BT_BROADCASTER AND
|
||||
CONFIG_BT_CTLR_ADV_EXT) OR
|
||||
CONFIG_BT_CTLR_ADV_PERIODIC OR
|
||||
CONFIG_BT_CTLR_SYNC_PERIODIC)
|
||||
zephyr_library_sources(
|
||||
|
||||
@@ -430,7 +430,7 @@ config BT_CTLR_PHY_CODED
|
||||
|
||||
config BT_CTLR_CHAN_SEL_2
|
||||
bool "Channel Selection Algorithm #2"
|
||||
depends on (BT_CONN || BT_CTLR_ADV_PERIODIC || BT_CTLR_SYNC_PERIODIC) && BT_CTLR_CHAN_SEL_2_SUPPORT
|
||||
depends on (BT_CONN || (BT_BROADCASTER && BT_CTLR_ADV_EXT) || BT_CTLR_ADV_PERIODIC || BT_CTLR_SYNC_PERIODIC) && BT_CTLR_CHAN_SEL_2_SUPPORT
|
||||
default y
|
||||
help
|
||||
Enable support for Bluetooth 5.0 LE Channel Selection Algorithm #2 in
|
||||
@@ -497,6 +497,14 @@ config BT_CTLR_SYNC_PERIODIC
|
||||
config BT_CTLR_SYNC_PERIODIC
|
||||
bool "LE Periodic Advertising in Synchronization State [EXPERIMENTAL]" if BT_LL_SW_SPLIT
|
||||
|
||||
config BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING
|
||||
bool "LE Periodic Advertiser filtering by CTE type"
|
||||
depends on BT_CTLR_SYNC_PERIODIC
|
||||
default y
|
||||
help
|
||||
Enable filtering of periodic advertisements depending on type of
|
||||
Constant Tone Extension.
|
||||
|
||||
config BT_CTLR_ADV_ISO
|
||||
bool "LE Broadcast Isochronous Channel advertising" if !BT_LL_SW_SPLIT
|
||||
depends on BT_BROADCASTER && BT_CTLR_ADV_ISO_SUPPORT
|
||||
|
||||
@@ -26,6 +26,9 @@ config BT_CTLR_DF_ANT_SWITCH_2US_SUPPORT
|
||||
config BT_CTLR_DF_ANT_SWITCH_1US_SUPPORT
|
||||
bool
|
||||
|
||||
config BT_CTLR_CTEINLINE_SUPPORT
|
||||
bool
|
||||
|
||||
menuconfig BT_CTLR_DF
|
||||
bool "LE Direction Finding [Experimental]"
|
||||
depends on BT_CTLR_DF_SUPPORT
|
||||
|
||||
@@ -35,6 +35,7 @@ config BT_LLL_VENDOR_NORDIC
|
||||
select BT_CTLR_ADV_ISO_SUPPORT
|
||||
select BT_CTLR_SYNC_ISO_SUPPORT
|
||||
select BT_CTLR_DF_SUPPORT if $(DT_NORDIC_RADIO_DFE_SUPPORTED)
|
||||
select BT_CTLR_CTEINLINE_SUPPORT if $(DT_NORDIC_RADIO_DFE_SUPPORTED)
|
||||
select BT_CTLR_CHAN_SEL_2_SUPPORT
|
||||
select BT_CTLR_MIN_USED_CHAN_SUPPORT
|
||||
select BT_CTLR_DTM_HCI_SUPPORT
|
||||
|
||||
@@ -852,7 +852,7 @@ static void read_bd_addr(struct net_buf *buf, struct net_buf **evt)
|
||||
|
||||
rp->status = 0x00;
|
||||
|
||||
ll_addr_get(0, &rp->bdaddr.val[0]);
|
||||
(void)ll_addr_read(0, &rp->bdaddr.val[0]);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_HCI_CODEC_AND_DELAY_INFO)
|
||||
@@ -3278,17 +3278,26 @@ static void le_per_adv_create_sync(struct net_buf *buf, struct net_buf **evt)
|
||||
uint8_t status;
|
||||
uint16_t skip;
|
||||
|
||||
if (adv_cmds_ext_check(evt)) {
|
||||
if (adv_cmds_ext_check(NULL)) {
|
||||
*evt = cmd_status(BT_HCI_ERR_CMD_DISALLOWED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
skip = sys_le16_to_cpu(cmd->skip);
|
||||
sync_timeout = sys_le16_to_cpu(cmd->sync_timeout);
|
||||
|
||||
status = ll_sync_create(cmd->options, cmd->sid, cmd->addr.type,
|
||||
cmd->addr.a.val, skip, sync_timeout,
|
||||
cmd->cte_type);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING)
|
||||
if ((cmd->cte_type & BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE) != 0) {
|
||||
status = BT_HCI_ERR_CMD_DISALLOWED;
|
||||
#else
|
||||
if (cmd->cte_type != BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING) {
|
||||
status = BT_HCI_ERR_INVALID_PARAM;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */
|
||||
} else {
|
||||
status = ll_sync_create(cmd->options, cmd->sid, cmd->addr.type, cmd->addr.a.val,
|
||||
skip, sync_timeout, cmd->cte_type);
|
||||
}
|
||||
*evt = cmd_status(status);
|
||||
}
|
||||
|
||||
@@ -3334,6 +3343,10 @@ static void le_per_adv_recv_enable(struct net_buf *buf, struct net_buf **evt)
|
||||
uint16_t handle;
|
||||
uint8_t status;
|
||||
|
||||
if (adv_cmds_ext_check(evt)) {
|
||||
return;
|
||||
}
|
||||
|
||||
handle = sys_le16_to_cpu(cmd->handle);
|
||||
|
||||
status = ll_sync_recv_enable(handle, cmd->enable);
|
||||
@@ -5497,7 +5510,7 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data,
|
||||
sep->status = se->status;
|
||||
sep->handle = sys_cpu_to_le16(node_rx->hdr.handle);
|
||||
|
||||
if (sep->status) {
|
||||
if (sep->status != BT_HCI_ERR_SUCCESS && sep->status != BT_HCI_ERR_UNSUPP_REMOTE_FEATURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@ void ll_reset(void);
|
||||
uint8_t ll_set_host_feature(uint8_t bit_number, uint8_t bit_value);
|
||||
uint64_t ll_feat_get(void);
|
||||
|
||||
uint8_t *ll_addr_get(uint8_t addr_type, uint8_t *p_bdaddr);
|
||||
uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const p_bdaddr);
|
||||
uint8_t *ll_addr_get(uint8_t addr_type);
|
||||
uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING)
|
||||
uint8_t ll_adv_set_by_hci_handle_get(uint8_t hci_handle, uint8_t *handle);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LL_VERSION_NUMBER BT_HCI_VERSION_5_2
|
||||
#define LL_VERSION_NUMBER BT_HCI_VERSION_5_3
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||
#define LL_FEAT_BIT_ENC BIT64(BT_LE_FEAT_BIT_ENC)
|
||||
|
||||
@@ -34,27 +34,6 @@
|
||||
static uint8_t pub_addr[BDADDR_SIZE];
|
||||
static uint8_t rnd_addr[BDADDR_SIZE];
|
||||
|
||||
uint8_t *ll_addr_get(uint8_t addr_type, uint8_t *bdaddr)
|
||||
{
|
||||
if (addr_type > 1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (addr_type) {
|
||||
if (bdaddr) {
|
||||
memcpy(bdaddr, rnd_addr, BDADDR_SIZE);
|
||||
}
|
||||
|
||||
return rnd_addr;
|
||||
}
|
||||
|
||||
if (bdaddr) {
|
||||
memcpy(bdaddr, pub_addr, BDADDR_SIZE);
|
||||
}
|
||||
|
||||
return pub_addr;
|
||||
}
|
||||
|
||||
uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const bdaddr)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_BT_BROADCASTER)) {
|
||||
@@ -81,6 +60,31 @@ uint8_t ll_addr_set(uint8_t addr_type, uint8_t const *const bdaddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t *ll_addr_get(uint8_t addr_type)
|
||||
{
|
||||
if (addr_type > BT_ADDR_LE_RANDOM) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (addr_type) {
|
||||
return rnd_addr;
|
||||
}
|
||||
|
||||
return pub_addr;
|
||||
}
|
||||
|
||||
uint8_t *ll_addr_read(uint8_t addr_type, uint8_t *const bdaddr)
|
||||
{
|
||||
uint8_t *addr;
|
||||
|
||||
addr = ll_addr_get(addr_type);
|
||||
if (addr) {
|
||||
memcpy(bdaddr, addr, BDADDR_SIZE);
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void bt_ctlr_set_public_addr(const uint8_t *addr)
|
||||
{
|
||||
(void)memcpy(pub_addr, addr, sizeof(pub_addr));
|
||||
|
||||
@@ -284,6 +284,9 @@ struct node_rx_ftr {
|
||||
uint8_t aux_lll_sched:1;
|
||||
uint8_t aux_w4next:1;
|
||||
uint8_t aux_failed:1;
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
|
||||
uint8_t sync_status:2;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */
|
||||
|
||||
uint8_t phy_flags:1;
|
||||
uint8_t scan_req:1;
|
||||
@@ -400,7 +403,14 @@ struct event_done_extra {
|
||||
union {
|
||||
struct {
|
||||
uint16_t trx_cnt;
|
||||
uint8_t crc_valid;
|
||||
uint8_t crc_valid:1;
|
||||
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING) && \
|
||||
defined(CONFIG_BT_CTLR_CTEINLINE_SUPPORT)
|
||||
/* Used to inform ULL that periodic advertising sync scan should be
|
||||
* terminated.
|
||||
*/
|
||||
uint8_t sync_term:1;
|
||||
#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING && CONFIG_BT_CTLR_CTEINLINE_SUPPORT */
|
||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||
uint8_t mic_state;
|
||||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user