Compare commits
103 Commits
collab-ini
...
v1.9-branc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
727f92c5d5 | ||
|
|
144579843e | ||
|
|
8f73afcdb6 | ||
|
|
72f9f37a2b | ||
|
|
1ffad048e8 | ||
|
|
c69ae2f4a1 | ||
|
|
1913a9f5ca | ||
|
|
7558c32f1e | ||
|
|
8fac8dfce9 | ||
|
|
cce8bf55db | ||
|
|
302333c087 | ||
|
|
c9686ab2b8 | ||
|
|
58f50cc91d | ||
|
|
c687fb8c58 | ||
|
|
487ebc2cfb | ||
|
|
aaf9850576 | ||
|
|
6e2b996ee4 | ||
|
|
2cf4e4ce91 | ||
|
|
e14188ecac | ||
|
|
d900daf28d | ||
|
|
039805224c | ||
|
|
4c52b42b13 | ||
|
|
a7dcd9d827 | ||
|
|
2741498afc | ||
|
|
44e8b69ecd | ||
|
|
19f7a6f3b9 | ||
|
|
4aaf544e8c | ||
|
|
8d9cd870e4 | ||
|
|
ed94d2adb7 | ||
|
|
4b98d72156 | ||
|
|
46ffe456f0 | ||
|
|
218dd04b3e | ||
|
|
b8bbd7439d | ||
|
|
35c025fc07 | ||
|
|
439fbddbb0 | ||
|
|
c67f64ed36 | ||
|
|
d68d799057 | ||
|
|
bda57337f2 | ||
|
|
3e2305359e | ||
|
|
a23d390225 | ||
|
|
2c86d827ec | ||
|
|
84286b67fa | ||
|
|
9199844d5b | ||
|
|
f7279ea0fb | ||
|
|
271da26813 | ||
|
|
061e8096be | ||
|
|
06c1d01a4d | ||
|
|
1f689c6f2e | ||
|
|
bddd8f4b37 | ||
|
|
6e2eba45d0 | ||
|
|
14c96b17a2 | ||
|
|
a78b466c1e | ||
|
|
971080ca44 | ||
|
|
92f5487d07 | ||
|
|
051a5406ae | ||
|
|
49ead11a00 | ||
|
|
0cc21ad9ba | ||
|
|
ea6cf668c0 | ||
|
|
2341411c39 | ||
|
|
4195177a9b | ||
|
|
d3e9ade200 | ||
|
|
38609c09d1 | ||
|
|
49710776a5 | ||
|
|
c9234cc0ec | ||
|
|
1885ebe67a | ||
|
|
5f6ee6d6b1 | ||
|
|
cbb7568aec | ||
|
|
20ef2f5faf | ||
|
|
6017e2db35 | ||
|
|
9d836af286 | ||
|
|
827ddbf09c | ||
|
|
1704a7c915 | ||
|
|
041ad3d426 | ||
|
|
cf3b3b93ca | ||
|
|
1c0368764c | ||
|
|
ab35052b89 | ||
|
|
b19f73de1d | ||
|
|
be823dcffb | ||
|
|
d7070b77eb | ||
|
|
d3831de32d | ||
|
|
92ce3bc2d6 | ||
|
|
b407d02637 | ||
|
|
416945ae75 | ||
|
|
89689e0286 | ||
|
|
91f4c387ae | ||
|
|
d2c4dbe6d7 | ||
|
|
ec53508b06 | ||
|
|
7f65aa8f78 | ||
|
|
705fb8ec26 | ||
|
|
d42bd89957 | ||
|
|
eebdb3b693 | ||
|
|
4d01527866 | ||
|
|
60b37e46ca | ||
|
|
7ee9fb5ced | ||
|
|
2d08b180b5 | ||
|
|
8136c0913f | ||
|
|
59d10ea93a | ||
|
|
c86b716481 | ||
|
|
ef7a6c485f | ||
|
|
66817cbac9 | ||
|
|
543acefc43 | ||
|
|
f913f9b9f0 | ||
|
|
3a4fb6e24e |
6
.known-issues/doc/duplicate.conf
Normal file
6
.known-issues/doc/duplicate.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
#
|
||||
^(?P<filename>([-:\\/\w\.])+[/\\]doc[/\\]api[/\\]file_system.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration.
|
||||
#
|
||||
^(?P<filename>([-:\\/\w\.])+[/\\]doc[/\\]api[/\\]io_interfaces.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration.
|
||||
#
|
||||
^(?P<filename>([-:\\/\w\.])+[/\\]doc[/\\]subsystems[/\\]sensor.rst):(?P<lineno>[0-9]+): WARNING: Duplicate declaration.
|
||||
@@ -20,12 +20,12 @@
|
||||
# include/net/net_if.h warnings
|
||||
#
|
||||
^(?P<filename>[-._/\w]+/doc/api/networking.rst):(?P<lineno>[0-9]+): WARNING: Error when parsing function declaration.
|
||||
^\If the function has no return type:
|
||||
^If the function has no return type:
|
||||
^[ \t]*Error in declarator or parameters and qualifiers
|
||||
^[ \t]*Invalid definition: Expected identifier in nested name, got keyword: struct \[error at [0-9]+]
|
||||
^.*struct net_if __aligned\(32\)
|
||||
^[- \t]*\^
|
||||
^\If the function has a return type:
|
||||
^If the function has a return type:
|
||||
^[ \t]*Error in declarator or parameters and qualifiers
|
||||
^[ \t]*If pointer to member declarator:
|
||||
^[ \t]*Invalid definition: Expected \'::\' in pointer to member \(function\). \[error at [0-9]+]
|
||||
|
||||
@@ -4,10 +4,10 @@ compiler: gcc
|
||||
|
||||
env:
|
||||
global:
|
||||
- SDK=0.9.1
|
||||
- SDK=0.9.2
|
||||
- SANITYCHECK_OPTIONS=" --inline-logs -R"
|
||||
- SANITYCHECK_OPTIONS_RETRY="${SANITYCHECK_OPTIONS} --only-failed --outdir=out-2nd-pass"
|
||||
- ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.1
|
||||
- ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.2
|
||||
- ZEPHYR_GCC_VARIANT=zephyr
|
||||
- USE_CCACHE=1
|
||||
- MATRIX_BUILDS="2"
|
||||
@@ -23,13 +23,16 @@ build:
|
||||
- ${SHIPPABLE_BUILD_DIR}/ccache
|
||||
pre_ci_boot:
|
||||
image_name: zephyrprojectrtos/ci
|
||||
image_tag: master.27
|
||||
image_tag: v0.2
|
||||
pull: true
|
||||
options: "-e HOME=/home/buildslave --privileged=true --tty --net=bridge --user buildslave"
|
||||
|
||||
ci:
|
||||
- export CCACHE_DIR=${SHIPPABLE_BUILD_DIR}/ccache/.ccache
|
||||
- git rebase origin/${PULL_REQUEST_BASE_BRANCH}
|
||||
- >
|
||||
if [ "$IS_PULL_REQUEST" = "true" ]; then
|
||||
git rebase origin/${PULL_REQUEST_BASE_BRANCH};
|
||||
fi
|
||||
- source zephyr-env.sh
|
||||
- ccache -c -s --max-size=2000M
|
||||
- make host-tools
|
||||
@@ -54,19 +57,20 @@ build:
|
||||
./scripts/ci/check-compliance.py --commits ${COMMIT_RANGE} || true;
|
||||
fi;
|
||||
- >
|
||||
sudo pip3 install sh;
|
||||
./scripts/ci/get_modified_tests.py --commits origin/${PULL_REQUEST_BASE_BRANCH}..HEAD > modified_tests.args;
|
||||
./scripts/ci/get_modified_boards.py --commits origin/${PULL_REQUEST_BASE_BRANCH}..HEAD > modified_boards.args;
|
||||
if [ "$IS_PULL_REQUEST" = "true" ]; then
|
||||
./scripts/ci/get_modified_tests.py --commits origin/${PULL_REQUEST_BASE_BRANCH}..HEAD > modified_tests.args;
|
||||
./scripts/ci/get_modified_boards.py --commits origin/${PULL_REQUEST_BASE_BRANCH}..HEAD > modified_boards.args;
|
||||
|
||||
if [ -s modified_boards.args ]; then
|
||||
./scripts/sanitycheck --subset ${MATRIX_BUILD}/${MATRIX_BUILDS_EXTRA} +modified_boards.args || ./scripts/sanitycheck +modified_boards.args --only-failed;
|
||||
cp ./scripts/sanity_chk/last_sanity.xml modified_boards.xml;
|
||||
fi;
|
||||
if [ -s modified_tests.args ]; then
|
||||
./scripts/sanitycheck --subset ${MATRIX_BUILD}/${MATRIX_BUILDS_EXTRA} +modified_tests.args || ./scripts/sanitycheck +modified_tests.args --only-failed
|
||||
cp ./scripts/sanity_chk/last_sanity.xml modified_tests.xml;
|
||||
fi;
|
||||
rm -f modified_tests.args modified_boards.args;
|
||||
if [ -s modified_boards.args ]; then
|
||||
./scripts/sanitycheck --subset ${MATRIX_BUILD}/${MATRIX_BUILDS_EXTRA} +modified_boards.args || ./scripts/sanitycheck +modified_boards.args --only-failed;
|
||||
cp ./scripts/sanity_chk/last_sanity.xml modified_boards.xml;
|
||||
fi;
|
||||
if [ -s modified_tests.args ]; then
|
||||
./scripts/sanitycheck --subset ${MATRIX_BUILD}/${MATRIX_BUILDS_EXTRA} +modified_tests.args || ./scripts/sanitycheck +modified_tests.args --only-failed;
|
||||
cp ./scripts/sanity_chk/last_sanity.xml modified_tests.xml;
|
||||
fi;
|
||||
rm -f modified_tests.args modified_boards.args;
|
||||
fi
|
||||
- >
|
||||
if [ "$MATRIX_BUILD" != "3" ]; then
|
||||
./scripts/sanitycheck ${PLATFORMS} --subset ${MATRIX_BUILD}/${MATRIX_BUILDS} ${COVERAGE} ${SANITYCHECK_OPTIONS} || ./scripts/sanitycheck ${PLATFORMS} ${COVERAGE} ${SANITYCHECK_OPTIONS_RETRY} || ./scripts/sanitycheck ${PLATFORMS} ${COVERAGE} ${SANITYCHECK_OPTIONS_RETRY}
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 9
|
||||
PATCHLEVEL = 0
|
||||
PATCHLEVEL = 2
|
||||
VERSION_RESERVED = 0
|
||||
EXTRAVERSION =
|
||||
NAME = Zephyr Kernel
|
||||
|
||||
@@ -15,7 +15,7 @@ From Wikipedia:
|
||||
Tensilica Xtensa LX6 microprocessor in both dual-core and single-core
|
||||
variations. ESP32 is created and developed by Espressif Systems, a
|
||||
Shanghai-based Chinese company, and is manufactured by TSMC using their 40nm
|
||||
process. [1]_
|
||||
process..
|
||||
|
||||
The features include the following:
|
||||
|
||||
@@ -171,7 +171,6 @@ for ESP32`_.
|
||||
References
|
||||
**********
|
||||
|
||||
.. [1] https://en.wikipedia.org/wiki/ESP32
|
||||
.. _`ESP32 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
|
||||
.. _`JTAG debugging for ESP32`: https://espressif.com/sites/default/files/documentation/jtag_debugging_for_esp32_en.pdf
|
||||
.. _`toolchain`: https://esp-idf.readthedocs.io/en/latest/get-started/index.html#get-started-setup-toochain
|
||||
|
||||
@@ -66,6 +66,8 @@ clean:
|
||||
@rm -rf reference/kconfig/*.rst
|
||||
@rm -rf samples
|
||||
@rm -rf boards
|
||||
@rm -f doc.log
|
||||
@rm -f doc.warnings
|
||||
|
||||
htmldocs: doxy html
|
||||
|
||||
@@ -79,7 +81,8 @@ kconfig: scripts/genrest/genrest.py
|
||||
prep: doxy content kconfig
|
||||
|
||||
html: content kconfig
|
||||
$(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
$(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 2>&1 | tee -a doc.log;
|
||||
$(Q)./scripts/filter-doc-log.sh doc.log
|
||||
@rm -rf samples
|
||||
@rm -rf boards
|
||||
|
||||
|
||||
14
doc/_templates/breadcrumbs.html
vendored
Normal file
14
doc/_templates/breadcrumbs.html
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends "!breadcrumbs.html" %}
|
||||
{% block breadcrumbs %}
|
||||
<!-- {{ docs_title }} -->
|
||||
{# parameterize default name "Docs" in breadcrumb via docs_title in conf.py #}
|
||||
{% if not docs_title %}
|
||||
{% set docs_title = "Docs" %}
|
||||
{% endif %}
|
||||
|
||||
<li><a href="{{ pathto(master_doc) }}">{{ docs_title }}</a> »</li>
|
||||
{% for doc in parents %}
|
||||
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> »</li>
|
||||
{% endfor %}
|
||||
<li>{{ title }}</li>
|
||||
{% endblock %}
|
||||
10
doc/_templates/layout.html
vendored
Normal file
10
doc/_templates/layout.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{% extends "!layout.html" %}
|
||||
{% block document %}
|
||||
{% if is_release %}
|
||||
<div class="wy-alert wy-alert-danger">
|
||||
The <a href="/{{ pagename }}.html">latest development version</a>
|
||||
of this page may be more current than this released {{ version }} version.
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
28
doc/_templates/versions.html
vendored
Normal file
28
doc/_templates/versions.html
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{# Add rst-badge after rst-versions for small badge style. #}
|
||||
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
|
||||
<span class="rst-current-version" data-toggle="rst-current-version">
|
||||
<span class="fa fa-book"> Zephyr Project</span>
|
||||
v: {{ current_version }}
|
||||
<span class="fa fa-caret-down"></span>
|
||||
</span>
|
||||
<div class="rst-other-versions">
|
||||
<dl>
|
||||
<dt>{{ _('Versions') }}</dt>
|
||||
{% for slug, url in versions %}
|
||||
<dd><a href="{{ url }}">{{ slug }}</a></dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{{ _('On zephyrproject.org') }}</dt>
|
||||
<dd>
|
||||
<a href="https://www.zephyrproject.org/">Project Home</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="https://www.zephyrproject.org/developers/#downloads">Downloads</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="https://github.com/zephyrproject-rtos/zephyr/releases">Releases</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
43
doc/conf.py
43
doc/conf.py
@@ -143,23 +143,15 @@ rst_epilog = """
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
except ImportError:
|
||||
html_theme = 'zephyr'
|
||||
html_theme_path = ['./themes']
|
||||
else:
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
if tags.has('daily') or tags.has('release'):
|
||||
html_theme = 'zephyr-docs-theme'
|
||||
html_theme_path = ['./themes']
|
||||
|
||||
import sphinx_rtd_theme
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
if tags.has('release'):
|
||||
is_release = True
|
||||
docs_title = 'Docs / %s' %(version)
|
||||
else:
|
||||
is_release = False
|
||||
docs_title = 'Docs'
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
@@ -175,12 +167,12 @@ html_title = "Zephyr Project Documentation"
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
html_logo = 'images/Zephyr-Kite-logo.png'
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
html_favicon = 'images/zp_favicon.png'
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
@@ -217,7 +209,7 @@ html_use_index = True
|
||||
html_split_index = True
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink =
|
||||
html_show_sourcelink = False
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
html_show_sphinx = False
|
||||
@@ -342,10 +334,28 @@ breathe_projects = {
|
||||
}
|
||||
breathe_default_project = "Zephyr"
|
||||
|
||||
# Qualifiers to a function are causing Sphihx/Breathe to warn about
|
||||
# Error when parsing function declaration and more. This is a list
|
||||
# of strings that the parser additionally should accept as
|
||||
# attributes.
|
||||
cpp_id_attributes = ['__syscall', '__syscall_inline', '__deprecated',
|
||||
'__may_alias', '__used', '__unused', '__weak',
|
||||
'__DEPRECATED_MACRO', 'FUNC_NORETURN' ]
|
||||
|
||||
|
||||
# docs_title is used in the breadcrumb title in the zephyr docs theme
|
||||
html_context = {
|
||||
'show_license': html_show_license,
|
||||
'docs_title': docs_title,
|
||||
'is_release': is_release,
|
||||
'theme_logo_only': False,
|
||||
'current_version': version,
|
||||
'versions': ( ("latest", "/"),
|
||||
("1.12.0", "/1.12.0/"),
|
||||
("1.11.0", "/1.11.0/"),
|
||||
("1.10.0", "/1.10.0/"),
|
||||
("1.9.2", "/1.9.0/"),
|
||||
)
|
||||
}
|
||||
|
||||
extlinks = {'jira': ('https://jira.zephyrproject.org/browse/%s', '')}
|
||||
@@ -364,3 +374,4 @@ linkcheck_anchors = False
|
||||
|
||||
def setup(app):
|
||||
app.add_stylesheet("zephyr-custom.css")
|
||||
app.add_javascript("zephyr-custom.js")
|
||||
|
||||
BIN
doc/images/Zephyr-Kite-logo.png
Normal file
BIN
doc/images/Zephyr-Kite-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
doc/images/zp_favicon.png
Normal file
BIN
doc/images/zp_favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 534 B |
@@ -2,6 +2,42 @@
|
||||
|
||||
.. _zephyr_1.9:
|
||||
|
||||
Zephyr Kernel 1.9.2
|
||||
###################
|
||||
|
||||
This is a maintenance release with fixes.
|
||||
|
||||
Kernel
|
||||
******
|
||||
* Generic queue item acquisition fixed to always return a valid item when
|
||||
using K_FOREVER
|
||||
|
||||
Bluetooth
|
||||
*********
|
||||
* Multiple stability fixes for BLE Mesh
|
||||
* Multiple stability fixes for the BLE Controller
|
||||
|
||||
Zephyr Kernel 1.9.1
|
||||
###################
|
||||
|
||||
This is a maintenance release with fixes and a two new features in the
|
||||
BLE Controller.
|
||||
|
||||
Drivers and Sensors
|
||||
*******************
|
||||
* mcux ethernet driver buffer overflow fixed
|
||||
* STM32 PWM prescaler issue fixed
|
||||
|
||||
Networking
|
||||
**********
|
||||
* Support for IPv6 in DNS fixed
|
||||
|
||||
Bluetooth
|
||||
*********
|
||||
* Multiple stability fixes for the BLE Controller
|
||||
* Support for PA/LNA amplifiers in the BLE Controller
|
||||
* Support for additional VS commands in the BLE Controller
|
||||
|
||||
Zephyr Kernel 1.9.0
|
||||
###################
|
||||
|
||||
@@ -39,9 +75,11 @@ Architectures
|
||||
* xtensa: Added ESP32 support
|
||||
* Stack sentinel: This places a sentinel value at the lowest 4 bytes of a stack
|
||||
memory region and checks it at various intervals, including when servicing
|
||||
interrupts or context switching. This is implemented on all arches except
|
||||
ARC, which supports stack bounds checking directly in hardware.
|
||||
* x86: enable MMU for application memory
|
||||
interrupts or context switching.
|
||||
* x86: Enable MMU for application memory
|
||||
* ARC: Added initial MPU support, including stack sentinel checking for ARC
|
||||
configurations not featuring hardware stack bounds checking
|
||||
* ARC: Nested interrupt support for normal, non-FIRQ interrupts
|
||||
|
||||
Boards
|
||||
******
|
||||
@@ -55,6 +93,9 @@ Boards
|
||||
* arm: Removed TI CC3200 LaunchXL board
|
||||
* arm: Added VBLUno51 and VBLUno52 boards
|
||||
* xtensa: Added ESP32 board support
|
||||
* ARC: Added support for EMSK EM7D v2.2 version (incl. MPU)
|
||||
* ARC: Board configuration restructuring, peripheral configs moved from soc to
|
||||
board level
|
||||
|
||||
Drivers and Sensors
|
||||
*******************
|
||||
@@ -338,3 +379,4 @@ JIRA Related Items
|
||||
* :jira:`ZEP-2576` - samples/net/sockets/echo, echo_async : fails to send the TCP packets
|
||||
* :jira:`ZEP-2581` - CC3220 executable binary format support
|
||||
* :jira:`ZEP-2584` - Update mbedTLS to 2.6.0
|
||||
* :jira:`ZEP-713` - Implement preemptible regular IRQs on ARC
|
||||
|
||||
@@ -17,7 +17,7 @@ notes pages listed below), or use Git clone and checkout commands, such as:
|
||||
|
||||
git clone https://github.com/zephyrproject-rtos/zephyr
|
||||
cd zephyr
|
||||
git checkout tags/v1.8.0
|
||||
git checkout tags/v1.9.0
|
||||
|
||||
|
||||
The project's technical documentation is also tagged to correspond with a
|
||||
@@ -29,6 +29,7 @@ Zephyr Kernel Releases
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
release-notes-1.9
|
||||
release-notes-1.8
|
||||
release-notes-1.7
|
||||
release-notes-1.6
|
||||
|
||||
40
doc/scripts/filter-doc-log.sh
Executable file
40
doc/scripts/filter-doc-log.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run the filter-known-issues.py script to remove "expected" warning
|
||||
# messages from the output of the document build process and write
|
||||
# the filtered output to stdout
|
||||
#
|
||||
# Only argument is the name of the log file saved by the build.
|
||||
|
||||
KI_SCRIPT=${ZEPHYR_BASE}/scripts/filter-known-issues.py
|
||||
CONFIG_DIR=${ZEPHYR_BASE}/.known-issues/doc
|
||||
|
||||
LOG_FILE=$1
|
||||
|
||||
red='\E[31m'
|
||||
green='\e[32m'
|
||||
|
||||
if [ -z "${LOG_FILE}" ]; then
|
||||
echo "Error in $0: missing input parameter <logfile>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -s "${LOG_FILE}" ]; then
|
||||
$KI_SCRIPT --config-dir ${CONFIG_DIR} ${LOG_FILE} > doc.warnings 2>&1
|
||||
if [ -s doc.warnings ]; then
|
||||
echo
|
||||
echo -e "${red}New errors/warnings found, please fix them:"
|
||||
echo -e "=============================================="
|
||||
tput sgr0
|
||||
echo
|
||||
cat doc.warnings
|
||||
echo
|
||||
else
|
||||
echo -e "${green}No new errors/warnings."
|
||||
tput sgr0
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Error in $0: logfile \"${LOG_FILE}\" not found."
|
||||
exit 1
|
||||
fi
|
||||
@@ -47,7 +47,7 @@ def print_items(items, outdir, indent):
|
||||
config = open("%s/%s.rst" % (outdir, var), "w")
|
||||
config.write(":orphan:\n\n")
|
||||
config.write(".. title:: %s\n\n" %item.get_name())
|
||||
config.write(".. option:: CONFIG_%s:\n" %item.get_name())
|
||||
config.write(".. option:: CONFIG_%s\n" %item.get_name())
|
||||
config.write(".. _CONFIG_%s:\n" %item.get_name())
|
||||
if text:
|
||||
config.write("\n%s\n\n" %text)
|
||||
|
||||
147
doc/static/zephyr-custom.css
vendored
147
doc/static/zephyr-custom.css
vendored
@@ -1,4 +1,103 @@
|
||||
/* -- Extra CSS styles for Zephyr content ----------------------------------- */
|
||||
/* -- Extra CSS styles for Zephyr content (RTD theme) ----------------------- */
|
||||
|
||||
/* make the page width fill the window */
|
||||
.wy-nav-content {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
/* pygments tweak for white-on-black console */
|
||||
/* hold off on this change for now
|
||||
|
||||
.highlight-console .highlight {
|
||||
background-color: black;
|
||||
}
|
||||
.highlight-console .highlight .go, .highlight-console .highlight .gp {
|
||||
color: white;
|
||||
}
|
||||
.highlight-console .highlight .hll {
|
||||
background-color: white;
|
||||
}
|
||||
.highlight-console .highlight .hll .go, .highlight-console .highlight .hll .gp {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
*/
|
||||
|
||||
/* tweak doc version selection
|
||||
.rst-versions {
|
||||
position: static;
|
||||
border-top: none;
|
||||
padding: 0px;
|
||||
}
|
||||
*/
|
||||
|
||||
.rst-versions .rst-current-version {
|
||||
padding: 5px;
|
||||
background-color: #2980B9;
|
||||
color: #80FF80;
|
||||
}
|
||||
|
||||
.rst-versions .rst-other-versions {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div.rst-other-versions dl {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
/* code block highlight color in rtd changed to lime green, no no no */
|
||||
|
||||
.rst-content tt.literal, .rst-content code.literal, .highlight {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
.rst-content tt.literal, .rst-content code.literal {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* Make the version number more visible */
|
||||
.wy-side-nav-search>div.version {
|
||||
color: rgba(255,255,255,1);
|
||||
}
|
||||
|
||||
/* squish the space between a paragraph before a list */
|
||||
div > p + ul, div > p + ol {
|
||||
margin-top: -20px;
|
||||
}
|
||||
|
||||
/* add some space before the figure caption */
|
||||
p.caption {
|
||||
# border-top: 1px solid;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
/* decrease line leading a bit, 24px is too wide */
|
||||
|
||||
p {
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
/* add a colon after the figure/table number (before the caption) */
|
||||
span.caption-number::after {
|
||||
content: ": ";
|
||||
}
|
||||
|
||||
p.extrafooter {
|
||||
text-align: right;
|
||||
margin-top: -36px;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
display: table !important;
|
||||
}
|
||||
|
||||
|
||||
.code-block-caption {
|
||||
color: #000;
|
||||
font: italic 85%/1 arial,sans-serif;
|
||||
padding: 1em 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* make .. hlist:: tables fill the page */
|
||||
table.hlist {
|
||||
@@ -9,3 +108,49 @@ table.hlist {
|
||||
th,td {
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
/* dbk tweak for doxygen-generated API headings (for RTD theme) */
|
||||
.rst-content dl.group>dt, .rst-content dl.group>dd>p {
|
||||
display:none !important;
|
||||
}
|
||||
.rst-content dl.group {
|
||||
margin: 0 0 12px 0px;
|
||||
}
|
||||
.rst-content dl.group>dd {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
.rst-content p.breathe-sectiondef-title {
|
||||
text-decoration: underline; /* dbk for API sub-headings */
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.rst-content div.breathe-sectiondef {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
/* tweak display of option tables to make first column wider */
|
||||
col.option {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
/* tweak format for <kbd> (:kbd:`F10`) */
|
||||
kbd
|
||||
{
|
||||
-moz-border-radius:3px;
|
||||
-moz-box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 2px #fff inset;
|
||||
-webkit-border-radius:3px;
|
||||
-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 2px #fff inset;
|
||||
background-color:#f7f7f7;
|
||||
border:1px solid #ccc;
|
||||
border-radius:3px;
|
||||
box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 2px #fff inset;
|
||||
color:#333;
|
||||
display:inline-block;
|
||||
font-family:Arial,Helvetica,sans-serif;
|
||||
font-size:11px;
|
||||
line-height:1.4;
|
||||
margin:0 .1em;
|
||||
padding:.1em .6em;
|
||||
text-shadow:0 1px 0 #fff;
|
||||
}
|
||||
|
||||
6
doc/static/zephyr-custom.js
vendored
Normal file
6
doc/static/zephyr-custom.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/* tweak logo link to the project home page in a new tab*/
|
||||
|
||||
$(document).ready(function(){
|
||||
$( ".icon-home" ).attr("href", "https://zephyrproject.org/");
|
||||
$( ".icon-home" ).attr("target", "_blank");
|
||||
});
|
||||
@@ -116,7 +116,11 @@ RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS =
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
# Hide internal names (starting with an underscore, and doxygen-generated names
|
||||
# for nested unnamed unions that don't generate meaningful sphinx output anyway.
|
||||
EXCLUDE_SYMBOLS = _* *.__unnamed__
|
||||
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
@@ -279,9 +283,14 @@ PREDEFINED = "CONFIG_SYS_CLOCK_EXISTS=y" \
|
||||
"CONFIG_DEVICE_POWER_MANAGEMENT=y" \
|
||||
"CONFIG_BT_SMP=y" \
|
||||
"CONFIG_BT_BREDR=y" \
|
||||
"__deprecated=" \
|
||||
"__printf_like(x, y)=" \
|
||||
"__attribute(x)__="
|
||||
"NET_MGMT_DEFINE_REQUEST_HANDLER(x)=" \
|
||||
"__deprecated=" \
|
||||
"__packed=" \
|
||||
"__aligned(x)=" \
|
||||
"__printf_like(x, y)=" \
|
||||
"__attribute__(x)=" \
|
||||
"__syscall=" \
|
||||
"__syscall_inline="
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -38,7 +38,13 @@ static u32_t __get_tim_clk(u32_t bus_clk,
|
||||
apb_psc = CONFIG_CLOCK_STM32_APB2_PRESCALER;
|
||||
}
|
||||
|
||||
if (apb_psc == RCC_HCLK_DIV1) {
|
||||
/*
|
||||
* If the APB prescaler equals 1, the timer clock frequencies
|
||||
* are set to the same frequency as that of the APB domain.
|
||||
* Otherwise, they are set to twice (×2) the frequency of the
|
||||
* APB domain.
|
||||
*/
|
||||
if (apb_psc == 1) {
|
||||
tim_clk = bus_clk;
|
||||
} else {
|
||||
tim_clk = 2 * bus_clk;
|
||||
|
||||
@@ -1438,6 +1438,15 @@ struct bt_hci_evt_link_key_notify {
|
||||
u8_t key_type;
|
||||
} __packed;
|
||||
|
||||
/* Overflow link types */
|
||||
#define BT_OVERFLOW_LINK_SYNCH 0x00
|
||||
#define BT_OVERFLOW_LINK_ACL 0x01
|
||||
|
||||
#define BT_HCI_EVT_DATA_BUF_OVERFLOW 0x1a
|
||||
struct bt_hci_evt_data_buf_overflow {
|
||||
u8_t link_type;
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI 0x22
|
||||
struct bt_hci_evt_inquiry_result_with_rssi {
|
||||
bt_addr_t addr;
|
||||
|
||||
@@ -292,9 +292,6 @@ extern const struct bt_mesh_model_op bt_mesh_cfg_op[];
|
||||
struct bt_mesh_health {
|
||||
struct bt_mesh_model *model;
|
||||
|
||||
/* Health Period (divider) */
|
||||
u8_t period;
|
||||
|
||||
/* Fetch current faults */
|
||||
int (*fault_get_cur)(struct bt_mesh_model *model, u8_t *test_id,
|
||||
u16_t *company_id, u8_t *faults,
|
||||
|
||||
@@ -292,7 +292,8 @@ static int _signal_poll_event(struct k_poll_event *event, u32_t state,
|
||||
|
||||
_unpend_thread(thread);
|
||||
_abort_thread_timeout(thread);
|
||||
_set_thread_return_value(thread, 0);
|
||||
_set_thread_return_value(thread,
|
||||
state == K_POLL_STATE_NOT_READY ? -EINTR : 0);
|
||||
|
||||
if (!_is_thread_ready(thread)) {
|
||||
goto ready_event;
|
||||
|
||||
@@ -68,11 +68,9 @@ static void prepare_thread_to_run(struct k_thread *thread, void *data)
|
||||
#endif /* CONFIG_POLL */
|
||||
|
||||
/* returns 1 if a reschedule must take place, 0 otherwise */
|
||||
static inline int handle_poll_events(struct k_queue *queue)
|
||||
static inline int handle_poll_events(struct k_queue *queue, u32_t state)
|
||||
{
|
||||
#ifdef CONFIG_POLL
|
||||
u32_t state = K_POLL_STATE_DATA_AVAILABLE;
|
||||
|
||||
return _handle_obj_poll_events(&queue->poll_events, state);
|
||||
#else
|
||||
return 0;
|
||||
@@ -95,7 +93,7 @@ void k_queue_cancel_wait(struct k_queue *queue)
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (handle_poll_events(queue)) {
|
||||
if (handle_poll_events(queue, K_POLL_STATE_NOT_READY)) {
|
||||
(void)_Swap(key);
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +124,7 @@ void k_queue_insert(struct k_queue *queue, void *prev, void *data)
|
||||
sys_slist_insert(&queue->data_q, prev, data);
|
||||
|
||||
#if defined(CONFIG_POLL)
|
||||
if (handle_poll_events(queue)) {
|
||||
if (handle_poll_events(queue, K_POLL_STATE_DATA_AVAILABLE)) {
|
||||
(void)_Swap(key);
|
||||
return;
|
||||
}
|
||||
@@ -171,7 +169,7 @@ void k_queue_append_list(struct k_queue *queue, void *head, void *tail)
|
||||
}
|
||||
#else
|
||||
sys_slist_append_list(&queue->data_q, head, tail);
|
||||
if (handle_poll_events(queue)) {
|
||||
if (handle_poll_events(queue, K_POLL_STATE_DATA_AVAILABLE)) {
|
||||
(void)_Swap(key);
|
||||
return;
|
||||
}
|
||||
@@ -199,20 +197,32 @@ static void *k_queue_poll(struct k_queue *queue, s32_t timeout)
|
||||
{
|
||||
struct k_poll_event event;
|
||||
int err;
|
||||
unsigned int key;
|
||||
void *val;
|
||||
|
||||
k_poll_event_init(&event, K_POLL_TYPE_FIFO_DATA_AVAILABLE,
|
||||
K_POLL_MODE_NOTIFY_ONLY, queue);
|
||||
|
||||
event.state = K_POLL_STATE_NOT_READY;
|
||||
do {
|
||||
event.state = K_POLL_STATE_NOT_READY;
|
||||
|
||||
err = k_poll(&event, 1, timeout);
|
||||
if (err) {
|
||||
return NULL;
|
||||
}
|
||||
err = k_poll(&event, 1, timeout);
|
||||
if (err) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__ASSERT_NO_MSG(event.state == K_POLL_STATE_FIFO_DATA_AVAILABLE);
|
||||
__ASSERT_NO_MSG(event.state ==
|
||||
K_POLL_STATE_FIFO_DATA_AVAILABLE);
|
||||
|
||||
return sys_slist_get(&queue->data_q);
|
||||
/* sys_slist_* aren't threadsafe, so must be always protected by
|
||||
* irq_lock.
|
||||
*/
|
||||
key = irq_lock();
|
||||
val = sys_slist_get(&queue->data_q);
|
||||
irq_unlock(key);
|
||||
} while (!val && timeout == K_FOREVER);
|
||||
|
||||
return val;
|
||||
}
|
||||
#endif /* CONFIG_POLL */
|
||||
|
||||
|
||||
@@ -225,7 +225,12 @@ static void bt_tx_thread(void *p1, void *p2, void *p3)
|
||||
SYS_LOG_DBG("buf %p type %u len %u",
|
||||
buf, bt_buf_get_type(buf), buf->len);
|
||||
|
||||
bt_send(buf);
|
||||
ret = bt_send(buf);
|
||||
if (ret) {
|
||||
SYS_LOG_ERR("Unable to send (ret %d)", ret);
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
|
||||
STACK_ANALYZE("tx_stack", bt_tx_thread_stack);
|
||||
|
||||
/* Make sure other threads get a chance to run */
|
||||
|
||||
@@ -232,11 +232,16 @@ static void tx_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
while (1) {
|
||||
struct net_buf *buf;
|
||||
int err;
|
||||
|
||||
/* Wait until a buffer is available */
|
||||
buf = net_buf_get(&tx_queue, K_FOREVER);
|
||||
/* Pass buffer to the stack */
|
||||
bt_send(buf);
|
||||
err = bt_send(buf);
|
||||
if (err) {
|
||||
SYS_LOG_ERR("Unable to send (err %d)", err);
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
|
||||
/* Give other threads a chance to run if tx_queue keeps getting
|
||||
* new data all the time.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import subprocess
|
||||
import re
|
||||
@@ -69,7 +69,7 @@ def run_gitlint(tc, commit_range):
|
||||
|
||||
if msg != "":
|
||||
failure = ET.SubElement(tc, 'failure', type="failure", message="commit message error on range: %s" %commit_range)
|
||||
failure.text = (str(msg))
|
||||
failure.text = (msg.decode('utf8'))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
@@ -86,10 +86,10 @@ def run_checkpatch(tc, commit_range):
|
||||
stderr=subprocess.STDOUT, shell=True)
|
||||
|
||||
except subprocess.CalledProcessError as ex:
|
||||
m = re.search("([1-9][0-9]*) errors,", str(ex.output))
|
||||
m = re.search("([1-9][0-9]*) errors,", ex.output.decode('utf8'))
|
||||
if m:
|
||||
failure = ET.SubElement(tc, 'failure', type="failure", message="checkpatch issues")
|
||||
failure.text = (str(ex.output))
|
||||
failure.text = (ex.output.decode('utf8'))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
@@ -102,7 +102,7 @@ def check_doc(tc, range):
|
||||
log = f.read()
|
||||
failure = ET.SubElement(tc, 'failure', type="failure",
|
||||
message="documentation issues")
|
||||
failure.text = (str(log))
|
||||
failure.text = (log.decode('utf8'))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
@@ -185,6 +185,8 @@ def report_warning(data):
|
||||
warnings.write(data)
|
||||
|
||||
for filename in args.FILENAMEs:
|
||||
if os.stat(filename).st_size == 0:
|
||||
continue # skip empty log files
|
||||
try:
|
||||
with open(filename, "r+b") as f:
|
||||
logging.info("%s: filtering", filename)
|
||||
|
||||
@@ -8,6 +8,13 @@
|
||||
|
||||
if BT_HCI
|
||||
|
||||
config BT_HCI_VS_EXT
|
||||
bool "Zephyr HCI Vendor-Specific Extensions"
|
||||
default y
|
||||
help
|
||||
Enable support for the Zephyr HCI Vendor-Specific Extensions in the
|
||||
Host and/or Controller.
|
||||
|
||||
config BT_RPA
|
||||
# Virtual/hidden option
|
||||
bool
|
||||
|
||||
@@ -30,12 +30,16 @@ endchoice
|
||||
|
||||
comment "BLE Controller configuration"
|
||||
|
||||
config BT_CTLR_HCI_VS_EXT
|
||||
bool "Zephyr HCI Vendor-Specific Extensions"
|
||||
default y
|
||||
config BT_CTLR_HCI_VS_BUILD_INFO
|
||||
string "Zephyr HCI VS Build Info string"
|
||||
default ""
|
||||
depends on BT_HCI_VS_EXT
|
||||
help
|
||||
Enable support for the Zephyr HCI Vendor-Specific Extensions in the
|
||||
Controller.
|
||||
User-defined string that will be returned by the Zephyr VS Read Build
|
||||
Information command after the Zephyr version and build time. When
|
||||
setting this to a value different from an empty string, a space
|
||||
character is required at the beginning to separate it from the
|
||||
already included information.
|
||||
|
||||
config BT_CTLR_DUP_FILTER_LEN
|
||||
prompt "Number of addresses in the scan duplicate filter"
|
||||
@@ -334,7 +338,7 @@ config BT_CTLR_SCHED_ADVANCED
|
||||
config BT_CTLR_RADIO_ENABLE_FAST
|
||||
bool "Use tTXEN/RXEN,FAST ramp-up"
|
||||
depends on SOC_SERIES_NRF52X
|
||||
default y if SOC_NRF52840
|
||||
default y
|
||||
help
|
||||
Enable use of fast radio ramp-up mode.
|
||||
|
||||
@@ -386,6 +390,78 @@ config BT_CTLR_SCAN_REQ_RSSI
|
||||
|
||||
endmenu
|
||||
|
||||
comment "BLE Controller hardware configuration"
|
||||
|
||||
menuconfig BT_CTLR_GPIO_PA
|
||||
bool "Power Amplifier GPIO interface"
|
||||
depends on !SOC_SERIES_NRF51X
|
||||
help
|
||||
Enable GPIO interface to a Power Amplifier. This allows hardware
|
||||
designs using PA to let the Controller toggle their state based on
|
||||
radio activity.
|
||||
|
||||
if BT_CTLR_GPIO_PA
|
||||
|
||||
config BT_CTLR_GPIO_PA_PIN
|
||||
prompt "Power Amplifier GPIO pin number"
|
||||
int
|
||||
help
|
||||
GPIO Pin number connected to a Power Amplifier.
|
||||
|
||||
config BT_CTLR_GPIO_PA_POL_INV
|
||||
bool "Inverted polarity for the PA pin"
|
||||
help
|
||||
Enable inverted polarity (active low) for the PA pin.
|
||||
|
||||
config BT_CTLR_GPIO_PA_OFFSET
|
||||
prompt "Time from PA ON to Tx ready"
|
||||
int
|
||||
default 5
|
||||
range 0 10
|
||||
help
|
||||
Time before Tx ready to turn on PA.
|
||||
|
||||
endif # BT_CTLR_GPIO_PA
|
||||
|
||||
menuconfig BT_CTLR_GPIO_LNA
|
||||
bool "Low Noise Amplifier GPIO interface"
|
||||
depends on !SOC_SERIES_NRF51X
|
||||
help
|
||||
Enable GPIO interface to a Low Noise Amplifier. This allows hardware
|
||||
designs using LNAs to let the Controller toggle their state based on
|
||||
radio activity.
|
||||
|
||||
if BT_CTLR_GPIO_LNA
|
||||
|
||||
config BT_CTLR_GPIO_LNA_PIN
|
||||
prompt "Low Noise Amplifier GPIO pin number"
|
||||
int
|
||||
help
|
||||
GPIO Pin number connected to a Low Noise Amplifier.
|
||||
|
||||
config BT_CTLR_GPIO_LNA_POL_INV
|
||||
bool "Inverted polarity for the LNA pin"
|
||||
help
|
||||
Enable inverted polarity (active low) for the LNA pin.
|
||||
|
||||
config BT_CTLR_GPIO_LNA_OFFSET
|
||||
prompt "Time from LNA ON to Rx ready"
|
||||
int
|
||||
default 5
|
||||
range 0 10
|
||||
help
|
||||
Time before Rx ready to turn on LNA.
|
||||
|
||||
endif # BT_CTLR_GPIO_LNA
|
||||
|
||||
config BT_CTLR_PA_LNA_GPIOTE_CHAN
|
||||
# Hidden "nRF5 GPIO PA/LNA GPIOTE Channel"
|
||||
depends on SOC_FAMILY_NRF5 && (BT_CTLR_GPIO_PA || BT_CTLR_GPIO_LNA)
|
||||
int
|
||||
default 3
|
||||
help
|
||||
Select the nRF5 GPIOTE channel to use for PA/LNA GPIO feature.
|
||||
|
||||
comment "BLE Controller debug configuration"
|
||||
|
||||
config BT_CTLR_ASSERT_HANDLER
|
||||
@@ -408,6 +484,7 @@ config BT_CTLR_PROFILE_ISR
|
||||
|
||||
config BT_CTLR_DEBUG_PINS
|
||||
bool "Bluetooth Controller Debug Pins"
|
||||
depends on BOARD_NRF51_PCA10028 || BOARD_NRF52_PCA10040 || BOARD_NRF52840_PCA10056
|
||||
help
|
||||
Turn on debug GPIO toggling for the BLE Controller. This is useful
|
||||
when debugging with a logic analyzer or profiling certain sections of
|
||||
|
||||
@@ -8,157 +8,202 @@
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
|
||||
#if defined(CONFIG_BOARD_NRF52840_PCA10056)
|
||||
#define DEBUG_PORT NRF_P1
|
||||
#define DEBUG_PIN0 BIT(1)
|
||||
#define DEBUG_PIN1 BIT(2)
|
||||
#define DEBUG_PIN2 BIT(3)
|
||||
#define DEBUG_PIN3 BIT(4)
|
||||
#define DEBUG_PIN4 BIT(5)
|
||||
#define DEBUG_PIN5 BIT(6)
|
||||
#define DEBUG_PIN6 BIT(7)
|
||||
#define DEBUG_PIN7 BIT(8)
|
||||
#define DEBUG_PIN8 BIT(10)
|
||||
#define DEBUG_PIN9 BIT(11)
|
||||
#elif defined(CONFIG_BOARD_NRF52_PCA10040)
|
||||
#define DEBUG_PORT NRF_GPIO
|
||||
#define DEBUG_PIN0 BIT(11)
|
||||
#define DEBUG_PIN1 BIT(12)
|
||||
#define DEBUG_PIN2 BIT(13)
|
||||
#define DEBUG_PIN3 BIT(14)
|
||||
#define DEBUG_PIN4 BIT(15)
|
||||
#define DEBUG_PIN5 BIT(16)
|
||||
#define DEBUG_PIN6 BIT(17)
|
||||
#define DEBUG_PIN7 BIT(18)
|
||||
#define DEBUG_PIN8 BIT(19)
|
||||
#define DEBUG_PIN9 BIT(20)
|
||||
#elif defined(CONFIG_BOARD_NRF51_PCA10028)
|
||||
#define DEBUG_PORT NRF_GPIO
|
||||
#define DEBUG_PIN0 BIT(12)
|
||||
#define DEBUG_PIN1 BIT(13)
|
||||
#define DEBUG_PIN2 BIT(14)
|
||||
#define DEBUG_PIN3 BIT(15)
|
||||
#define DEBUG_PIN4 BIT(16)
|
||||
#define DEBUG_PIN5 BIT(17)
|
||||
#define DEBUG_PIN6 BIT(18)
|
||||
#define DEBUG_PIN7 BIT(19)
|
||||
#define DEBUG_PIN8 BIT(20)
|
||||
#define DEBUG_PIN9 BIT(23)
|
||||
#else
|
||||
#error BT_CTLR_DEBUG_PINS not supported on this board.
|
||||
#endif
|
||||
|
||||
#define DEBUG_PIN_MASK (DEBUG_PIN0 | DEBUG_PIN1 | DEBUG_PIN2 | DEBUG_PIN3 | \
|
||||
DEBUG_PIN4 | DEBUG_PIN5 | DEBUG_PIN6 | DEBUG_PIN7 | \
|
||||
DEBUG_PIN8 | DEBUG_PIN9)
|
||||
#define DEBUG_CLOSE_MASK (DEBUG_PIN3 | DEBUG_PIN4 | DEBUG_PIN5 | DEBUG_PIN6)
|
||||
|
||||
/* below are some interesting macros referenced by controller
|
||||
* which can be defined to SoC's GPIO toggle to observe/debug the
|
||||
* controller's runtime behavior.
|
||||
*/
|
||||
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
|
||||
#define DEBUG_INIT() do { \
|
||||
NRF_GPIO->DIRSET = 0x03FF0000; \
|
||||
NRF_GPIO->OUTCLR = 0x03FF0000; } \
|
||||
DEBUG_PORT->DIRSET = DEBUG_PIN_MASK; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN_MASK; } \
|
||||
while (0)
|
||||
|
||||
#define DEBUG_CPU_SLEEP(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTSET = BIT(16); \
|
||||
NRF_GPIO->OUTCLR = BIT(16); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN0; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN0; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(16); \
|
||||
NRF_GPIO->OUTSET = BIT(16); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN0; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN0; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_TICKER_ISR(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(17); \
|
||||
NRF_GPIO->OUTSET = BIT(17); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN1; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN1; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTSET = BIT(17); \
|
||||
NRF_GPIO->OUTCLR = BIT(17); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN1; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN1; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_TICKER_TASK(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(17); \
|
||||
NRF_GPIO->OUTSET = BIT(17); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN1; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN1; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTSET = BIT(17); \
|
||||
NRF_GPIO->OUTCLR = BIT(17); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN1; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN1; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_TICKER_JOB(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(18); \
|
||||
NRF_GPIO->OUTSET = BIT(18); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN2; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN2; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTSET = BIT(18); \
|
||||
NRF_GPIO->OUTCLR = BIT(18); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN2; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN2; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_ISR(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(23); \
|
||||
NRF_GPIO->OUTSET = BIT(23); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN7; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN7; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTSET = BIT(23); \
|
||||
NRF_GPIO->OUTCLR = BIT(23); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN7; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN7; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_XTAL(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(24); \
|
||||
NRF_GPIO->OUTSET = BIT(24); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN8; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN8; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTSET = BIT(24); \
|
||||
NRF_GPIO->OUTCLR = BIT(24); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN8; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN8; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_ACTIVE(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(25); \
|
||||
NRF_GPIO->OUTSET = BIT(25); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN9; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN9; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTSET = BIT(25); \
|
||||
NRF_GPIO->OUTCLR = BIT(25); } \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN9; \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN9; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_CLOSE(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = 0x00000000; \
|
||||
NRF_GPIO->OUTSET = 0x00000000; } \
|
||||
DEBUG_PORT->OUTCLR = 0x00000000; \
|
||||
DEBUG_PORT->OUTSET = 0x00000000; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = 0x00780000; } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_CLOSE_MASK; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_PREPARE_A(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(19); \
|
||||
NRF_GPIO->OUTSET = BIT(19); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN3; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN3; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(19); \
|
||||
NRF_GPIO->OUTSET = BIT(19); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN3; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN3; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_START_A(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(19); \
|
||||
NRF_GPIO->OUTSET = BIT(19); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN3; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN3; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(19); \
|
||||
NRF_GPIO->OUTSET = BIT(19); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN3; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN3; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_PREPARE_S(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(20); \
|
||||
NRF_GPIO->OUTSET = BIT(20); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN4; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN4; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(20); \
|
||||
NRF_GPIO->OUTSET = BIT(20); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN4; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN4; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_START_S(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(20); \
|
||||
NRF_GPIO->OUTSET = BIT(20); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN4; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN4; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(20); \
|
||||
NRF_GPIO->OUTSET = BIT(20); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN4; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN4; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_PREPARE_O(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(21); \
|
||||
NRF_GPIO->OUTSET = BIT(21); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN5; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN5; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(21); \
|
||||
NRF_GPIO->OUTSET = BIT(21); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN5; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN5; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_START_O(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(21); \
|
||||
NRF_GPIO->OUTSET = BIT(21); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN5; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN5; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(21); \
|
||||
NRF_GPIO->OUTSET = BIT(21); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN5; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN5; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_PREPARE_M(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(22); \
|
||||
NRF_GPIO->OUTSET = BIT(22); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN6; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN6; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(22); \
|
||||
NRF_GPIO->OUTSET = BIT(22); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN6; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN6; } \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_RADIO_START_M(flag) do { \
|
||||
if (flag) { \
|
||||
NRF_GPIO->OUTCLR = BIT(22); \
|
||||
NRF_GPIO->OUTSET = BIT(22); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN6; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN6; } \
|
||||
else { \
|
||||
NRF_GPIO->OUTCLR = BIT(22); \
|
||||
NRF_GPIO->OUTSET = BIT(22); } \
|
||||
DEBUG_PORT->OUTCLR = DEBUG_PIN6; \
|
||||
DEBUG_PORT->OUTSET = DEBUG_PIN6; } \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
@@ -48,6 +48,63 @@ void radio_isr_set(radio_isr_fp fp_radio_isr)
|
||||
irq_enable(RADIO_IRQn);
|
||||
}
|
||||
|
||||
void radio_setup(void)
|
||||
{
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
|
||||
NRF_GPIO->DIRSET = BIT(CONFIG_BT_CTLR_GPIO_PA_PIN);
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_POL_INV)
|
||||
NRF_GPIO->OUTSET = BIT(CONFIG_BT_CTLR_GPIO_PA_PIN);
|
||||
#else
|
||||
NRF_GPIO->OUTCLR = BIT(CONFIG_BT_CTLR_GPIO_PA_PIN);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
|
||||
NRF_GPIO->DIRSET = BIT(CONFIG_BT_CTLR_GPIO_LNA_PIN);
|
||||
|
||||
radio_gpio_lna_off();
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||
|
||||
#if defined(CONFIG_SOC_SERIES_NRF52X)
|
||||
struct {
|
||||
u32_t volatile reserved_0[0x5a0 >> 2];
|
||||
u32_t volatile bridge_type;
|
||||
u32_t volatile reserved_1[((0xe00 - 0x5a0) >> 2) - 1];
|
||||
struct {
|
||||
u32_t volatile CPU0;
|
||||
u32_t volatile SPIS1;
|
||||
u32_t volatile RADIO;
|
||||
u32_t volatile ECB;
|
||||
u32_t volatile CCM;
|
||||
u32_t volatile AAR;
|
||||
u32_t volatile SAADC;
|
||||
u32_t volatile UARTE;
|
||||
u32_t volatile SERIAL0;
|
||||
u32_t volatile SERIAL2;
|
||||
u32_t volatile NFCT;
|
||||
u32_t volatile I2S;
|
||||
u32_t volatile PDM;
|
||||
u32_t volatile PWM;
|
||||
} RAMPRI;
|
||||
} volatile *NRF_AMLI = (void volatile *)0x40000000UL;
|
||||
|
||||
NRF_AMLI->RAMPRI.CPU0 = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.SPIS1 = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.RADIO = 0x00000000UL;
|
||||
NRF_AMLI->RAMPRI.ECB = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.CCM = 0x00000000UL;
|
||||
NRF_AMLI->RAMPRI.AAR = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.SAADC = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.UARTE = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.SERIAL0 = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.SERIAL2 = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.NFCT = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.I2S = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.PDM = 0xFFFFFFFFUL;
|
||||
NRF_AMLI->RAMPRI.PWM = 0xFFFFFFFFUL;
|
||||
#endif /* CONFIG_SOC_SERIES_NRF52X */
|
||||
}
|
||||
|
||||
void radio_reset(void)
|
||||
{
|
||||
irq_disable(RADIO_IRQn);
|
||||
@@ -78,11 +135,6 @@ void radio_phy_set(u8_t phy, u8_t flags)
|
||||
#if defined(CONFIG_SOC_SERIES_NRF51X)
|
||||
case BIT(1):
|
||||
mode = RADIO_MODE_MODE_Nrf_2Mbit;
|
||||
|
||||
#if defined(CONFIG_SOC_NRF52840)
|
||||
/* Workaround: nRF52840 Engineering A Errata ID 164 */
|
||||
*(volatile u32_t *)0x4000173c &= ~0x80000000;
|
||||
#endif /* CONFIG_SOC_NRF52840 */
|
||||
break;
|
||||
|
||||
#elif defined(CONFIG_SOC_SERIES_NRF52X)
|
||||
@@ -377,7 +429,7 @@ void radio_tx_enable(void)
|
||||
void radio_disable(void)
|
||||
{
|
||||
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
|
||||
NRF_PPI->CHENCLR = PPI_CHEN_CH8_Msk | PPI_CHEN_CH11_Msk;
|
||||
NRF_PPI->CHENCLR = PPI_CHEN_CH9_Msk | PPI_CHEN_CH12_Msk;
|
||||
NRF_PPI->TASKS_CHG[0].DIS = 1;
|
||||
NRF_PPI->TASKS_CHG[1].DIS = 1;
|
||||
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
|
||||
@@ -452,19 +504,19 @@ static u8_t sw_tifs_toggle;
|
||||
static void sw_switch(u8_t dir, u8_t phy_curr, u8_t flags_curr, u8_t phy_next,
|
||||
u8_t flags_next)
|
||||
{
|
||||
u8_t ppi = 12 + sw_tifs_toggle;
|
||||
u8_t ppi = 13 + sw_tifs_toggle;
|
||||
u32_t delay;
|
||||
|
||||
NRF_TIMER1->EVENTS_COMPARE[sw_tifs_toggle] = 0;
|
||||
|
||||
NRF_PPI->CH[11].EEP = (u32_t)&(NRF_RADIO->EVENTS_END);
|
||||
NRF_PPI->CH[11].TEP = (u32_t)&(NRF_PPI->TASKS_CHG[sw_tifs_toggle].EN);
|
||||
NRF_PPI->CH[12].EEP = (u32_t)&(NRF_RADIO->EVENTS_END);
|
||||
NRF_PPI->CH[12].TEP = (u32_t)&(NRF_PPI->TASKS_CHG[sw_tifs_toggle].EN);
|
||||
|
||||
NRF_PPI->CH[ppi].EEP = (u32_t)
|
||||
&(NRF_TIMER1->EVENTS_COMPARE[sw_tifs_toggle]);
|
||||
if (dir) {
|
||||
delay = radio_tx_ready_delay_get(phy_next, flags_next) +
|
||||
radio_rx_chain_delay_get(phy_curr, flags_curr);
|
||||
radio_rx_chain_delay_get(phy_curr, 1);
|
||||
|
||||
NRF_PPI->CH[ppi].TEP = (u32_t)&(NRF_RADIO->TASKS_TXEN);
|
||||
} else {
|
||||
@@ -481,7 +533,7 @@ static void sw_switch(u8_t dir, u8_t phy_curr, u8_t flags_curr, u8_t phy_next,
|
||||
NRF_TIMER1->CC[sw_tifs_toggle] = 1;
|
||||
}
|
||||
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH8_Msk | PPI_CHEN_CH11_Msk;
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH9_Msk | PPI_CHEN_CH12_Msk;
|
||||
|
||||
sw_tifs_toggle += 1;
|
||||
sw_tifs_toggle &= 1;
|
||||
@@ -521,7 +573,7 @@ void radio_switch_complete_and_disable(void)
|
||||
(RADIO_SHORTS_READY_START_Msk | RADIO_SHORTS_END_DISABLE_Msk);
|
||||
|
||||
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
|
||||
NRF_PPI->CHENCLR = PPI_CHEN_CH8_Msk | PPI_CHEN_CH11_Msk;
|
||||
NRF_PPI->CHENCLR = PPI_CHEN_CH9_Msk | PPI_CHEN_CH12_Msk;
|
||||
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
|
||||
}
|
||||
|
||||
@@ -607,7 +659,7 @@ void radio_tmr_status_reset(void)
|
||||
NRF_PPI->CHENCLR =
|
||||
(PPI_CHEN_CH0_Msk | PPI_CHEN_CH1_Msk | PPI_CHEN_CH2_Msk |
|
||||
PPI_CHEN_CH3_Msk | PPI_CHEN_CH4_Msk | PPI_CHEN_CH5_Msk |
|
||||
PPI_CHEN_CH6_Msk | PPI_CHEN_CH7_Msk);
|
||||
PPI_CHEN_CH6_Msk | PPI_CHEN_CH15_Msk);
|
||||
}
|
||||
|
||||
void radio_tmr_tifs_set(u32_t tifs)
|
||||
@@ -643,19 +695,10 @@ u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder)
|
||||
NRF_PPI->CH[1].TEP = (u32_t)&(NRF_TIMER0->TASKS_START);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH1_Msk;
|
||||
|
||||
if (trx) {
|
||||
NRF_PPI->CH[0].EEP =
|
||||
(u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP =
|
||||
(u32_t)&(NRF_RADIO->TASKS_TXEN);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk;
|
||||
} else {
|
||||
NRF_PPI->CH[0].EEP =
|
||||
(u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP =
|
||||
(u32_t)&(NRF_RADIO->TASKS_RXEN);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk;
|
||||
}
|
||||
NRF_PPI->CH[0].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP = (trx) ? (u32_t)&(NRF_RADIO->TASKS_TXEN) :
|
||||
(u32_t)&(NRF_RADIO->TASKS_RXEN);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk;
|
||||
|
||||
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
|
||||
NRF_TIMER1->TASKS_CLEAR = 1;
|
||||
@@ -664,19 +707,17 @@ u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder)
|
||||
NRF_TIMER1->BITMODE = 0; /* 16 bit */
|
||||
NRF_TIMER1->TASKS_START = 1;
|
||||
|
||||
NRF_PPI->CH[8].EEP = (u32_t)&(NRF_RADIO->EVENTS_END);
|
||||
NRF_PPI->CH[8].TEP = (u32_t)&(NRF_TIMER1->TASKS_CLEAR);
|
||||
NRF_PPI->CH[9].EEP = (u32_t)&(NRF_RADIO->EVENTS_END);
|
||||
NRF_PPI->CH[9].TEP = (u32_t)&(NRF_TIMER1->TASKS_CLEAR);
|
||||
|
||||
NRF_PPI->CH[9].EEP = (u32_t)
|
||||
&(NRF_TIMER1->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[9].TEP = (u32_t)&(NRF_PPI->TASKS_CHG[0].DIS);
|
||||
NRF_PPI->CH[10].EEP = (u32_t)&(NRF_TIMER1->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[10].TEP = (u32_t)&(NRF_PPI->TASKS_CHG[0].DIS);
|
||||
|
||||
NRF_PPI->CH[10].EEP = (u32_t)
|
||||
&(NRF_TIMER1->EVENTS_COMPARE[1]);
|
||||
NRF_PPI->CH[10].TEP = (u32_t)&(NRF_PPI->TASKS_CHG[1].DIS);
|
||||
NRF_PPI->CH[11].EEP = (u32_t)&(NRF_TIMER1->EVENTS_COMPARE[1]);
|
||||
NRF_PPI->CH[11].TEP = (u32_t)&(NRF_PPI->TASKS_CHG[1].DIS);
|
||||
|
||||
NRF_PPI->CHG[0] = PPI_CHG_CH9_Msk | PPI_CHG_CH12_Msk;
|
||||
NRF_PPI->CHG[1] = PPI_CHG_CH10_Msk | PPI_CHG_CH13_Msk;
|
||||
NRF_PPI->CHG[0] = PPI_CHG_CH10_Msk | PPI_CHG_CH13_Msk;
|
||||
NRF_PPI->CHG[1] = PPI_CHG_CH11_Msk | PPI_CHG_CH14_Msk;
|
||||
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
|
||||
|
||||
return remainder;
|
||||
@@ -684,21 +725,45 @@ u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder)
|
||||
|
||||
void radio_tmr_start_us(u8_t trx, u32_t us)
|
||||
{
|
||||
if (trx) {
|
||||
NRF_PPI->CH[0].EEP =
|
||||
(u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP =
|
||||
(u32_t)&(NRF_RADIO->TASKS_TXEN);
|
||||
} else {
|
||||
NRF_PPI->CH[0].EEP =
|
||||
(u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP =
|
||||
(u32_t)&(NRF_RADIO->TASKS_RXEN);
|
||||
}
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk;
|
||||
|
||||
NRF_TIMER0->CC[0] = us;
|
||||
NRF_TIMER0->EVENTS_COMPARE[0] = 0;
|
||||
|
||||
NRF_PPI->CH[0].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP = (trx) ? (u32_t)&(NRF_RADIO->TASKS_TXEN) :
|
||||
(u32_t)&(NRF_RADIO->TASKS_RXEN);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk;
|
||||
}
|
||||
|
||||
u32_t radio_tmr_start_now(u8_t trx)
|
||||
{
|
||||
u32_t now, start;
|
||||
|
||||
/* Setup PPI for Radio start */
|
||||
NRF_PPI->CH[0].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[0]);
|
||||
NRF_PPI->CH[0].TEP = (trx) ? (u32_t)&(NRF_RADIO->TASKS_TXEN) :
|
||||
(u32_t)&(NRF_RADIO->TASKS_RXEN);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH0_Msk;
|
||||
|
||||
/* Capture the current time */
|
||||
NRF_TIMER0->TASKS_CAPTURE[1] = 1;
|
||||
now = NRF_TIMER0->CC[1];
|
||||
start = now;
|
||||
|
||||
/* Setup PPI while determining the latency in doing so */
|
||||
do {
|
||||
/* Set start to be, now plus the determined latency */
|
||||
start = (now << 1) - start;
|
||||
|
||||
/* Setup compare event with min. 1 us offset */
|
||||
NRF_TIMER0->CC[0] = start + 1;
|
||||
NRF_TIMER0->EVENTS_COMPARE[0] = 0;
|
||||
|
||||
/* Capture the current time */
|
||||
NRF_TIMER0->TASKS_CAPTURE[1] = 1;
|
||||
now = NRF_TIMER0->CC[1];
|
||||
} while (now > start);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
void radio_tmr_stop(void)
|
||||
@@ -714,14 +779,14 @@ void radio_tmr_stop(void)
|
||||
|
||||
void radio_tmr_hcto_configure(u32_t hcto)
|
||||
{
|
||||
NRF_TIMER0->CC[2] = hcto;
|
||||
NRF_TIMER0->EVENTS_COMPARE[2] = 0;
|
||||
NRF_TIMER0->CC[1] = hcto;
|
||||
NRF_TIMER0->EVENTS_COMPARE[1] = 0;
|
||||
|
||||
NRF_PPI->CH[4].EEP = (u32_t)&(NRF_RADIO->EVENTS_ADDRESS);
|
||||
NRF_PPI->CH[4].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]);
|
||||
NRF_PPI->CH[5].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[2]);
|
||||
NRF_PPI->CH[5].TEP = (u32_t)&(NRF_RADIO->TASKS_DISABLE);
|
||||
NRF_PPI->CHENSET = (PPI_CHEN_CH4_Msk | PPI_CHEN_CH5_Msk);
|
||||
NRF_PPI->CH[3].EEP = (u32_t)&(NRF_RADIO->EVENTS_ADDRESS);
|
||||
NRF_PPI->CH[3].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[1]);
|
||||
NRF_PPI->CH[4].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[1]);
|
||||
NRF_PPI->CH[4].TEP = (u32_t)&(NRF_RADIO->TASKS_DISABLE);
|
||||
NRF_PPI->CHENSET = (PPI_CHEN_CH3_Msk | PPI_CHEN_CH4_Msk);
|
||||
}
|
||||
|
||||
void radio_tmr_aa_capture(void)
|
||||
@@ -733,21 +798,34 @@ void radio_tmr_aa_capture(void)
|
||||
NRF_PPI->CHENSET = (PPI_CHEN_CH2_Msk | PPI_CHEN_CH3_Msk);
|
||||
}
|
||||
|
||||
u32_t radio_tmr_aa_get(void)
|
||||
{
|
||||
return NRF_TIMER0->CC[1];
|
||||
}
|
||||
|
||||
static u32_t radio_tmr_aa;
|
||||
|
||||
void radio_tmr_aa_save(u32_t aa)
|
||||
{
|
||||
radio_tmr_aa = aa;
|
||||
}
|
||||
|
||||
u32_t radio_tmr_aa_restore(void)
|
||||
{
|
||||
/* NOTE: we dont need to restore for now, but return the saved value. */
|
||||
return radio_tmr_aa;
|
||||
}
|
||||
|
||||
u32_t radio_tmr_ready_get(void)
|
||||
{
|
||||
return NRF_TIMER0->CC[0];
|
||||
}
|
||||
|
||||
u32_t radio_tmr_aa_get(void)
|
||||
{
|
||||
return (NRF_TIMER0->CC[1] - NRF_TIMER0->CC[0]);
|
||||
}
|
||||
|
||||
void radio_tmr_end_capture(void)
|
||||
{
|
||||
NRF_PPI->CH[7].EEP = (u32_t)&(NRF_RADIO->EVENTS_END);
|
||||
NRF_PPI->CH[7].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH7_Msk;
|
||||
NRF_PPI->CH[5].EEP = (u32_t)&(NRF_RADIO->EVENTS_END);
|
||||
NRF_PPI->CH[5].TEP = (u32_t)&(NRF_TIMER0->TASKS_CAPTURE[2]);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH5_Msk;
|
||||
}
|
||||
|
||||
u32_t radio_tmr_end_get(void)
|
||||
@@ -765,19 +843,137 @@ u32_t radio_tmr_sample_get(void)
|
||||
return NRF_TIMER0->CC[3];
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN) || \
|
||||
defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
|
||||
void radio_gpio_pa_setup(void)
|
||||
{
|
||||
NRF_GPIOTE->CONFIG[CONFIG_BT_CTLR_PA_LNA_GPIOTE_CHAN] =
|
||||
(GPIOTE_CONFIG_MODE_Task <<
|
||||
GPIOTE_CONFIG_MODE_Pos) |
|
||||
(CONFIG_BT_CTLR_GPIO_PA_PIN <<
|
||||
GPIOTE_CONFIG_PSEL_Pos) |
|
||||
(GPIOTE_CONFIG_POLARITY_Toggle <<
|
||||
GPIOTE_CONFIG_POLARITY_Pos) |
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_POL_INV)
|
||||
(GPIOTE_CONFIG_OUTINIT_High <<
|
||||
GPIOTE_CONFIG_OUTINIT_Pos);
|
||||
#else
|
||||
(GPIOTE_CONFIG_OUTINIT_Low <<
|
||||
GPIOTE_CONFIG_OUTINIT_Pos);
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
|
||||
void radio_gpio_lna_setup(void)
|
||||
{
|
||||
NRF_GPIOTE->CONFIG[CONFIG_BT_CTLR_PA_LNA_GPIOTE_CHAN] =
|
||||
(GPIOTE_CONFIG_MODE_Task <<
|
||||
GPIOTE_CONFIG_MODE_Pos) |
|
||||
(CONFIG_BT_CTLR_GPIO_LNA_PIN <<
|
||||
GPIOTE_CONFIG_PSEL_Pos) |
|
||||
(GPIOTE_CONFIG_POLARITY_Toggle <<
|
||||
GPIOTE_CONFIG_POLARITY_Pos) |
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_POL_INV)
|
||||
(GPIOTE_CONFIG_OUTINIT_High <<
|
||||
GPIOTE_CONFIG_OUTINIT_Pos);
|
||||
#else
|
||||
(GPIOTE_CONFIG_OUTINIT_Low <<
|
||||
GPIOTE_CONFIG_OUTINIT_Pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
void radio_gpio_lna_on(void)
|
||||
{
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_POL_INV)
|
||||
NRF_GPIO->OUTCLR = BIT(CONFIG_BT_CTLR_GPIO_LNA_PIN);
|
||||
#else
|
||||
NRF_GPIO->OUTSET = BIT(CONFIG_BT_CTLR_GPIO_LNA_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
void radio_gpio_lna_off(void)
|
||||
{
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_POL_INV)
|
||||
NRF_GPIO->OUTSET = BIT(CONFIG_BT_CTLR_GPIO_LNA_PIN);
|
||||
#else
|
||||
NRF_GPIO->OUTCLR = BIT(CONFIG_BT_CTLR_GPIO_LNA_PIN);
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||
|
||||
void radio_gpio_pa_lna_enable(u32_t trx_us)
|
||||
{
|
||||
NRF_TIMER0->CC[2] = trx_us;
|
||||
NRF_TIMER0->EVENTS_COMPARE[2] = 0;
|
||||
|
||||
NRF_PPI->CH[7].EEP = (u32_t)&(NRF_TIMER0->EVENTS_COMPARE[2]);
|
||||
NRF_PPI->CH[7].TEP = (u32_t)
|
||||
&(NRF_GPIOTE->TASKS_OUT[CONFIG_BT_CTLR_PA_LNA_GPIOTE_CHAN]);
|
||||
|
||||
NRF_PPI->CH[8].EEP = (u32_t)&(NRF_RADIO->EVENTS_DISABLED);
|
||||
NRF_PPI->CH[8].TEP = (u32_t)
|
||||
&(NRF_GPIOTE->TASKS_OUT[CONFIG_BT_CTLR_PA_LNA_GPIOTE_CHAN]);
|
||||
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH7_Msk | PPI_CHEN_CH8_Msk;
|
||||
}
|
||||
|
||||
void radio_gpio_pa_lna_disable(void)
|
||||
{
|
||||
NRF_PPI->CHENCLR = PPI_CHEN_CH7_Msk | PPI_CHEN_CH8_Msk;
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN || CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||
|
||||
static u8_t MALIGN(4) _ccm_scratch[(RADIO_PDU_LEN_MAX - 4) + 16];
|
||||
|
||||
void *radio_ccm_rx_pkt_set(struct ccm *ccm, void *pkt)
|
||||
void *radio_ccm_rx_pkt_set(struct ccm *ccm, u8_t phy, void *pkt)
|
||||
{
|
||||
u32_t mode;
|
||||
|
||||
NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Disabled;
|
||||
NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Enabled;
|
||||
NRF_CCM->MODE =
|
||||
#if !defined(CONFIG_SOC_SERIES_NRF51X)
|
||||
((CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) &
|
||||
CCM_MODE_LENGTH_Msk) |
|
||||
mode = (CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) &
|
||||
CCM_MODE_MODE_Msk;
|
||||
#if defined(CONFIG_SOC_SERIES_NRF52X)
|
||||
/* Enable CCM support for 8-bit length field PDUs. */
|
||||
mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) &
|
||||
CCM_MODE_LENGTH_Msk;
|
||||
|
||||
/* Select CCM data rate based on current PHY in use. */
|
||||
switch (phy) {
|
||||
default:
|
||||
case BIT(0):
|
||||
mode |= (CCM_MODE_DATARATE_1Mbit <<
|
||||
CCM_MODE_DATARATE_Pos) &
|
||||
CCM_MODE_DATARATE_Msk;
|
||||
break;
|
||||
|
||||
case BIT(1):
|
||||
mode |= (CCM_MODE_DATARATE_2Mbit <<
|
||||
CCM_MODE_DATARATE_Pos) &
|
||||
CCM_MODE_DATARATE_Msk;
|
||||
break;
|
||||
|
||||
#if defined(CONFIG_SOC_NRF52840)
|
||||
case BIT(2):
|
||||
mode |= (CCM_MODE_DATARATE_125Kbps <<
|
||||
CCM_MODE_DATARATE_Pos) &
|
||||
CCM_MODE_DATARATE_Msk;
|
||||
|
||||
NRF_CCM->RATEOVERRIDE =
|
||||
(CCM_RATEOVERRIDE_RATEOVERRIDE_500Kbps <<
|
||||
CCM_RATEOVERRIDE_RATEOVERRIDE_Pos) &
|
||||
CCM_RATEOVERRIDE_RATEOVERRIDE_Msk;
|
||||
|
||||
NRF_PPI->CH[15].EEP = (u32_t)&(NRF_RADIO->EVENTS_RATEBOOST);
|
||||
NRF_PPI->CH[15].TEP = (u32_t)&(NRF_CCM->TASKS_RATEOVERRIDE);
|
||||
NRF_PPI->CHENSET = PPI_CHEN_CH15_Msk;
|
||||
break;
|
||||
#endif /* CONFIG_SOC_NRF52840 */
|
||||
}
|
||||
#endif
|
||||
((CCM_MODE_MODE_Decryption << CCM_MODE_MODE_Pos) &
|
||||
CCM_MODE_MODE_Msk);
|
||||
NRF_CCM->MODE = mode;
|
||||
NRF_CCM->CNFPTR = (u32_t)ccm;
|
||||
NRF_CCM->INPTR = (u32_t)_pkt_scratch;
|
||||
NRF_CCM->OUTPTR = (u32_t)pkt;
|
||||
@@ -798,15 +994,24 @@ void *radio_ccm_rx_pkt_set(struct ccm *ccm, void *pkt)
|
||||
|
||||
void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt)
|
||||
{
|
||||
u32_t mode;
|
||||
|
||||
NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Disabled;
|
||||
NRF_CCM->ENABLE = CCM_ENABLE_ENABLE_Enabled;
|
||||
NRF_CCM->MODE =
|
||||
#if !defined(CONFIG_SOC_SERIES_NRF51X)
|
||||
((CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) &
|
||||
CCM_MODE_LENGTH_Msk) |
|
||||
mode = (CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) &
|
||||
CCM_MODE_MODE_Msk;
|
||||
#if defined(CONFIG_SOC_SERIES_NRF52X)
|
||||
/* Enable CCM support for 8-bit length field PDUs. */
|
||||
mode |= (CCM_MODE_LENGTH_Extended << CCM_MODE_LENGTH_Pos) &
|
||||
CCM_MODE_LENGTH_Msk;
|
||||
|
||||
/* NOTE: use fastest data rate as tx data needs to be prepared before
|
||||
* radio Tx on any PHY.
|
||||
*/
|
||||
mode |= (CCM_MODE_DATARATE_2Mbit << CCM_MODE_DATARATE_Pos) &
|
||||
CCM_MODE_DATARATE_Msk;
|
||||
#endif
|
||||
((CCM_MODE_MODE_Encryption << CCM_MODE_MODE_Pos) &
|
||||
CCM_MODE_MODE_Msk);
|
||||
NRF_CCM->MODE = mode;
|
||||
NRF_CCM->CNFPTR = (u32_t)ccm;
|
||||
NRF_CCM->INPTR = (u32_t)pkt;
|
||||
NRF_CCM->OUTPTR = (u32_t)_pkt_scratch;
|
||||
@@ -844,13 +1049,19 @@ static u8_t MALIGN(4) _aar_scratch[3];
|
||||
|
||||
void radio_ar_configure(u32_t nirk, void *irk)
|
||||
{
|
||||
NRF_AAR->ENABLE = 1;
|
||||
NRF_AAR->ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos) &
|
||||
AAR_ENABLE_ENABLE_Msk;
|
||||
NRF_AAR->NIRK = nirk;
|
||||
NRF_AAR->IRKPTR = (u32_t)irk;
|
||||
NRF_AAR->ADDRPTR = (u32_t)NRF_RADIO->PACKETPTR - 1;
|
||||
NRF_AAR->SCRATCHPTR = (u32_t)&_aar_scratch[0];
|
||||
|
||||
NRF_AAR->EVENTS_END = 0;
|
||||
NRF_AAR->EVENTS_RESOLVED = 0;
|
||||
NRF_AAR->EVENTS_NOTRESOLVED = 0;
|
||||
|
||||
radio_bc_configure(64);
|
||||
radio_bc_status_reset();
|
||||
|
||||
NRF_PPI->CH[6].EEP = (u32_t)&(NRF_RADIO->EVENTS_BCMATCH);
|
||||
NRF_PPI->CH[6].TEP = (u32_t)&(NRF_AAR->TASKS_START);
|
||||
@@ -864,18 +1075,16 @@ u32_t radio_ar_match_get(void)
|
||||
|
||||
void radio_ar_status_reset(void)
|
||||
{
|
||||
if (radio_bc_has_match()) {
|
||||
NRF_AAR->EVENTS_END = 0;
|
||||
NRF_AAR->EVENTS_RESOLVED = 0;
|
||||
NRF_AAR->EVENTS_NOTRESOLVED = 0;
|
||||
}
|
||||
|
||||
radio_bc_status_reset();
|
||||
|
||||
NRF_AAR->ENABLE = (AAR_ENABLE_ENABLE_Disabled << AAR_ENABLE_ENABLE_Pos) &
|
||||
AAR_ENABLE_ENABLE_Msk;
|
||||
}
|
||||
|
||||
u32_t radio_ar_has_match(void)
|
||||
{
|
||||
return (radio_bc_has_match() &&
|
||||
(NRF_AAR->EVENTS_END) &&
|
||||
(NRF_AAR->EVENTS_RESOLVED));
|
||||
NRF_AAR->EVENTS_END &&
|
||||
NRF_AAR->EVENTS_RESOLVED &&
|
||||
!NRF_AAR->EVENTS_NOTRESOLVED);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ typedef void (*radio_isr_fp) (void);
|
||||
void isr_radio(void);
|
||||
void radio_isr_set(radio_isr_fp fp_radio_isr);
|
||||
|
||||
void radio_setup(void);
|
||||
void radio_reset(void);
|
||||
void radio_phy_set(u8_t phy, u8_t flags);
|
||||
void radio_tx_power_set(u32_t power);
|
||||
@@ -67,17 +68,27 @@ void radio_tmr_status_reset(void);
|
||||
void radio_tmr_tifs_set(u32_t tifs);
|
||||
u32_t radio_tmr_start(u8_t trx, u32_t ticks_start, u32_t remainder);
|
||||
void radio_tmr_start_us(u8_t trx, u32_t us);
|
||||
u32_t radio_tmr_start_now(u8_t trx);
|
||||
void radio_tmr_stop(void);
|
||||
void radio_tmr_hcto_configure(u32_t hcto);
|
||||
void radio_tmr_aa_capture(void);
|
||||
u32_t radio_tmr_ready_get(void);
|
||||
u32_t radio_tmr_aa_get(void);
|
||||
void radio_tmr_aa_save(u32_t aa);
|
||||
u32_t radio_tmr_aa_restore(void);
|
||||
u32_t radio_tmr_ready_get(void);
|
||||
void radio_tmr_end_capture(void);
|
||||
u32_t radio_tmr_end_get(void);
|
||||
void radio_tmr_sample(void);
|
||||
u32_t radio_tmr_sample_get(void);
|
||||
|
||||
void *radio_ccm_rx_pkt_set(struct ccm *ccm, void *pkt);
|
||||
void radio_gpio_pa_setup(void);
|
||||
void radio_gpio_lna_setup(void);
|
||||
void radio_gpio_lna_on(void);
|
||||
void radio_gpio_lna_off(void);
|
||||
void radio_gpio_pa_lna_enable(u32_t trx_us);
|
||||
void radio_gpio_pa_lna_disable(void);
|
||||
|
||||
void *radio_ccm_rx_pkt_set(struct ccm *ccm, u8_t phy, void *pkt);
|
||||
void *radio_ccm_tx_pkt_set(struct ccm *ccm, void *pkt);
|
||||
u32_t radio_ccm_is_done(void);
|
||||
u32_t radio_ccm_mic_is_valid(void);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <bluetooth/hci_vs.h>
|
||||
#include <bluetooth/buf.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <drivers/bluetooth/hci_driver.h>
|
||||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
@@ -57,6 +58,7 @@ static u32_t dup_curr;
|
||||
s32_t hci_hbuf_total;
|
||||
u32_t hci_hbuf_sent;
|
||||
u32_t hci_hbuf_acked;
|
||||
u16_t hci_hbuf_pend[CONFIG_BT_MAX_CONN];
|
||||
atomic_t hci_state_mask;
|
||||
static struct k_poll_signal *hbuf_signal;
|
||||
#endif
|
||||
@@ -73,6 +75,11 @@ static u64_t event_mask = DEFAULT_EVENT_MASK;
|
||||
static u64_t event_mask_page_2 = DEFAULT_EVENT_MASK_PAGE_2;
|
||||
static u64_t le_event_mask = DEFAULT_LE_EVENT_MASK;
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
static void le_conn_complete(u8_t status, struct radio_le_conn_cmplt *radio_cc,
|
||||
u16_t handle, struct net_buf *buf);
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
static void evt_create(struct net_buf *buf, u8_t evt, u8_t len)
|
||||
{
|
||||
struct bt_hci_evt_hdr *hdr;
|
||||
@@ -214,6 +221,7 @@ static void reset(struct net_buf *buf, struct net_buf **evt)
|
||||
hci_hbuf_total = 0;
|
||||
hci_hbuf_sent = 0;
|
||||
hci_hbuf_acked = 0;
|
||||
memset(hci_hbuf_pend, 0, sizeof(hci_hbuf_pend));
|
||||
conn_count = 0;
|
||||
if (buf) {
|
||||
atomic_set_bit(&hci_state_mask, HCI_STATE_BIT_RESET);
|
||||
@@ -261,6 +269,7 @@ static void set_ctl_to_host_flow(struct net_buf *buf, struct net_buf **evt)
|
||||
|
||||
hci_hbuf_sent = 0;
|
||||
hci_hbuf_acked = 0;
|
||||
memset(hci_hbuf_pend, 0, sizeof(hci_hbuf_pend));
|
||||
hci_hbuf_total = -hci_hbuf_total;
|
||||
}
|
||||
|
||||
@@ -310,7 +319,18 @@ static void host_num_completed_packets(struct net_buf *buf,
|
||||
|
||||
/* leave *evt == NULL so no event is generated */
|
||||
for (i = 0; i < cmd->num_handles; i++) {
|
||||
count += sys_le16_to_cpu(cmd->h[i].count);
|
||||
u16_t h = sys_le16_to_cpu(cmd->h[i].handle);
|
||||
u16_t c = sys_le16_to_cpu(cmd->h[i].count);
|
||||
|
||||
if ((h >= ARRAY_SIZE(hci_hbuf_pend)) ||
|
||||
(c > hci_hbuf_pend[h])) {
|
||||
ccst = cmd_complete(evt, sizeof(*ccst));
|
||||
ccst->status = BT_HCI_ERR_INVALID_PARAM;
|
||||
return;
|
||||
}
|
||||
|
||||
hci_hbuf_pend[h] -= c;
|
||||
count += c;
|
||||
}
|
||||
|
||||
BT_DBG("FC: acked: %d", count);
|
||||
@@ -456,86 +476,87 @@ static void read_supported_commands(struct net_buf *buf, struct net_buf **evt)
|
||||
rp->commands[5] |= BIT(6) | BIT(7);
|
||||
/* Read TX Power Level. */
|
||||
rp->commands[10] |= BIT(2);
|
||||
|
||||
#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
|
||||
/* Set FC, Host Buffer Size and Host Num Completed */
|
||||
rp->commands[10] |= BIT(5) | BIT(6) | BIT(7);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */
|
||||
|
||||
/* Read Local Version Info, Read Local Supported Features. */
|
||||
rp->commands[14] |= BIT(3) | BIT(5);
|
||||
/* Read BD ADDR. */
|
||||
rp->commands[15] |= BIT(1);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_RSSI)
|
||||
/* Read RSSI. */
|
||||
rp->commands[15] |= BIT(5);
|
||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||
|
||||
/* Set Event Mask Page 2 */
|
||||
rp->commands[22] |= BIT(2);
|
||||
/* LE Set Event Mask, LE Read Buffer Size, LE Read Local Supp Feats,
|
||||
* Set Random Addr
|
||||
*/
|
||||
rp->commands[25] |= BIT(0) | BIT(1) | BIT(2) | BIT(4);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_FILTER)
|
||||
/* LE Read WL Size, LE Clear WL */
|
||||
rp->commands[26] |= BIT(6) | BIT(7);
|
||||
/* LE Add Dev to WL, LE Remove Dev from WL */
|
||||
rp->commands[27] |= BIT(0) | BIT(1);
|
||||
#endif /* CONFIG_BT_CTLR_FILTER */
|
||||
|
||||
/* LE Encrypt, LE Rand */
|
||||
rp->commands[27] |= BIT(6) | BIT(7);
|
||||
/* LE Read Supported States */
|
||||
rp->commands[28] |= BIT(3);
|
||||
|
||||
#if defined(CONFIG_BT_BROADCASTER)
|
||||
/* LE Set Adv Params, LE Read Adv Channel TX Power, LE Set Adv Data */
|
||||
rp->commands[25] |= BIT(5) | BIT(6) | BIT(7);
|
||||
/* LE Set Scan Response Data, LE Set Adv Enable */
|
||||
rp->commands[26] |= BIT(0) | BIT(1);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_BROADCASTER */
|
||||
|
||||
#if defined(CONFIG_BT_OBSERVER)
|
||||
/* LE Set Scan Params, LE Set Scan Enable */
|
||||
rp->commands[26] |= BIT(2) | BIT(3);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
#if defined(CONFIG_BT_CENTRAL)
|
||||
/* LE Create Connection, LE Create Connection Cancel */
|
||||
rp->commands[26] |= BIT(4) | BIT(5);
|
||||
/* Set Host Channel Classification */
|
||||
rp->commands[27] |= BIT(3);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||
/* LE Start Encryption */
|
||||
rp->commands[28] |= BIT(0);
|
||||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||
#endif /* CONFIG_BT_CENTRAL */
|
||||
|
||||
#if defined(CONFIG_BT_PERIPHERAL)
|
||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||
/* LE LTK Request Reply, LE LTK Request Negative Reply */
|
||||
rp->commands[28] |= BIT(1) | BIT(2);
|
||||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||
#endif
|
||||
#if defined(CONFIG_BT_CTLR_DTM_HCI)
|
||||
/* LE RX Test, LE TX Test, LE Test End */
|
||||
rp->commands[28] |= BIT(4) | BIT(5) | BIT(6);
|
||||
/* LE Enhanced RX Test. */
|
||||
rp->commands[35] |= BIT(7);
|
||||
/* LE Enhanced TX Test. */
|
||||
rp->commands[36] |= BIT(0);
|
||||
#endif /* CONFIG_BT_CTLR_DTM_HCI */
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
#endif /* CONFIG_BT_PERIPHERAL */
|
||||
|
||||
/* Disconnect. */
|
||||
rp->commands[0] |= BIT(5);
|
||||
/* LE Connection Update, LE Read Channel Map, LE Read Remote Features */
|
||||
rp->commands[27] |= BIT(2) | BIT(4) | BIT(5);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ)
|
||||
/* LE Remote Conn Param Req and Neg Reply */
|
||||
rp->commands[33] |= BIT(4) | BIT(5);
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_LE_PING)
|
||||
/* Read and Write authenticated payload timeout */
|
||||
rp->commands[32] |= BIT(4) | BIT(5);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
/* LE resolving list commands, LE Read Peer RPA */
|
||||
rp->commands[34] |= BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7);
|
||||
/* LE Read Local RPA, LE Set AR Enable, Set RPA Timeout */
|
||||
rp->commands[35] |= BIT(0) | BIT(1) | BIT(2);
|
||||
/* LE Set Privacy Mode */
|
||||
rp->commands[39] |= BIT(2);
|
||||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
#endif /* CONFIG_BT_CTLR_LE_PING */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_DATA_LENGTH)
|
||||
/* LE Set Data Length, and LE Read Suggested Data Length. */
|
||||
@@ -546,10 +567,39 @@ static void read_supported_commands(struct net_buf *buf, struct net_buf **evt)
|
||||
rp->commands[35] |= BIT(3);
|
||||
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PHY)
|
||||
/* LE Read PHY Command. */
|
||||
rp->commands[35] |= BIT(4);
|
||||
/* LE Set Default PHY Command. */
|
||||
rp->commands[35] |= BIT(5);
|
||||
/* LE Set PHY Command. */
|
||||
rp->commands[35] |= BIT(6);
|
||||
#endif /* CONFIG_BT_CTLR_PHY */
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_DTM_HCI)
|
||||
/* LE RX Test, LE TX Test, LE Test End */
|
||||
rp->commands[28] |= BIT(4) | BIT(5) | BIT(6);
|
||||
/* LE Enhanced RX Test. */
|
||||
rp->commands[35] |= BIT(7);
|
||||
/* LE Enhanced TX Test. */
|
||||
rp->commands[36] |= BIT(0);
|
||||
#endif /* CONFIG_BT_CTLR_DTM_HCI */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
/* LE resolving list commands, LE Read Peer RPA */
|
||||
rp->commands[34] |= BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7);
|
||||
/* LE Read Local RPA, LE Set AR Enable, Set RPA Timeout */
|
||||
rp->commands[35] |= BIT(0) | BIT(1) | BIT(2);
|
||||
/* LE Set Privacy Mode */
|
||||
rp->commands[39] |= BIT(2);
|
||||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
|
||||
#if defined(CONFIG_BT_HCI_RAW) && defined(CONFIG_BT_TINYCRYPT_ECC)
|
||||
/* LE Read Local P256 Public Key and LE Generate DH Key*/
|
||||
rp->commands[34] |= BIT(1) | BIT(2);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_HCI_RAW && CONFIG_BT_TINYCRYPT_ECC */
|
||||
|
||||
/* LE Read TX Power. */
|
||||
rp->commands[38] |= BIT(7);
|
||||
}
|
||||
@@ -682,11 +732,12 @@ static void le_set_random_address(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_le_set_random_address *cmd = (void *)buf->data;
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
u32_t status;
|
||||
|
||||
ll_addr_set(1, &cmd->bdaddr.val[0]);
|
||||
status = ll_addr_set(1, &cmd->bdaddr.val[0]);
|
||||
|
||||
ccst = cmd_complete(evt, sizeof(*ccst));
|
||||
ccst->status = 0x00;
|
||||
ccst->status = status;
|
||||
}
|
||||
|
||||
static void le_read_wl_size(struct net_buf *buf, struct net_buf **evt)
|
||||
@@ -958,12 +1009,29 @@ static void le_create_connection(struct net_buf *buf, struct net_buf **evt)
|
||||
static void le_create_conn_cancel(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
struct net_buf *cc;
|
||||
u8_t cmd_status;
|
||||
u32_t status;
|
||||
|
||||
status = ll_connect_disable();
|
||||
cmd_status = status ? BT_HCI_ERR_CMD_DISALLOWED : 0x00;
|
||||
|
||||
if (!cmd_status) {
|
||||
*evt = bt_buf_get_rx(BT_BUF_EVT, K_FOREVER);
|
||||
le_conn_complete(BT_HCI_ERR_UNKNOWN_CONN_ID, NULL, 0x0000,
|
||||
*evt);
|
||||
if ((*evt)->len) {
|
||||
ccst = cmd_complete(&cc, sizeof(*ccst));
|
||||
ccst->status = cmd_status;
|
||||
bt_recv_prio(cc);
|
||||
return;
|
||||
} else {
|
||||
net_buf_unref(*evt);
|
||||
}
|
||||
}
|
||||
|
||||
ccst = cmd_complete(evt, sizeof(*ccst));
|
||||
ccst->status = (!status) ? 0x00 : BT_HCI_ERR_CMD_DISALLOWED;
|
||||
ccst->status = cmd_status;
|
||||
}
|
||||
|
||||
static void le_set_host_chan_classif(struct net_buf *buf, struct net_buf **evt)
|
||||
@@ -1072,13 +1140,10 @@ static void le_conn_update(struct net_buf *buf, struct net_buf **evt)
|
||||
conn_latency = sys_le16_to_cpu(cmd->conn_latency);
|
||||
supervision_timeout = sys_le16_to_cpu(cmd->supervision_timeout);
|
||||
|
||||
/** @todo if peer supports LE Conn Param Req,
|
||||
* use Req cmd (1) instead of Initiate cmd (0).
|
||||
*/
|
||||
status = ll_conn_update(handle, 0, 0, conn_interval_max,
|
||||
conn_latency, supervision_timeout);
|
||||
|
||||
*evt = cmd_status((!status) ? 0x00 : BT_HCI_ERR_CMD_DISALLOWED);
|
||||
*evt = cmd_status(status);
|
||||
}
|
||||
|
||||
static void le_conn_param_req_reply(struct net_buf *buf, struct net_buf **evt)
|
||||
@@ -1100,7 +1165,7 @@ static void le_conn_param_req_reply(struct net_buf *buf, struct net_buf **evt)
|
||||
timeout);
|
||||
|
||||
rp = cmd_complete(evt, sizeof(*rp));
|
||||
rp->status = (!status) ? 0x00 : BT_HCI_ERR_CMD_DISALLOWED;
|
||||
rp->status = status;
|
||||
rp->handle = sys_cpu_to_le16(handle);
|
||||
}
|
||||
|
||||
@@ -1116,7 +1181,7 @@ static void le_conn_param_req_neg_reply(struct net_buf *buf,
|
||||
status = ll_conn_update(handle, 2, cmd->reason, 0, 0, 0);
|
||||
|
||||
rp = cmd_complete(evt, sizeof(*rp));
|
||||
rp->status = (!status) ? 0x00 : BT_HCI_ERR_CMD_DISALLOWED;
|
||||
rp->status = status;
|
||||
rp->handle = sys_cpu_to_le16(handle);
|
||||
}
|
||||
|
||||
@@ -1220,16 +1285,45 @@ static void le_set_phy(struct net_buf *buf, struct net_buf **evt)
|
||||
u32_t status;
|
||||
u16_t handle;
|
||||
u16_t phy_opts;
|
||||
u8_t mask_phys;
|
||||
|
||||
handle = sys_le16_to_cpu(cmd->handle);
|
||||
phy_opts = sys_le16_to_cpu(cmd->phy_opts);
|
||||
|
||||
mask_phys = 0x01;
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_PHY_2M)) {
|
||||
mask_phys |= BIT(1);
|
||||
}
|
||||
if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) {
|
||||
mask_phys |= BIT(2);
|
||||
}
|
||||
|
||||
if (cmd->all_phys & BT_HCI_LE_PHY_TX_ANY) {
|
||||
cmd->tx_phys = 0x07;
|
||||
cmd->tx_phys = mask_phys;
|
||||
}
|
||||
if (cmd->all_phys & BT_HCI_LE_PHY_RX_ANY) {
|
||||
cmd->rx_phys = 0x07;
|
||||
cmd->rx_phys = mask_phys;
|
||||
}
|
||||
|
||||
if (!(cmd->tx_phys & 0x07) ||
|
||||
!(cmd->rx_phys & 0x07)) {
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
|
||||
ccst = cmd_complete(evt, sizeof(*ccst));
|
||||
ccst->status = BT_HCI_ERR_INVALID_PARAM;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((cmd->tx_phys | cmd->rx_phys) & ~mask_phys) {
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
|
||||
ccst = cmd_complete(evt, sizeof(*ccst));
|
||||
ccst->status = BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (phy_opts & 0x03) {
|
||||
phy_opts -= 1;
|
||||
phy_opts &= 1;
|
||||
@@ -1673,10 +1767,12 @@ static void vs_read_supported_commands(struct net_buf *buf,
|
||||
|
||||
/* Set Version Information, Supported Commands, Supported Features. */
|
||||
rp->commands[0] |= BIT(0) | BIT(1) | BIT(2);
|
||||
#if defined(CONFIG_BT_CTLR_HCI_VS_EXT)
|
||||
#if defined(CONFIG_BT_HCI_VS_EXT)
|
||||
/* Write BD_ADDR, Read Build Info */
|
||||
rp->commands[0] |= BIT(5) | BIT(7);
|
||||
/* Read Static Addresses, Read Key Hierarchy Roots */
|
||||
rp->commands[1] |= BIT(0) | BIT(1);
|
||||
#endif /* CONFIG_BT_CTLR_HCI_VS_EXT */
|
||||
#endif /* CONFIG_BT_HCI_VS_EXT */
|
||||
}
|
||||
|
||||
static void vs_read_supported_features(struct net_buf *buf,
|
||||
@@ -1690,7 +1786,41 @@ static void vs_read_supported_features(struct net_buf *buf,
|
||||
memset(&rp->features[0], 0x00, sizeof(rp->features));
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_HCI_VS_EXT)
|
||||
#if defined(CONFIG_BT_HCI_VS_EXT)
|
||||
static void vs_write_bd_addr(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_cp_vs_write_bd_addr *cmd = (void *)buf->data;
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
|
||||
ll_addr_set(0, &cmd->bdaddr.val[0]);
|
||||
|
||||
ccst = cmd_complete(evt, sizeof(*ccst));
|
||||
ccst->status = 0x00;
|
||||
}
|
||||
|
||||
static void vs_read_build_info(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_rp_vs_read_build_info *rp;
|
||||
|
||||
#define BUILD_TIMESTAMP " " __DATE__ " " __TIME__
|
||||
|
||||
#define HCI_VS_BUILD_INFO "Zephyr OS v" \
|
||||
KERNEL_VERSION_STRING BUILD_TIMESTAMP CONFIG_BT_CTLR_HCI_VS_BUILD_INFO
|
||||
|
||||
const char build_info[] = HCI_VS_BUILD_INFO;
|
||||
|
||||
#define BUILD_INFO_EVT_LEN (sizeof(struct bt_hci_evt_hdr) + \
|
||||
sizeof(struct bt_hci_evt_cmd_complete) + \
|
||||
sizeof(struct bt_hci_rp_vs_read_build_info) + \
|
||||
sizeof(build_info))
|
||||
|
||||
BUILD_ASSERT(CONFIG_BT_RX_BUF_LEN >= BUILD_INFO_EVT_LEN);
|
||||
|
||||
rp = cmd_complete(evt, sizeof(*rp) + sizeof(build_info));
|
||||
rp->status = 0x00;
|
||||
memcpy(rp->info, build_info, sizeof(build_info));
|
||||
}
|
||||
|
||||
static void vs_read_static_addrs(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct bt_hci_rp_vs_read_static_addrs *rp;
|
||||
@@ -1707,6 +1837,7 @@ static void vs_read_static_addrs(struct net_buf *buf, struct net_buf **evt)
|
||||
struct bt_hci_vs_static_addr *addr;
|
||||
|
||||
rp = cmd_complete(evt, sizeof(*rp) + sizeof(*addr));
|
||||
rp->status = 0x00;
|
||||
rp->num_addrs = 1;
|
||||
|
||||
addr = &rp->a[0];
|
||||
@@ -1776,7 +1907,7 @@ static void vs_read_key_hierarchy_roots(struct net_buf *buf,
|
||||
#endif /* CONFIG_SOC_FAMILY_NRF5 */
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_CTLR_HCI_VS_EXT */
|
||||
#endif /* CONFIG_BT_HCI_VS_EXT */
|
||||
|
||||
static int vendor_cmd_handle(u16_t ocf, struct net_buf *cmd,
|
||||
struct net_buf **evt)
|
||||
@@ -1794,7 +1925,15 @@ static int vendor_cmd_handle(u16_t ocf, struct net_buf *cmd,
|
||||
vs_read_supported_features(cmd, evt);
|
||||
break;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_HCI_VS_EXT)
|
||||
#if defined(CONFIG_BT_HCI_VS_EXT)
|
||||
case BT_OCF(BT_HCI_OP_VS_READ_BUILD_INFO):
|
||||
vs_read_build_info(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_VS_WRITE_BD_ADDR):
|
||||
vs_write_bd_addr(cmd, evt);
|
||||
break;
|
||||
|
||||
case BT_OCF(BT_HCI_OP_VS_READ_STATIC_ADDRS):
|
||||
vs_read_static_addrs(cmd, evt);
|
||||
break;
|
||||
@@ -1802,7 +1941,7 @@ static int vendor_cmd_handle(u16_t ocf, struct net_buf *cmd,
|
||||
case BT_OCF(BT_HCI_OP_VS_READ_KEY_HIERARCHY_ROOTS):
|
||||
vs_read_key_hierarchy_roots(cmd, evt);
|
||||
break;
|
||||
#endif /* CONFIG_BT_CTLR_HCI_VS_EXT */
|
||||
#endif /* CONFIG_BT_HCI_VS_EXT */
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -1811,6 +1950,21 @@ static int vendor_cmd_handle(u16_t ocf, struct net_buf *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void data_buf_overflow(struct net_buf **buf)
|
||||
{
|
||||
struct bt_hci_evt_data_buf_overflow *ep;
|
||||
|
||||
if (!(event_mask & BT_EVT_MASK_DATA_BUFFER_OVERFLOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
*buf = bt_buf_get_rx(BT_BUF_EVT, K_FOREVER);
|
||||
evt_create(*buf, BT_HCI_EVT_DATA_BUF_OVERFLOW, sizeof(*ep));
|
||||
ep = net_buf_add(*buf, sizeof(*ep));
|
||||
|
||||
ep->link_type = BT_OVERFLOW_LINK_ACL;
|
||||
}
|
||||
|
||||
struct net_buf *hci_cmd_handle(struct net_buf *cmd)
|
||||
{
|
||||
struct bt_hci_evt_cc_status *ccst;
|
||||
@@ -1869,7 +2023,7 @@ struct net_buf *hci_cmd_handle(struct net_buf *cmd)
|
||||
return evt;
|
||||
}
|
||||
|
||||
int hci_acl_handle(struct net_buf *buf)
|
||||
int hci_acl_handle(struct net_buf *buf, struct net_buf **evt)
|
||||
{
|
||||
struct radio_pdu_node_tx *radio_pdu_node_tx;
|
||||
struct bt_hci_acl_hdr *acl;
|
||||
@@ -1878,6 +2032,8 @@ int hci_acl_handle(struct net_buf *buf)
|
||||
u8_t flags;
|
||||
u16_t len;
|
||||
|
||||
*evt = NULL;
|
||||
|
||||
if (buf->len < sizeof(*acl)) {
|
||||
BT_ERR("No HCI ACL header");
|
||||
return -EINVAL;
|
||||
@@ -1900,6 +2056,7 @@ int hci_acl_handle(struct net_buf *buf)
|
||||
radio_pdu_node_tx = radio_tx_mem_acquire();
|
||||
if (!radio_pdu_node_tx) {
|
||||
BT_ERR("Tx Buffer Overflow");
|
||||
data_buf_overflow(evt);
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
@@ -2221,19 +2378,20 @@ static void le_scan_req_received(struct pdu_data *pdu_data, u8_t *b,
|
||||
#endif /* CONFIG_BT_CTLR_SCAN_REQ_NOTIFY */
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle,
|
||||
struct net_buf *buf)
|
||||
static void le_conn_complete(u8_t status, struct radio_le_conn_cmplt *radio_cc,
|
||||
u16_t handle, struct net_buf *buf)
|
||||
{
|
||||
struct bt_hci_evt_le_conn_complete *lecc;
|
||||
struct radio_le_conn_cmplt *radio_cc;
|
||||
|
||||
radio_cc = (struct radio_le_conn_cmplt *) (pdu_data->payload.lldata);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
if (!status) {
|
||||
/* Update current RPA */
|
||||
ll_rl_crpa_set(radio_cc->peer_addr_type, &radio_cc->peer_addr[0],
|
||||
0xff, &radio_cc->peer_rpa[0]);
|
||||
ll_rl_crpa_set(radio_cc->peer_addr_type,
|
||||
&radio_cc->peer_addr[0], 0xff,
|
||||
&radio_cc->peer_rpa[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
|
||||
(!(le_event_mask & BT_EVT_MASK_LE_CONN_COMPLETE) &&
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
@@ -2244,7 +2402,7 @@ static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!radio_cc->status) {
|
||||
if (!status) {
|
||||
conn_count++;
|
||||
}
|
||||
|
||||
@@ -2255,7 +2413,13 @@ static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle,
|
||||
leecc = meta_evt(buf, BT_HCI_EVT_LE_ENH_CONN_COMPLETE,
|
||||
sizeof(*leecc));
|
||||
|
||||
leecc->status = radio_cc->status;
|
||||
if (status) {
|
||||
memset(leecc, 0x00, sizeof(*leecc));
|
||||
leecc->status = status;
|
||||
return;
|
||||
}
|
||||
|
||||
leecc->status = 0x00;
|
||||
leecc->handle = sys_cpu_to_le16(handle);
|
||||
leecc->role = radio_cc->role;
|
||||
|
||||
@@ -2287,7 +2451,13 @@ static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle,
|
||||
|
||||
lecc = meta_evt(buf, BT_HCI_EVT_LE_CONN_COMPLETE, sizeof(*lecc));
|
||||
|
||||
lecc->status = radio_cc->status;
|
||||
if (status) {
|
||||
memset(lecc, 0x00, sizeof(*lecc));
|
||||
lecc->status = status;
|
||||
return;
|
||||
}
|
||||
|
||||
lecc->status = 0x00;
|
||||
lecc->handle = sys_cpu_to_le16(handle);
|
||||
lecc->role = radio_cc->role;
|
||||
lecc->peer_addr.type = radio_cc->peer_addr_type;
|
||||
@@ -2314,6 +2484,13 @@ static void disconn_complete(struct pdu_data *pdu_data, u16_t handle,
|
||||
ep->handle = sys_cpu_to_le16(handle);
|
||||
ep->reason = *((u8_t *)pdu_data);
|
||||
|
||||
#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
|
||||
/* Clear any pending packets upon disconnection */
|
||||
/* Note: This requires linear handle values starting from 0 */
|
||||
LL_ASSERT(handle < ARRAY_SIZE(hci_hbuf_pend));
|
||||
hci_hbuf_acked += hci_hbuf_pend[handle];
|
||||
hci_hbuf_pend[handle] = 0;
|
||||
#endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */
|
||||
conn_count--;
|
||||
}
|
||||
|
||||
@@ -2457,7 +2634,12 @@ static void encode_control(struct radio_pdu_node_rx *node_rx,
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
case NODE_RX_TYPE_CONNECTION:
|
||||
le_conn_complete(pdu_data, handle, buf);
|
||||
{
|
||||
struct radio_le_conn_cmplt *cc;
|
||||
|
||||
cc = (void *)pdu_data->payload.lldata;
|
||||
le_conn_complete(cc->status, cc, handle, buf);
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_RX_TYPE_TERMINATE:
|
||||
@@ -2753,6 +2935,11 @@ void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf)
|
||||
LL_ASSERT((hci_hbuf_sent - hci_hbuf_acked) <
|
||||
hci_hbuf_total);
|
||||
hci_hbuf_sent++;
|
||||
/* Note: This requires linear handle values starting
|
||||
* from 0
|
||||
*/
|
||||
LL_ASSERT(handle < ARRAY_SIZE(hci_hbuf_pend));
|
||||
hci_hbuf_pend[handle]++;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -186,11 +186,14 @@ static inline struct net_buf *process_node(struct radio_pdu_node_rx *node_rx)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
|
||||
static inline struct net_buf *process_hbuf(void)
|
||||
static inline struct net_buf *process_hbuf(struct radio_pdu_node_rx *n)
|
||||
{
|
||||
/* shadow total count in case of preemption */
|
||||
struct radio_pdu_node_rx *node_rx = NULL;
|
||||
s32_t hbuf_total = hci_hbuf_total;
|
||||
struct net_buf *buf = NULL;
|
||||
sys_snode_t *node = NULL;
|
||||
s8_t class;
|
||||
int reset;
|
||||
|
||||
reset = atomic_test_and_clear_bit(&hci_state_mask, HCI_STATE_BIT_RESET);
|
||||
@@ -199,67 +202,73 @@ static inline struct net_buf *process_hbuf(void)
|
||||
sys_slist_init(&hbuf_pend);
|
||||
}
|
||||
|
||||
if (hbuf_total > 0) {
|
||||
struct radio_pdu_node_rx *node_rx = NULL;
|
||||
s8_t class, next_class = -1;
|
||||
sys_snode_t *node = NULL;
|
||||
if (hbuf_total <= 0) {
|
||||
hbuf_count = -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* available host buffers */
|
||||
/* available host buffers */
|
||||
hbuf_count = hbuf_total - (hci_hbuf_sent - hci_hbuf_acked);
|
||||
|
||||
/* host acked ACL packets, try to dequeue from hbuf */
|
||||
node = sys_slist_peek_head(&hbuf_pend);
|
||||
if (!node) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return early if this iteration already has a node to process */
|
||||
node_rx = NODE_RX(node);
|
||||
class = hci_get_class(node_rx);
|
||||
if (n) {
|
||||
if (class == HCI_CLASS_EVT_CONNECTION ||
|
||||
(class == HCI_CLASS_ACL_DATA && hbuf_count)) {
|
||||
/* node to process later, schedule an iteration */
|
||||
BT_DBG("FC: signalling");
|
||||
k_poll_signal(&hbuf_signal, 0x0);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (class) {
|
||||
case HCI_CLASS_EVT_CONNECTION:
|
||||
BT_DBG("FC: dequeueing event");
|
||||
(void) sys_slist_get(&hbuf_pend);
|
||||
break;
|
||||
case HCI_CLASS_ACL_DATA:
|
||||
if (hbuf_count) {
|
||||
BT_DBG("FC: dequeueing ACL data");
|
||||
(void) sys_slist_get(&hbuf_pend);
|
||||
} else {
|
||||
/* no buffers, HCI will signal */
|
||||
node = NULL;
|
||||
}
|
||||
break;
|
||||
case HCI_CLASS_EVT_DISCARDABLE:
|
||||
case HCI_CLASS_EVT_REQUIRED:
|
||||
default:
|
||||
LL_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (node) {
|
||||
buf = encode_node(node_rx, class);
|
||||
/* Update host buffers after encoding */
|
||||
hbuf_count = hbuf_total - (hci_hbuf_sent - hci_hbuf_acked);
|
||||
|
||||
/* host acked ACL packets, try to dequeue from hbuf */
|
||||
/* next node */
|
||||
node = sys_slist_peek_head(&hbuf_pend);
|
||||
if (node) {
|
||||
node_rx = NODE_RX(node);
|
||||
class = hci_get_class(node_rx);
|
||||
switch (class) {
|
||||
case HCI_CLASS_EVT_CONNECTION:
|
||||
BT_DBG("FC: dequeueing event");
|
||||
node = sys_slist_get(&hbuf_pend);
|
||||
break;
|
||||
case HCI_CLASS_ACL_DATA:
|
||||
if (hbuf_count) {
|
||||
BT_DBG("FC: dequeueing ACL data");
|
||||
node = sys_slist_get(&hbuf_pend);
|
||||
hbuf_count--;
|
||||
} else {
|
||||
/* no buffers, HCI will signal */
|
||||
node = NULL;
|
||||
}
|
||||
break;
|
||||
case HCI_CLASS_EVT_DISCARDABLE:
|
||||
case HCI_CLASS_EVT_REQUIRED:
|
||||
default:
|
||||
LL_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (node) {
|
||||
struct radio_pdu_node_rx *next;
|
||||
bool empty = true;
|
||||
|
||||
node_rx = NODE_RX(node);
|
||||
node = sys_slist_peek_head(&hbuf_pend);
|
||||
if (node) {
|
||||
next = NODE_RX(node);
|
||||
next_class = hci_get_class(next);
|
||||
}
|
||||
empty = sys_slist_is_empty(&hbuf_pend);
|
||||
|
||||
buf = encode_node(node_rx, class);
|
||||
if (!empty && (class == HCI_CLASS_EVT_CONNECTION ||
|
||||
(class == HCI_CLASS_ACL_DATA &&
|
||||
hbuf_count))) {
|
||||
/* more to process, schedule an
|
||||
* iteration
|
||||
*/
|
||||
BT_DBG("FC: signalling");
|
||||
k_poll_signal(&hbuf_signal, 0x0);
|
||||
}
|
||||
if (class == HCI_CLASS_EVT_CONNECTION ||
|
||||
(class == HCI_CLASS_ACL_DATA && hbuf_count)) {
|
||||
/* more to process, schedule an
|
||||
* iteration
|
||||
*/
|
||||
BT_DBG("FC: signalling");
|
||||
k_poll_signal(&hbuf_signal, 0x0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hbuf_count = -1;
|
||||
}
|
||||
|
||||
return buf;
|
||||
@@ -301,7 +310,7 @@ static void recv_thread(void *p1, void *p2, void *p3)
|
||||
events[1].state = K_POLL_STATE_NOT_READY;
|
||||
|
||||
/* process host buffers first if any */
|
||||
buf = process_hbuf();
|
||||
buf = process_hbuf(node_rx);
|
||||
|
||||
#else
|
||||
node_rx = k_fifo_get(&recv_fifo, K_FOREVER);
|
||||
@@ -347,6 +356,22 @@ static int cmd_handle(struct net_buf *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
static int acl_handle(struct net_buf *buf)
|
||||
{
|
||||
struct net_buf *evt;
|
||||
int err;
|
||||
|
||||
err = hci_acl_handle(buf, &evt);
|
||||
if (evt) {
|
||||
BT_DBG("Replying with event of %u bytes", evt->len);
|
||||
bt_recv_prio(evt);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
||||
static int hci_driver_send(struct net_buf *buf)
|
||||
{
|
||||
u8_t type;
|
||||
@@ -363,9 +388,9 @@ static int hci_driver_send(struct net_buf *buf)
|
||||
switch (type) {
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
case BT_BUF_ACL_OUT:
|
||||
err = hci_acl_handle(buf);
|
||||
err = acl_handle(buf);
|
||||
break;
|
||||
#endif
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
case BT_BUF_CMD:
|
||||
err = cmd_handle(buf);
|
||||
break;
|
||||
|
||||
@@ -39,7 +39,7 @@ struct net_buf *hci_cmd_handle(struct net_buf *cmd);
|
||||
void hci_evt_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
|
||||
s8_t hci_get_class(struct radio_pdu_node_rx *node_rx);
|
||||
#if defined(CONFIG_BT_CONN)
|
||||
int hci_acl_handle(struct net_buf *acl);
|
||||
int hci_acl_handle(struct net_buf *acl, struct net_buf **evt);
|
||||
void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);
|
||||
void hci_num_cmplt_encode(struct net_buf *buf, u16_t handle, u8_t num);
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@ void ll_reset(void);
|
||||
void ll_radio_state_abort(void);
|
||||
u32_t ll_radio_state_is_idle(void);
|
||||
u8_t *ll_addr_get(u8_t addr_type, u8_t *p_bdaddr);
|
||||
void ll_addr_set(u8_t addr_type, u8_t const *const p_bdaddr);
|
||||
u32_t ll_addr_set(u8_t addr_type, u8_t const *const p_bdaddr);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||
u32_t ll_adv_params_set(u8_t handle, u16_t evt_prop, u32_t interval,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -175,17 +175,12 @@
|
||||
****************************************************************************/
|
||||
/* Minimum LL Payload support (Dont change). */
|
||||
#define RADIO_LL_LENGTH_OCTETS_RX_MIN 27
|
||||
#define RADIO_LL_LENGTH_TIME_RX_MIN (((RADIO_LL_LENGTH_OCTETS_RX_MIN) \
|
||||
+ 14) * 8 \
|
||||
)
|
||||
|
||||
/* Maximum LL Payload support (27 to 251). */
|
||||
#ifndef RADIO_LL_LENGTH_OCTETS_RX_MAX
|
||||
#define RADIO_LL_LENGTH_OCTETS_RX_MAX 251
|
||||
#endif
|
||||
#define RADIO_LL_LENGTH_TIME_RX_MAX (((RADIO_LL_LENGTH_OCTETS_RX_MAX) \
|
||||
+ 14) * 8 \
|
||||
)
|
||||
|
||||
/* Implementation default L2CAP MTU */
|
||||
#ifndef RADIO_L2CAP_MTU_MAX
|
||||
#define RADIO_L2CAP_MTU_MAX (RADIO_LL_LENGTH_OCTETS_RX_MAX - 4)
|
||||
|
||||
@@ -165,6 +165,7 @@ struct connection {
|
||||
#endif /* CONFIG_BT_CTLR_PHY */
|
||||
|
||||
struct {
|
||||
u8_t initiate;
|
||||
u8_t error_code;
|
||||
u8_t rand[8];
|
||||
u8_t ediv[2];
|
||||
@@ -207,6 +208,7 @@ struct connection {
|
||||
LLCP_CPR_STATE_UPD
|
||||
} state:3 __packed;
|
||||
u8_t cmd:1;
|
||||
u8_t disabled:1;
|
||||
u8_t status;
|
||||
u16_t interval;
|
||||
u16_t latency;
|
||||
|
||||
@@ -222,9 +222,11 @@ int ll_init(struct k_sem *sem_rx)
|
||||
_ticker_users[MAYFLY_CALL_ID_2][0] = 0;
|
||||
_ticker_users[MAYFLY_CALL_ID_PROGRAM][0] = TICKER_USER_APP_OPS;
|
||||
|
||||
ticker_init(RADIO_TICKER_INSTANCE_ID_RADIO, TICKER_NODES,
|
||||
&_ticker_nodes[0], MAYFLY_CALLER_COUNT, &_ticker_users[0],
|
||||
TICKER_USER_OPS, &_ticker_user_ops[0]);
|
||||
err = ticker_init(RADIO_TICKER_INSTANCE_ID_RADIO,
|
||||
TICKER_NODES, &_ticker_nodes[0],
|
||||
MAYFLY_CALLER_COUNT, &_ticker_users[0],
|
||||
TICKER_USER_OPS, &_ticker_user_ops[0]);
|
||||
LL_ASSERT(!err);
|
||||
|
||||
clk_m16 = device_get_binding(CONFIG_CLOCK_CONTROL_NRF5_M16SRC_DRV_NAME);
|
||||
if (!clk_m16) {
|
||||
@@ -288,11 +290,18 @@ u8_t *ll_addr_get(u8_t addr_type, u8_t *bdaddr)
|
||||
return _ll_context.pub_addr;
|
||||
}
|
||||
|
||||
void ll_addr_set(u8_t addr_type, u8_t const *const bdaddr)
|
||||
u32_t ll_addr_set(u8_t addr_type, u8_t const *const bdaddr)
|
||||
{
|
||||
if (radio_adv_is_enabled() ||
|
||||
(radio_scan_is_enabled() & (BIT(1) | BIT(2)))) {
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
if (addr_type) {
|
||||
memcpy(_ll_context.rnd_addr, bdaddr, BDADDR_SIZE);
|
||||
} else {
|
||||
memcpy(_ll_context.pub_addr, bdaddr, BDADDR_SIZE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <zephyr/types.h>
|
||||
#include <soc.h>
|
||||
#include <clock_control.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/cntr.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
@@ -72,20 +74,25 @@ static const u8_t prbs9[] = {
|
||||
/* TODO: fill correct prbs15 */
|
||||
static const u8_t prbs15[255] = { 0x00, };
|
||||
|
||||
static u8_t tx_req;
|
||||
static u8_t volatile tx_ack;
|
||||
|
||||
static void isr_tx(void)
|
||||
{
|
||||
u8_t trx_done;
|
||||
u32_t l, i, s, t;
|
||||
|
||||
/* Read radio status and events */
|
||||
trx_done = radio_is_done();
|
||||
|
||||
/* Clear radio status and events */
|
||||
radio_status_reset();
|
||||
radio_tmr_status_reset();
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
|
||||
radio_gpio_pa_lna_disable();
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
|
||||
|
||||
/* Exit if radio disabled */
|
||||
if (!trx_done) {
|
||||
if (((tx_req - tx_ack) & 0x01) == 0) {
|
||||
tx_ack = tx_req;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,7 +115,14 @@ static void isr_tx(void)
|
||||
radio_tmr_aa_capture();
|
||||
radio_tmr_end_capture();
|
||||
|
||||
/* TODO: check for probable stall timer capture being set */
|
||||
/* TODO: check for probable stale timer capture being set */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
|
||||
radio_gpio_pa_setup();
|
||||
radio_gpio_pa_lna_enable(t + radio_tx_ready_delay_get(test_phy,
|
||||
test_phy_flags) -
|
||||
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
|
||||
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
|
||||
}
|
||||
|
||||
static void isr_rx(void)
|
||||
@@ -171,6 +185,7 @@ static u32_t init(u8_t chan, u8_t phy, void (*isr)(void))
|
||||
/* Setup Radio in Tx/Rx */
|
||||
/* NOTE: No whitening in test mode. */
|
||||
radio_phy_set(test_phy, test_phy_flags);
|
||||
radio_tmr_tifs_set(150);
|
||||
radio_tx_power_set(0);
|
||||
radio_freq_chan_set((chan << 1) + 2);
|
||||
radio_aa_set((u8_t *)&test_sync_word);
|
||||
@@ -182,6 +197,7 @@ static u32_t init(u8_t chan, u8_t phy, void (*isr)(void))
|
||||
|
||||
u32_t ll_test_tx(u8_t chan, u8_t len, u8_t type, u8_t phy)
|
||||
{
|
||||
u32_t start_us;
|
||||
u8_t *payload;
|
||||
u8_t *pdu;
|
||||
u32_t err;
|
||||
@@ -195,6 +211,8 @@ u32_t ll_test_tx(u8_t chan, u8_t len, u8_t type, u8_t phy)
|
||||
return err;
|
||||
}
|
||||
|
||||
tx_req++;
|
||||
|
||||
pdu = radio_pkt_scratch_get();
|
||||
payload = &pdu[2];
|
||||
|
||||
@@ -237,10 +255,20 @@ u32_t ll_test_tx(u8_t chan, u8_t len, u8_t type, u8_t phy)
|
||||
|
||||
radio_pkt_tx_set(pdu);
|
||||
radio_switch_complete_and_disable();
|
||||
radio_tmr_start(1, cntr_cnt_get() + CNTR_MIN_DELTA, 0);
|
||||
start_us = radio_tmr_start(1, cntr_cnt_get() + CNTR_MIN_DELTA, 0);
|
||||
radio_tmr_aa_capture();
|
||||
radio_tmr_end_capture();
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_PA_PIN)
|
||||
radio_gpio_pa_setup();
|
||||
radio_gpio_pa_lna_enable(start_us +
|
||||
radio_tx_ready_delay_get(test_phy,
|
||||
test_phy_flags) -
|
||||
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
|
||||
#else /* !CONFIG_BT_CTLR_GPIO_PA_PIN */
|
||||
ARG_UNUSED(start_us);
|
||||
#endif /* !CONFIG_BT_CTLR_GPIO_PA_PIN */
|
||||
|
||||
started = true;
|
||||
|
||||
return 0;
|
||||
@@ -263,6 +291,10 @@ u32_t ll_test_rx(u8_t chan, u8_t phy, u8_t mod_idx)
|
||||
radio_switch_complete_and_rx(test_phy);
|
||||
radio_tmr_start(0, cntr_cnt_get() + CNTR_MIN_DELTA, 0);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
|
||||
radio_gpio_lna_on();
|
||||
#endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||
|
||||
started = true;
|
||||
|
||||
return 0;
|
||||
@@ -271,6 +303,7 @@ u32_t ll_test_rx(u8_t chan, u8_t phy, u8_t mod_idx)
|
||||
u32_t ll_test_end(u16_t *num_rx)
|
||||
{
|
||||
struct device *hf_clock;
|
||||
u8_t ack;
|
||||
|
||||
if (!started) {
|
||||
return 1;
|
||||
@@ -280,8 +313,17 @@ u32_t ll_test_end(u16_t *num_rx)
|
||||
*num_rx = test_num_rx;
|
||||
test_num_rx = 0;
|
||||
|
||||
/* Disable Radio */
|
||||
radio_disable();
|
||||
/* Disable Radio, if in Rx test */
|
||||
ack = tx_ack;
|
||||
if (tx_req == ack) {
|
||||
radio_disable();
|
||||
} else {
|
||||
/* Wait for Tx to complete */
|
||||
tx_req = ack + 2;
|
||||
while (tx_req != tx_ack) {
|
||||
cpu_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop packet timer */
|
||||
radio_tmr_stop();
|
||||
@@ -293,6 +335,10 @@ u32_t ll_test_end(u16_t *num_rx)
|
||||
/* Stop coarse timer */
|
||||
cntr_stop();
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
|
||||
radio_gpio_lna_off();
|
||||
#endif /* !CONFIG_BT_CTLR_GPIO_LNA_PIN */
|
||||
|
||||
started = false;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -224,6 +224,14 @@ struct pdu_data_llctrl_enc_rsp {
|
||||
u8_t ivs[4];
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_start_enc_req {
|
||||
/* no members */
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_start_enc_rsp {
|
||||
/* no members */
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_unknown_rsp {
|
||||
u8_t type;
|
||||
} __packed;
|
||||
@@ -236,6 +244,14 @@ struct pdu_data_llctrl_feature_rsp {
|
||||
u8_t features[8];
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_pause_enc_req {
|
||||
/* no members */
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_pause_enc_rsp {
|
||||
/* no members */
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_version_ind {
|
||||
u8_t version_number;
|
||||
u16_t company_id;
|
||||
@@ -246,6 +262,10 @@ struct pdu_data_llctrl_reject_ind {
|
||||
u8_t error_code;
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_slave_feature_req {
|
||||
u8_t features[8];
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_conn_param_req {
|
||||
u16_t interval_min;
|
||||
u16_t interval_max;
|
||||
@@ -281,14 +301,34 @@ struct pdu_data_llctrl_reject_ext_ind {
|
||||
u8_t error_code;
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_length_req_rsp {
|
||||
struct pdu_data_llctrl_ping_req {
|
||||
/* no members */
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_ping_rsp {
|
||||
/* no members */
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_length_req {
|
||||
u16_t max_rx_octets;
|
||||
u16_t max_rx_time;
|
||||
u16_t max_tx_octets;
|
||||
u16_t max_tx_time;
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_phy_req_rsp {
|
||||
struct pdu_data_llctrl_length_rsp {
|
||||
u16_t max_rx_octets;
|
||||
u16_t max_rx_time;
|
||||
u16_t max_tx_octets;
|
||||
u16_t max_tx_time;
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_phy_req {
|
||||
u8_t tx_phys;
|
||||
u8_t rx_phys;
|
||||
} __packed;
|
||||
|
||||
struct pdu_data_llctrl_phy_rsp {
|
||||
u8_t tx_phys;
|
||||
u8_t rx_phys;
|
||||
} __packed;
|
||||
@@ -312,19 +352,25 @@ struct pdu_data_llctrl {
|
||||
struct pdu_data_llctrl_terminate_ind terminate_ind;
|
||||
struct pdu_data_llctrl_enc_req enc_req;
|
||||
struct pdu_data_llctrl_enc_rsp enc_rsp;
|
||||
struct pdu_data_llctrl_start_enc_req start_enc_req;
|
||||
struct pdu_data_llctrl_start_enc_rsp start_enc_rsp;
|
||||
struct pdu_data_llctrl_unknown_rsp unknown_rsp;
|
||||
struct pdu_data_llctrl_feature_req feature_req;
|
||||
struct pdu_data_llctrl_feature_rsp feature_rsp;
|
||||
struct pdu_data_llctrl_pause_enc_req pause_enc_req;
|
||||
struct pdu_data_llctrl_pause_enc_rsp pause_enc_rsp;
|
||||
struct pdu_data_llctrl_version_ind version_ind;
|
||||
struct pdu_data_llctrl_reject_ind reject_ind;
|
||||
struct pdu_data_llctrl_feature_req slave_feature_req;
|
||||
struct pdu_data_llctrl_slave_feature_req slave_feature_req;
|
||||
struct pdu_data_llctrl_conn_param_req conn_param_req;
|
||||
struct pdu_data_llctrl_conn_param_rsp conn_param_rsp;
|
||||
struct pdu_data_llctrl_reject_ext_ind reject_ext_ind;
|
||||
struct pdu_data_llctrl_length_req_rsp length_req;
|
||||
struct pdu_data_llctrl_length_req_rsp length_rsp;
|
||||
struct pdu_data_llctrl_phy_req_rsp phy_req;
|
||||
struct pdu_data_llctrl_phy_req_rsp phy_rsp;
|
||||
struct pdu_data_llctrl_ping_req ping_req;
|
||||
struct pdu_data_llctrl_ping_rsp ping_rsp;
|
||||
struct pdu_data_llctrl_length_req length_req;
|
||||
struct pdu_data_llctrl_length_rsp length_rsp;
|
||||
struct pdu_data_llctrl_phy_req phy_req;
|
||||
struct pdu_data_llctrl_phy_rsp phy_rsp;
|
||||
struct pdu_data_llctrl_phy_upd_ind phy_upd_ind;
|
||||
struct pdu_data_llctrl_min_used_chans_ind min_used_chans_ind;
|
||||
} __packed ctrldata;
|
||||
|
||||
@@ -39,8 +39,8 @@ struct ticker_node {
|
||||
ticker_timeout_func timeout_func;
|
||||
void *context;
|
||||
|
||||
u16_t ticks_to_expire_minus;
|
||||
u16_t ticks_slot;
|
||||
u32_t ticks_to_expire_minus;
|
||||
u32_t ticks_slot;
|
||||
u16_t lazy_periodic;
|
||||
u16_t lazy_current;
|
||||
u32_t remainder_periodic;
|
||||
@@ -62,7 +62,7 @@ struct ticker_user_op_start {
|
||||
u32_t ticks_periodic;
|
||||
u32_t remainder_periodic;
|
||||
u16_t lazy;
|
||||
u16_t ticks_slot;
|
||||
u32_t ticks_slot;
|
||||
ticker_timeout_func fp_timeout_func;
|
||||
void *context;
|
||||
};
|
||||
@@ -112,9 +112,9 @@ struct ticker_instance {
|
||||
u8_t ticks_elapsed_last;
|
||||
u32_t ticks_elapsed[DOUBLE_BUFFER_SIZE];
|
||||
u32_t ticks_current;
|
||||
u8_t ticker_id_head;
|
||||
u32_t ticks_slot_previous;
|
||||
u8_t ticker_id_slot_previous;
|
||||
u16_t ticks_slot_previous;
|
||||
u8_t ticker_id_head;
|
||||
u8_t job_guard;
|
||||
u8_t worker_trigger;
|
||||
u8_t (*fp_caller_id_get)(u8_t user_id);
|
||||
@@ -416,7 +416,7 @@ static void ticks_to_expire_prep(struct ticker_node *ticker,
|
||||
u32_t ticks_current, u32_t ticks_at_start)
|
||||
{
|
||||
u32_t ticks_to_expire = ticker->ticks_to_expire;
|
||||
u16_t ticks_to_expire_minus = ticker->ticks_to_expire_minus;
|
||||
u32_t ticks_to_expire_minus = ticker->ticks_to_expire_minus;
|
||||
|
||||
/* Calculate ticks to expire for this new node */
|
||||
if (((ticks_at_start - ticks_current) & BIT(23)) == 0) {
|
||||
@@ -833,6 +833,20 @@ static inline u32_t ticker_job_insert(struct ticker_instance *instance,
|
||||
ticker->ticks_to_expire += ticker->ticks_periodic +
|
||||
ticker_remainder_inc(ticker);
|
||||
ticker->lazy_current++;
|
||||
|
||||
/* Remove any accumulated drift (possibly added due to
|
||||
* ticker job execution latencies).
|
||||
*/
|
||||
if (ticker->ticks_to_expire >
|
||||
ticker->ticks_to_expire_minus) {
|
||||
ticker->ticks_to_expire -=
|
||||
ticker->ticks_to_expire_minus;
|
||||
ticker->ticks_to_expire_minus = 0;
|
||||
} else {
|
||||
ticker->ticks_to_expire_minus -=
|
||||
ticker->ticks_to_expire;
|
||||
ticker->ticks_to_expire = 0;
|
||||
}
|
||||
} else {
|
||||
return TICKER_STATUS_FAILURE;
|
||||
}
|
||||
@@ -1522,7 +1536,7 @@ void ticker_trigger(u8_t instance_index)
|
||||
|
||||
u32_t ticker_start(u8_t instance_index, u8_t user_id, u8_t ticker_id,
|
||||
u32_t ticks_anchor, u32_t ticks_first, u32_t ticks_periodic,
|
||||
u32_t remainder_periodic, u16_t lazy, u16_t ticks_slot,
|
||||
u32_t remainder_periodic, u16_t lazy, u32_t ticks_slot,
|
||||
ticker_timeout_func ticker_timeout_func, void *context,
|
||||
ticker_op_func fp_op_func, void *op_context)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
/** \brief Timer node type size.
|
||||
*/
|
||||
#define TICKER_NODE_T_SIZE 36
|
||||
#define TICKER_NODE_T_SIZE 40
|
||||
|
||||
/** \brief Timer user type size.
|
||||
*/
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
/** \brief Timer user operation type size.
|
||||
*/
|
||||
#define TICKER_USER_OP_T_SIZE 44
|
||||
#define TICKER_USER_OP_T_SIZE 48
|
||||
|
||||
/** \brief Timer timeout function type.
|
||||
*/
|
||||
@@ -100,7 +100,7 @@ bool ticker_is_initialized(u8_t instance_index);
|
||||
void ticker_trigger(u8_t instance_index);
|
||||
u32_t ticker_start(u8_t instance_index, u8_t user_id, u8_t ticker_id,
|
||||
u32_t ticks_anchor, u32_t ticks_first, u32_t ticks_periodic,
|
||||
u32_t remainder_periodic, u16_t lazy, u16_t ticks_slot,
|
||||
u32_t remainder_periodic, u16_t lazy, u32_t ticks_slot,
|
||||
ticker_timeout_func ticker_timeout_func, void *context,
|
||||
ticker_op_func fp_op_func, void *op_context);
|
||||
u32_t ticker_update(u8_t instance_index, u8_t user_id, u8_t ticker_id,
|
||||
|
||||
@@ -67,14 +67,6 @@ endif # BT_MESH_PROXY
|
||||
|
||||
endif # BT_CONN
|
||||
|
||||
config BT_MESH_LOCAL_INTERFACE
|
||||
bool "Local network interface"
|
||||
default y
|
||||
help
|
||||
This is needed in order to send messages between two local Mesh
|
||||
elements. Only disable it if you're sure this will not be needed
|
||||
(which helps save a little bit of memory).
|
||||
|
||||
config BT_MESH_SELF_TEST
|
||||
bool "Perform self-tests"
|
||||
help
|
||||
|
||||
@@ -103,15 +103,15 @@ static void mod_publish(struct k_work *work)
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
if (pub->func) {
|
||||
pub->func(pub->mod);
|
||||
}
|
||||
|
||||
period_ms = bt_mesh_model_pub_period_get(pub->mod);
|
||||
BT_DBG("period %u ms", period_ms);
|
||||
if (period_ms) {
|
||||
k_delayed_work_submit(&pub->timer, period_ms);
|
||||
}
|
||||
|
||||
if (pub->func) {
|
||||
pub->func(pub->mod);
|
||||
}
|
||||
}
|
||||
|
||||
static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
|
||||
@@ -83,6 +83,10 @@ static void hb_send(struct bt_mesh_model *model)
|
||||
feat |= BT_MESH_FEAT_RELAY;
|
||||
}
|
||||
|
||||
if (bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED) {
|
||||
feat |= BT_MESH_FEAT_PROXY;
|
||||
}
|
||||
|
||||
if (bt_mesh_friend_get() == BT_MESH_FRIEND_ENABLED) {
|
||||
feat |= BT_MESH_FEAT_FRIEND;
|
||||
}
|
||||
@@ -95,7 +99,7 @@ static void hb_send(struct bt_mesh_model *model)
|
||||
|
||||
hb.feat = sys_cpu_to_be16(feat);
|
||||
|
||||
BT_DBG("InitTTL %u feat 0x%02x", cfg->hb_pub.ttl, feat);
|
||||
BT_DBG("InitTTL %u feat 0x%04x", cfg->hb_pub.ttl, feat);
|
||||
|
||||
bt_mesh_ctl_send(&tx, TRANS_CTL_OP_HEARTBEAT, &hb, sizeof(hb), NULL);
|
||||
}
|
||||
@@ -143,6 +147,14 @@ static int comp_get_page_0(struct net_buf_simple *buf)
|
||||
feat |= BT_MESH_FEAT_RELAY;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
|
||||
feat |= BT_MESH_FEAT_PROXY;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
|
||||
feat |= BT_MESH_FEAT_FRIEND;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
|
||||
feat |= BT_MESH_FEAT_LOW_POWER;
|
||||
}
|
||||
@@ -1212,11 +1224,7 @@ static void send_mod_sub_status(struct bt_mesh_model *model,
|
||||
|
||||
net_buf_simple_add_u8(msg, status);
|
||||
net_buf_simple_add_le16(msg, elem_addr);
|
||||
if (status) {
|
||||
net_buf_simple_add_le16(msg, BT_MESH_ADDR_UNASSIGNED);
|
||||
} else {
|
||||
net_buf_simple_add_le16(msg, sub_addr);
|
||||
}
|
||||
net_buf_simple_add_le16(msg, sub_addr);
|
||||
|
||||
if (vnd) {
|
||||
memcpy(net_buf_simple_add(msg, 4), mod_id, 4);
|
||||
@@ -1694,7 +1702,7 @@ static void mod_sub_va_overwrite(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
u16_t elem_addr, sub_addr;
|
||||
u16_t elem_addr, sub_addr = BT_MESH_ADDR_UNASSIGNED;
|
||||
struct bt_mesh_model *mod;
|
||||
struct bt_mesh_elem *elem;
|
||||
u8_t *label_uuid;
|
||||
@@ -2489,12 +2497,17 @@ static void lpn_timeout_get(struct bt_mesh_model *model,
|
||||
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x lpn_addr 0x%02x",
|
||||
ctx->net_idx, ctx->app_idx, ctx->addr, lpn_addr);
|
||||
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(lpn_addr)) {
|
||||
BT_WARN("Invalid LPNAddress; ignoring msg");
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_model_msg_init(msg, OP_LPN_TIMEOUT_STATUS);
|
||||
net_buf_simple_add_le16(msg, lpn_addr);
|
||||
memset(net_buf_simple_add(msg, 3), 0, 3);
|
||||
|
||||
if (bt_mesh_model_send(model, ctx, msg, NULL, NULL)) {
|
||||
BT_ERR("Unable to send Friend Status");
|
||||
BT_ERR("Unable to send LPN PollTimeout Status");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2577,7 +2590,7 @@ static void krp_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
|
||||
} else if ((sub->kr_phase == BT_MESH_KR_PHASE_1 ||
|
||||
sub->kr_phase == BT_MESH_KR_PHASE_2) &&
|
||||
phase == BT_MESH_KR_PHASE_3) {
|
||||
memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0]));
|
||||
bt_mesh_net_revoke_keys(sub);
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) ||
|
||||
IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
|
||||
bt_mesh_friend_cred_refresh(ctx->net_idx);
|
||||
@@ -2652,18 +2665,18 @@ send:
|
||||
bt_mesh_model_send(model, ctx, msg, NULL, NULL);
|
||||
}
|
||||
|
||||
static void hearbeat_pub_get(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
static void heartbeat_pub_get(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_DBG("src 0x%04x", ctx->addr);
|
||||
|
||||
hb_pub_send_status(model, ctx, STATUS_SUCCESS, NULL);
|
||||
}
|
||||
|
||||
static void hearbeat_pub_set(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
static void heartbeat_pub_set(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct hb_pub_param *param = (void *)buf->data;
|
||||
struct bt_mesh_cfg *cfg = model->user_data;
|
||||
@@ -2725,7 +2738,7 @@ static void hearbeat_pub_set(struct bt_mesh_model *model,
|
||||
* as possible after the Heartbeat Publication Period state
|
||||
* has been configured for periodic publishing.
|
||||
*/
|
||||
if (param->period_log) {
|
||||
if (param->period_log && param->count_log) {
|
||||
k_work_submit(&cfg->hb_pub.timer.work);
|
||||
} else {
|
||||
k_delayed_work_cancel(&cfg->hb_pub.timer);
|
||||
@@ -2772,18 +2785,18 @@ static void hb_sub_send_status(struct bt_mesh_model *model,
|
||||
bt_mesh_model_send(model, ctx, msg, NULL, NULL);
|
||||
}
|
||||
|
||||
static void hearbeat_sub_get(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
static void heartbeat_sub_get(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_DBG("src 0x%04x", ctx->addr);
|
||||
|
||||
hb_sub_send_status(model, ctx, STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void hearbeat_sub_set(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
static void heartbeat_sub_set(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_mesh_cfg *cfg = model->user_data;
|
||||
u16_t sub_src, sub_dst;
|
||||
@@ -2820,21 +2833,25 @@ static void hearbeat_sub_set(struct bt_mesh_model *model,
|
||||
sub_period == 0x00) {
|
||||
cfg->hb_sub.src = BT_MESH_ADDR_UNASSIGNED;
|
||||
cfg->hb_sub.dst = BT_MESH_ADDR_UNASSIGNED;
|
||||
cfg->hb_sub.min_hops = 0;
|
||||
cfg->hb_sub.max_hops = 0;
|
||||
period_ms = 0;
|
||||
} else {
|
||||
cfg->hb_sub.src = sub_src;
|
||||
cfg->hb_sub.dst = sub_dst;
|
||||
cfg->hb_sub.min_hops = 0x7f;
|
||||
cfg->hb_sub.max_hops = 0;
|
||||
period_ms = hb_pwr2(sub_period, 1) * 1000;
|
||||
}
|
||||
|
||||
BT_DBG("period_ms %u", period_ms);
|
||||
|
||||
cfg->hb_sub.count = 0;
|
||||
cfg->hb_sub.min_hops = 0x7f;
|
||||
cfg->hb_sub.max_hops = 0;
|
||||
|
||||
if (period_ms) {
|
||||
cfg->hb_sub.expiry = k_uptime_get() + period_ms;
|
||||
} else {
|
||||
cfg->hb_sub.expiry = 0;
|
||||
}
|
||||
|
||||
hb_sub_send_status(model, ctx, STATUS_SUCCESS);
|
||||
@@ -2884,10 +2901,10 @@ const struct bt_mesh_model_op bt_mesh_cfg_op[] = {
|
||||
{ OP_LPN_TIMEOUT_GET, 2, lpn_timeout_get },
|
||||
{ OP_KRP_GET, 2, krp_get },
|
||||
{ OP_KRP_SET, 3, krp_set },
|
||||
{ OP_HEARTBEAT_PUB_GET, 0, hearbeat_pub_get },
|
||||
{ OP_HEARTBEAT_PUB_SET, 9, hearbeat_pub_set },
|
||||
{ OP_HEARTBEAT_SUB_GET, 0, hearbeat_sub_get },
|
||||
{ OP_HEARTBEAT_SUB_SET, 5, hearbeat_sub_set },
|
||||
{ OP_HEARTBEAT_PUB_GET, 0, heartbeat_pub_get },
|
||||
{ OP_HEARTBEAT_PUB_SET, 9, heartbeat_pub_set },
|
||||
{ OP_HEARTBEAT_SUB_GET, 0, heartbeat_sub_get },
|
||||
{ OP_HEARTBEAT_SUB_SET, 5, heartbeat_sub_set },
|
||||
BT_MESH_MODEL_OP_END,
|
||||
};
|
||||
|
||||
@@ -2899,7 +2916,7 @@ static void hb_publish(struct k_work *work)
|
||||
struct bt_mesh_subnet *sub;
|
||||
u16_t period_ms;
|
||||
|
||||
BT_DBG("");
|
||||
BT_DBG("hb_pub.count: %u", cfg->hb_pub.count);
|
||||
|
||||
sub = bt_mesh_subnet_get(cfg->hb_pub.net_idx);
|
||||
if (!sub) {
|
||||
@@ -2911,6 +2928,10 @@ static void hb_publish(struct k_work *work)
|
||||
|
||||
hb_send(model);
|
||||
|
||||
if (cfg->hb_pub.count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cfg->hb_pub.count != 0xffff) {
|
||||
cfg->hb_pub.count--;
|
||||
}
|
||||
@@ -2960,7 +2981,7 @@ int bt_mesh_conf_init(struct bt_mesh_model *model, bool primary)
|
||||
}
|
||||
|
||||
if (!IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
|
||||
cfg->frnd = BT_MESH_RELAY_NOT_SUPPORTED;
|
||||
cfg->frnd = BT_MESH_FRIEND_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#define OP_HEALTH_FAULT_TEST BT_MESH_MODEL_OP_2(0x80, 0x32)
|
||||
#define OP_HEALTH_FAULT_TEST_UNREL BT_MESH_MODEL_OP_2(0x80, 0x33)
|
||||
#define OP_HEALTH_PERIOD_GET BT_MESH_MODEL_OP_2(0x80, 0x34)
|
||||
#define OP_HEALTH_PERIOD_SET BT_MESH_MODEL_OP_2(0x80, 0x34)
|
||||
#define OP_HEALTH_PERIOD_SET BT_MESH_MODEL_OP_2(0x80, 0x35)
|
||||
#define OP_HEALTH_PERIOD_SET_UNREL BT_MESH_MODEL_OP_2(0x80, 0x36)
|
||||
#define OP_HEALTH_PERIOD_STATUS BT_MESH_MODEL_OP_2(0x80, 0x37)
|
||||
#define OP_HEARTBEAT_PUB_GET BT_MESH_MODEL_OP_2(0x80, 0x38)
|
||||
|
||||
@@ -79,6 +79,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
||||
struct net_buf_simple *msg)
|
||||
{
|
||||
struct bt_mesh_health *srv = mod->user_data;
|
||||
const struct bt_mesh_comp *comp;
|
||||
u8_t *test_id, *company_ptr;
|
||||
u16_t company_id;
|
||||
u8_t fault_count;
|
||||
@@ -88,6 +89,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
||||
|
||||
test_id = net_buf_simple_add(msg, 1);
|
||||
company_ptr = net_buf_simple_add(msg, sizeof(company_id));
|
||||
comp = bt_mesh_comp_get();
|
||||
|
||||
fault_count = net_buf_simple_tailroom(msg) - 4;
|
||||
|
||||
@@ -97,16 +99,17 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
||||
&fault_count);
|
||||
if (err) {
|
||||
BT_ERR("Failed to get faults (err %d)", err);
|
||||
sys_put_le16(0, company_ptr);
|
||||
sys_put_le16(comp->cid, company_ptr);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
fault_count = 0;
|
||||
} else {
|
||||
sys_put_le16(company_id, company_ptr);
|
||||
net_buf_simple_add(msg, fault_count);
|
||||
}
|
||||
} else {
|
||||
BT_WARN("No callback for getting faults");
|
||||
net_buf_simple_push_u8(msg, HEALTH_TEST_STANDARD);
|
||||
net_buf_simple_push_le16(msg, 0);
|
||||
sys_put_le16(comp->cid, company_ptr);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
fault_count = 0;
|
||||
}
|
||||
|
||||
@@ -213,7 +216,13 @@ static void health_fault_test(struct bt_mesh_model *model,
|
||||
BT_DBG("test 0x%02x company 0x%04x", test_id, company_id);
|
||||
|
||||
if (srv->fault_test) {
|
||||
srv->fault_test(model, test_id, company_id);
|
||||
int err;
|
||||
|
||||
err = srv->fault_test(model, test_id, company_id);
|
||||
if (err) {
|
||||
BT_WARN("Running fault test failed with err %d", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
health_get_registered(model, company_id, msg);
|
||||
@@ -279,11 +288,10 @@ static void send_health_period_status(struct bt_mesh_model *model,
|
||||
{
|
||||
/* Needed size: opcode (2 bytes) + msg + MIC */
|
||||
struct net_buf_simple *msg = NET_BUF_SIMPLE(2 + 1 + 4);
|
||||
struct bt_mesh_health *srv = model->user_data;
|
||||
|
||||
bt_mesh_model_msg_init(msg, OP_HEALTH_PERIOD_STATUS);
|
||||
|
||||
net_buf_simple_add_u8(msg, srv->period);
|
||||
net_buf_simple_add_u8(msg, model->pub->period_div);
|
||||
|
||||
bt_mesh_model_send(model, ctx, msg, NULL, NULL);
|
||||
}
|
||||
@@ -301,7 +309,6 @@ static void health_period_set_unrel(struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_mesh_health *srv = model->user_data;
|
||||
u8_t period;
|
||||
|
||||
period = net_buf_simple_pull_u8(buf);
|
||||
@@ -312,7 +319,7 @@ static void health_period_set_unrel(struct bt_mesh_model *model,
|
||||
|
||||
BT_DBG("period %u", period);
|
||||
|
||||
srv->period = period;
|
||||
model->pub->period_div = period;
|
||||
}
|
||||
|
||||
static void health_period_set(struct bt_mesh_model *model,
|
||||
@@ -344,16 +351,13 @@ const struct bt_mesh_model_op bt_mesh_health_op[] = {
|
||||
static void health_pub(struct bt_mesh_model *mod)
|
||||
{
|
||||
struct net_buf_simple *msg = NET_BUF_SIMPLE(HEALTH_STATUS_SIZE);
|
||||
struct bt_mesh_health *srv = mod->user_data;
|
||||
size_t count;
|
||||
int err;
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
count = health_get_current(mod, msg);
|
||||
if (count) {
|
||||
mod->pub->period_div = srv->period;
|
||||
} else {
|
||||
if (!count) {
|
||||
mod->pub->period_div = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define BT_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000)
|
||||
#define BT_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xc000 && (addr) <= 0xff00)
|
||||
#define BT_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xc000)
|
||||
#define BT_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xff00 && (addr) <= 0xfffb)
|
||||
|
||||
struct bt_mesh_net;
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ static u16_t msg_cache_next;
|
||||
|
||||
/* Singleton network context (the implementation only supports one) */
|
||||
struct bt_mesh_net bt_mesh = {
|
||||
.local_queue = _K_FIFO_INITIALIZER(bt_mesh.local_queue),
|
||||
.sub = {
|
||||
[0 ... (CONFIG_BT_MESH_SUBNET_COUNT - 1)] = {
|
||||
.net_idx = BT_MESH_KEY_UNUSED,
|
||||
@@ -470,6 +471,26 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16],
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub)
|
||||
{
|
||||
int i;
|
||||
|
||||
BT_DBG("idx 0x%04x", sub->net_idx);
|
||||
|
||||
memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0]));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
||||
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
|
||||
|
||||
if (key->net_idx != sub->net_idx || !key->updated) {
|
||||
continue;
|
||||
}
|
||||
|
||||
memcpy(&key->keys[0], &key->keys[1], sizeof(key->keys[0]));
|
||||
key->updated = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, u8_t new_kr, bool new_key)
|
||||
{
|
||||
if (new_kr != sub->kr_flag && sub->kr_phase == BT_MESH_KR_NORMAL) {
|
||||
@@ -501,8 +522,7 @@ bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, u8_t new_kr, bool new_key)
|
||||
*/
|
||||
case BT_MESH_KR_PHASE_2:
|
||||
BT_DBG("KR Phase 0x%02x -> Normal", sub->kr_phase);
|
||||
memcpy(&sub->keys[0], &sub->keys[1],
|
||||
sizeof(sub->keys[0]));
|
||||
bt_mesh_net_revoke_keys(sub);
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER) ||
|
||||
IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
|
||||
bt_mesh_friend_cred_refresh(sub->net_idx);
|
||||
@@ -677,7 +697,6 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_MESH_LOCAL_INTERFACE)
|
||||
static void bt_mesh_net_local(struct k_work *work)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
@@ -688,7 +707,6 @@ static void bt_mesh_net_local(struct k_work *work)
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf,
|
||||
bool proxy)
|
||||
@@ -801,7 +819,6 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_MESH_LOCAL_INTERFACE)
|
||||
/* Deliver to local network interface if necessary */
|
||||
if (bt_mesh_fixed_group_match(tx->ctx->addr) ||
|
||||
bt_mesh_elem_find(tx->ctx->addr)) {
|
||||
@@ -813,9 +830,6 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
|
||||
} else {
|
||||
bt_mesh_adv_send(buf, cb);
|
||||
}
|
||||
#else
|
||||
bt_mesh_adv_send(buf, cb);
|
||||
#endif
|
||||
|
||||
done:
|
||||
net_buf_unref(buf);
|
||||
@@ -975,9 +989,6 @@ static int net_find_and_decrypt(const u8_t *data, size_t data_len,
|
||||
return false;
|
||||
}
|
||||
|
||||
#if (defined(CONFIG_BT_MESH_RELAY) || \
|
||||
defined(CONFIG_BT_MESH_FRIEND) || \
|
||||
defined(CONFIG_BT_MESH_GATT_PROXY))
|
||||
static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
||||
struct bt_mesh_net_rx *rx)
|
||||
{
|
||||
@@ -988,7 +999,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
||||
BT_DBG("TTL %u CTL %u dst 0x%04x", rx->ctx.recv_ttl, CTL(sbuf->data),
|
||||
rx->dst);
|
||||
|
||||
if (rx->ctx.recv_ttl <= 1) {
|
||||
if (rx->net_if != BT_MESH_NET_IF_LOCAL && rx->ctx.recv_ttl <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1081,7 +1092,6 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
||||
done:
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
#endif /* RELAY || FRIEND || GATT_PROXY */
|
||||
|
||||
int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
|
||||
struct bt_mesh_net_rx *rx, struct net_buf_simple *buf,
|
||||
@@ -1135,6 +1145,17 @@ int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
|
||||
|
||||
BT_DBG("Decryption successful. Payload len %u", buf->len);
|
||||
|
||||
if (net_if != BT_MESH_NET_IF_PROXY_CFG &&
|
||||
rx->dst == BT_MESH_ADDR_UNASSIGNED) {
|
||||
BT_ERR("Destination address is unassigned; dropping packet");
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (BT_MESH_ADDR_IS_RFU(rx->dst)) {
|
||||
BT_ERR("Destination address is RFU; dropping packet");
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (net_if != BT_MESH_NET_IF_LOCAL && bt_mesh_elem_find(rx->ctx.addr)) {
|
||||
BT_DBG("Dropping locally originated packet");
|
||||
return -EBADMSG;
|
||||
@@ -1181,12 +1202,8 @@ void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi,
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined(CONFIG_BT_MESH_RELAY) || \
|
||||
defined(CONFIG_BT_MESH_FRIEND) || \
|
||||
defined(CONFIG_BT_MESH_GATT_PROXY))
|
||||
net_buf_simple_restore(buf, &state);
|
||||
bt_mesh_net_relay(buf, &rx);
|
||||
#endif /* CONFIG_BT_MESH_RELAY || FRIEND || GATT_PROXY */
|
||||
}
|
||||
|
||||
static void ivu_complete(struct k_work *work)
|
||||
@@ -1201,7 +1218,5 @@ void bt_mesh_net_init(void)
|
||||
{
|
||||
k_delayed_work_init(&bt_mesh.ivu_complete, ivu_complete);
|
||||
|
||||
#if defined(CONFIG_BT_MESH_LOCAL_INTERFACE)
|
||||
k_work_init(&bt_mesh.local_work, bt_mesh_net_local);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -166,11 +166,9 @@ struct bt_mesh_net {
|
||||
|
||||
s64_t last_update; /* Time since last IV Update change */
|
||||
|
||||
#if defined(CONFIG_BT_MESH_LOCAL_INTERFACE)
|
||||
/* Local network interface */
|
||||
struct k_work local_work;
|
||||
struct k_fifo local_queue;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_MESH_FRIEND)
|
||||
struct bt_mesh_friend frnd; /* Friend state */
|
||||
@@ -247,6 +245,8 @@ int bt_mesh_friend_cred_del(u16_t net_idx, u16_t addr);
|
||||
|
||||
bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, u8_t new_kr, bool new_key);
|
||||
|
||||
void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub);
|
||||
|
||||
int bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub);
|
||||
|
||||
void bt_mesh_rpl_reset(void);
|
||||
|
||||
@@ -617,7 +617,8 @@ static int prov_auth(u8_t method, u8_t action, u8_t size)
|
||||
}
|
||||
|
||||
if (output == BT_MESH_DISPLAY_STRING) {
|
||||
u8_t i, str[9];
|
||||
char str[9];
|
||||
u8_t i;
|
||||
|
||||
bt_rand(str, size);
|
||||
|
||||
@@ -1194,12 +1195,6 @@ static void prov_msg_recv(void)
|
||||
|
||||
BT_DBG("type 0x%02x len %u", type, link.rx.buf->len);
|
||||
|
||||
if (type != PROV_FAILED && type != link.expect) {
|
||||
BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect);
|
||||
prov_send_fail_msg(PROV_ERR_UNEXP_PDU);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bt_mesh_fcs_check(link.rx.buf, link.rx.fcs)) {
|
||||
BT_ERR("Incorrect FCS");
|
||||
return;
|
||||
@@ -1209,6 +1204,12 @@ static void prov_msg_recv(void)
|
||||
link.rx.prev_id = link.rx.id;
|
||||
link.rx.id = 0;
|
||||
|
||||
if (type != PROV_FAILED && type != link.expect) {
|
||||
BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect);
|
||||
prov_send_fail_msg(PROV_ERR_UNEXP_PDU);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type >= ARRAY_SIZE(prov_handlers)) {
|
||||
BT_ERR("Unknown provisioning PDU type 0x%02x", type);
|
||||
close_link(PROV_ERR_NVAL_PDU, CLOSE_REASON_FAILED);
|
||||
|
||||
@@ -980,7 +980,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx)
|
||||
}
|
||||
|
||||
/* Bail out early if we're not ready to receive such a large SDU */
|
||||
if (!sdu_len_is_ok(&net_rx->ctx, seg_n)) {
|
||||
if (!sdu_len_is_ok(net_rx->ctl, seg_n)) {
|
||||
BT_ERR("Too big incoming SDU length");
|
||||
send_ack(net_rx->sub, net_rx->dst, net_rx->ctx.addr,
|
||||
net_rx->ctx.send_ttl, seq_zero, 0);
|
||||
|
||||
@@ -287,11 +287,20 @@ static int dns_read(struct dns_resolve_context *ctx,
|
||||
info->ai_addr.sa_family = AF_INET;
|
||||
info->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
} else if (ctx->queries[query_idx].query_type == DNS_QUERY_TYPE_AAAA) {
|
||||
/* We cannot resolve IPv6 address if IPv6 is disabled. The reason
|
||||
* being that "struct sockaddr" does not have enough space for
|
||||
* IPv6 address in that case.
|
||||
*/
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
address_size = DNS_IPV6_LEN;
|
||||
addr = (u8_t *)&net_sin6(&info->ai_addr)->sin6_addr;
|
||||
info->ai_family = AF_INET6;
|
||||
info->ai_addr.sa_family = AF_INET6;
|
||||
info->ai_addrlen = sizeof(struct sockaddr_in6);
|
||||
#else
|
||||
ret = DNS_EAI_FAMILY;
|
||||
goto quit;
|
||||
#endif
|
||||
} else {
|
||||
ret = DNS_EAI_FAMILY;
|
||||
goto quit;
|
||||
@@ -608,10 +617,10 @@ int dns_resolve_name(struct dns_resolve_context *ctx,
|
||||
void *user_data,
|
||||
s32_t timeout)
|
||||
{
|
||||
struct net_buf *dns_data;
|
||||
struct net_buf *dns_data = NULL;
|
||||
struct net_buf *dns_qname = NULL;
|
||||
struct sockaddr addr;
|
||||
int ret, i, j = 0;
|
||||
int ret, i = -1, j = 0;
|
||||
int failure = 0;
|
||||
|
||||
if (!ctx || !ctx->is_used || !query || !cb) {
|
||||
@@ -638,11 +647,16 @@ int dns_resolve_name(struct dns_resolve_context *ctx,
|
||||
info.ai_addr.sa_family = AF_INET;
|
||||
info.ai_addrlen = sizeof(struct sockaddr_in);
|
||||
} else if (type == DNS_QUERY_TYPE_AAAA) {
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
memcpy(net_sin6(&info.ai_addr), net_sin6(&addr),
|
||||
sizeof(struct sockaddr_in6));
|
||||
info.ai_family = AF_INET6;
|
||||
info.ai_addr.sa_family = AF_INET6;
|
||||
info.ai_addrlen = sizeof(struct sockaddr_in6);
|
||||
#else
|
||||
ret = -EAFNOSUPPORT;
|
||||
goto quit;
|
||||
#endif
|
||||
} else {
|
||||
goto try_resolve;
|
||||
}
|
||||
@@ -729,11 +743,14 @@ try_resolve:
|
||||
|
||||
quit:
|
||||
if (ret < 0) {
|
||||
if (k_delayed_work_remaining_get(&ctx->queries[i].timer) > 0) {
|
||||
k_delayed_work_cancel(&ctx->queries[i].timer);
|
||||
}
|
||||
if (i >= 0) {
|
||||
if (k_delayed_work_remaining_get(
|
||||
&ctx->queries[i].timer) > 0) {
|
||||
k_delayed_work_cancel(&ctx->queries[i].timer);
|
||||
}
|
||||
|
||||
ctx->queries[i].cb = NULL;
|
||||
ctx->queries[i].cb = NULL;
|
||||
}
|
||||
|
||||
if (dns_id) {
|
||||
*dns_id = 0;
|
||||
|
||||
3
tests/kernel/fifo/fifo_api/prj_poll.conf
Normal file
3
tests/kernel/fifo/fifo_api/prj_poll.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
CONFIG_ZTEST=y
|
||||
CONFIG_IRQ_OFFLOAD=y
|
||||
CONFIG_POLL=y
|
||||
@@ -1,3 +1,6 @@
|
||||
tests:
|
||||
- test:
|
||||
tags: kernel
|
||||
- test:
|
||||
tags: kernel
|
||||
- test_poll:
|
||||
extra_args: CONF_FILE="prj_poll.conf"
|
||||
tags: kernel
|
||||
|
||||
31
tests/net/lib/dns_resolve/prj-no-ipv6.conf
Normal file
31
tests/net/lib/dns_resolve/prj-no-ipv6.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
CONFIG_NETWORKING=y
|
||||
CONFIG_NET_TEST=y
|
||||
CONFIG_RANDOM_GENERATOR=y
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
|
||||
CONFIG_NET_L2_DUMMY=y
|
||||
|
||||
CONFIG_DNS_RESOLVER=y
|
||||
CONFIG_DNS_RESOLVER_MAX_SERVERS=2
|
||||
CONFIG_DNS_NUM_OF_CONCUR_QUERIES=1
|
||||
|
||||
CONFIG_DNS_SERVER_IP_ADDRESSES=y
|
||||
CONFIG_DNS_SERVER1="192.0.2.2"
|
||||
CONFIG_DNS_SERVER2="192.0.2.2:5353"
|
||||
|
||||
CONFIG_NET_LOG=y
|
||||
CONFIG_SYS_LOG_NET_LEVEL=2
|
||||
CONFIG_SYS_LOG_SHOW_COLOR=y
|
||||
#CONFIG_NET_DEBUG_DNS_RESOLVE=y
|
||||
|
||||
CONFIG_NET_IPV4=y
|
||||
CONFIG_NET_IPV6=n
|
||||
CONFIG_NET_IPV6_DAD=n
|
||||
CONFIG_NET_IPV6_MLD=n
|
||||
CONFIG_NET_IPV6_ND=n
|
||||
CONFIG_NET_ARP=n
|
||||
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_ZTEST=y
|
||||
|
||||
CONFIG_MAIN_STACK_SIZE=1344
|
||||
@@ -374,10 +374,12 @@ static void dns_query_ipv4_server_count(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ctx->servers[i].dns_server.sa_family == AF_INET) {
|
||||
count++;
|
||||
if (ctx->servers[i].dns_server.sa_family == AF_INET6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
if (net_sin(&ctx->servers[i].dns_server)->sin_port ==
|
||||
ntohs(53)) {
|
||||
port++;
|
||||
@@ -385,7 +387,7 @@ static void dns_query_ipv4_server_count(void)
|
||||
}
|
||||
|
||||
zassert_equal(count, 2, "Invalid number of IPv4 servers");
|
||||
zassert_equal(port, 2, "Invalid number of IPv4 servers with port 53");
|
||||
zassert_equal(port, 1, "Invalid number of IPv4 servers with port 53");
|
||||
}
|
||||
|
||||
static void dns_query_ipv6_server_count(void)
|
||||
@@ -402,18 +404,25 @@ static void dns_query_ipv6_server_count(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ctx->servers[i].dns_server.sa_family == AF_INET6) {
|
||||
count++;
|
||||
if (ctx->servers[i].dns_server.sa_family == AF_INET) {
|
||||
continue;
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
if (net_sin6(&ctx->servers[i].dns_server)->sin6_port ==
|
||||
ntohs(53)) {
|
||||
port++;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
zassert_equal(count, 2, "Invalid number of IPv6 servers");
|
||||
zassert_equal(port, 2, "Invalid number of IPv6 servers with port 53");
|
||||
zassert_equal(port, 1, "Invalid number of IPv6 servers with port 53");
|
||||
#else
|
||||
zassert_equal(count, 0, "Invalid number of IPv6 servers");
|
||||
zassert_equal(port, 0, "Invalid number of IPv6 servers with port 53");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void dns_query_too_many(void)
|
||||
@@ -671,10 +680,12 @@ void dns_result_numeric_cb(enum dns_resolve_status status,
|
||||
}
|
||||
|
||||
if (info && info->ai_family == AF_INET6) {
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
if (net_ipv6_addr_cmp(&net_sin6(&info->ai_addr)->sin6_addr,
|
||||
&my_addr3) != true) {
|
||||
zassert_true(false, "IPv6 address does not match");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
k_sem_give(&wait_data2);
|
||||
|
||||
@@ -3,3 +3,8 @@ tests:
|
||||
tags: dns net
|
||||
min_ram: 16
|
||||
timeout: 600
|
||||
- test-no-ipv6:
|
||||
tags: dns net
|
||||
min_ram: 16
|
||||
timeout: 600
|
||||
extra_args: CONF_FILE=prj-no-ipv6.conf
|
||||
|
||||
Reference in New Issue
Block a user