mirror of
https://github.com/espressif/openthread.git
synced 2026-06-12 00:14:53 +00:00
Compare commits
285 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c6179c24ed | |||
| ac11f66419 | |||
| f5acfb2dac | |||
| 11a24d111f | |||
| 1d1e5d16e0 | |||
| 778e3b9ead | |||
| ca8799a4b8 | |||
| b9b9c19640 | |||
| 2a5a926952 | |||
| d4d872c05c | |||
| 2592e3433a | |||
| ed31bfefb6 | |||
| 53305d4762 | |||
| b7471733c5 | |||
| e4bf2ffe34 | |||
| d1653a8edc | |||
| ed43da9110 | |||
| 8c73c9747b | |||
| c3bb95d5f4 | |||
| acf44c45cd | |||
| ff259b845b | |||
| 488ee63b4c | |||
| d8509e6254 | |||
| d805b5dd1c | |||
| 3d5c4b41df | |||
| 68083d8a67 | |||
| aae250af89 | |||
| 77fd973a76 | |||
| 778fbfa82d | |||
| c3bc9481e2 | |||
| 992f9c6374 | |||
| d5333ca831 | |||
| 3d1bdf3317 | |||
| bdb9382976 | |||
| 05590e2dc8 | |||
| 9ebe41f16e | |||
| f5e2a0f961 | |||
| f92364c977 | |||
| f459d9e333 | |||
| 16c927ea1c | |||
| 23c01d7eaf | |||
| 06bd4d6161 | |||
| 74cc79d7a2 | |||
| 3811b6529e | |||
| 43c66a3d5f | |||
| 131e42c60f | |||
| 9c6b45c1dc | |||
| 04feddc458 | |||
| ee83b1cb5d | |||
| 76010bc9ad | |||
| f23eee42f8 | |||
| 697c5e53a2 | |||
| 13311256f6 | |||
| 09e06c6eff | |||
| e387505d4f | |||
| 4a0d069ee8 | |||
| b0266bc00e | |||
| 2b726ef29f | |||
| 812c36f658 | |||
| c4b6206f16 | |||
| a34d1176b9 | |||
| 4eb64510bf | |||
| 10de4c4f13 | |||
| 4f57b8d461 | |||
| d3e00fbd28 | |||
| c5b4cd7bbc | |||
| 61d9e72c18 | |||
| 7e8b482e3c | |||
| b3620ae51a | |||
| 6b712bd270 | |||
| bd8513b904 | |||
| 7954c34231 | |||
| f6df50cde6 | |||
| 081567fda6 | |||
| ba3d188db7 | |||
| 06a6de24fa | |||
| fc8949afb5 | |||
| 12a1e618b2 | |||
| 32a17d8abe | |||
| 02690328a8 | |||
| 384dcbf631 | |||
| ecdd5312a3 | |||
| e64ba13faa | |||
| bcf9d8058e | |||
| 5f7f48be9b | |||
| 1942a79d75 | |||
| 322671e682 | |||
| cc8e4cce15 | |||
| da45d327c7 | |||
| fe655f4ef1 | |||
| 8988bd84c3 | |||
| 13df0374d1 | |||
| 32d7405174 | |||
| 5a627ba0fd | |||
| 615e951ca9 | |||
| af1fd05f0b | |||
| 92f18c5c53 | |||
| bacf8d625f | |||
| 6df8627135 | |||
| 7b44e089a7 | |||
| 9d76424c3c | |||
| 19f9ba20a3 | |||
| 5b430bf80b | |||
| 2cab708443 | |||
| 3a64f399bf | |||
| 0756d1ea8f | |||
| b5ea9c8106 | |||
| b11121b7b5 | |||
| 6973a1b067 | |||
| a7e0516fb2 | |||
| bf2e1c39bc | |||
| a0c4ede86d | |||
| 436bde84f5 | |||
| 1fad9f7626 | |||
| b66d521d1d | |||
| 531339b65d | |||
| dd02babfeb | |||
| f4c76f11fc | |||
| e9877198c4 | |||
| 945edf1eb6 | |||
| 2ad5515be2 | |||
| 1861291a62 | |||
| 865727adc8 | |||
| 4311d1931a | |||
| 2a27a15c1a | |||
| ccf8ea6923 | |||
| 1929c7c187 | |||
| f88f954289 | |||
| ae4c28c5ae | |||
| a53715b231 | |||
| f43b9f0332 | |||
| 46c7dccfef | |||
| 5d50088da9 | |||
| 6dca78e757 | |||
| c3dd3ba8fb | |||
| 30d65bca48 | |||
| bce7c1ae1f | |||
| 3d60038bcb | |||
| d9fd256b47 | |||
| ba4389a44a | |||
| a6032491b8 | |||
| 0988f460dc | |||
| 9308db14c9 | |||
| ba006225e0 | |||
| 10c9a365f2 | |||
| cd83fc1477 | |||
| 958eb5c5bf | |||
| d72c10eed3 | |||
| 989a56e96d | |||
| cba1bebf1f | |||
| d7cbc17961 | |||
| 0f10480ed6 | |||
| e51941177f | |||
| 9699d319af | |||
| 5516024905 | |||
| 130cfd790c | |||
| d17bde5b2d | |||
| 2c3a10d67a | |||
| 9d70832b85 | |||
| 3d146f3f60 | |||
| 85fb24aedf | |||
| 0b8e9745e5 | |||
| 142b8cf58c | |||
| 188ec0d476 | |||
| 570e30522f | |||
| 8942e7f895 | |||
| 370d4dc0b5 | |||
| b8b88d9492 | |||
| 96bba3659c | |||
| fdd0afacc5 | |||
| e50be395e4 | |||
| d48799dddf | |||
| a5eb1c9401 | |||
| 829632e33e | |||
| 0126c5f44b | |||
| a0718d90b1 | |||
| 4dd9fd0c9e | |||
| 969d511d04 | |||
| c2b6621d9f | |||
| e84f05c641 | |||
| 20aee3fa70 | |||
| 897a29565e | |||
| cb91e43322 | |||
| 1d10948069 | |||
| 061d22ba8e | |||
| 2d4896f675 | |||
| 7f73cd42a4 | |||
| 1b5298eb76 | |||
| f790edd5e2 | |||
| 8161a90a0c | |||
| bbac0e7980 | |||
| 47e5277659 | |||
| 4c8ae758fd | |||
| 51c58d9080 | |||
| 7c648559da | |||
| 92a5bd5451 | |||
| 1bc309452f | |||
| 01dd49286e | |||
| f33a586530 | |||
| d1d8c6fecd | |||
| 3aa4060018 | |||
| d06f96a50f | |||
| fda4549df7 | |||
| 82088fe24d | |||
| 80565c58a9 | |||
| 034fc826f3 | |||
| a1e2698401 | |||
| ea1b2292be | |||
| 3120efb486 | |||
| f4d93d8fcf | |||
| df2c11a6cb | |||
| c336a1899f | |||
| 82ce9dd4c4 | |||
| 967d89cd1a | |||
| 9f451a2b32 | |||
| 3a31a5f368 | |||
| 3c38af22b4 | |||
| ba14836b68 | |||
| 919157d0a6 | |||
| 0a41196540 | |||
| 4ce6a4708d | |||
| 5700f90590 | |||
| 0b41ae0a30 | |||
| cbbed06931 | |||
| c28496dbd8 | |||
| 62fcf85106 | |||
| 24fd146e10 | |||
| b2f8c4adba | |||
| 2615d10db8 | |||
| cc72e29c88 | |||
| 21c5bf7025 | |||
| 3b0738542c | |||
| 4116b30c58 | |||
| 9a104a814c | |||
| c096c0e9ca | |||
| e3f157402c | |||
| 7af484f49f | |||
| 184aef663a | |||
| 600ae09994 | |||
| 4e8eeccfe8 | |||
| 747a0a8069 | |||
| 0b1e922a1d | |||
| b6ac79f61a | |||
| 1c9373bb0c | |||
| c96bf599b7 | |||
| 925b12cc08 | |||
| 12d35f3dfa | |||
| 32ac6ddfad | |||
| 209716aa19 | |||
| 5755797937 | |||
| 47b42bb8d9 | |||
| a282aa9f9b | |||
| 5bc71b2a4f | |||
| 390efb4c38 | |||
| 1f2a315acf | |||
| 12933d3f86 | |||
| 19ca3a0a3c | |||
| 96819f934a | |||
| 19181047fd | |||
| 6809b33f31 | |||
| bec3a5edb0 | |||
| 424005f695 | |||
| 7b60716713 | |||
| ed0334f626 | |||
| f98f89adfe | |||
| 8095a086d7 | |||
| c73db3ff2f | |||
| e538aad095 | |||
| 6242a1e68e | |||
| 095f530bd7 | |||
| a68cd059cc | |||
| ec96609070 | |||
| 78f8437c3b | |||
| 793483da0d | |||
| 03c9b9389d | |||
| 13416b15fb | |||
| 366786dbed | |||
| 0ec9612379 | |||
| 648770a8ad | |||
| 78e3b28127 | |||
| 158e59f267 | |||
| eca7a63adc | |||
| 6e0eb8addf | |||
| 5876ff79ae | |||
| 75ecf8d260 |
+33
-33
@@ -30,20 +30,16 @@ name: Build
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
pretty:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -59,21 +55,22 @@ jobs:
|
||||
markdown-lint-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: gaurav-nelson/github-action-markdown-link-check@v1
|
||||
with:
|
||||
use-verbose-mode: 'yes'
|
||||
max-depth: 3
|
||||
|
||||
cmake-version:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo pip3 install --system -U cmake==3.10.3
|
||||
sudo pip3 install -U scikit-build
|
||||
sudo pip3 install -U cmake==3.10.3
|
||||
cmake --version | grep 3.10.3
|
||||
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
|
||||
- name: Build
|
||||
@@ -97,7 +94,7 @@ jobs:
|
||||
CC: ${{ matrix.compiler_c }}
|
||||
CXX: ${{ matrix.compiler_cpp }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -111,7 +108,7 @@ jobs:
|
||||
scan-build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -123,19 +120,19 @@ jobs:
|
||||
script/check-scan-build
|
||||
|
||||
mbedtls3-build:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
|
||||
rm -rf third_party/mbedtls/repo
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ARMmbed/mbedtls
|
||||
ref: v3.1.0
|
||||
ref: v3.2.1
|
||||
path: third_party/mbedtls/repo
|
||||
- name: Build
|
||||
run: |
|
||||
@@ -143,7 +140,7 @@ jobs:
|
||||
|
||||
arm-gcc:
|
||||
name: arm-gcc-${{ matrix.gcc_ver }}
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -164,7 +161,7 @@ jobs:
|
||||
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
|
||||
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -175,25 +172,28 @@ jobs:
|
||||
wget --tries 4 --no-check-certificate --quiet ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2
|
||||
tar xjf gcc-arm.tar.bz2
|
||||
# use the minimal required cmake version
|
||||
sudo pip3 install --system -U cmake==3.10.3
|
||||
sudo pip3 install -U scikit-build
|
||||
sudo pip3 install -U cmake==3.10.3
|
||||
cmake --version | grep 3.10.3
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run: |
|
||||
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
|
||||
script/check-arm-build
|
||||
|
||||
gcc:
|
||||
name: gcc-${{ matrix.gcc_ver }}
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gcc_ver: [5, 6, 7, 8, 9, 10, 11]
|
||||
gcc_ver: [9, 10, 11, 12]
|
||||
env:
|
||||
CC: gcc-${{ matrix.gcc_ver }}
|
||||
CXX: g++-${{ matrix.gcc_ver }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -216,12 +216,12 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
|
||||
clang_ver: ["9", "10", "11", "12", "13"]
|
||||
env:
|
||||
CC: clang-${{ matrix.clang_ver }}
|
||||
CXX: clang++-${{ matrix.clang_ver }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -246,7 +246,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
|
||||
clang_ver: ["9", "10", "11", "12", "13"]
|
||||
env:
|
||||
CC: clang-${{ matrix.clang_ver }}
|
||||
CXX: clang++-${{ matrix.clang_ver }}
|
||||
@@ -254,7 +254,7 @@ jobs:
|
||||
CXXFLAGS: -m32 -Wconversion
|
||||
LDFLAGS: -m32
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -277,7 +277,7 @@ jobs:
|
||||
gn:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -303,12 +303,12 @@ jobs:
|
||||
CXX: clang++
|
||||
- CC: gcc
|
||||
CXX: g++
|
||||
runs-on: macos-10.15
|
||||
runs-on: macos-12
|
||||
env:
|
||||
CC: ${{ matrix.CC }}
|
||||
CXX: ${{ matrix.CXX }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -326,7 +326,7 @@ jobs:
|
||||
android:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build
|
||||
|
||||
@@ -30,15 +30,11 @@ name: Docker
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
buildx:
|
||||
name: buildx-${{ matrix.docker_name }}
|
||||
@@ -49,7 +45,7 @@ jobs:
|
||||
include:
|
||||
- docker_name: environment
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
|
||||
@@ -27,7 +27,13 @@
|
||||
#
|
||||
|
||||
name: CIFuzz
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
@@ -30,19 +30,15 @@ name: Makefile Check
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
makefile-check:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Check
|
||||
|
||||
+27
-18
@@ -30,15 +30,11 @@ name: Border Router
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
backbone-router:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -57,7 +53,7 @@ jobs:
|
||||
# of OMR prefix and Domain prefix is not deterministic.
|
||||
BORDER_ROUTING: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build OTBR Docker
|
||||
@@ -81,11 +77,11 @@ jobs:
|
||||
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE"
|
||||
echo "CI_ENV=${CI_ENV}"
|
||||
sudo -E ./script/test cert_suite ./tests/scripts/thread-cert/backbone/*.py || (sudo chmod a+r *.log *.json *.pcap && false)
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-1-3-backbone-docker
|
||||
path: /tmp/coverage/
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: thread-1-3-backbone-results
|
||||
@@ -98,7 +94,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-1-3-backbone
|
||||
path: tmp/coverage.info
|
||||
@@ -113,31 +109,43 @@ jobs:
|
||||
otbr_trel: 0
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
|
||||
packet_verification: 1
|
||||
nat64: 0
|
||||
description: ""
|
||||
- otbr_mdns: "mDNSResponder"
|
||||
otbr_trel: 1
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
|
||||
packet_verification: 2
|
||||
nat64: 0
|
||||
description: ""
|
||||
- otbr_mdns: "mDNSResponder"
|
||||
otbr_trel: 0
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/MATN/*.py
|
||||
packet_verification: 1
|
||||
nat64: 0
|
||||
description: "MATN"
|
||||
- otbr_mdns: "mDNSResponder"
|
||||
otbr_trel: 0
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/LowPower/*.py
|
||||
packet_verification: 1
|
||||
nat64: 0
|
||||
description: "LowPower"
|
||||
- otbr_mdns: "mDNSResponder"
|
||||
otbr_trel: 0
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/nat64/*.py
|
||||
packet_verification: 1
|
||||
nat64: 1
|
||||
description: "nat64 openthread"
|
||||
- otbr_mdns: "avahi"
|
||||
otbr_trel: 0
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
|
||||
packet_verification: 1
|
||||
nat64: 0
|
||||
description: ""
|
||||
- otbr_mdns: "avahi"
|
||||
otbr_trel: 1
|
||||
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
|
||||
packet_verification: 2
|
||||
nat64: 0
|
||||
description: ""
|
||||
name: BR ${{ matrix.description }} (${{ matrix.otbr_mdns }}, TREL=${{matrix.otbr_trel}})
|
||||
env:
|
||||
@@ -152,9 +160,10 @@ jobs:
|
||||
PYTHONUNBUFFERED: 1
|
||||
VERBOSE: 1
|
||||
BORDER_ROUTING: 1
|
||||
NAT64: ${{ matrix.nat64 }}
|
||||
MAX_JOBS: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build OTBR Docker
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -177,11 +186,11 @@ jobs:
|
||||
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE"
|
||||
echo "CI_ENV=${CI_ENV}"
|
||||
sudo -E ./script/test cert_suite ${{ matrix.cert_scripts }} || (sudo chmod a+r *.log *.json *.pcap && false)
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-border-router-docker
|
||||
path: /tmp/coverage/
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: thread-border-router-results
|
||||
@@ -194,7 +203,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-border-router
|
||||
path: tmp/coverage.info
|
||||
@@ -205,7 +214,7 @@ jobs:
|
||||
- thread-border-router
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -229,7 +238,7 @@ jobs:
|
||||
needs: upload-coverage
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: geekyeggo/delete-artifact@1-glob-support
|
||||
- uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: cov-*
|
||||
useGlob: true
|
||||
|
||||
@@ -30,15 +30,11 @@ name: OTCI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
cli-sim:
|
||||
name: cli-sim VIRTUAL_TIME=${{ matrix.virtual_time }}
|
||||
@@ -52,7 +48,7 @@ jobs:
|
||||
VIRTUAL_TIME: ${{ matrix.virtual_time }}
|
||||
REAL_DEVICE: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
|
||||
+14
-18
@@ -30,6 +30,10 @@ name: OTNS
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
COVERAGE: 1
|
||||
REFERENCE_DEVICE: 1
|
||||
@@ -40,19 +44,11 @@ env:
|
||||
|
||||
jobs:
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
|
||||
unittests:
|
||||
name: Unittests
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: '1.14'
|
||||
@@ -73,7 +69,7 @@ jobs:
|
||||
cd /tmp/otns
|
||||
./script/test py-unittests
|
||||
)
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: unittests-pcaps
|
||||
@@ -83,7 +79,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-otns-unittests
|
||||
path: tmp/coverage.info
|
||||
@@ -92,7 +88,7 @@ jobs:
|
||||
name: Examples
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: '1.14'
|
||||
@@ -113,7 +109,7 @@ jobs:
|
||||
cd /tmp/otns
|
||||
./script/test py-examples
|
||||
)
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: examples-pcaps
|
||||
@@ -123,7 +119,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-otns-examples
|
||||
path: tmp/coverage.info
|
||||
@@ -150,7 +146,7 @@ jobs:
|
||||
env:
|
||||
STRESS_LEVEL: ${{ matrix.stress_level }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: '1.14'
|
||||
@@ -171,7 +167,7 @@ jobs:
|
||||
cd /tmp/otns
|
||||
./script/test stress-tests ${{ matrix.suite }}
|
||||
)
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: stress-tests-${{ matrix.suite }}-pcaps
|
||||
@@ -181,7 +177,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-otns-stress-tests-${{ matrix.suite }}
|
||||
path: tmp/coverage.info
|
||||
@@ -193,7 +189,7 @@ jobs:
|
||||
- stress-tests
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y lcov
|
||||
|
||||
+39
-33
@@ -30,23 +30,19 @@ name: POSIX
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
|
||||
expects-linux:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
|
||||
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
|
||||
@@ -61,7 +57,7 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED_RCP=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED_RCP == '1' }}
|
||||
with:
|
||||
name: core-expect-rcp
|
||||
@@ -70,19 +66,18 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-expects-linux-1
|
||||
path: tmp/coverage.info
|
||||
- name: Run TUN Mode
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y dnsmasq bind9-host ntp
|
||||
sudo systemctl start dnsmasq ntp
|
||||
host ipv6.google.com 127.0.0.1
|
||||
echo 'listen-address=::1' | sudo tee /etc/dnsmasq.conf
|
||||
echo 0 | sudo tee /proc/sys/net/ipv6/conf/all/disable_ipv6
|
||||
sudo systemctl restart dnsmasq
|
||||
sudo apt-get install --no-install-recommends -y bind9-host ntp socat
|
||||
sudo systemctl restart ntp
|
||||
sudo socat 'UDP6-LISTEN:53,fork,reuseaddr,bind=[::1]' UDP:127.0.0.53:53 &
|
||||
host ipv6.google.com 127.0.0.53
|
||||
host ipv6.google.com ::1
|
||||
ulimit -c unlimited
|
||||
./script/test prepare_coredump_upload
|
||||
@@ -93,13 +88,13 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED_TUN=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED_TUN == '1' }}
|
||||
with:
|
||||
name: core-expect-linux
|
||||
path: |
|
||||
./ot-core-dump/*
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: syslog-expect-linux
|
||||
@@ -107,10 +102,21 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-expects-linux-2
|
||||
path: tmp/coverage.info
|
||||
|
||||
tcplp-buffering:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build
|
||||
run: make -C third_party/tcplp/lib/test/
|
||||
- name: Run
|
||||
run: third_party/tcplp/lib/test/test_all
|
||||
|
||||
thread-cert:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -123,7 +129,7 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
VIRTUAL_TIME_UART: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -139,7 +145,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
VERBOSE=1 OT_CLI_PATH="$PWD/output/posix/bin/ot-cli -v" RADIO_DEVICE="$PWD/output/simulation/bin/ot-rcp" make -f src/posix/Makefile-posix check
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: thread-cert
|
||||
@@ -147,7 +153,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-cert
|
||||
path: tmp/coverage.info
|
||||
@@ -157,7 +163,7 @@ jobs:
|
||||
env:
|
||||
COVERAGE: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -174,7 +180,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-ncp-rcp-migrate
|
||||
path: tmp/coverage.info
|
||||
@@ -191,7 +197,7 @@ jobs:
|
||||
OT_DAEMON: ${{ matrix.OT_DAEMON }}
|
||||
OT_READLINE: 'readline'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -219,14 +225,14 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-pty-linux-${{ matrix.DAEMON }}
|
||||
path: tmp/coverage.info
|
||||
|
||||
pty-macos:
|
||||
name: pty-macos OT_DAEMON=${{ matrix.OT_DAEMON }}
|
||||
runs-on: macos-10.15
|
||||
runs-on: macos-12
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -235,7 +241,7 @@ jobs:
|
||||
OT_DAEMON: ${{ matrix.OT_DAEMON }}
|
||||
OT_READLINE: 'off'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
rm -f '/usr/local/bin/2to3'
|
||||
@@ -251,7 +257,7 @@ jobs:
|
||||
rcp-stack-reset:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -267,7 +273,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-rcp-stack-reset
|
||||
path: tmp/coverage.info
|
||||
@@ -280,7 +286,7 @@ jobs:
|
||||
- thread-cert
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -302,7 +308,7 @@ jobs:
|
||||
needs: upload-coverage
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: geekyeggo/delete-artifact@1-glob-support
|
||||
- uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: cov-*
|
||||
useGlob: true
|
||||
|
||||
@@ -30,15 +30,11 @@ name: Simulation 1.1
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
distcheck:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -49,7 +45,7 @@ jobs:
|
||||
THREAD_VERSION: 1.1
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -75,7 +71,7 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
MULTIPLY: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -92,7 +88,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: packet-verification-pcaps
|
||||
@@ -102,7 +98,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-packet-verification
|
||||
path: tmp/coverage.info
|
||||
@@ -118,7 +114,7 @@ jobs:
|
||||
THREAD_VERSION: 1.1
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -133,7 +129,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
VERBOSE=1 make -f examples/Makefile-simulation check
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: cli-ftd-thread-cert
|
||||
@@ -141,7 +137,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-cli-ftd
|
||||
path: tmp/coverage.info
|
||||
@@ -164,7 +160,7 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -179,7 +175,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
VERBOSE=1 make -f examples/Makefile-simulation check
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: cli-mtd-thread-cert
|
||||
@@ -187,7 +183,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-cli-mtd-${{ matrix.message_use_heap }}
|
||||
path: tmp/coverage.info
|
||||
@@ -204,7 +200,7 @@ jobs:
|
||||
TIME_SYNC: 1
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -219,7 +215,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
VERBOSE=1 make -f examples/Makefile-simulation check
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: cli-time-sync-thread-cert
|
||||
@@ -227,19 +223,19 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-cli-time-sync
|
||||
path: tmp/coverage.info
|
||||
|
||||
expects:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
|
||||
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
|
||||
THREAD_VERSION: 1.1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
|
||||
@@ -254,7 +250,7 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED_CLI=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED_CLI == '1' }}
|
||||
with:
|
||||
name: core-expect-cli
|
||||
@@ -263,7 +259,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-expects
|
||||
path: tmp/coverage.info
|
||||
@@ -273,7 +269,7 @@ jobs:
|
||||
env:
|
||||
THREAD_VERSION: 1.1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -306,7 +302,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-ot-commissioner
|
||||
path: tmp/coverage.info
|
||||
@@ -321,7 +317,7 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
CXXFLAGS: "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -335,7 +331,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
VERBOSE=1 make -f examples/Makefile-simulation check
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: multiple-instance-thread-cert
|
||||
@@ -343,7 +339,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-multiple-instance
|
||||
path: tmp/coverage.info
|
||||
@@ -359,7 +355,7 @@ jobs:
|
||||
- multiple-instance
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -381,7 +377,7 @@ jobs:
|
||||
needs: upload-coverage
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: geekyeggo/delete-artifact@1-glob-support
|
||||
- uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: cov-*
|
||||
useGlob: true
|
||||
|
||||
@@ -30,15 +30,11 @@ name: Simulation 1.3
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
thread-1-3:
|
||||
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
|
||||
@@ -59,7 +55,7 @@ jobs:
|
||||
compiler: [{c: "gcc", cxx: "g++", gcov: "gcc"}, { c: "clang-10", cxx: "clang++-10", gcov: "llvm"}]
|
||||
arch: ["m32", "m64"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -84,12 +80,12 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps
|
||||
path: "*.pcap"
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED == '1' }}
|
||||
with:
|
||||
name: core-packet-verification-thread-1-3
|
||||
@@ -98,7 +94,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage "${{ matrix.compiler.gcov }}"
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
|
||||
path: tmp/coverage.info
|
||||
@@ -115,7 +111,7 @@ jobs:
|
||||
INTER_OP: 1
|
||||
INTER_OP_BBR: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -143,14 +139,14 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: packet-verification-low-power-pcaps
|
||||
path: |
|
||||
*.pcap
|
||||
*.json
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED == '1' }}
|
||||
with:
|
||||
name: core-packet-verification-low-power
|
||||
@@ -159,7 +155,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-packet-verification-low-power
|
||||
path: tmp/coverage.info
|
||||
@@ -173,7 +169,7 @@ jobs:
|
||||
THREAD_VERSION: 1.3
|
||||
MULTIPLY: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -190,7 +186,7 @@ jobs:
|
||||
- name: Run
|
||||
run: |
|
||||
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: packet-verification-1.1-on-1.3-pcaps
|
||||
@@ -200,7 +196,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-packet-verification-1-1-on-1-3
|
||||
path: tmp/coverage.info
|
||||
@@ -212,7 +208,7 @@ jobs:
|
||||
THREAD_VERSION: 1.3
|
||||
VIRTUAL_TIME: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -229,7 +225,7 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED == '1' }}
|
||||
with:
|
||||
name: core-expect-1-3
|
||||
@@ -238,7 +234,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-expects
|
||||
path: tmp/coverage.info
|
||||
@@ -255,7 +251,7 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
INTER_OP: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -282,12 +278,12 @@ jobs:
|
||||
CRASHED=$(./script/test check_crash | tail -1)
|
||||
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
|
||||
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: thread-1-3-posix-pcaps
|
||||
path: "*.pcap"
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && env.CRASHED == '1' }}
|
||||
with:
|
||||
name: core-thread-1-3-posix
|
||||
@@ -296,7 +292,7 @@ jobs:
|
||||
- name: Generate Coverage
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cov-thread-1-3-posix
|
||||
path: tmp/coverage.info
|
||||
@@ -310,7 +306,7 @@ jobs:
|
||||
- thread-1-3-posix
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -332,7 +328,7 @@ jobs:
|
||||
needs: upload-coverage
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: geekyeggo/delete-artifact@1-glob-support
|
||||
- uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: cov-*
|
||||
useGlob: true
|
||||
|
||||
@@ -30,25 +30,21 @@ name: Size
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
size-report:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Bootstrap
|
||||
if: "github.event_name == 'push'"
|
||||
run: |
|
||||
python3 -m pip install --upgrade setuptools wheel
|
||||
python3 -m pip install mdv
|
||||
python3 -m pip install git+https://github.com/axiros/terminal_markdown_viewer.git
|
||||
- name: Run
|
||||
env:
|
||||
OT_BASE_BRANCH: "${{ github.base_ref }}"
|
||||
|
||||
@@ -30,19 +30,15 @@ name: Toranj
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
jobs:
|
||||
|
||||
toranj-ncp:
|
||||
name: toranj-ncp-${{ matrix.TORANJ_RADIO }}
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -51,7 +47,7 @@ jobs:
|
||||
COVERAGE: 1
|
||||
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -61,12 +57,15 @@ jobs:
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
sudo apt-get --no-install-recommends install -y dbus libdbus-1-dev
|
||||
sudo apt-get --no-install-recommends install -y autoconf-archive
|
||||
sudo apt-get --no-install-recommends install -y bsdtar
|
||||
sudo apt-get --no-install-recommends install -y libarchive-tools
|
||||
sudo apt-get --no-install-recommends install -y libtool
|
||||
sudo apt-get --no-install-recommends install -y libglib2.0-dev
|
||||
sudo apt-get --no-install-recommends install -y libboost-dev libboost-signals-dev
|
||||
sudo apt-get --no-install-recommends install -y lcov
|
||||
|
||||
sudo add-apt-repository universe
|
||||
sudo apt-get update
|
||||
sudo apt-get --no-install-recommends install -y libboost-all-dev python2
|
||||
|
||||
script/git-tool clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
|
||||
cd wpantund
|
||||
./bootstrap.sh
|
||||
@@ -80,7 +79,7 @@ jobs:
|
||||
if: "matrix.TORANJ_RADIO != 'multi'"
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: "matrix.TORANJ_RADIO != 'multi'"
|
||||
with:
|
||||
name: cov-toranj-ncp-${{ matrix.TORANJ_RADIO }}
|
||||
@@ -88,7 +87,7 @@ jobs:
|
||||
|
||||
toranj-cli:
|
||||
name: toranj-cli-${{ matrix.TORANJ_RADIO }}
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
TORANJ_RADIO: ['15.4']
|
||||
@@ -97,7 +96,7 @@ jobs:
|
||||
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
|
||||
TORANJ_CLI: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -114,19 +113,40 @@ jobs:
|
||||
if: "matrix.TORANJ_RADIO != 'multi'"
|
||||
run: |
|
||||
./script/test generate_coverage gcc
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: "matrix.TORANJ_RADIO != 'multi'"
|
||||
with:
|
||||
name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }}
|
||||
path: tmp/coverage.info
|
||||
|
||||
toranj-unittest:
|
||||
name: toranj-unittest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov
|
||||
sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386
|
||||
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
|
||||
- name: Build & Run
|
||||
run: |
|
||||
./tests/toranj/build.sh cmake
|
||||
ninja test
|
||||
|
||||
upload-coverage:
|
||||
needs:
|
||||
- toranj-ncp
|
||||
- toranj-cli
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
@@ -148,7 +168,7 @@ jobs:
|
||||
needs: upload-coverage
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: geekyeggo/delete-artifact@1-glob-support
|
||||
- uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: cov-*
|
||||
useGlob: true
|
||||
|
||||
@@ -30,19 +30,15 @@ name: API Version
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
cancel-previous-runs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "github.ref != 'refs/heads/main'"
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
api-version:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Check
|
||||
|
||||
+51
-16
@@ -169,6 +169,7 @@ LOCAL_SRC_FILES := \
|
||||
src/core/api/backbone_router_ftd_api.cpp \
|
||||
src/core/api/border_agent_api.cpp \
|
||||
src/core/api/border_router_api.cpp \
|
||||
src/core/api/border_routing_api.cpp \
|
||||
src/core/api/channel_manager_api.cpp \
|
||||
src/core/api/channel_monitor_api.cpp \
|
||||
src/core/api/child_supervision_api.cpp \
|
||||
@@ -196,6 +197,7 @@ LOCAL_SRC_FILES := \
|
||||
src/core/api/logging_api.cpp \
|
||||
src/core/api/message_api.cpp \
|
||||
src/core/api/multi_radio_api.cpp \
|
||||
src/core/api/nat64_api.cpp \
|
||||
src/core/api/netdata_api.cpp \
|
||||
src/core/api/netdata_publisher_api.cpp \
|
||||
src/core/api/netdiag_api.cpp \
|
||||
@@ -210,6 +212,7 @@ LOCAL_SRC_FILES := \
|
||||
src/core/api/srp_server_api.cpp \
|
||||
src/core/api/tasklet_api.cpp \
|
||||
src/core/api/tcp_api.cpp \
|
||||
src/core/api/tcp_ext_api.cpp \
|
||||
src/core/api/thread_api.cpp \
|
||||
src/core/api/thread_ftd_api.cpp \
|
||||
src/core/api/trel_api.cpp \
|
||||
@@ -230,6 +233,8 @@ LOCAL_SRC_FILES := \
|
||||
src/core/common/crc16.cpp \
|
||||
src/core/common/data.cpp \
|
||||
src/core/common/error.cpp \
|
||||
src/core/common/frame_builder.cpp \
|
||||
src/core/common/frame_data.cpp \
|
||||
src/core/common/heap.cpp \
|
||||
src/core/common/heap_data.cpp \
|
||||
src/core/common/heap_string.cpp \
|
||||
@@ -296,12 +301,13 @@ LOCAL_SRC_FILES := \
|
||||
src/core/net/dns_types.cpp \
|
||||
src/core/net/dnssd_server.cpp \
|
||||
src/core/net/icmp6.cpp \
|
||||
src/core/net/ip4_address.cpp \
|
||||
src/core/net/ip4_types.cpp \
|
||||
src/core/net/ip6.cpp \
|
||||
src/core/net/ip6_address.cpp \
|
||||
src/core/net/ip6_filter.cpp \
|
||||
src/core/net/ip6_headers.cpp \
|
||||
src/core/net/ip6_mpl.cpp \
|
||||
src/core/net/nat64_translator.cpp \
|
||||
src/core/net/nd6.cpp \
|
||||
src/core/net/nd_agent.cpp \
|
||||
src/core/net/netif.cpp \
|
||||
@@ -310,6 +316,7 @@ LOCAL_SRC_FILES := \
|
||||
src/core/net/srp_client.cpp \
|
||||
src/core/net/srp_server.cpp \
|
||||
src/core/net/tcp6.cpp \
|
||||
src/core/net/tcp6_ext.cpp \
|
||||
src/core/net/udp6.cpp \
|
||||
src/core/radio/radio.cpp \
|
||||
src/core/radio/radio_callbacks.cpp \
|
||||
@@ -329,6 +336,7 @@ LOCAL_SRC_FILES := \
|
||||
src/core/thread/indirect_sender.cpp \
|
||||
src/core/thread/key_manager.cpp \
|
||||
src/core/thread/link_metrics.cpp \
|
||||
src/core/thread/link_metrics_types.cpp \
|
||||
src/core/thread/link_quality.cpp \
|
||||
src/core/thread/lowpan.cpp \
|
||||
src/core/thread/mesh_forwarder.cpp \
|
||||
@@ -397,6 +405,46 @@ LOCAL_SRC_FILES := \
|
||||
src/posix/platform/trel.cpp \
|
||||
src/posix/platform/udp.cpp \
|
||||
src/posix/platform/utils.cpp \
|
||||
third_party/tcplp/bsdtcp/tcp_usrreq.c \
|
||||
third_party/tcplp/bsdtcp/tcp_subr.c \
|
||||
third_party/tcplp/bsdtcp/tcp_output.c \
|
||||
third_party/tcplp/bsdtcp/cc/cc_newreno.c \
|
||||
third_party/tcplp/bsdtcp/tcp_reass.c \
|
||||
third_party/tcplp/bsdtcp/tcp_timewait.c \
|
||||
third_party/tcplp/bsdtcp/tcp_sack.c \
|
||||
third_party/tcplp/bsdtcp/tcp_input.c \
|
||||
third_party/tcplp/bsdtcp/tcp_timer.c \
|
||||
third_party/tcplp/lib/bitmap.c \
|
||||
third_party/tcplp/lib/cbuf.c \
|
||||
third_party/tcplp/lib/lbuf.c \
|
||||
$(OPENTHREAD_PROJECT_SRC_FILES) \
|
||||
$(NULL)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libopenthread-mbedtls
|
||||
LOCAL_MODULE_TAGS := eng
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(OPENTHREAD_PROJECT_INCLUDES) \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/src \
|
||||
$(LOCAL_PATH)/src/cli \
|
||||
$(LOCAL_PATH)/src/core \
|
||||
$(LOCAL_PATH)/src/posix/platform \
|
||||
$(LOCAL_PATH)/src/posix/platform/include \
|
||||
$(LOCAL_PATH)/third_party/mbedtls \
|
||||
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
-std=c99 \
|
||||
$(OPENTHREAD_PUBLIC_CFLAGS) \
|
||||
$(OPENTHREAD_PRIVATE_CFLAGS) \
|
||||
$(OPENTHREAD_PROJECT_CFLAGS) \
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
third_party/mbedtls/repo/library/aes.c \
|
||||
third_party/mbedtls/repo/library/aesni.c \
|
||||
third_party/mbedtls/repo/library/arc4.c \
|
||||
@@ -484,20 +532,6 @@ LOCAL_SRC_FILES := \
|
||||
third_party/mbedtls/repo/library/x509write_crt.c \
|
||||
third_party/mbedtls/repo/library/x509write_csr.c \
|
||||
third_party/mbedtls/repo/library/xtea.c \
|
||||
third_party/tcplp/bsdtcp/tcp_usrreq.c \
|
||||
third_party/tcplp/bsdtcp/tcp_subr.c \
|
||||
third_party/tcplp/bsdtcp/tcp_output.c \
|
||||
third_party/tcplp/bsdtcp/cc/cc_newreno.c \
|
||||
third_party/tcplp/bsdtcp/tcp_reass.c \
|
||||
third_party/tcplp/bsdtcp/tcp_timewait.c \
|
||||
third_party/tcplp/bsdtcp/tcp_sack.c \
|
||||
third_party/tcplp/bsdtcp/tcp_input.c \
|
||||
third_party/tcplp/bsdtcp/tcp_timer.c \
|
||||
third_party/tcplp/lib/bitmap.c \
|
||||
third_party/tcplp/lib/cbuf.c \
|
||||
third_party/tcplp/lib/lbuf.c \
|
||||
$(OPENTHREAD_PROJECT_SRC_FILES) \
|
||||
$(NULL)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
@@ -580,6 +614,7 @@ LOCAL_CPPFLAGS := \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_LDLIBS := \
|
||||
-lanl \
|
||||
-lrt \
|
||||
-lutil
|
||||
|
||||
@@ -589,7 +624,7 @@ LOCAL_SRC_FILES := \
|
||||
src/posix/main.c \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_STATIC_LIBRARIES = libopenthread-cli ot-core
|
||||
LOCAL_STATIC_LIBRARIES = libopenthread-cli ot-core libopenthread-mbedtls
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
ifeq ($(USE_OTBR_DAEMON), 1)
|
||||
|
||||
@@ -40,6 +40,9 @@ set(OT_EXTERNAL_MBEDTLS "" CACHE STRING "Specify external mbedtls library")
|
||||
option(OT_MBEDTLS_THREADING "enable mbedtls threading" OFF)
|
||||
|
||||
add_library(ot-config INTERFACE)
|
||||
add_library(ot-config-ftd INTERFACE)
|
||||
add_library(ot-config-mtd INTERFACE)
|
||||
add_library(ot-config-radio INTERFACE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
OpenThread is an open source implementation of the Thread 1.2.0 Final Specification.
|
||||
The Thread 1.2.0 Final Specification is promulgated by the Thread Group. The Thread
|
||||
OpenThread is an open source implementation of the Thread 1.3.0 Final Specification.
|
||||
The Thread 1.3.0 Final Specification is promulgated by the Thread Group. The Thread
|
||||
Group is a non-profit organization formed for the purposes of defining one or
|
||||
more specifications, best practices, reference architectures, implementation
|
||||
guidelines and certification programs to promote the availability of compliant
|
||||
@@ -7,10 +7,10 @@ implementations of the Thread protocol. Information on becoming a Member, includ
|
||||
information about the benefits thereof, can be found at http://threadgroup.org.
|
||||
|
||||
OpenThread is not affiliated with or endorsed by the Thread Group. Implementation
|
||||
of this OpenThread code does not assure compliance with the Thread 1.2.0 Final
|
||||
of this OpenThread code does not assure compliance with the Thread 1.3.0 Final
|
||||
Specification and does not convey the right to identify any final product as Thread
|
||||
certified. Members of the Thread Group may hold patents and other intellectual
|
||||
property rights relating to the Thread 1.2.0 Final Specification, ownership and
|
||||
property rights relating to the Thread 1.3.0 Final Specification, ownership and
|
||||
licenses of which are subject to the Thread Group’s IP Policies, and not this license.
|
||||
|
||||
The included copyright to the OpenThread code is subject to the license in the
|
||||
|
||||
@@ -10,7 +10,7 @@ OpenThread released by Google is... <a href="https://www.threadgroup.org/What-is
|
||||
|
||||
**...OS and platform agnostic**, with a narrow platform abstraction layer and a small memory footprint, making it highly portable. It supports both system-on-chip (SoC) and network co-processor (NCP) designs.
|
||||
|
||||
**...a Thread Certified Component**, implementing all features defined in the [Thread 1.2 specification](https://www.threadgroup.org/support#specifications), including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as [Border Router](https://github.com/openthread/ot-br-posix) support.
|
||||
**...a Thread Certified Component**, implementing all features defined in the [Thread 1.3.0 specification](https://www.threadgroup.org/support#specifications), including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as [Border Router](https://github.com/openthread/ot-br-posix) support.
|
||||
|
||||
More information about Thread can be found at [threadgroup.org](http://threadgroup.org/). Thread is a registered trademark of the Thread Group, Inc.
|
||||
|
||||
@@ -29,7 +29,7 @@ More information about Thread can be found at [threadgroup.org](http://threadgro
|
||||
|
||||
# Who supports OpenThread?
|
||||
|
||||
<a href="https://www.arm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.espressif.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-espressif-github.png" alt="Espressif" width="200px"></a><a href="https://www.google.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="https://www.infineon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-infineon.png" alt="Infineon" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.telink-semi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-telink-github.png" alt="Telink Semiconductor" width="200px"></a><a href="https://www.ti.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" width="200px"></a>
|
||||
<a href="https://www.amazon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-amazon.png" alt="Amazon" width="200px"></a><a href="https://www.arm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.eero.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-eero.png" alt="Eero" width="200px"></a><a href="https://www.espressif.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-espressif-github.png" alt="Espressif" width="200px"></a><a href="https://www.google.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="https://www.infineon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-infineon.png" alt="Infineon" width="200px"></a><a href="https://mmbnetworks.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-mmb-networks.png" alt="MMB Networks" width="200px"></a><a href="https://www.nanoleaf.me/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nanoleaf.png" alt="Nanoleaf" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.telink-semi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-telink-github.png" alt="Telink Semiconductor" width="200px"></a><a href="https://www.ti.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" width="200px"></a>
|
||||
|
||||
# Getting started
|
||||
|
||||
@@ -54,10 +54,6 @@ We would love for you to contribute to OpenThread and help make it even better t
|
||||
|
||||
Contributors are required to abide by our [Code of Conduct](https://github.com/openthread/openthread/blob/main/CODE_OF_CONDUCT.md) and [Coding Conventions and Style Guide](https://github.com/openthread/openthread/blob/main/STYLE_GUIDE.md).
|
||||
|
||||
# Versioning
|
||||
|
||||
OpenThread follows the [Semantic Versioning guidelines](http://semver.org/) for release cycle transparency and to maintain backwards compatibility. OpenThread's versioning is independent of the Thread protocol specification version but will clearly indicate which version of the specification it currently supports.
|
||||
|
||||
# License
|
||||
|
||||
OpenThread is released under the [BSD 3-Clause license](https://github.com/openthread/openthread/blob/main/LICENSE). See the [`LICENSE`](https://github.com/openthread/openthread/blob/main/LICENSE) file for more information.
|
||||
|
||||
@@ -39,7 +39,8 @@ nlbuild_autotools_stem="third_party/nlbuild-autotools/repo"
|
||||
abs_srcdir=$(cd "$(dirname "${0}")" && pwd)
|
||||
|
||||
# filter out knowning information from stderr which is causing GitHub annotation check warnings.
|
||||
(cd "$abs_srcdir" && exec "$abs_srcdir/$nlbuild_autotools_stem/scripts/bootstrap" -I "$abs_srcdir/$nlbuild_autotools_stem" "${@}") 2> \
|
||||
>(grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/missing'" \
|
||||
(cd "$abs_srcdir" && exec "$abs_srcdir/$nlbuild_autotools_stem/scripts/bootstrap" -I "$abs_srcdir/$nlbuild_autotools_stem" "${@}") 2> >(
|
||||
grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/missing'" \
|
||||
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/compile'" \
|
||||
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/depcomp'" 1>&2)
|
||||
| grep -v "installing 'third_party/nlbuild-autotools/repo/third_party/autoconf/depcomp'" 1>&2
|
||||
)
|
||||
|
||||
+4
-7
@@ -804,14 +804,14 @@ AC_MSG_CHECKING([whether to build examples])
|
||||
|
||||
AC_ARG_WITH(examples,
|
||||
[AS_HELP_STRING([--with-examples=TARGET],
|
||||
[Build example applications for one of: simulation, cc2538 @<:@default=no@:>@.
|
||||
[Build example applications for one of: simulation @<:@default=no@:>@.
|
||||
Note that building example applications also builds the associated OpenThread platform libraries
|
||||
and any third_party libraries needed to support the examples.])],
|
||||
[
|
||||
case "${with_examples}" in
|
||||
no)
|
||||
;;
|
||||
simulation|cc2538)
|
||||
simulation)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(ERROR)
|
||||
@@ -824,7 +824,6 @@ AC_ARG_WITH(examples,
|
||||
AM_CONDITIONAL([OPENTHREAD_ENABLE_EXAMPLES], [test ${with_examples} != "no"])
|
||||
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SIMULATION],[test "${with_examples}" = "simulation"])
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${with_examples}" = "cc2538"])
|
||||
|
||||
AM_COND_IF([OPENTHREAD_EXAMPLES_SIMULATION], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=0")
|
||||
|
||||
@@ -845,11 +844,11 @@ AC_MSG_CHECKING([whether to build platform libraries])
|
||||
|
||||
AC_ARG_WITH(platform,
|
||||
[AS_HELP_STRING([--with-platform=TARGET],
|
||||
[Build OpenThread platform libraries for one of: cc2538, posix, simulation @<:@default=simulation@:>@.])],
|
||||
[Build OpenThread platform libraries for one of: posix, simulation @<:@default=simulation@:>@.])],
|
||||
[
|
||||
# Make sure the given target is valid.
|
||||
case "${with_platform}" in
|
||||
no|cc2538|posix|simulation)
|
||||
no|posix|simulation)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(ERROR)
|
||||
@@ -880,7 +879,6 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM], [test ${with_platform} != "no"])
|
||||
|
||||
OPENTHREAD_ENABLE_PLATFORM=${with_platform}
|
||||
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2538], [test "${with_platform}" = "cc2538"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_POSIX], [test "${with_platform}" = "posix"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SIMULATION],[test "${with_platform}" = "simulation"])
|
||||
|
||||
@@ -1023,7 +1021,6 @@ examples/apps/Makefile
|
||||
examples/apps/cli/Makefile
|
||||
examples/apps/ncp/Makefile
|
||||
examples/platforms/Makefile
|
||||
examples/platforms/cc2538/Makefile
|
||||
examples/platforms/simulation/Makefile
|
||||
examples/platforms/utils/Makefile
|
||||
tools/Makefile
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -57,6 +57,7 @@
|
||||
* @defgroup api-dnssd-server DNS-SD Server
|
||||
* @defgroup api-icmp6 ICMPv6
|
||||
* @defgroup api-ip6 IPv6
|
||||
* @defgroup api-nat64 NAT64
|
||||
* @defgroup api-srp SRP
|
||||
* @defgroup api-ping-sender Ping Sender
|
||||
*
|
||||
@@ -102,11 +103,13 @@
|
||||
* @defgroup api-backbone-router Backbone Router
|
||||
* @defgroup api-border-agent Border Agent
|
||||
* @defgroup api-border-router Border Router
|
||||
* @defgroup api-border-routing Border Routing Manager
|
||||
* @defgroup api-commissioner Commissioner
|
||||
* @defgroup api-thread-general General
|
||||
* @brief This module includes functions for all Thread roles.
|
||||
* @defgroup api-joiner Joiner
|
||||
* @defgroup api-operational-dataset Operational Dataset
|
||||
* @brief Includes functions for the Operational Dataset API.
|
||||
* @defgroup api-thread-router Router/Leader
|
||||
* @brief This module includes functions for Thread Routers and Leaders.
|
||||
* @defgroup api-server Server
|
||||
@@ -177,6 +180,7 @@
|
||||
* @defgroup plat-time Time Service
|
||||
* @defgroup plat-toolchain Toolchain
|
||||
* @defgroup plat-trel TREL - Platform
|
||||
* @defgroup plat-infra-if Infrastructure Interface
|
||||
*
|
||||
* @}
|
||||
*
|
||||
|
||||
+124
-347
@@ -34,58 +34,135 @@ option(OT_FTD "enable FTD" ON)
|
||||
option(OT_MTD "enable MTD" ON)
|
||||
option(OT_RCP "enable RCP" ON)
|
||||
|
||||
option(OT_ANYCAST_LOCATOR "enable anycast locator support")
|
||||
if(OT_ANYCAST_LOCATOR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE=1")
|
||||
set(OT_CONFIG_VALUES
|
||||
""
|
||||
"ON"
|
||||
"OFF"
|
||||
)
|
||||
|
||||
macro(ot_option name ot_config description)
|
||||
# Declare an OT cmake config with `name` mapping to OPENTHREAD_CONFIG
|
||||
# `ot_config`. Parameter `description` provides the help string for this
|
||||
# OT cmake config. There is an optional last parameter which if provided
|
||||
# determines the default value for the cmake config. If not provided
|
||||
# empty string is used which will be treated as "not specified". In this
|
||||
# case, the variable `name` would still be false but the related
|
||||
# OPENTHREAD_CONFIG is not added in `ot-config`.
|
||||
|
||||
if (${ARGC} GREATER 3)
|
||||
set(${name} ${ARGN} CACHE STRING "enable ${description}")
|
||||
else()
|
||||
set(${name} "" CACHE STRING "enable ${description}")
|
||||
endif()
|
||||
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${OT_CONFIG_VALUES})
|
||||
|
||||
string(COMPARE EQUAL "${${name}}" "" is_empty)
|
||||
if (is_empty)
|
||||
message(STATUS "${name}=\"\"")
|
||||
elseif (${name})
|
||||
message(STATUS "${name}=ON --> ${ot_config}=1")
|
||||
target_compile_definitions(ot-config INTERFACE "${ot_config}=1")
|
||||
else()
|
||||
message(STATUS "${name}=OFF --> ${ot_config}=0")
|
||||
target_compile_definitions(ot-config INTERFACE "${ot_config}=0")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
ot_option(OT_ANYCAST_LOCATOR OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE "anycast locator")
|
||||
ot_option(OT_ASSERT OPENTHREAD_CONFIG_ASSERT_ENABLE "assert function OT_ASSERT()")
|
||||
ot_option(OT_BACKBONE_ROUTER OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE "backbone router functionality")
|
||||
ot_option(OT_BACKBONE_ROUTER_DUA_NDPROXYING OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE "BBR DUA ND Proxy")
|
||||
ot_option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE "BBR MR")
|
||||
ot_option(OT_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent")
|
||||
ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router")
|
||||
ot_option(OT_BORDER_ROUTING OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE "border routing")
|
||||
ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager")
|
||||
ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor")
|
||||
ot_option(OT_CHILD_SUPERVISION OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE "child supervision")
|
||||
ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api")
|
||||
ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)")
|
||||
ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)")
|
||||
ot_option(OT_COAPS OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE "secure coap")
|
||||
ot_option(OT_COMMISSIONER OPENTHREAD_CONFIG_COMMISSIONER_ENABLE "commissioner")
|
||||
ot_option(OT_CSL_AUTO_SYNC OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE "data polling based on csl")
|
||||
ot_option(OT_CSL_DEBUG OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE "csl debug")
|
||||
ot_option(OT_CSL_RECEIVER OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE "csl receiver")
|
||||
ot_option(OT_DATASET_UPDATER OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE "dataset updater")
|
||||
ot_option(OT_DHCP6_CLIENT OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE "DHCP6 client")
|
||||
ot_option(OT_DHCP6_SERVER OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE "DHCP6 server")
|
||||
ot_option(OT_DIAGNOSTIC OPENTHREAD_CONFIG_DIAG_ENABLE "diagnostic")
|
||||
ot_option(OT_DNS_CLIENT OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE "DNS client")
|
||||
ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (DSO)")
|
||||
ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
|
||||
ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
|
||||
ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
|
||||
ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
|
||||
ot_option(OT_FIREWALL OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE "firewall")
|
||||
ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history tracker")
|
||||
ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation")
|
||||
ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection")
|
||||
ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner")
|
||||
ot_option(OT_LEGACY OPENTHREAD_CONFIG_LEGACY_ENABLE "legacy network")
|
||||
ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator")
|
||||
ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject")
|
||||
ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service")
|
||||
ot_option(OT_LOG_LEVEL_DYNAMIC OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE "dynamic log level control")
|
||||
ot_option(OT_MAC_FILTER OPENTHREAD_CONFIG_MAC_FILTER_ENABLE "mac filter")
|
||||
ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers")
|
||||
ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)")
|
||||
ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)")
|
||||
ot_option(OT_MTD_NETDIAG OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE "TMF network diagnostics on MTDs")
|
||||
ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances")
|
||||
ot_option(OT_NAT64_BORDER_ROUTING OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE "border routing NAT64")
|
||||
ot_option(OT_NAT64_TRANSLATOR OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE "NAT64 translator support")
|
||||
ot_option(OT_NEIGHBOR_DISCOVERY_AGENT OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE "neighbor discovery agent")
|
||||
ot_option(OT_NETDATA_PUBLISHER OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE "Network Data publisher")
|
||||
ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
|
||||
ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
|
||||
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
|
||||
ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
|
||||
ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
|
||||
ot_option(OT_SERVICE OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE "Network Data service")
|
||||
ot_option(OT_SETTINGS_RAM OPENTHREAD_SETTINGS_RAM "volatile-only storage of settings")
|
||||
ot_option(OT_SLAAC OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE "SLAAC address")
|
||||
ot_option(OT_SNTP_CLIENT OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE "SNTP client")
|
||||
ot_option(OT_SRP_CLIENT OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE "SRP client")
|
||||
ot_option(OT_SRP_SERVER OPENTHREAD_CONFIG_SRP_SERVER_ENABLE "SRP server")
|
||||
ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service")
|
||||
ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature")
|
||||
ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload")
|
||||
ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
|
||||
ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")
|
||||
|
||||
option(OT_DOC "Build OpenThread documentation")
|
||||
|
||||
option(OT_FULL_LOGS "enable full logs")
|
||||
if(OT_FULL_LOGS)
|
||||
if(NOT OT_LOG_LEVEL)
|
||||
message(STATUS "OT_FULL_LOGS=ON --> Setting LOG_LEVEL to DEBG")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
|
||||
endif()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
|
||||
endif()
|
||||
|
||||
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
|
||||
if(OT_ASSERT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
|
||||
set(OT_MLE_MAX_CHILDREN "" CACHE STRING "set maximum number of children")
|
||||
if(OT_MLE_MAX_CHILDREN MATCHES "^[0-9]+$")
|
||||
message(STATUS "OT_MLE_MAX_CHILDREN=${OT_MLE_MAX_CHILDREN}")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_MAX_CHILDREN=${OT_MLE_MAX_CHILDREN}")
|
||||
elseif(NOT OT_MLE_MAX_CHILDREN STREQUAL "")
|
||||
message(FATAL_ERROR "Invalid maximum number of children: ${OT_MLE_MAX_CHILDREN}")
|
||||
endif()
|
||||
|
||||
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
|
||||
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
|
||||
message(STATUS "OT_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=0")
|
||||
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
endif()
|
||||
|
||||
option(OT_BACKBONE_ROUTER "enable backbone router functionality")
|
||||
if(OT_BACKBONE_ROUTER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1")
|
||||
set(OT_BACKBONE_ROUTER_DUA_NDPROXYING ON CACHE BOOL "Enable DUA NDProxying by default")
|
||||
set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING ON CACHE BOOL "Enable Multicast Routing by default")
|
||||
endif()
|
||||
|
||||
option(OT_BACKBONE_ROUTER_DUA_NDPROXYING "enable Backbone Router DUA ND Proxying functionality" OFF)
|
||||
if(OT_BACKBONE_ROUTER_DUA_NDPROXYING)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING "enable Backbone Router Multicast Routing functionality" OFF)
|
||||
if(OT_BACKBONE_ROUTER_MULTICAST_ROUTING)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_AGENT "enable border agent support")
|
||||
if(OT_BORDER_AGENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_ROUTER "enable border router support")
|
||||
if(OT_BORDER_ROUTER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_ROUTING "enable border routing support")
|
||||
if(OT_BORDER_ROUTING)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_ROUTING_NAT64 "enable border routing NAT64 support")
|
||||
if(OT_BORDER_ROUTING_NAT64)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE=1")
|
||||
endif()
|
||||
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
|
||||
|
||||
if(NOT OT_EXTERNAL_MBEDTLS)
|
||||
set(OT_MBEDTLS mbedtls)
|
||||
@@ -102,307 +179,7 @@ else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0")
|
||||
endif()
|
||||
|
||||
option(OT_CHANNEL_MANAGER "enable channel manager support")
|
||||
if(OT_CHANNEL_MANAGER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CHANNEL_MONITOR "enable channel monitor support")
|
||||
if(OT_CHANNEL_MONITOR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CHILD_SUPERVISION "enable child supervision support")
|
||||
if(OT_CHILD_SUPERVISION)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAP "enable coap api support")
|
||||
if(OT_COAP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_API_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAPS "enable secure coap api support")
|
||||
if(OT_COAPS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAP_BLOCK "enable coap block-wise transfer (RFC7959) api support")
|
||||
if(OT_COAP_BLOCK)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAP_OBSERVE "enable coap observe (RFC7641) api support")
|
||||
if(OT_COAP_OBSERVE)
|
||||
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COMMISSIONER "enable commissioner support")
|
||||
if(OT_COMMISSIONER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CSL_RECEIVER "enable csl receiver")
|
||||
if(OT_CSL_RECEIVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CSL_AUTO_SYNC "enable data polling based on csl config" ${OT_CSL_RECEIVER})
|
||||
if(OT_CSL_AUTO_SYNC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_CSL_DEBUG "enable csl debug")
|
||||
if(OT_CSL_DEBUG)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DATASET_UPDATER "enable dataset updater support")
|
||||
if(OT_DATASET_UPDATER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DHCP6_CLIENT "enable DHCP6 client support")
|
||||
if(OT_DHCP6_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DHCP6_SERVER "enable DHCP6 server support")
|
||||
if(OT_DHCP6_SERVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DIAGNOSTIC "enable diagnostic support")
|
||||
if(OT_DIAGNOSTIC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DIAG_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DNS_CLIENT "enable DNS client support")
|
||||
if(OT_DNS_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DNS_DSO "enable DNS Stateful Operations (DSO) support")
|
||||
if(OT_DNS_DSO)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_DSO_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DNSSD_SERVER "enable DNS-SD server support")
|
||||
if(OT_DNSSD_SERVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DOC "Build OpenThread documentation")
|
||||
|
||||
option(OT_ECDSA "enable ECDSA support")
|
||||
if(OT_ECDSA)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ECDSA_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SRP_CLIENT "enable SRP client support")
|
||||
if (OT_SRP_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DUA "enable Domain Unicast Address feature for Thread 1.2")
|
||||
if(OT_DUA)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DUA_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MESSAGE_USE_HEAP "enable heap allocator for message buffers")
|
||||
if(OT_MESSAGE_USE_HEAP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MLR "enable Multicast Listener Registration feature for Thread 1.2")
|
||||
if(OT_MLR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLR_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_EXTERNAL_HEAP "enable external heap support")
|
||||
if(OT_EXTERNAL_HEAP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_HISTORY_TRACKER "enable history tracker support")
|
||||
if(OT_HISTORY_TRACKER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_IP6_FRAGM "enable ipv6 fragmentation support")
|
||||
if(OT_IP6_FRAGM)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_JAM_DETECTION "enable jam detection support")
|
||||
if(OT_JAM_DETECTION)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_JOINER "enable joiner support")
|
||||
if(OT_JOINER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JOINER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LEGACY "enable legacy network support")
|
||||
if(OT_LEGACY)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LEGACY_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LINK_RAW "enable link raw service")
|
||||
if(OT_LINK_RAW)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LINK_METRICS_INITIATOR "enable link metrics initiator")
|
||||
if (OT_LINK_METRICS_INITIATOR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LINK_METRICS_SUBJECT "enable link metrics subject")
|
||||
if (OT_LINK_METRICS_SUBJECT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LOG_LEVEL_DYNAMIC "enable dynamic log level control")
|
||||
if(OT_LOG_LEVEL_DYNAMIC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MAC_FILTER "enable mac filter support")
|
||||
if(OT_MAC_FILTER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MLE_LONG_ROUTES "enable MLE long routes extension (experimental, breaks Thread conformance)")
|
||||
if(OT_MLE_LONG_ROUTES)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MTD_NETDIAG "enable TMF network diagnostics on MTDs")
|
||||
if(OT_MTD_NETDIAG)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MULTIPLE_INSTANCE "enable multiple instances")
|
||||
if(OT_MULTIPLE_INSTANCE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_NEIGHBOR_DISCOVERY_AGENT "enable neighbor discovery agent support")
|
||||
if(OT_NEIGHBOR_DISCOVERY_AGENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_NETDATA_PUBLISHER "enable Thread Network Data publisher")
|
||||
if(OT_NETDATA_PUBLISHER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_PING_SENDER "enable ping sender support" ${OT_APP_CLI})
|
||||
if(OT_PING_SENDER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_PLATFORM_NETIF "enable platform netif support")
|
||||
if(OT_PLATFORM_NETIF)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_PLATFORM_UDP "enable platform UDP support")
|
||||
if(OT_PLATFORM_UDP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1")
|
||||
endif()
|
||||
|
||||
if(OT_POSIX_SETTINGS_PATH)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
|
||||
endif()
|
||||
|
||||
option(OT_REFERENCE_DEVICE "enable Thread Test Harness reference device support")
|
||||
if(OT_REFERENCE_DEVICE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SERVICE "enable support for injecting Service entries into the Thread Network Data")
|
||||
if(OT_SERVICE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SETTINGS_RAM "enable volatile-only storage of settings")
|
||||
if(OT_SETTINGS_RAM)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SETTINGS_RAM=1")
|
||||
endif()
|
||||
|
||||
option(OT_SLAAC "enable support for adding of auto-configured SLAAC addresses by OpenThread")
|
||||
if(OT_SLAAC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SNTP_CLIENT "enable SNTP Client support")
|
||||
if(OT_SNTP_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SRP_SERVER "enable SRP server")
|
||||
if (OT_SRP_SERVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_TIME_SYNC "enable the time synchronization service feature")
|
||||
if(OT_TIME_SYNC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_TREL "enable TREL radio link for Thread over Infrastructure feature")
|
||||
if (OT_TREL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_TX_BEACON_PAYLOAD "enable Thread beacon payload in outgoing beacons")
|
||||
if (OT_TX_BEACON_PAYLOAD)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_UDP_FORWARD "enable UDP forward support")
|
||||
if(OT_UDP_FORWARD)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_UPTIME "enable support for tracking OpenThread instance's uptime")
|
||||
if(OT_UPTIME)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UPTIME_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_FIREWALL "enable firewall")
|
||||
if (OT_FIREWALL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_FULL_LOGS "enable full logs")
|
||||
if(OT_FULL_LOGS)
|
||||
if(NOT OT_LOG_LEVEL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
|
||||
endif()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
|
||||
endif()
|
||||
|
||||
option(OT_OTNS "enable OTNS support")
|
||||
if(OT_OTNS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_OTNS_ENABLE=1")
|
||||
endif()
|
||||
|
||||
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
|
||||
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
endif()
|
||||
|
||||
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
|
||||
|
||||
# Checks
|
||||
if(OT_PLATFORM_UDP AND OT_UDP_FORWARD)
|
||||
message(FATAL_ERROR "OT_PLATFORM_UDP and OT_UDP_FORWARD are exclusive")
|
||||
endif()
|
||||
|
||||
@@ -20,6 +20,7 @@ RUN set -x \
|
||||
inetutils-ping \
|
||||
ca-certificates \
|
||||
&& update-ca-certificates \
|
||||
&& python3 -m pip install -U pip \
|
||||
&& python3 -m pip install -U cmake \
|
||||
&& python3 -m pip install wheel
|
||||
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2016, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
AR = arm-none-eabi-ar
|
||||
CCAS = arm-none-eabi-as
|
||||
CPP = arm-none-eabi-cpp
|
||||
CC = arm-none-eabi-gcc
|
||||
CXX = arm-none-eabi-g++
|
||||
LD = arm-none-eabi-ld
|
||||
STRIP = arm-none-eabi-strip
|
||||
NM = arm-none-eabi-nm
|
||||
RANLIB = arm-none-eabi-ranlib
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
|
||||
BuildJobs ?= 10
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--enable-ncp \
|
||||
--enable-radio-only \
|
||||
--enable-linker-map \
|
||||
--with-examples=cc2538 \
|
||||
$(NULL)
|
||||
|
||||
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
|
||||
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||
|
||||
CC2538_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc2538-config.h\"'
|
||||
CC2538_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-cc2538-config-check.h\"'
|
||||
CC2538_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/cc2538/
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
-g \
|
||||
$(CC2538_CONFIG_FILE_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
|
||||
|
||||
# Optional CC2592 options, first and foremost, whether to enable support for it
|
||||
# at all.
|
||||
ifeq ($(CC2592),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_WITH_CC2592=1
|
||||
|
||||
# If the PA_EN is on another port C pin, specify it with CC2592_PA_PIN.
|
||||
ifneq ($(CC2592_PA_EN),)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_PA_EN_PIN=$(CC2592_PA_EN)
|
||||
endif
|
||||
|
||||
# If the LNA_EN is on another port C pin, specify it with CC2592_LNA_PIN.
|
||||
ifneq ($(CC2592_LNA_EN),)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_LNA_EN_PIN=$(CC2592_LNA_EN)
|
||||
endif
|
||||
|
||||
# If we're not using HGM, set CC2538_USE_HGM to 0.
|
||||
ifeq ($(CC2592_USE_HGM),0)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_USE_HGM=0
|
||||
else # CC2592_USE_HGM=1
|
||||
|
||||
# HGM in use, if not on port D, specify the port here (A, B or C) with CC2592_HGM_PORT.
|
||||
ifneq ($(CC2592_HGM_PORT),)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_PORT=GPIO_$(CC2592_HGM_PORT)_BASE
|
||||
endif
|
||||
|
||||
# If HGM is not at pin 2, specify which pin here with CC2592_HGM_PIN.
|
||||
ifneq ($(CC2592_HGM_PIN),)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_PIN=$(CC2592_HGM_PIN)
|
||||
endif
|
||||
|
||||
# If we want it off by default, specify CC2592_HGM_DEFAULT_STATE=0
|
||||
ifeq ($(CC2592_HGM_DEFAULT_STATE),0)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE=false
|
||||
endif
|
||||
|
||||
endif # CC2592_USE_HGM
|
||||
|
||||
endif # CC2592
|
||||
|
||||
ifneq ($(CC2538_RECEIVE_SENSITIVITY),)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY=$(CC2538_RECEIVE_SENSITIVITY)
|
||||
endif
|
||||
|
||||
ifneq ($(CC2538_RSSI_OFFSET),)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_RSSI_OFFSET=$(CC2538_RSSI_OFFSET)
|
||||
endif
|
||||
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-nostartfiles \
|
||||
-specs=nano.specs \
|
||||
-specs=nosys.specs \
|
||||
-Wl,--gc-sections \
|
||||
$(NULL)
|
||||
|
||||
ECHO := @echo
|
||||
MAKE := make
|
||||
MKDIR_P := mkdir -p
|
||||
LN_S := ln -s
|
||||
RM_F := rm -f
|
||||
|
||||
INSTALL := /usr/bin/install
|
||||
INSTALLFLAGS := -p
|
||||
|
||||
BuildPath = build
|
||||
TopBuildDir = $(BuildPath)
|
||||
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
|
||||
|
||||
ResultPath = output
|
||||
TopResultDir = $(ResultPath)
|
||||
AbsTopResultDir = $(PWD)/$(TopResultDir)
|
||||
|
||||
TargetTuple = cc2538
|
||||
|
||||
ARCHS = cortex-m3
|
||||
|
||||
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
|
||||
|
||||
ifndef BuildJobs
|
||||
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
|
||||
endif
|
||||
JOBSFLAG := -j$(BuildJobs)
|
||||
|
||||
#
|
||||
# configure-arch <arch>
|
||||
#
|
||||
# Configure OpenThread for the specified architecture.
|
||||
#
|
||||
# arch - The architecture to configure.
|
||||
#
|
||||
define configure-arch
|
||||
$(ECHO) " CONFIG $(TargetTuple)..."
|
||||
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--prefix=/ \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
$(configure_OPTIONS))
|
||||
endef # configure-arch
|
||||
|
||||
#
|
||||
# build-arch <arch>
|
||||
#
|
||||
# Build the OpenThread intermediate build products for the specified
|
||||
# architecture.
|
||||
#
|
||||
# arch - The architecture to build.
|
||||
#
|
||||
define build-arch
|
||||
$(ECHO) " BUILD $(TargetTuple)"
|
||||
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
|
||||
all
|
||||
endef # build-arch
|
||||
|
||||
#
|
||||
# stage-arch <arch>
|
||||
#
|
||||
# Stage (install) the OpenThread final build products for the specified
|
||||
# architecture.
|
||||
#
|
||||
# arch - The architecture to stage.
|
||||
#
|
||||
define stage-arch
|
||||
$(ECHO) " STAGE $(TargetTuple)"
|
||||
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
|
||||
DESTDIR=$(AbsTopResultDir) \
|
||||
install
|
||||
endef # stage-arch
|
||||
|
||||
#
|
||||
# ARCH_template <arch>
|
||||
#
|
||||
# Define macros, targets and rules to configure, build, and stage the
|
||||
# OpenThread for a single architecture.
|
||||
#
|
||||
# arch - The architecture to instantiate the template for.
|
||||
#
|
||||
define ARCH_template
|
||||
CONFIGURE_TARGETS += configure-$(1)
|
||||
BUILD_TARGETS += do-build-$(1)
|
||||
STAGE_TARGETS += stage-$(1)
|
||||
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
|
||||
DIRECTORIES += $(BuildPath)/$(TargetTuple)
|
||||
|
||||
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
|
||||
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
|
||||
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
|
||||
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
|
||||
|
||||
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
|
||||
|
||||
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
|
||||
$$(call configure-arch,$(1))
|
||||
|
||||
do-build-$(1): configure-$(1)
|
||||
|
||||
do-build-$(1):
|
||||
+$$(call build-arch,$(1))
|
||||
|
||||
stage-$(1): do-build-$(1)
|
||||
|
||||
stage-$(1): | $(TopResultDir)
|
||||
$$(call stage-arch,$(1))
|
||||
|
||||
$(1): stage-$(1)
|
||||
endef # ARCH_template
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
all: stage
|
||||
|
||||
#
|
||||
# cortex-m3
|
||||
#
|
||||
|
||||
cortex-m3_target_ABI = cortex-m3
|
||||
cortex-m3_target_CPPFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
|
||||
cortex-m3_target_CFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
|
||||
cortex-m3_target_CXXFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
|
||||
cortex-m3_target_LDFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
|
||||
|
||||
# Instantiate an architecture-specific build template for each target
|
||||
# architecture.
|
||||
|
||||
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
|
||||
|
||||
#
|
||||
# Common / Finalization
|
||||
#
|
||||
|
||||
configure: $(CONFIGURE_TARGETS)
|
||||
|
||||
build: $(BUILD_TARGETS)
|
||||
|
||||
stage: $(STAGE_TARGETS)
|
||||
|
||||
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
|
||||
|
||||
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
|
||||
|
||||
all: stage
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(ECHO) " MKDIR $@"
|
||||
@$(MKDIR_P) "$@"
|
||||
|
||||
clean:
|
||||
$(ECHO) " CLEAN"
|
||||
@$(RM_F) -r $(CLEAN_DIRS)
|
||||
|
||||
help:
|
||||
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
|
||||
$(ECHO) "architectures: "
|
||||
$(ECHO) ""
|
||||
$(ECHO) " $(ARCHS)"
|
||||
$(ECHO) ""
|
||||
$(ECHO) "To build only a particular architecture, specify: "
|
||||
$(ECHO) ""
|
||||
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
|
||||
$(ECHO) ""
|
||||
+4
-3
@@ -12,7 +12,6 @@ This page lists the available common switches with description. Unless stated ot
|
||||
| BORDER_AGENT | OT_BORDER_AGENT | Enables support for border agent. In most cases, enable this switch if you are building On-mesh Commissioner or Border Router with External Commissioning support. |
|
||||
| BORDER_ROUTER | OT_BORDER_ROUTER | Enables support for Border Router. This switch is usually combined with the BORDER_AGENT and UDP_FORWARD (or PLATFORM_UDP in case of RCP design) switches to build Border Router device. |
|
||||
| BORDER_ROUTING | OT_BORDER_ROUTING | Enables bi-directional border routing between Thread and Infrastructure networks for Border Router. |
|
||||
| BORDER_ROUTING_NAT64 | OT_BORDER_ROUTING_NAT64 | Enables NAT64 border routing support for Border Router. |
|
||||
| BUILTIN_MBEDTLS_MANAGEMENT | OT_BUILTIN_MBEDTLS_MANAGEMENT | Enables the built-in mbedTLS management. Enable this switch if the external mbedTLS is used, but mbedTLS memory allocation and debug config should be managed internally by OpenThread. |
|
||||
| CHANNEL_MANAGER | OT_CHANNEL_MANAGER | Enables support for channel manager. Enable this switch on devices that are supposed to request a Thread network channel change. This switch should be used only with an FTD build. |
|
||||
| CHANNEL_MONITOR | OT_CHANNEL_MONITOR | Enables support for channel monitor. Enable this switch on devices that are supposed to determine the cleaner channels. |
|
||||
@@ -54,6 +53,8 @@ This page lists the available common switches with description. Unless stated ot
|
||||
| MLR | OT_MLR | Enables Multicast Listener Registration feature for Thread 1.2. |
|
||||
| MTD_NETDIAG | OT_MTD_NETDIAG | Enables the TMF network diagnostics on MTDs. |
|
||||
| MULTIPLE_INSTANCE | OT_MULTIPLE_INSTANCE | Enables multiple OpenThread instances. |
|
||||
| NAT64_BORDER_ROUTING | OT_NAT64_BORDER_ROUTING | Enables NAT64 border routing support for Border Router. |
|
||||
| NAT64_TRANSLATOR | OT_NAT64_TRANSLATOR | Enables NAT64 translator for Border Router. |
|
||||
| NETDATA_PUBLISHER | OT_NETDATA_PUBLISHER | Enables support for Thread Network Data publisher. |
|
||||
| PING_SENDER | OT_PING_SENDER | Enables support for ping sender. |
|
||||
| OTNS | OT_OTNS | Enables support for [OpenThread Network Simulator](https://github.com/openthread/ot-ns). Enable this switch if you are building OpenThread for OpenThread Network Simulator. |
|
||||
@@ -67,7 +68,7 @@ This page lists the available common switches with description. Unless stated ot
|
||||
| SRP_CLIENT | OT_SRP_CLIENT | Enable support for SRP client. |
|
||||
| SRP_SERVER | OT_SRP_SERVER | Enable support for SRP server. |
|
||||
| THREAD_VERSION | OT_THREAD_VERSION | Enables the chosen Thread version (1.1 / 1.2 (default)). For example, set to `1.1` for Thread 1.1. |
|
||||
| TIME_SYNC | OT_TIME_SYNC | Enables the time synchronization service feature. **Note: Enabling this feature breaks conformance to the Thread Specification.** | |
|
||||
| TIME_SYNC | OT_TIME_SYNC | Enables the time synchronization service feature. **Note: Enabling this feature breaks conformance to the Thread Specification.** |
|
||||
| TREL | OT_TREL | Enables TREL radio link for Thread over Infrastructure feature. |
|
||||
| UDP_FORWARD | OT_UDP_FORWARD | Enables support for UDP forward. | Enable this switch on the Border Router device (running on the NCP design) with External Commissioning support to service Thread Commissioner packets on the NCP side. |
|
||||
| UDP_FORWARD | OT_UDP_FORWARD | Enables support for UDP forward. Enable this switch on the Border Router device (running on the NCP design) with External Commissioning support to service Thread Commissioner packets on the NCP side. |
|
||||
| UPTIME | OT_UPTIME | Enables support for tracking OpenThread instance's uptime. |
|
||||
|
||||
@@ -44,6 +44,7 @@ target_link_libraries(ot-cli-ftd PRIVATE
|
||||
${OT_PLATFORM_LIB_FTD}
|
||||
openthread-cli-ftd
|
||||
${OT_MBEDTLS}
|
||||
ot-config-ftd
|
||||
ot-config
|
||||
)
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@
|
||||
extern void otAppCliInit(otInstance *aInstance);
|
||||
|
||||
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
|
||||
void *otPlatCAlloc(size_t aNum, size_t aSize)
|
||||
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
|
||||
{
|
||||
return calloc(aNum, aSize);
|
||||
}
|
||||
|
||||
void otPlatFree(void *aPtr)
|
||||
OT_TOOL_WEAK void otPlatFree(void *aPtr)
|
||||
{
|
||||
free(aPtr);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void otTaskletsSignalPending(otInstance *aInstance)
|
||||
}
|
||||
|
||||
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
static void ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
|
||||
static otError ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
OT_UNUSED_VARIABLE(aArgsLength);
|
||||
@@ -75,9 +75,25 @@ static void ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
static const otCliCommand kCommands[] = {{"exit", ProcessExit}};
|
||||
|
||||
#if OPENTHREAD_EXAMPLES_SIMULATION
|
||||
extern otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[]);
|
||||
#endif
|
||||
|
||||
static const otCliCommand kCommands[] = {
|
||||
{"exit", ProcessExit},
|
||||
#if OPENTHREAD_EXAMPLES_SIMULATION
|
||||
/*
|
||||
* The CLI command `nodeidfilter` only works for simulation in real time.
|
||||
* The usage of the command `nodeidfilter`:
|
||||
* - `nodeidfilter deny <nodeid>`: It denies the connection to a specified node.
|
||||
* - `nodeidfilter clear`: It restores the filter state to default.
|
||||
*/
|
||||
{"nodeidfilter", ProcessNodeIdFilter},
|
||||
#endif
|
||||
};
|
||||
#endif // OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
otInstance *instance;
|
||||
|
||||
@@ -44,6 +44,7 @@ target_link_libraries(ot-cli-mtd PRIVATE
|
||||
${OT_PLATFORM_LIB_MTD}
|
||||
openthread-cli-mtd
|
||||
${OT_MBEDTLS}
|
||||
ot-config-mtd
|
||||
ot-config
|
||||
)
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ target_link_libraries(ot-cli-radio PRIVATE
|
||||
${OT_PLATFORM_LIB_RCP}
|
||||
openthread-cli-radio
|
||||
${OT_MBEDTLS_RCP}
|
||||
ot-config-radio
|
||||
ot-config
|
||||
)
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ target_link_libraries(ot-ncp-ftd PRIVATE
|
||||
${OT_PLATFORM_LIB_FTD}
|
||||
openthread-ncp-ftd
|
||||
${OT_MBEDTLS}
|
||||
ot-config-ftd
|
||||
ot-config
|
||||
)
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
extern void otAppNcpInit(otInstance *aInstance);
|
||||
|
||||
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
|
||||
void *otPlatCAlloc(size_t aNum, size_t aSize)
|
||||
OT_TOOL_WEAK void *otPlatCAlloc(size_t aNum, size_t aSize)
|
||||
{
|
||||
return calloc(aNum, aSize);
|
||||
}
|
||||
|
||||
void otPlatFree(void *aPtr)
|
||||
OT_TOOL_WEAK void otPlatFree(void *aPtr)
|
||||
{
|
||||
free(aPtr);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ target_link_libraries(ot-ncp-mtd PRIVATE
|
||||
${OT_PLATFORM_LIB_MTD}
|
||||
openthread-ncp-mtd
|
||||
${OT_MBEDTLS}
|
||||
ot-config-mtd
|
||||
ot-config
|
||||
)
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ target_link_libraries(ot-rcp PRIVATE
|
||||
openthread-radio
|
||||
${OT_PLATFORM_LIB_RCP}
|
||||
openthread-rcp
|
||||
ot-config-radio
|
||||
ot-config
|
||||
)
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ BIG_ENDIAN ?= 0
|
||||
BORDER_AGENT ?= 0
|
||||
BORDER_ROUTER ?= 0
|
||||
BORDER_ROUTING ?= 0
|
||||
BORDER_ROUTING_NAT64 ?= 0
|
||||
COAP ?= 0
|
||||
COAP_BLOCK ?= 0
|
||||
COAP_OBSERVE ?= 0
|
||||
@@ -73,6 +72,8 @@ MLE_LONG_ROUTES ?= 0
|
||||
MLR ?= 0
|
||||
MTD_NETDIAG ?= 0
|
||||
MULTIPLE_INSTANCE ?= 0
|
||||
NAT64_BORDER_ROUTING ?= 0
|
||||
NAT64_TRANSLATOR ?= 0
|
||||
NEIGHBOR_DISCOVERY_AGENT ?= 0
|
||||
NETDATA_PUBLISHER ?= 0
|
||||
OTNS ?= 0
|
||||
@@ -117,8 +118,12 @@ ifeq ($(BORDER_ROUTING),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(BORDER_ROUTING_NAT64),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE=1
|
||||
ifeq ($(NAT64_BORDER_ROUTING),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(NAT64_TRANSLATOR),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(COAP),1)
|
||||
|
||||
@@ -30,6 +30,7 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
EXTRA_DIST = \
|
||||
cc1352 \
|
||||
cc2538 \
|
||||
cc2652 \
|
||||
efr32 \
|
||||
gp712 \
|
||||
@@ -45,7 +46,6 @@ EXTRA_DIST = \
|
||||
# Always package (e.g. for 'make dist') these subdirectories.
|
||||
|
||||
DIST_SUBDIRS = \
|
||||
cc2538 \
|
||||
simulation \
|
||||
utils \
|
||||
$(NULL)
|
||||
@@ -56,10 +56,6 @@ SUBDIRS = \
|
||||
utils \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_PLATFORM_CC2538
|
||||
SUBDIRS += cc2538
|
||||
endif
|
||||
|
||||
if OPENTHREAD_PLATFORM_SIMULATION
|
||||
SUBDIRS += simulation
|
||||
endif
|
||||
|
||||
@@ -41,10 +41,6 @@ LDFLAGS_COMMON = $(NULL)
|
||||
SOURCES_COMMON = $(NULL)
|
||||
LIBTOOLFLAGS_COMMON = --preserve-dup-deps
|
||||
|
||||
if OPENTHREAD_EXAMPLES_CC2538
|
||||
include $(top_srcdir)/examples/platforms/cc2538/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_SIMULATION
|
||||
include $(top_srcdir)/examples/platforms/simulation/Makefile.platform.am
|
||||
endif
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
set(OT_PLATFORM_LIB "openthread-cc2538" PARENT_SCOPE)
|
||||
|
||||
if(NOT OT_CONFIG)
|
||||
set(OT_CONFIG "openthread-core-cc2538-config.h")
|
||||
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES
|
||||
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-cc2538-config-check.h\""
|
||||
"OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1"
|
||||
)
|
||||
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
|
||||
|
||||
add_library(openthread-cc2538
|
||||
alarm.c
|
||||
diag.c
|
||||
entropy.c
|
||||
flash.c
|
||||
misc.c
|
||||
radio.c
|
||||
startup-gcc.c
|
||||
system.c
|
||||
logging.c
|
||||
uart.c
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-cc2538
|
||||
PRIVATE
|
||||
ot-config
|
||||
PUBLIC
|
||||
-T${PROJECT_SOURCE_DIR}/examples/platforms/cc2538/cc2538.ld
|
||||
-Wl,--gc-sections -Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-cc2538
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-cc2538 PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-cc2538 PRIVATE
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
)
|
||||
@@ -1,69 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2016, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
# Do not enable -Wcast-align for this platform
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
lib_LIBRARIES = libopenthread-cc2538.a
|
||||
|
||||
libopenthread_cc2538_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/src/core \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
cc2538-reg.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
flash.c \
|
||||
misc.c \
|
||||
openthread-core-cc2538-config.h \
|
||||
openthread-core-cc2538-config-check.h \
|
||||
platform-cc2538.h \
|
||||
radio.c \
|
||||
rom-utility.h \
|
||||
startup-gcc.c \
|
||||
system.c \
|
||||
logging.c \
|
||||
uart.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_cc2538_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_cc2538_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
@@ -1,112 +1 @@
|
||||
# OpenThread on CC2538 Example
|
||||
|
||||
This directory contains example platform drivers for the [Texas Instruments CC2538][cc2538].
|
||||
|
||||
[cc2538]: http://www.ti.com/product/CC2538
|
||||
|
||||
The example platform drivers are intended to present the minimal code necessary to support OpenThread. As a result, the example platform drivers do not necessarily highlight the platform's full capabilities.
|
||||
|
||||
## Toolchain
|
||||
|
||||
Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
|
||||
|
||||
[gnu-toolchain]: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm
|
||||
|
||||
In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>
|
||||
$ ./script/bootstrap
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
In a Bash terminal, follow these instructions to build the cc2538 examples.
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>
|
||||
$ ./bootstrap
|
||||
$ make -f examples/Makefile-cc2538
|
||||
```
|
||||
|
||||
### CC2592 support
|
||||
|
||||
If your board has a CC2592 range extender front-end IC connected to the CC2538 (e.g. the CC2538-CC2592 EM reference design), you need to initialise this part before reception of radio traffic will work.
|
||||
|
||||
Support is enabled in OpenThread by building with `CC2592=1`:
|
||||
|
||||
```bash
|
||||
$ make -f examples/Makefile-cc2538 CC2592=1
|
||||
```
|
||||
|
||||
The default settings should work for any design following the integration advice given in TI's application report ["AN130 - Using CC2592 Front End With CC2538"](http://www.ti.com/lit/pdf/swra447).
|
||||
|
||||
Additional settings can be customised:
|
||||
|
||||
- `CC2592_PA_EN`: This specifies which pin (on port C of the CC2538) connects to the CC2592's `PA_EN` pin. The default is `3` (PC3).
|
||||
- `CC2592_LNA_EN`: This specifies which pin (on port C of the CC2538) connects to the CC2592's `LNA_EN` pin. The default is `2` (PC2).
|
||||
- `CC2592_USE_HGM`: This defines whether the HGM pin of the CC2592 is under GPIO control or not. If not, it is assumed that the HGM pin is tied to a power rail.
|
||||
- `CC2592_HGM_PORT`: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO port, you may specify that port (`A`, `B` or `C`) here.
|
||||
- `CC2592_HGM_PORT`: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO port, you may specify that port (`A`, `B` or `C`) here. Default is `D`.
|
||||
- `CC2592_HGM_PIN`: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO pin, you can specify the pin here. Default is `2`.
|
||||
- `CC2592_HGM_DEFAULT_STATE`: By default, HGM is enabled at power-on, but you may want to have it default to off, specify `CC2592_HGM_DEFAULT_STATE=0` to do so.
|
||||
- `CC2538_RECEIVE_SENSITIVITY`: If you have tied the HGM pin to a power rail, this allows you to calibrate the RSSI values according to the new receive sensitivity. This has no effect if `CC2592_USE_HGM=1` (the default).
|
||||
- `CC2538_RSSI_OFFSET`: If you have tied the HGM pin to a power rail, this allows you to calibrate the RSSI values according to the new RSSI offset. This has no effect if `CC2592_USE_HGM=1` (the default).
|
||||
|
||||
## Flash Binaries
|
||||
|
||||
If the build completed successfully, the `elf` files may be found in `<path-to-openthread>/output/cc2538/bin`.
|
||||
|
||||
To flash the images with [Flash Programmer 2][ti-flash-programmer-2], the files must have the `*.elf` extension.
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>/output/cc2538/bin
|
||||
$ cp ot-cli ot-cli.elf
|
||||
```
|
||||
|
||||
To load the images with the [serial bootloader][ti-cc2538-bootloader], the images must be converted to `bin`. This is done using `arm-none-eabi-objcopy`
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>/output/cc2538/bin
|
||||
$ arm-none-eabi-objcopy -O binary ot-cli ot-cli.bin
|
||||
```
|
||||
|
||||
The [cc2538-bsl.py script][cc2538-bsl-tool] provides a convenient method for flashing a CC2538 via the UART. To enter the bootloader backdoor for flashing, hold down SELECT for CC2538DK (corresponds to logic '0') while you press the Reset button.
|
||||
|
||||
[ti-flash-programmer-2]: http://www.ti.com/tool/flash-programmer
|
||||
[ti-cc2538-bootloader]: http://www.ti.com/lit/an/swra466a/swra466a.pdf
|
||||
[cc2538-bsl-tool]: https://github.com/JelmerT/cc2538-bsl
|
||||
|
||||
## Interact
|
||||
|
||||
1. Open terminal to `/dev/ttyUSB1` (serial port settings: 115200 8-N-1).
|
||||
2. Type `help` for list of commands.
|
||||
|
||||
```bash
|
||||
> help
|
||||
help
|
||||
channel
|
||||
childtimeout
|
||||
contextreusedelay
|
||||
extaddr
|
||||
extpanid
|
||||
ipaddr
|
||||
keysequence
|
||||
leaderweight
|
||||
mode
|
||||
netdata register
|
||||
networkidtimeout
|
||||
networkkey
|
||||
networkname
|
||||
panid
|
||||
ping
|
||||
prefix
|
||||
releaserouterid
|
||||
rloc16
|
||||
route
|
||||
routerupgradethreshold
|
||||
scan
|
||||
start
|
||||
state
|
||||
stop
|
||||
```
|
||||
The OpenThread on CC2538 example has moved to https://github.com/openthread/ot-cc2538
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread platform abstraction for the alarm.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
|
||||
enum
|
||||
{
|
||||
kSystemClock = 32000000, ///< MHz
|
||||
kTicksPerSec = 1000, ///< Ticks per second
|
||||
};
|
||||
|
||||
static uint32_t sCounter = 0;
|
||||
static uint32_t sAlarmT0 = 0;
|
||||
static uint32_t sAlarmDt = 0;
|
||||
static bool sIsRunning = false;
|
||||
|
||||
static uint8_t sTimersIsRunning = 0;
|
||||
static uint32_t sTimersExpireAt[OT_CC2538_TIMERS_COUNT];
|
||||
|
||||
extern void cc2538EnergyScanTimerHandler(void);
|
||||
|
||||
void cc2538SetTimer(otCC2538Timer aTimer, uint32_t aDelay)
|
||||
{
|
||||
sTimersIsRunning |= (1 << aTimer);
|
||||
sTimersExpireAt[aTimer] = sCounter + aDelay;
|
||||
}
|
||||
|
||||
void cc2538AlarmInit(void)
|
||||
{
|
||||
HWREG(NVIC_ST_RELOAD) = kSystemClock / kTicksPerSec;
|
||||
HWREG(NVIC_ST_CTRL) = NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_INTEN | NVIC_ST_CTRL_ENABLE;
|
||||
}
|
||||
|
||||
uint32_t otPlatAlarmMilliGetNow(void)
|
||||
{
|
||||
return sCounter;
|
||||
}
|
||||
|
||||
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
sAlarmT0 = t0;
|
||||
sAlarmDt = dt;
|
||||
sIsRunning = true;
|
||||
}
|
||||
|
||||
void otPlatAlarmMilliStop(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
sIsRunning = false;
|
||||
}
|
||||
|
||||
void cc2538AlarmProcess(otInstance *aInstance)
|
||||
{
|
||||
uint32_t expires;
|
||||
bool fire = false;
|
||||
|
||||
if (sTimersIsRunning)
|
||||
{
|
||||
if ((int32_t)(sTimersExpireAt[OT_CC2538_TIMER_ENERGY_SCAN] - sCounter) < 0)
|
||||
{
|
||||
sTimersIsRunning &= ~(1 << OT_CC2538_TIMER_ENERGY_SCAN);
|
||||
cc2538EnergyScanTimerHandler();
|
||||
}
|
||||
}
|
||||
|
||||
if (sIsRunning)
|
||||
{
|
||||
expires = sAlarmT0 + sAlarmDt;
|
||||
|
||||
if (sAlarmT0 <= sCounter)
|
||||
{
|
||||
if (expires >= sAlarmT0 && expires <= sCounter)
|
||||
{
|
||||
fire = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (expires >= sAlarmT0 || expires <= sCounter)
|
||||
{
|
||||
fire = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fire)
|
||||
{
|
||||
sIsRunning = false;
|
||||
|
||||
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
if (otPlatDiagModeGet())
|
||||
{
|
||||
otPlatDiagAlarmFired(aInstance);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
otPlatAlarmMilliFired(aInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SysTick_Handler()
|
||||
{
|
||||
sCounter++;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
|
||||
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
|
||||
set(CMAKE_RANLIB arm-none-eabi-ranlib)
|
||||
|
||||
set(COMMON_C_FLAGS "-mthumb -fno-builtin -Wall -fdata-sections -ffunction-sections -mabi=aapcs -mcpu=cortex-m3 -mfloat-abi=soft")
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs -nostartfiles")
|
||||
@@ -1,326 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes CC2538 register definitions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CC2538_REG_H_
|
||||
#define CC2538_REG_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define HWREG(x) (*((volatile uint32_t *)(x)))
|
||||
|
||||
/*!
|
||||
* For registers that are arrays of 32-bit integers.
|
||||
*
|
||||
* @param reg Register address
|
||||
* @param idx Register array index
|
||||
*/
|
||||
#define HWREG_ARR(reg, idx) HWREG((reg) + ((idx) << 2))
|
||||
|
||||
#define NVIC_ST_CTRL 0xE000E010 // SysTick Control and Status
|
||||
#define NVIC_ST_RELOAD 0xE000E014 // SysTick Reload Value Register
|
||||
#define NVIC_EN0 0xE000E100 // Interrupt 0-31 Set Enable
|
||||
|
||||
#define NVIC_ST_CTRL_COUNT 0x00010000 // Count Flag
|
||||
#define NVIC_ST_CTRL_CLK_SRC 0x00000004 // Clock Source
|
||||
#define NVIC_ST_CTRL_INTEN 0x00000002 // Interrupt Enable
|
||||
#define NVIC_ST_CTRL_ENABLE 0x00000001 // Enable
|
||||
|
||||
#define RFCORE_XREG_SRCMATCH_EN 0x00000001 // SRCMATCH.SRC_MATCH_EN(1)
|
||||
#define RFCORE_XREG_SRCMATCH_AUTOPEND 0x00000002 // SRCMATCH.AUTOPEND(1)
|
||||
#define RFCORE_XREG_SRCMATCH_PEND_DATAREQ_ONLY 0x00000004 // SRCMATCH.PEND_DATAREQ_ONLY(1)
|
||||
|
||||
#define RFCORE_XREG_SRCMATCH_ENABLE_STATUS_SIZE 3 // Num of register for source match enable status
|
||||
#define RFCORE_XREG_SRCMATCH_SHORT_ENTRIES 24 // 24 short address entries in maximum
|
||||
#define RFCORE_XREG_SRCMATCH_EXT_ENTRIES 12 // 12 extended address entries in maximum
|
||||
#define RFCORE_XREG_SRCMATCH_SHORT_ENTRY_OFFSET 4 // address offset for one short address entry
|
||||
#define RFCORE_XREG_SRCMATCH_EXT_ENTRY_OFFSET 8 // address offset for one extended address entry
|
||||
|
||||
#define INT_UART0 21 // UART0 Rx and Tx
|
||||
|
||||
#define IEEE_EUI64 0x00280028 // Address of IEEE EUI-64 address
|
||||
|
||||
#define RFCORE_FFSM_SRCADDRESS_TABLE 0x40088400 // Source Address Table
|
||||
|
||||
#define RFCORE_FFSM_SRCEXTPENDEN0 0x40088590 // Enable/Disable automatic pending per extended address
|
||||
#define RFCORE_FFSM_SRCSHORTPENDEN0 0x4008859C // Enable/Disable automatic pending per short address
|
||||
#define RFCORE_FFSM_EXT_ADDR0 0x400885A8 // Local address information
|
||||
#define RFCORE_FFSM_PAN_ID0 0x400885C8 // Local address information
|
||||
#define RFCORE_FFSM_PAN_ID1 0x400885CC // Local address information
|
||||
#define RFCORE_FFSM_SHORT_ADDR0 0x400885D0 // Local address information
|
||||
#define RFCORE_FFSM_SHORT_ADDR1 0x400885D4 // Local address information
|
||||
#define RFCORE_XREG_FRMFILT0 0x40088600 // The frame filtering function
|
||||
#define RFCORE_XREG_SRCMATCH 0x40088608 // Source address matching and pending bits
|
||||
#define RFCORE_XREG_SRCSHORTEN0 0x4008860C // Short address matching
|
||||
#define RFCORE_XREG_SRCEXTEN0 0x40088618 // Extended address matching
|
||||
|
||||
#define RFCORE_XREG_FRMCTRL0 0x40088624 // Frame handling
|
||||
#define RFCORE_XREG_FRMCTRL1 0x40088628 // Frame handling
|
||||
#define RFCORE_XREG_RXENABLE 0x4008862C // RX enabling
|
||||
#define RFCORE_XREG_FREQCTRL 0x4008863C // Controls the RF frequency
|
||||
#define RFCORE_XREG_TXPOWER 0x40088640 // Controls the output power
|
||||
#define RFCORE_XREG_FSMSTAT0 0x40088648 // Radio finite state machine status
|
||||
#define RFCORE_XREG_FSMSTAT1 0x4008864C // Radio status register
|
||||
#define RFCORE_XREG_FIFOPCTRL 0x40088650 // FIFOP threshold
|
||||
#define RFCORE_XREG_CCACTRL0 0x40088658 // CCA threshold
|
||||
#define RFCORE_XREG_RSSI 0x40088660 // RSSI status register
|
||||
#define RFCORE_XREG_RSSISTAT 0x40088664 // RSSI valid status register
|
||||
#define RFCORE_XREG_AGCCTRL1 0x400886C8 // AGC reference level
|
||||
#define RFCORE_XREG_RFC_OBS_CTRL 0x400887AC // RF Core observable output
|
||||
#define RFCORE_XREG_TXFILTCFG 0x400887E8 // TX filter configuration
|
||||
#define RFCORE_XREG_RFRND 0x4008869C // Random data
|
||||
#define RFCORE_SFR_RFDATA 0x40088828 // The TX FIFO and RX FIFO
|
||||
#define RFCORE_SFR_RFERRF 0x4008882C // RF error interrupt flags
|
||||
#define RFCORE_SFR_RFIRQF0 0x40088834 // RF interrupt flags
|
||||
#define RFCORE_SFR_RFST 0x40088838 // RF CSMA-CA/strobe processor
|
||||
#define CCTEST_OBSSEL 0x44010014 // CCTEST observable output route
|
||||
|
||||
#define RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN 0x00000001 // Enables frame filtering
|
||||
|
||||
#define RFCORE_XREG_FRMCTRL0_AUTOACK 0x00000020
|
||||
#define RFCORE_XREG_FRMCTRL0_ENERGY_SCAN 0x00000010
|
||||
#define RFCORE_XREG_FRMCTRL0_AUTOCRC 0x00000040
|
||||
#define RFCORE_XREG_FRMCTRL0_INFINITY_RX 0x00000008
|
||||
|
||||
#define RFCORE_XREG_FRMCTRL1_PENDING_OR 0x00000004
|
||||
|
||||
#define RFCORE_XREG_RFRND_IRND 0x00000001
|
||||
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_MASK 0x0000003F
|
||||
#define RFCORE_XREG_FSMSTAT0_CAL_DONE 0x00000080
|
||||
#define RFCORE_XREG_FSMSTAT0_CAL_RUN 0x00000040
|
||||
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_IDLE 0x00000000
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX_CAL 0x00000002
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT0 0x00000003
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT1 0x00000004
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT2 0x00000005
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT3 0x00000006
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX0 0x00000007
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX1 0x00000008
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX2 0x00000009
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX3 0x0000000A
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX4 0x0000000B
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX5 0x0000000C
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX6 0x0000000D
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX_WAIT 0x0000000E
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX_FRST 0x00000010
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RX_OVER 0x00000011
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX_CAL 0x00000020
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX0 0x00000022
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX1 0x00000023
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX2 0x00000024
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX3 0x00000025
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX4 0x00000026
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX_FINAL 0x00000027
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_RXTX_TRANS 0x00000028
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK_CAL 0x00000030
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK0 0x00000031
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK1 0x00000032
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK2 0x00000033
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK3 0x00000034
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK4 0x00000035
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK5 0x00000036
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_ACK_DELAY 0x00000037
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX_UNDER 0x00000038
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX_DOWN0 0x0000001A
|
||||
#define RFCORE_XREG_FSMSTAT0_STATE_TX_DOWN1 0x0000003A
|
||||
|
||||
#define RFCORE_XREG_FSMSTAT1_RX_ACTIVE 0x00000001
|
||||
#define RFCORE_XREG_FSMSTAT1_TX_ACTIVE 0x00000002
|
||||
#define RFCORE_XREG_FSMSTAT1_LOCK_STATUS 0x00000004
|
||||
#define RFCORE_XREG_FSMSTAT1_SAMPLED_CCA 0x00000008
|
||||
#define RFCORE_XREG_FSMSTAT1_CCA 0x00000010 // Clear channel assessment
|
||||
#define RFCORE_XREG_FSMSTAT1_SFD 0x00000020
|
||||
#define RFCORE_XREG_FSMSTAT1_FIFOP 0x00000040
|
||||
#define RFCORE_XREG_FSMSTAT1_FIFO 0x00000080
|
||||
|
||||
#define RFCORE_XREG_RSSISTAT_RSSI_VALID 0x00000001 // RSSI value is valid.
|
||||
|
||||
#define RFCORE_XREG_RFC_OBS_POL_INV 0x00000040 // Invert polarity of OBS signal
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_ZERO 0x00000000 // Observable = constant zero
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_ONE 0x00000001 // Observable = constant one
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_SNIFF_DATA 0x00000008 // RFC sniff data
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_SNIFF_CLK 0x00000009 // RFC sniff clock
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_RSSI_VALID 0x0000000c // RSSI valid
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_DEMOD_CCA 0x0000000d // Clear channel assessment
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_SAMPLED_CCA 0x0000000e // Sampled CCA signal
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_SFD_SYNC 0x0000000f // SFD received or transmitted
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_TX_ACTIVE 0x00000010 // Transmitter is active
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_RX_ACTIVE 0x00000011 // Receiver is active
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_FFCTRL_FIFO 0x00000012 // One or more bytes in FIFO
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_FFCTRL_FIFOP 0x00000013 // One or more frames in FIFO
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_PACKET_DONE 0x00000014 // Packet received
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_RFC_XOR_RAND_IQ 0x00000016 // RAND I ^ RAND Q
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_RFC_RAND_Q 0x00000017 // Random data from Q channel
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_RFC_RAND_I 0x00000018 // Random data from I channel
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_LOCK_STATUS 0x00000019 // PLL is in lock
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_PA_PD 0x00000028 // Power amp power down
|
||||
#define RFCORE_XREG_RFC_OBS_MUX_LNA_PD 0x0000002a // LNA power down
|
||||
|
||||
#define RFCORE_SFR_RFERRF_NLOCK 0x00000001 // Failed to achieve PLL lock.
|
||||
#define RFCORE_SFR_RFERRF_RXABO 0x00000002 // RX Aborted.
|
||||
#define RFCORE_SFR_RFERRF_RXOVERF 0x00000004 // RX FIFO overflowed.
|
||||
#define RFCORE_SFR_RFERRF_RXUNDERF 0x00000008 // RX FIFO underflowed.
|
||||
#define RFCORE_SFR_RFERRF_TXOVERF 0x00000010 // TX FIFO overflowed.
|
||||
#define RFCORE_SFR_RFERRF_TXUNDERF 0x00000020 // TX FIFO underflowed.
|
||||
#define RFCORE_SFR_RFERRF_STROBEERR 0x00000040 // Command Strobe Error.
|
||||
|
||||
#define RFCORE_SFR_RFST_INSTR_RXON 0xE3 // Instruction set RX on
|
||||
#define RFCORE_SFR_RFST_INSTR_TXON 0xE9 // Instruction set TX on
|
||||
#define RFCORE_SFR_RFST_INSTR_RFOFF 0xEF // Instruction set RF off
|
||||
#define RFCORE_SFR_RFST_INSTR_FLUSHRX 0xED // Instruction set flush rx buffer
|
||||
#define RFCORE_SFR_RFST_INSTR_FLUSHTX 0xEE // Instruction set flush tx buffer
|
||||
|
||||
#define CCTEST_OBSSEL_EN 0x00000080 // Enable the OBS output on this pin
|
||||
#define CCTEST_OBSSEL_SEL_OBS0 0x00000000 // Route OBS0 to pin
|
||||
#define CCTEST_OBSSEL_SEL_OBS1 0x00000001 // Route OBS1 to pin
|
||||
#define CCTEST_OBSSEL_SEL_OBS2 0x00000002 // Route OBS2 to pin
|
||||
|
||||
#define ANA_REGS_BASE 0x400D6000 // ANA_REGS
|
||||
#define ANA_REGS_O_IVCTRL 0x00000004 // Analog control register
|
||||
|
||||
#define SYS_CTRL_CLOCK_CTRL 0x400D2000 // The clock control register
|
||||
#define SYS_CTRL_SYSDIV_32MHZ 0x00000000 // Sys_div for sysclk 32MHz
|
||||
#define SYS_CTRL_CLOCK_CTRL_AMP_DET 0x00200000
|
||||
|
||||
#define SYS_CTRL_PWRDBG 0x400D2074
|
||||
#define SYS_CTRL_PWRDBG_FORCE_WARM_RESET 0x00000008
|
||||
|
||||
#define SYS_CTRL_RCGCUART 0x400D2028
|
||||
#define SYS_CTRL_SCGCUART 0x400D202C
|
||||
#define SYS_CTRL_DCGCUART 0x400D2030
|
||||
#define SYS_CTRL_I_MAP 0x400D2098
|
||||
#define SYS_CTRL_RCGCRFC 0x400D20A8
|
||||
#define SYS_CTRL_SCGCRFC 0x400D20AC
|
||||
#define SYS_CTRL_DCGCRFC 0x400D20B0
|
||||
#define SYS_CTRL_EMUOVR 0x400D20B4
|
||||
|
||||
#define SYS_CTRL_RCGCRFC_RFC0 0x00000001
|
||||
#define SYS_CTRL_SCGCRFC_RFC0 0x00000001
|
||||
#define SYS_CTRL_DCGCRFC_RFC0 0x00000001
|
||||
|
||||
#define SYS_CTRL_I_MAP_ALTMAP 0x00000001
|
||||
|
||||
#define SYS_CTRL_RCGCUART_UART0 0x00000001
|
||||
#define SYS_CTRL_SCGCUART_UART0 0x00000001
|
||||
#define SYS_CTRL_DCGCUART_UART0 0x00000001
|
||||
|
||||
#define SYS_CTRL_RCGCUART_UART1 0x00000002
|
||||
#define SYS_CTRL_SCGCUART_UART1 0x00000002
|
||||
#define SYS_CTRL_DCGCUART_UART1 0x00000002
|
||||
|
||||
#define IOC_PA0_SEL 0x400D4000 // Peripheral select control
|
||||
#define IOC_PA1_SEL 0x400D4004 // Peripheral select control
|
||||
#define IOC_PA2_SEL 0x400D4008
|
||||
#define IOC_PA3_SEL 0x400D400C
|
||||
#define IOC_UARTRXD_UART0 0x400D4100
|
||||
#define IOC_UARTRXD_UART1 0x400D4108
|
||||
|
||||
#define IOC_PA0_OVER 0x400D4080
|
||||
#define IOC_PA1_OVER 0x400D4084
|
||||
#define IOC_PA2_OVER 0x400D4088
|
||||
#define IOC_PA3_OVER 0x400D408C
|
||||
|
||||
#define IOC_MUX_OUT_SEL_UART0_TXD 0x00000000
|
||||
#define IOC_MUX_OUT_SEL_UART1_TXD 0x00000002
|
||||
|
||||
#define IOC_OVERRIDE_OE 0x00000008 // PAD Config Override Output Enable
|
||||
#define IOC_OVERRIDE_DIS 0x00000000 // PAD Config Override Disabled
|
||||
|
||||
#define IOC_PAD_IN_SEL_PA0 0x00000000 // PA0
|
||||
#define IOC_PAD_IN_SEL_PA1 0x00000001 // PA1
|
||||
#define IOC_PAD_IN_SEL_PA2 0x00000002 // PA2
|
||||
#define IOC_PAD_IN_SEL_PA3 0x00000003 // PA3
|
||||
|
||||
#define UART0_BASE 0x4000C000
|
||||
#define UART1_BASE 0x4000D000
|
||||
#define GPIO_A_BASE 0x400D9000 // GPIO A
|
||||
#define GPIO_B_BASE 0x400DA000 // GPIO B
|
||||
#define GPIO_C_BASE 0x400DB000 // GPIO C
|
||||
#define GPIO_D_BASE 0x400DC000 // GPIO D
|
||||
|
||||
#define GPIO_O_DIR 0x00000400
|
||||
#define GPIO_O_AFSEL 0x00000420
|
||||
|
||||
#define GPIO_PIN(x) (1UL << x) // Arbitrary GPIO pin
|
||||
#define GPIO_PIN_0 0x00000001 // GPIO pin 0
|
||||
#define GPIO_PIN_1 0x00000002 // GPIO pin 1
|
||||
#define GPIO_PIN_2 0x00000004 // GPIO pin 2
|
||||
#define GPIO_PIN_3 0x00000008 // GPIO pin 3
|
||||
#define GPIO_PIN_4 0x00000010 // GPIO pin 4
|
||||
#define GPIO_PIN_5 0x00000020 // GPIO pin 5
|
||||
#define GPIO_PIN_6 0x00000040 // GPIO pin 6
|
||||
#define GPIO_PIN_7 0x00000080 // GPIO pin 7
|
||||
|
||||
#define UART_O_DR 0x00000000 // UART data
|
||||
#define UART_O_FR 0x00000018 // UART flag
|
||||
#define UART_O_IBRD 0x00000024
|
||||
#define UART_O_FBRD 0x00000028
|
||||
#define UART_O_LCRH 0x0000002C
|
||||
#define UART_O_CTL 0x00000030 // UART control
|
||||
#define UART_O_IM 0x00000038 // UART interrupt mask
|
||||
#define UART_O_MIS 0x00000040 // UART masked interrupt status
|
||||
#define UART_O_ICR 0x00000044 // UART interrupt clear
|
||||
#define UART_O_CC 0x00000FC8 // UART clock configuration
|
||||
|
||||
#define UART_FR_RXFE 0x00000010 // UART receive FIFO empty
|
||||
#define UART_FR_TXFF 0x00000020 // UART transmit FIFO full
|
||||
#define UART_FR_RXFF 0x00000040 // UART receive FIFO full
|
||||
|
||||
#define UART_CONFIG_WLEN_8 0x00000060 // 8 bit data
|
||||
#define UART_CONFIG_STOP_ONE 0x00000000 // One stop bit
|
||||
#define UART_CONFIG_PAR_NONE 0x00000000 // No parity
|
||||
|
||||
#define UART_CTL_UARTEN 0x00000001 // UART enable
|
||||
#define UART_CTL_TXE 0x00000100 // UART transmit enable
|
||||
#define UART_CTL_RXE 0x00000200 // UART receive enable
|
||||
|
||||
#define UART_IM_RXIM 0x00000010 // UART receive interrupt mask
|
||||
#define UART_IM_RTIM 0x00000040 // UART receive time-out interrupt
|
||||
|
||||
#define SOC_ADC_ADCCON1 0x400D7000 // ADC Control
|
||||
#define SOC_ADC_RNDL 0x400D7014 // RNG low data
|
||||
#define SOC_ADC_RNDH 0x400D7018 // RNG high data
|
||||
|
||||
#define SOC_ADC_ADCCON1_RCTRL0 0x00000004 // ADCCON1 RCTRL bit 0
|
||||
#define SOC_ADC_ADCCON1_RCTRL1 0x00000008 // ADCCON1 RCTRL bit 1
|
||||
|
||||
#define FLASH_CTRL_FCTL 0x400D3008 // Flash control
|
||||
#define FLASH_CTRL_DIECFG0 0x400D3014 // Flash information
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* GCC linker script for CC2538.
|
||||
*/
|
||||
|
||||
_512k_bytes = (512*1024);
|
||||
_256k_bytes = (256*1024);
|
||||
_128k_bytes = (128*1024);
|
||||
_FLASH_page_size = 2048;
|
||||
|
||||
/*
|
||||
* Change for your chip, default is 512k chips
|
||||
*/
|
||||
_FLASH_size_bytes = _512k_bytes;
|
||||
_FLASH_n_pages = (_FLASH_size_bytes / _FLASH_page_size);
|
||||
/* reduce the usable size by: the CCA + settings Page A & B, total 3 pages */
|
||||
_FLASH_usable_size = (_FLASH_size_bytes - (3 * _FLASH_page_size));
|
||||
_FLASH_start = 0x00200000;
|
||||
_FLASH_end = (_FLASH_start + _FLASH_size_bytes);
|
||||
|
||||
/*
|
||||
* The CCA (Customer Configuration Area) is always the last page.
|
||||
* See: http://www.ti.com/lit/ug/swru319c/swru319c.pdf
|
||||
* table 8-2 for more details.
|
||||
*/
|
||||
_FLASH_cca_page = (_FLASH_end - (1 * _FLASH_page_size));
|
||||
|
||||
/*
|
||||
* OpenThread NV storage goes in the settings page.
|
||||
* OpenThread requires at least 2 adjacent pages, call them A and B.
|
||||
*/
|
||||
_FLASH_settings_pageB = (_FLASH_end - (2 * _FLASH_page_size));
|
||||
_FLASH_settings_pageA = (_FLASH_end - (3 * _FLASH_page_size));
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* would like to use SYMBOLS (from above)here but we cannot
|
||||
* GCC version 4.9 does not support symbolic expressions here.
|
||||
* But later versions do support the feature.
|
||||
*/
|
||||
FLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0007c000
|
||||
FLASH_CCA (rx) : ORIGIN = 0x0027FFD4, LENGTH = 0x2c
|
||||
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||
}
|
||||
/*
|
||||
* To safty check what would have been the SYMBOL values
|
||||
* we use these ASSERTS to verify things are still good.
|
||||
*/
|
||||
ASSERT( _FLASH_start == 0x00200000, "invalid flash start address for cc2538")
|
||||
ASSERT( _FLASH_cca_page == 0x0027f800, "invalid cca start address for cc2538")
|
||||
ASSERT( _FLASH_usable_size == 0x0007e800, "Invalid usable size for this config")
|
||||
|
||||
|
||||
|
||||
ENTRY(flash_cca_lock_page)
|
||||
SECTIONS
|
||||
{
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_text = .;
|
||||
*(.vectors)
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
_etext = .;
|
||||
} > FLASH= 0
|
||||
|
||||
.init_array :
|
||||
{
|
||||
_init_array = .;
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array*))
|
||||
_einit_array = .;
|
||||
} > FLASH
|
||||
|
||||
.ARM.exidx : ALIGN(4)
|
||||
{
|
||||
*(.ARM.exidx*)
|
||||
} > FLASH
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data = .;
|
||||
*(.data*)
|
||||
_edata = .;
|
||||
} > SRAM AT > FLASH
|
||||
_ldata = LOADADDR(.data);
|
||||
|
||||
.bss : ALIGN(4)
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
_ebss = .;
|
||||
} > SRAM
|
||||
|
||||
_heap = .;
|
||||
end = .;
|
||||
|
||||
.stack : ALIGN(4)
|
||||
{
|
||||
*(.stack)
|
||||
} > SRAM
|
||||
|
||||
.flashcca :
|
||||
{
|
||||
KEEP(*(.flash_cca))
|
||||
} > FLASH_CCA
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
*/
|
||||
static bool sDiagMode = false;
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
{
|
||||
sDiagMode = aMode;
|
||||
}
|
||||
|
||||
bool otPlatDiagModeGet()
|
||||
{
|
||||
return sDiagMode;
|
||||
}
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aChannel);
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aTxPower);
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aFrame);
|
||||
OT_UNUSED_VARIABLE(aError);
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements an entropy source based on ADC.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <openthread/platform/entropy.h>
|
||||
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
static void generateRandom(uint8_t *aOutput, uint16_t aOutputLength)
|
||||
{
|
||||
uint32_t frmctrl0;
|
||||
|
||||
HWREG(SOC_ADC_ADCCON1) &= ~(SOC_ADC_ADCCON1_RCTRL1 | SOC_ADC_ADCCON1_RCTRL0);
|
||||
HWREG(SYS_CTRL_RCGCRFC) = SYS_CTRL_RCGCRFC_RFC0;
|
||||
|
||||
while (HWREG(SYS_CTRL_RCGCRFC) != SYS_CTRL_RCGCRFC_RFC0)
|
||||
;
|
||||
|
||||
frmctrl0 = HWREG(RFCORE_XREG_FRMCTRL0);
|
||||
HWREG(RFCORE_XREG_FRMCTRL0) = RFCORE_XREG_FRMCTRL0_INFINITY_RX;
|
||||
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_RXON;
|
||||
|
||||
while (!HWREG(RFCORE_XREG_RSSISTAT) & RFCORE_XREG_RSSISTAT_RSSI_VALID)
|
||||
;
|
||||
|
||||
for (uint16_t index = 0; index < aOutputLength; index++)
|
||||
{
|
||||
aOutput[index] = 0;
|
||||
|
||||
for (uint8_t offset = 0; offset < 8 * sizeof(uint8_t); offset++)
|
||||
{
|
||||
aOutput[index] <<= 1;
|
||||
aOutput[index] |= (HWREG(RFCORE_XREG_RFRND) & RFCORE_XREG_RFRND_IRND);
|
||||
}
|
||||
}
|
||||
|
||||
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_RFOFF;
|
||||
HWREG(RFCORE_XREG_FRMCTRL0) = frmctrl0;
|
||||
}
|
||||
|
||||
void cc2538RandomInit(void)
|
||||
{
|
||||
uint16_t seed = 0;
|
||||
|
||||
while (seed == 0x0000 || seed == 0x8003)
|
||||
{
|
||||
generateRandom((uint8_t *)&seed, sizeof(seed));
|
||||
}
|
||||
|
||||
HWREG(SOC_ADC_RNDL) = (seed >> 8) & 0xff;
|
||||
HWREG(SOC_ADC_RNDL) = seed & 0xff;
|
||||
}
|
||||
|
||||
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
uint8_t channel = 0;
|
||||
|
||||
otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
if (sInstance && otPlatRadioIsEnabled(sInstance))
|
||||
{
|
||||
channel = 11 + (HWREG(RFCORE_XREG_FREQCTRL) - 11) / 5;
|
||||
otPlatRadioSleep(sInstance);
|
||||
otPlatRadioDisable(sInstance);
|
||||
}
|
||||
|
||||
generateRandom(aOutput, aOutputLength);
|
||||
|
||||
if (channel)
|
||||
{
|
||||
cc2538RadioInit();
|
||||
otPlatRadioEnable(sInstance);
|
||||
otPlatRadioReceive(sInstance, channel);
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
#include "rom-utility.h"
|
||||
|
||||
#define FLASH_CTRL_FCTL_BUSY 0x00000080
|
||||
|
||||
#define FLASH_PAGE_SIZE 2048
|
||||
#define FLASH_PAGE_NUM 2
|
||||
#define FLASH_SWAP_SIZE (FLASH_PAGE_SIZE * (FLASH_PAGE_NUM / 2))
|
||||
|
||||
/* The linker script creates this external symbol */
|
||||
extern uint8_t _FLASH_settings_pageA[];
|
||||
|
||||
/* Convert a settings offset to the physical address within the flash settings pages */
|
||||
static uint32_t flashPhysAddr(uint8_t aSwapIndex, uint32_t aOffset)
|
||||
{
|
||||
uint32_t address = (uint32_t)(&_FLASH_settings_pageA[0]) + aOffset;
|
||||
|
||||
if (aSwapIndex)
|
||||
{
|
||||
address += FLASH_SWAP_SIZE;
|
||||
}
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
void otPlatFlashInit(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
}
|
||||
|
||||
uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return FLASH_SWAP_SIZE;
|
||||
}
|
||||
|
||||
void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
ROM_PageErase(flashPhysAddr(aSwapIndex, 0), FLASH_PAGE_SIZE);
|
||||
while (HWREG(FLASH_CTRL_FCTL) & FLASH_CTRL_FCTL_BUSY)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
uint32_t *data = (uint32_t *)(aData);
|
||||
|
||||
for (uint32_t size = 0; size < aSize; size += sizeof(uint32_t), aOffset += sizeof(uint32_t), data++)
|
||||
{
|
||||
ROM_ProgramFlash(data, flashPhysAddr(aSwapIndex, aOffset), sizeof(uint32_t));
|
||||
|
||||
while (HWREG(FLASH_CTRL_FCTL) & FLASH_CTRL_FCTL_BUSY)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, uint8_t *aData, uint32_t aSize)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
memcpy(aData, (void *)flashPhysAddr(aSwapIndex, aOffset), aSize);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <openthread/platform/misc.h>
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
|
||||
void otPlatReset(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
HWREG(SYS_CTRL_PWRDBG) = SYS_CTRL_PWRDBG_FORCE_WARM_RESET;
|
||||
}
|
||||
|
||||
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
// TODO: Write me!
|
||||
return OT_PLAT_RESET_REASON_POWER_ON;
|
||||
}
|
||||
|
||||
void otPlatWakeHost(void)
|
||||
{
|
||||
// TODO: implement an operation to wake the host from sleep state.
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes cc2538 compile-time configuration constants for OpenThread.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_CC2538_CONFIG_H_
|
||||
#define OPENTHREAD_CORE_CC2538_CONFIG_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
*
|
||||
* The platform-specific string to insert into the OpenThread version string.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "CC2538"
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software ACK timeout logic.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software retransmission logic.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software CSMA-CA backoff logic.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software transmission security logic.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE
|
||||
*
|
||||
* Define to 1 if you want to enable software energy scanning logic.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
|
||||
*
|
||||
* Define to 1 to enable NCP HDLC support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT
|
||||
*
|
||||
* Enable support for using interrupt-driven radio reception. This allows
|
||||
* for a single frame to be received whilst the CPU is busy processing some
|
||||
* other code.
|
||||
*
|
||||
* To disable interrupts and just rely on polling, set this to 0.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT
|
||||
#define OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2538_WITH_CC2592
|
||||
*
|
||||
* Enable support for the CC2592 range-extender front-end.
|
||||
*
|
||||
* This is a feature of the CC2538-CC2592 EM and other peripherals which
|
||||
* extends the range of the bare CC2538 to over a kilometre line-of-sight.
|
||||
* The CC2592 needs to be wired up to the RF port on the CC2538 in accordance
|
||||
* with application note 130 ("Using CC2592 Front End With CC2538", TI doc
|
||||
* SWRA447).
|
||||
*
|
||||
* If you have such a board, change this to 1.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2538_WITH_CC2592
|
||||
#define OPENTHREAD_CONFIG_CC2538_WITH_CC2592 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2592_PA_EN_PIN
|
||||
*
|
||||
* Define the pin (on port C) that connects to the CC2592 PA_EN pin.
|
||||
*
|
||||
* One of the 3 observable channels on the CC2538 radio module will be
|
||||
* configured to take the "PA power down" signal from the radio module itself,
|
||||
* invert it, and emit it on this GPIO pin. Due to hardware constraints, it
|
||||
* may only be connected to a pin on GPIO port C.
|
||||
*
|
||||
* The default (PC3) is as per TI recommendations in AN130.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2592_PA_EN_PIN
|
||||
#define OPENTHREAD_CONFIG_CC2592_PA_EN_PIN 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN
|
||||
*
|
||||
* Define the pin (on port C) that connects to the CC2592 LNA_EN pin.
|
||||
*
|
||||
* One of the 3 observable channels on the CC2538 radio module will be
|
||||
* configured to take the "LNA power down" signal from the radio module itself,
|
||||
* invert it, and emit it on this GPIO pin. Due to hardware constraints, it
|
||||
* may only be connected to a pin on GPIO port C.
|
||||
*
|
||||
* The default (PC2) is as per TI recommendations in AN130.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN
|
||||
#define OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2592_USE_HGM
|
||||
*
|
||||
* Enable control of the high-gain mode signal.
|
||||
*
|
||||
* High-gain mode is enabled through the `HGM` pin on the CC2592, which may be
|
||||
* connected to any free GPIO pin for software control, or may be linked to
|
||||
* VDD or 0V to hard-wire it to a given state.
|
||||
*
|
||||
* Set this to 0 if you have wired this pin to a power rail, or have a
|
||||
* non-standard way of controlling it.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2592_USE_HGM
|
||||
#define OPENTHREAD_CONFIG_CC2592_USE_HGM 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY
|
||||
*
|
||||
* Set the CC2538 receive sensitivity.
|
||||
*
|
||||
* A bare CC2538 has a receive sensitivity of -88dBm. The CC2592 changes this
|
||||
* to -85 or -81 depending on whether the HGM pin is high or low. If
|
||||
* `OPENTHREAD_CONFIG_CC2592_USE_HGM` is 0, then this sets the receive
|
||||
* sensitivity.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY
|
||||
#define OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY -88
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET
|
||||
*
|
||||
* Set the CC2538 RSSI offset. This calibrates the RSSI readings received from
|
||||
* the CC2538 radio module to give a reading in dBm.
|
||||
*
|
||||
* For a standard CC2538 (no front-end), the RSSI offset is 73.
|
||||
*
|
||||
* For a CC2592 hard-wired in high-gain mode, an offset of 85 should be used;
|
||||
* or for low-gain mode, 81. If `OPENTHREAD_CONFIG_CC2592_USE_HGM` is 0, then
|
||||
* this calibrates the RSSI value accordingly.
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET
|
||||
#define OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET 73
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2592_HGM_PORT
|
||||
*
|
||||
* Define the GPIO port that the HGM pin is connected to. It may be
|
||||
* connected to any available GPIO pin.
|
||||
*
|
||||
* The default (GPIO port D) is as per TI recommendations.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2592_HGM_PORT
|
||||
#define OPENTHREAD_CONFIG_CC2592_HGM_PORT GPIO_D_BASE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2592_HGM_PIN
|
||||
*
|
||||
* Define the pin on the GPIO port that the HGM pin is connected to. It
|
||||
* may be connected to any available GPIO pin.
|
||||
*
|
||||
* The default (PD2) is as per TI recommendations.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2592_HGM_PIN
|
||||
#define OPENTHREAD_CONFIG_CC2592_HGM_PIN 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE
|
||||
*
|
||||
* Define the default state of the CC2592's HGM pin.
|
||||
*
|
||||
* The default is to turn high-gain mode on.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE
|
||||
#define OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE true
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
|
||||
*
|
||||
* Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
|
||||
*
|
||||
* When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
|
||||
|
||||
#endif // OPENTHREAD_CORE_CC2538_CONFIG_H_
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes the platform-specific initializers.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_CC2538_H_
|
||||
#define PLATFORM_CC2538_H_
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <stdint.h>
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/instance.h>
|
||||
|
||||
#include "cc2538-reg.h"
|
||||
|
||||
// Global OpenThread instance structure
|
||||
extern otInstance *sInstance;
|
||||
|
||||
/**
|
||||
* Initialize the debug uart
|
||||
*/
|
||||
void cc2538DebugUartInit(void);
|
||||
|
||||
/**
|
||||
* This function initializes the alarm service used by OpenThread.
|
||||
*
|
||||
*/
|
||||
void cc2538AlarmInit(void);
|
||||
|
||||
/**
|
||||
* This function performs alarm driver processing.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
void cc2538AlarmProcess(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function initializes the radio service used by OpenThread.
|
||||
*
|
||||
*/
|
||||
void cc2538RadioInit(void);
|
||||
|
||||
/**
|
||||
* This function performs radio driver processing.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
void cc2538RadioProcess(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function initializes the random number service used by OpenThread.
|
||||
*
|
||||
*/
|
||||
void cc2538RandomInit(void);
|
||||
|
||||
/**
|
||||
* This function performs UART driver processing.
|
||||
*
|
||||
*/
|
||||
void cc2538UartProcess(void);
|
||||
|
||||
#if OPENTHREAD_CONFIG_CC2538_WITH_CC2592 && OPENTHREAD_CONFIG_CC2592_USE_HGM
|
||||
/**
|
||||
* Change the state of the CC2592 HGM pin.
|
||||
*
|
||||
* @param aState Whether or not to enable HGM
|
||||
*/
|
||||
void cc2538RadioSetHgm(bool aState);
|
||||
|
||||
/**
|
||||
* Retrieve the state of the CC2592 HGM pin.
|
||||
*/
|
||||
bool cc2538RadioGetHgm(void);
|
||||
#endif // OPENTHREAD_CONFIG_CC2538_WITH_CC2592 && OPENTHREAD_CONFIG_CC2592_USE_HGM
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OT_CC2538_TIMER_ENERGY_SCAN, ///< Internal timer for energy scan
|
||||
OT_CC2538_TIMERS_COUNT, ///< Number of internal timers
|
||||
} otCC2538Timer;
|
||||
|
||||
/**
|
||||
* This function sets the internal timer.
|
||||
*
|
||||
* @param[in] aTimer The timer identifier.
|
||||
* @param[in] aDelay The delay to trigger the timer, and must be no more than `INT32_MAX`.
|
||||
*
|
||||
*/
|
||||
void cc2538SetTimer(otCC2538Timer aTimer, uint32_t aDelay);
|
||||
|
||||
#endif // PLATFORM_CC2538_H_
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ROM_UTILITY_H_
|
||||
#define ROM_UTILITY_H_
|
||||
|
||||
#define ROM_API_TABLE_ADDR 0x00000048
|
||||
|
||||
typedef uint32_t (*volatile FPTR_CRC32_T)(uint8_t * /*pData*/, uint32_t /*byteCount*/);
|
||||
typedef uint32_t (*volatile FPTR_GETFLSIZE_T)(void);
|
||||
typedef uint32_t (*volatile FPTR_GETCHIPID_T)(void);
|
||||
typedef int32_t (*volatile FPTR_PAGEERASE_T)(uint32_t /*FlashAddr*/, uint32_t /*Size*/);
|
||||
typedef int32_t (*volatile FPTR_PROGFLASH_T)(uint32_t * /*pRamData*/, uint32_t /*FlashAdr*/, uint32_t /*ByteCount*/);
|
||||
typedef void (*volatile FPTR_RESETDEV_T)(void);
|
||||
typedef void *(*volatile FPTR_MEMSET_T)(void * /*s*/, int32_t /*c*/, uint32_t /*n*/);
|
||||
typedef void *(*volatile FPTR_MEMCPY_T)(void * /*s1*/, const void * /*s2*/, uint32_t /*n*/);
|
||||
typedef int32_t (*volatile FPTR_MEMCMP_T)(const void * /*s1*/, const void * /*s2*/, uint32_t /*n*/);
|
||||
typedef void *(*volatile FPTR_MEMMOVE_T)(void * /*s1*/, const void * /*s2*/, uint32_t /*n*/);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FPTR_CRC32_T Crc32;
|
||||
FPTR_GETFLSIZE_T GetFlashSize;
|
||||
FPTR_GETCHIPID_T GetChipId;
|
||||
FPTR_PAGEERASE_T PageErase;
|
||||
FPTR_PROGFLASH_T ProgramFlash;
|
||||
FPTR_RESETDEV_T ResetDevice;
|
||||
FPTR_MEMSET_T memset;
|
||||
FPTR_MEMCPY_T memcpy;
|
||||
FPTR_MEMCMP_T memcmp;
|
||||
FPTR_MEMMOVE_T memmove;
|
||||
} ROM_API_T;
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define P_ROM_API ((ROM_API_T*)ROM_API_TABLE_ADDR)
|
||||
|
||||
#define ROM_Crc32(a,b) P_ROM_API->Crc32(a,b)
|
||||
#define ROM_GetFlashSize() P_ROM_API->GetFlashSize()
|
||||
#define ROM_GetChipId() P_ROM_API->GetChipId()
|
||||
#define ROM_PageErase(a,b) P_ROM_API->PageErase(a,b)
|
||||
#define ROM_ProgramFlash(a,b,c) P_ROM_API->ProgramFlash(a,b,c)
|
||||
#define ROM_ResetDevice() P_ROM_API->ResetDevice()
|
||||
#define ROM_Memset(a,b,c) P_ROM_API->memset(a,b,c)
|
||||
#define ROM_Memcpy(a,b,c) P_ROM_API->memcpy(a,b,c)
|
||||
#define ROM_Memcmp(a,b,c) P_ROM_API->memcmp(a,b,c)
|
||||
#define ROM_Memmove(a,b,c) P_ROM_API->memmove(a,b,c)
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // ROM_UTILITY_H_
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements gcc-specific startup code for the cc2538.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cc2538-reg.h"
|
||||
|
||||
extern uint8_t _ldata;
|
||||
extern uint8_t _data;
|
||||
extern uint8_t _edata;
|
||||
extern uint8_t _bss;
|
||||
extern uint8_t _ebss;
|
||||
extern uint8_t _init_array;
|
||||
extern uint8_t _einit_array;
|
||||
|
||||
__extension__ typedef int __guard __attribute__((mode(__DI__)));
|
||||
|
||||
int __cxa_guard_acquire(__guard *g)
|
||||
{
|
||||
return !*(char *)(g);
|
||||
}
|
||||
|
||||
void __cxa_guard_release(__guard *g)
|
||||
{
|
||||
*(char *)g = 1;
|
||||
}
|
||||
|
||||
void __cxa_guard_abort(__guard *g)
|
||||
{
|
||||
(void)g;
|
||||
}
|
||||
|
||||
void __cxa_pure_virtual(void)
|
||||
{
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
void IntDefaultHandler(void);
|
||||
void ResetHandler(void);
|
||||
|
||||
extern void SysTick_Handler(void);
|
||||
extern void UART0IntHandler(void);
|
||||
extern void RFCoreRxTxIntHandler(void);
|
||||
extern void RFCoreErrIntHandler(void);
|
||||
extern void main(void);
|
||||
|
||||
static uint64_t stack[640] __attribute__((section(".stack")));
|
||||
|
||||
__attribute__((section(".vectors"), used)) void (*const vectors[])(void) = {
|
||||
(void (*)(void))((unsigned long)stack + sizeof(stack)), // Initial Stack Pointer
|
||||
ResetHandler, // 1 The reset handler
|
||||
ResetHandler, // 2 The NMI handler
|
||||
IntDefaultHandler, // 3 The hard fault handler
|
||||
IntDefaultHandler, // 4 The MPU fault handler
|
||||
IntDefaultHandler, // 5 The bus fault handler
|
||||
IntDefaultHandler, // 6 The usage fault handler
|
||||
0, // 7 Reserved
|
||||
0, // 8 Reserved
|
||||
0, // 9 Reserved
|
||||
0, // 10 Reserved
|
||||
IntDefaultHandler, // 11 SVCall handler
|
||||
IntDefaultHandler, // 12 Debug monitor handler
|
||||
0, // 13 Reserved
|
||||
IntDefaultHandler, // 14 The PendSV handler
|
||||
SysTick_Handler, // 15 The SysTick handler
|
||||
IntDefaultHandler, // 16 GPIO Port A
|
||||
IntDefaultHandler, // 17 GPIO Port B
|
||||
IntDefaultHandler, // 18 GPIO Port C
|
||||
IntDefaultHandler, // 19 GPIO Port D
|
||||
0, // 20 none
|
||||
UART0IntHandler, // 21 UART0 Rx and Tx
|
||||
IntDefaultHandler, // 22 UART1 Rx and Tx
|
||||
IntDefaultHandler, // 23 SSI0 Rx and Tx
|
||||
IntDefaultHandler, // 24 I2C Master and Slave
|
||||
0, // 25 Reserved
|
||||
0, // 26 Reserved
|
||||
0, // 27 Reserved
|
||||
0, // 28 Reserved
|
||||
0, // 29 Reserved
|
||||
IntDefaultHandler, // 30 ADC Sequence 0
|
||||
0, // 31 Reserved
|
||||
0, // 32 Reserved
|
||||
0, // 33 Reserved
|
||||
IntDefaultHandler, // 34 Watchdog timer, timer 0
|
||||
IntDefaultHandler, // 35 Timer 0 subtimer A
|
||||
IntDefaultHandler, // 36 Timer 0 subtimer B
|
||||
IntDefaultHandler, // 37 Timer 1 subtimer A
|
||||
IntDefaultHandler, // 38 Timer 1 subtimer B
|
||||
IntDefaultHandler, // 39 Timer 2 subtimer A
|
||||
IntDefaultHandler, // 40 Timer 2 subtimer B
|
||||
IntDefaultHandler, // 41 Analog Comparator 0
|
||||
RFCoreRxTxIntHandler, // 42 RFCore Rx/Tx
|
||||
RFCoreErrIntHandler, // 43 RFCore Error
|
||||
IntDefaultHandler, // 44 IcePick
|
||||
IntDefaultHandler, // 45 FLASH Control
|
||||
IntDefaultHandler, // 46 AES
|
||||
IntDefaultHandler, // 47 PKA
|
||||
IntDefaultHandler, // 48 Sleep Timer
|
||||
IntDefaultHandler, // 49 MacTimer
|
||||
IntDefaultHandler, // 50 SSI1 Rx and Tx
|
||||
IntDefaultHandler, // 51 Timer 3 subtimer A
|
||||
IntDefaultHandler, // 52 Timer 3 subtimer B
|
||||
0, // 53 Reserved
|
||||
0, // 54 Reserved
|
||||
0, // 55 Reserved
|
||||
0, // 56 Reserved
|
||||
0, // 57 Reserved
|
||||
0, // 58 Reserved
|
||||
0, // 59 Reserved
|
||||
IntDefaultHandler, // 60 USB 2538
|
||||
0, // 61 Reserved
|
||||
IntDefaultHandler, // 62 uDMA
|
||||
IntDefaultHandler, // 63 uDMA Error
|
||||
};
|
||||
|
||||
void IntDefaultHandler(void)
|
||||
{
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define FLASH_CCA_BOOTLDR_CFG_DISABLE 0xEFFFFFFF ///< Disable backdoor function
|
||||
#define FLASH_CCA_BOOTLDR_CFG_ENABLE 0xF0FFFFFF ///< Enable backdoor function
|
||||
#define FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH 0x08000000 ///< Selected pin on pad A active high
|
||||
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M 0x07000000 ///< Selected pin on pad A mask
|
||||
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S 24 ///< Selected pin on pad A shift
|
||||
#define FLASH_CCA_IMAGE_VALID 0x00000000 ///< Indicates valid image in flash
|
||||
|
||||
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN 3 ///< Select Button on SmartRF06 Eval Board
|
||||
|
||||
// clang-format on
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t ui32BootldrCfg;
|
||||
uint32_t ui32ImageValid;
|
||||
uint32_t ui32ImageVectorAddr;
|
||||
uint8_t ui8lock[32];
|
||||
} flash_cca_lock_page_t;
|
||||
|
||||
__attribute__((__section__(".flashcca"), used)) const flash_cca_lock_page_t flash_cca_lock_page = {
|
||||
FLASH_CCA_BOOTLDR_CFG_ENABLE | (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S),
|
||||
FLASH_CCA_IMAGE_VALID,
|
||||
(uint32_t)&vectors,
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
|
||||
|
||||
typedef void (*init_fn_t)(void);
|
||||
|
||||
void ResetHandler(void)
|
||||
{
|
||||
HWREG(SYS_CTRL_EMUOVR) = 0xFF;
|
||||
|
||||
// configure clocks
|
||||
HWREG(SYS_CTRL_CLOCK_CTRL) |= SYS_CTRL_CLOCK_CTRL_AMP_DET;
|
||||
HWREG(SYS_CTRL_CLOCK_CTRL) = SYS_CTRL_SYSDIV_32MHZ;
|
||||
|
||||
// alternate map
|
||||
HWREG(SYS_CTRL_I_MAP) |= SYS_CTRL_I_MAP_ALTMAP;
|
||||
|
||||
// copy the data segment initializers from flash to SRAM
|
||||
memcpy(&_data, &_ldata, &_edata - &_data);
|
||||
|
||||
// zero-fill the bss segment
|
||||
memset(&_bss, 0, &_ebss - &_bss);
|
||||
|
||||
// C++ runtime initialization (BSS, Data, relocation, etc.)
|
||||
init_fn_t *fp;
|
||||
|
||||
for (fp = (init_fn_t *)&_init_array; fp < (init_fn_t *)&_einit_array; fp++)
|
||||
{
|
||||
(*fp)();
|
||||
}
|
||||
|
||||
// call the application's entry point
|
||||
main();
|
||||
|
||||
// end here if main() returns
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread platform abstraction for UART communication.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/config.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <openthread/platform/debug_uart.h>
|
||||
#include <openthread/platform/logging.h>
|
||||
|
||||
#include "platform-cc2538.h"
|
||||
#include "utils/code_utils.h"
|
||||
#include "utils/uart.h"
|
||||
|
||||
enum
|
||||
{
|
||||
kPlatformClock = 32000000,
|
||||
kBaudRate = 115200,
|
||||
kReceiveBufferSize = 128,
|
||||
};
|
||||
|
||||
extern void UART0IntHandler(void);
|
||||
|
||||
static void processReceive(void);
|
||||
static void processTransmit(void);
|
||||
|
||||
static const uint8_t *sTransmitBuffer = NULL;
|
||||
static uint16_t sTransmitLength = 0;
|
||||
|
||||
typedef struct RecvBuffer
|
||||
{
|
||||
// The data buffer
|
||||
uint8_t mBuffer[kReceiveBufferSize];
|
||||
// The offset of the first item written to the list.
|
||||
uint16_t mHead;
|
||||
// The offset of the next item to be written to the list.
|
||||
uint16_t mTail;
|
||||
} RecvBuffer;
|
||||
|
||||
static RecvBuffer sReceive;
|
||||
|
||||
static void enable_uart_clocks(void)
|
||||
{
|
||||
static int uart_clocks_done = 0;
|
||||
|
||||
if (uart_clocks_done)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uart_clocks_done = 1;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
|
||||
HWREG(SYS_CTRL_RCGCUART) = (SYS_CTRL_RCGCUART_UART0 | SYS_CTRL_RCGCUART_UART1);
|
||||
HWREG(SYS_CTRL_SCGCUART) = (SYS_CTRL_SCGCUART_UART0 | SYS_CTRL_SCGCUART_UART1);
|
||||
HWREG(SYS_CTRL_DCGCUART) = (SYS_CTRL_DCGCUART_UART0 | SYS_CTRL_DCGCUART_UART1);
|
||||
#else
|
||||
HWREG(SYS_CTRL_RCGCUART) = SYS_CTRL_RCGCUART_UART0;
|
||||
HWREG(SYS_CTRL_SCGCUART) = SYS_CTRL_SCGCUART_UART0;
|
||||
HWREG(SYS_CTRL_DCGCUART) = SYS_CTRL_DCGCUART_UART0;
|
||||
#endif
|
||||
}
|
||||
|
||||
otError otPlatUartEnable(void)
|
||||
{
|
||||
uint32_t div;
|
||||
|
||||
sReceive.mHead = 0;
|
||||
sReceive.mTail = 0;
|
||||
|
||||
// clock
|
||||
enable_uart_clocks();
|
||||
|
||||
HWREG(UART0_BASE + UART_O_CC) = 0;
|
||||
|
||||
// tx pin
|
||||
HWREG(IOC_PA1_SEL) = IOC_MUX_OUT_SEL_UART0_TXD;
|
||||
HWREG(IOC_PA1_OVER) = IOC_OVERRIDE_OE;
|
||||
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_1;
|
||||
|
||||
// rx pin
|
||||
HWREG(IOC_UARTRXD_UART0) = IOC_PAD_IN_SEL_PA0;
|
||||
HWREG(IOC_PA0_OVER) = IOC_OVERRIDE_DIS;
|
||||
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_0;
|
||||
|
||||
HWREG(UART0_BASE + UART_O_CTL) = 0;
|
||||
|
||||
// baud rate
|
||||
div = (((kPlatformClock * 8) / kBaudRate) + 1) / 2;
|
||||
HWREG(UART0_BASE + UART_O_IBRD) = div / 64;
|
||||
HWREG(UART0_BASE + UART_O_FBRD) = div % 64;
|
||||
HWREG(UART0_BASE + UART_O_LCRH) = UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE;
|
||||
|
||||
// configure interrupts
|
||||
HWREG(UART0_BASE + UART_O_IM) |= UART_IM_RXIM | UART_IM_RTIM;
|
||||
|
||||
// enable
|
||||
HWREG(UART0_BASE + UART_O_CTL) = UART_CTL_UARTEN | UART_CTL_TXE | UART_CTL_RXE;
|
||||
|
||||
// enable interrupts
|
||||
HWREG(NVIC_EN0) = 1 << ((INT_UART0 - 16) & 31);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatUartDisable(void)
|
||||
{
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
|
||||
|
||||
sTransmitBuffer = aBuf;
|
||||
sTransmitLength = aBufLength;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void processReceive(void)
|
||||
{
|
||||
// Copy tail to prevent multiple reads
|
||||
uint16_t tail = sReceive.mTail;
|
||||
|
||||
// If the data wraps around, process the first part
|
||||
if (sReceive.mHead > tail)
|
||||
{
|
||||
otPlatUartReceived(sReceive.mBuffer + sReceive.mHead, kReceiveBufferSize - sReceive.mHead);
|
||||
|
||||
// Reset the buffer mHead back to zero.
|
||||
sReceive.mHead = 0;
|
||||
}
|
||||
|
||||
// For any data remaining, process it
|
||||
if (sReceive.mHead != tail)
|
||||
{
|
||||
otPlatUartReceived(sReceive.mBuffer + sReceive.mHead, tail - sReceive.mHead);
|
||||
|
||||
// Set mHead to the local tail we have cached
|
||||
sReceive.mHead = tail;
|
||||
}
|
||||
}
|
||||
|
||||
otError otPlatUartFlush(void)
|
||||
{
|
||||
otEXPECT(sTransmitBuffer != NULL);
|
||||
|
||||
for (; sTransmitLength > 0; sTransmitLength--)
|
||||
{
|
||||
while (HWREG(UART0_BASE + UART_O_FR) & UART_FR_TXFF)
|
||||
;
|
||||
|
||||
HWREG(UART0_BASE + UART_O_DR) = *sTransmitBuffer++;
|
||||
}
|
||||
|
||||
sTransmitBuffer = NULL;
|
||||
return OT_ERROR_NONE;
|
||||
|
||||
exit:
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
void processTransmit(void)
|
||||
{
|
||||
otPlatUartFlush();
|
||||
otPlatUartSendDone();
|
||||
}
|
||||
|
||||
void cc2538UartProcess(void)
|
||||
{
|
||||
processReceive();
|
||||
processTransmit();
|
||||
}
|
||||
|
||||
void UART0IntHandler(void)
|
||||
{
|
||||
uint32_t mis;
|
||||
uint8_t byte;
|
||||
|
||||
mis = HWREG(UART0_BASE + UART_O_MIS);
|
||||
HWREG(UART0_BASE + UART_O_ICR) = mis;
|
||||
|
||||
if (mis & (UART_IM_RXIM | UART_IM_RTIM))
|
||||
{
|
||||
while (!(HWREG(UART0_BASE + UART_O_FR) & UART_FR_RXFE))
|
||||
{
|
||||
byte = HWREG(UART0_BASE + UART_O_DR);
|
||||
|
||||
// We can only write if incrementing mTail doesn't equal mHead
|
||||
if (sReceive.mHead != (sReceive.mTail + 1) % kReceiveBufferSize)
|
||||
{
|
||||
sReceive.mBuffer[sReceive.mTail] = byte;
|
||||
sReceive.mTail = (sReceive.mTail + 1) % kReceiveBufferSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
|
||||
|
||||
int otPlatDebugUart_kbhit(void)
|
||||
{
|
||||
uint32_t v;
|
||||
|
||||
/* get flags */
|
||||
v = HWREG(UART1_BASE + UART_O_FR);
|
||||
|
||||
/* if FIFO empty we have no data */
|
||||
return !(v & UART_FR_RXFE);
|
||||
}
|
||||
|
||||
int otPlatDebugUart_getc(void)
|
||||
{
|
||||
int v = 1;
|
||||
|
||||
/* if nothing in fifo */
|
||||
if (!otPlatDebugUart_kbhit())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* fetch */
|
||||
v = (int)HWREG(UART0_BASE + UART_O_DR);
|
||||
v = (v & 0x0ff);
|
||||
return v;
|
||||
}
|
||||
|
||||
void otPlatDebugUart_putchar_raw(int b)
|
||||
{
|
||||
/* wait till not busy */
|
||||
while (HWREG(UART1_BASE + UART_O_FR) & UART_FR_TXFF)
|
||||
;
|
||||
|
||||
/* write byte */
|
||||
HWREG(UART1_BASE + UART_O_DR) = ((uint32_t)(b & 0x0ff));
|
||||
}
|
||||
|
||||
void cc2538DebugUartInit(void)
|
||||
{
|
||||
int32_t a, b;
|
||||
|
||||
// clocks
|
||||
enable_uart_clocks();
|
||||
|
||||
HWREG(UART1_BASE + UART_O_CC) = 0;
|
||||
|
||||
// UART1 - tx pin
|
||||
// Using an RF06 Evaluation board
|
||||
// http://www.ti.com/tool/cc2538dk
|
||||
// PA3 => is jumper position RF1.14
|
||||
// To use these, you will require a "flying-lead" UART adapter
|
||||
HWREG(IOC_PA3_SEL) = IOC_MUX_OUT_SEL_UART1_TXD;
|
||||
HWREG(IOC_PA3_OVER) = IOC_OVERRIDE_OE;
|
||||
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_3;
|
||||
|
||||
// UART1 - rx pin we don't really use but we setup anyway
|
||||
// PA2 => is jumper position RF1.16
|
||||
HWREG(IOC_UARTRXD_UART1) = IOC_PAD_IN_SEL_PA2;
|
||||
HWREG(IOC_PA2_OVER) = IOC_OVERRIDE_DIS;
|
||||
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_2;
|
||||
|
||||
HWREG(UART1_BASE + UART_O_CC) = 0;
|
||||
|
||||
// baud rate
|
||||
b = (((kPlatformClock * 8) / kBaudRate) + 1) / 2;
|
||||
a = b / 64;
|
||||
b = b % 64;
|
||||
|
||||
HWREG(UART1_BASE + UART_O_IBRD) = a;
|
||||
HWREG(UART1_BASE + UART_O_FBRD) = b;
|
||||
HWREG(UART1_BASE + UART_O_LCRH) = UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE;
|
||||
|
||||
/* NOTE:
|
||||
* uart1 is not using IRQs it is tx only
|
||||
* and we block when writing bytes
|
||||
*/
|
||||
HWREG(UART1_BASE + UART_O_CTL) = UART_CTL_UARTEN | UART_CTL_TXE | UART_CTL_RXE;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -51,4 +51,11 @@ otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex,
|
||||
|
||||
return OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInfraIfIndex);
|
||||
|
||||
return OT_ERROR_FAILED;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -254,4 +254,15 @@
|
||||
#define OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES 20
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE
|
||||
*
|
||||
* Define to 1 to generate ECDSA signatures determinsitically
|
||||
* according to RFC 6979 instead of randomly.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE
|
||||
#define OPENTHREAD_CONFIG_DETERMINISTIC_ECDSA_ENABLE 1
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_SIMULATION_CONFIG_H_
|
||||
|
||||
@@ -232,6 +232,18 @@ void otSimSendUartWriteEvent(const uint8_t *aData, uint16_t aLength);
|
||||
*/
|
||||
bool platformRadioIsTransmitPending(void);
|
||||
|
||||
/**
|
||||
* This function parses an environment variable as an unsigned 16-bit integer.
|
||||
*
|
||||
* If the environment variable does not exist, this function does nothing.
|
||||
* If it is not a valid integer, this function will terminate the process with an error message.
|
||||
*
|
||||
* @param[in] aEnvName The name of the environment variable.
|
||||
* @param[out] aValue A pointer to the unsigned 16-bit integer.
|
||||
*
|
||||
*/
|
||||
void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue);
|
||||
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
|
||||
/**
|
||||
|
||||
@@ -71,10 +71,12 @@ enum
|
||||
|
||||
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
|
||||
extern int sSockFd;
|
||||
extern uint16_t sPortBase;
|
||||
extern uint16_t sPortOffset;
|
||||
#else
|
||||
static int sTxFd = -1;
|
||||
static int sRxFd = -1;
|
||||
static uint16_t sPortBase = 9000;
|
||||
static uint16_t sPortOffset = 0;
|
||||
static uint16_t sPort = 0;
|
||||
#endif
|
||||
@@ -164,8 +166,84 @@ static otMacKeyMaterial sCurrKey;
|
||||
static otMacKeyMaterial sNextKey;
|
||||
static otRadioKeyType sKeyType;
|
||||
|
||||
enum
|
||||
{
|
||||
SIM_GPIO = 0,
|
||||
};
|
||||
|
||||
static bool sGpioValue = false;
|
||||
|
||||
static int8_t GetRssi(uint16_t aChannel);
|
||||
|
||||
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
|
||||
static uint8_t sDeniedNodeIdsBitVector[(MAX_NETWORK_SIZE + 7) / 8];
|
||||
|
||||
static bool NodeIdFilterIsConnectable(uint16_t aNodeId)
|
||||
{
|
||||
uint16_t index = aNodeId - 1;
|
||||
|
||||
return (sDeniedNodeIdsBitVector[index / 8] & (0x80 >> (index % 8))) == 0;
|
||||
}
|
||||
|
||||
static void NodeIdFilterDeny(uint16_t aNodeId)
|
||||
{
|
||||
uint16_t index = aNodeId - 1;
|
||||
|
||||
sDeniedNodeIdsBitVector[index / 8] |= 0x80 >> (index % 8);
|
||||
}
|
||||
|
||||
static void NodeIdFilterClear(void)
|
||||
{
|
||||
memset(sDeniedNodeIdsBitVector, 0, sizeof(sDeniedNodeIdsBitVector));
|
||||
}
|
||||
|
||||
otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
otEXPECT_ACTION(aArgsLength > 0, error = OT_ERROR_INVALID_COMMAND);
|
||||
|
||||
if (!strcmp(aArgs[0], "clear"))
|
||||
{
|
||||
otEXPECT_ACTION(aArgsLength == 1, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
NodeIdFilterClear();
|
||||
}
|
||||
else if (!strcmp(aArgs[0], "deny"))
|
||||
{
|
||||
uint16_t nodeId;
|
||||
char * endptr;
|
||||
|
||||
otEXPECT_ACTION(aArgsLength == 2, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
nodeId = (uint16_t)strtol(aArgs[1], &endptr, 0);
|
||||
|
||||
otEXPECT_ACTION(*endptr == '\0', error = OT_ERROR_INVALID_ARGS);
|
||||
otEXPECT_ACTION(1 <= nodeId && nodeId <= MAX_NETWORK_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
NodeIdFilterDeny(nodeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = OT_ERROR_INVALID_COMMAND;
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#else
|
||||
otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
OT_UNUSED_VARIABLE(aArgsLength);
|
||||
OT_UNUSED_VARIABLE(aArgs);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
|
||||
|
||||
static bool IsTimeAfterOrEqual(uint32_t aTimeA, uint32_t aTimeB)
|
||||
{
|
||||
return (aTimeA - aTimeB) < (1U << 31);
|
||||
@@ -298,7 +376,7 @@ static void initFds(void)
|
||||
|
||||
otEXPECT_ACTION((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1, perror("socket(sTxFd)"));
|
||||
|
||||
sPort = (uint16_t)(9000 + sPortOffset + gNodeId);
|
||||
sPort = (uint16_t)(sPortBase + sPortOffset + gNodeId);
|
||||
sockaddr.sin_family = AF_INET;
|
||||
sockaddr.sin_port = htons(sPort);
|
||||
sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
@@ -337,7 +415,7 @@ static void initFds(void)
|
||||
}
|
||||
|
||||
sockaddr.sin_family = AF_INET;
|
||||
sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset));
|
||||
sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset));
|
||||
sockaddr.sin_addr.s_addr = inet_addr(OT_RADIO_GROUP);
|
||||
|
||||
otEXPECT_ACTION(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1, perror("bind(sRxFd)"));
|
||||
@@ -356,24 +434,10 @@ exit:
|
||||
void platformRadioInit(void)
|
||||
{
|
||||
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
|
||||
char *offset;
|
||||
parseFromEnvAsUint16("PORT_BASE", &sPortBase);
|
||||
|
||||
offset = getenv("PORT_OFFSET");
|
||||
|
||||
if (offset)
|
||||
{
|
||||
char *endptr;
|
||||
|
||||
sPortOffset = (uint16_t)strtol(offset, &endptr, 0);
|
||||
|
||||
if (*endptr != '\0')
|
||||
{
|
||||
fprintf(stderr, "Invalid PORT_OFFSET: %s\n", offset);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sPortOffset *= (MAX_NETWORK_SIZE + 1);
|
||||
}
|
||||
parseFromEnvAsUint16("PORT_OFFSET", &sPortOffset);
|
||||
sPortOffset *= (MAX_NETWORK_SIZE + 1);
|
||||
|
||||
initFds();
|
||||
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
|
||||
@@ -829,7 +893,10 @@ void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const
|
||||
|
||||
if (rval > 0)
|
||||
{
|
||||
if (sockaddr.sin_port != htons(sPort))
|
||||
uint16_t srcPort = ntohs(sockaddr.sin_port);
|
||||
uint16_t srcNodeId = srcPort - sPortOffset - sPortBase;
|
||||
|
||||
if (NodeIdFilterIsConnectable(srcNodeId) && srcPort != sPort)
|
||||
{
|
||||
sReceiveFrame.mLength = (uint16_t)(rval - 1);
|
||||
|
||||
@@ -847,7 +914,7 @@ void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
|
||||
if (platformRadioIsTransmitPending())
|
||||
{
|
||||
radioSendMessage(aInstance);
|
||||
@@ -870,7 +937,7 @@ void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFr
|
||||
sockaddr.sin_family = AF_INET;
|
||||
inet_pton(AF_INET, OT_RADIO_GROUP, &sockaddr.sin_addr);
|
||||
|
||||
sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset));
|
||||
sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset));
|
||||
rval =
|
||||
sendto(sTxFd, (const char *)aMessage, 1 + aFrame->mLength, 0, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
|
||||
|
||||
@@ -1321,3 +1388,43 @@ otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode)
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue)
|
||||
{
|
||||
char *env = getenv(aEnvName);
|
||||
|
||||
if (env)
|
||||
{
|
||||
char *endptr;
|
||||
|
||||
*aValue = (uint16_t)strtol(env, &endptr, 0);
|
||||
|
||||
if (*endptr != '\0')
|
||||
{
|
||||
fprintf(stderr, "Invalid %s: %s\n", aEnvName, env);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
|
||||
sGpioValue = aValue;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
otEXPECT_ACTION((aGpio == SIM_GPIO) && (aValue != NULL), error = OT_ERROR_INVALID_ARGS);
|
||||
*aValue = sGpioValue;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ char **gArguments = NULL;
|
||||
|
||||
uint64_t sNow = 0; // microseconds
|
||||
int sSockFd;
|
||||
uint16_t sPortBase = 9000;
|
||||
uint16_t sPortOffset;
|
||||
|
||||
static void handleSignal(int aSignal)
|
||||
@@ -78,7 +79,7 @@ void otSimSendEvent(const struct Event *aEvent)
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
sockaddr.sin_family = AF_INET;
|
||||
inet_pton(AF_INET, "127.0.0.1", &sockaddr.sin_addr);
|
||||
sockaddr.sin_port = htons(9000 + sPortOffset);
|
||||
sockaddr.sin_port = htons(sPortBase + sPortOffset);
|
||||
|
||||
rval = sendto(sSockFd, aEvent, offsetof(struct Event, mData) + aEvent->mDataLength, 0, (struct sockaddr *)&sockaddr,
|
||||
sizeof(sockaddr));
|
||||
@@ -176,28 +177,15 @@ otError otPlatUartFlush(void)
|
||||
static void socket_init(void)
|
||||
{
|
||||
struct sockaddr_in sockaddr;
|
||||
char * offset;
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
sockaddr.sin_family = AF_INET;
|
||||
|
||||
offset = getenv("PORT_OFFSET");
|
||||
parseFromEnvAsUint16("PORT_BASE", &sPortBase);
|
||||
|
||||
if (offset)
|
||||
{
|
||||
char *endptr;
|
||||
parseFromEnvAsUint16("PORT_OFFSET", &sPortOffset);
|
||||
sPortOffset *= (MAX_NETWORK_SIZE + 1);
|
||||
|
||||
sPortOffset = (uint16_t)strtol(offset, &endptr, 0);
|
||||
|
||||
if (*endptr != '\0')
|
||||
{
|
||||
fprintf(stderr, "Invalid PORT_OFFSET: %s\n", offset);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sPortOffset *= (MAX_NETWORK_SIZE + 1);
|
||||
}
|
||||
|
||||
sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset + gNodeId));
|
||||
sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset + gNodeId));
|
||||
sockaddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
sSockFd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
otLinkMetrics GetLinkMetrics(void) const { return mLinkMetrics; }
|
||||
|
||||
private:
|
||||
uint8_t GetLinkMargin(int8_t aRssi) const { return LinkQualityInfo::ConvertRssToLinkMargin(sNoiseFloor, aRssi); }
|
||||
uint8_t GetLinkMargin(int8_t aRssi) const { return ComputeLinkMargin(sNoiseFloor, aRssi); }
|
||||
|
||||
bool Matches(const otShortAddress &aShortAddress) const { return mShortAddress == aShortAddress; };
|
||||
|
||||
|
||||
+3
-12
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2017, The OpenThread Authors.
|
||||
# Copyright (c) 2022, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -26,14 +26,5 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# cc2538 platform-specific Makefile
|
||||
#
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/cc2538/libopenthread-cc2538.a \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/cc2538/cc2538.ld \
|
||||
$(NULL)
|
||||
# Intentionally empty, the file is only needed to enable "zephyr" target
|
||||
# as OT platform for CMake
|
||||
@@ -0,0 +1,3 @@
|
||||
The OpenThread stack is integrated with ZephyrOS and nRF Connect SDK.
|
||||
|
||||
See the [Zephyr's OpenThread platform](https://github.com/zephyrproject-rtos/zephyr/tree/main/modules/openthread) and [CLI example](https://github.com/nrfconnect/sdk-nrf/tree/main/samples/openthread/cli) for more information about the integration.
|
||||
@@ -39,6 +39,7 @@ openthread_headers = \
|
||||
openthread/backbone_router_ftd.h \
|
||||
openthread/border_agent.h \
|
||||
openthread/border_router.h \
|
||||
openthread/border_routing.h \
|
||||
openthread/channel_manager.h \
|
||||
openthread/channel_monitor.h \
|
||||
openthread/child_supervision.h \
|
||||
@@ -69,6 +70,7 @@ openthread_headers = \
|
||||
openthread/logging.h \
|
||||
openthread/message.h \
|
||||
openthread/multi_radio.h \
|
||||
openthread/nat64.h \
|
||||
openthread/ncp.h \
|
||||
openthread/netdata.h \
|
||||
openthread/netdata_publisher.h \
|
||||
|
||||
@@ -43,6 +43,7 @@ source_set("openthread") {
|
||||
"backbone_router_ftd.h",
|
||||
"border_agent.h",
|
||||
"border_router.h",
|
||||
"border_routing.h",
|
||||
"channel_manager.h",
|
||||
"channel_monitor.h",
|
||||
"child_supervision.h",
|
||||
@@ -73,6 +74,7 @@ source_set("openthread") {
|
||||
"logging.h",
|
||||
"message.h",
|
||||
"multi_radio.h",
|
||||
"nat64.h",
|
||||
"ncp.h",
|
||||
"netdata.h",
|
||||
"netdata_publisher.h",
|
||||
|
||||
@@ -64,7 +64,14 @@ typedef enum
|
||||
} otBackboneRouterState;
|
||||
|
||||
/**
|
||||
* This function enables or disables Backbone functionality.
|
||||
* Enables or disables Backbone functionality.
|
||||
*
|
||||
* If enabled, a Server Data Request message `SRV_DATA.ntf` is triggered for the attached
|
||||
* device if there is no Backbone Router Service in the Thread Network Data.
|
||||
*
|
||||
* If disabled, `SRV_DATA.ntf` is triggered if the Backbone Router is in the Primary state.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnable TRUE to enable Backbone functionality, FALSE otherwise.
|
||||
@@ -78,7 +85,7 @@ typedef enum
|
||||
void otBackboneRouterSetEnabled(otInstance *aInstance, bool aEnable);
|
||||
|
||||
/**
|
||||
* This function gets the Backbone Router state.
|
||||
* Gets the Backbone Router #otBackboneRouterState.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -95,7 +102,9 @@ void otBackboneRouterSetEnabled(otInstance *aInstance, bool aEnable);
|
||||
otBackboneRouterState otBackboneRouterGetState(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function gets the local Backbone Router configuration.
|
||||
* Gets the local Backbone Router configuration.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aConfig A pointer where to put local Backbone Router configuration.
|
||||
@@ -110,7 +119,12 @@ otBackboneRouterState otBackboneRouterGetState(otInstance *aInstance);
|
||||
void otBackboneRouterGetConfig(otInstance *aInstance, otBackboneRouterConfig *aConfig);
|
||||
|
||||
/**
|
||||
* This function sets the local Backbone Router configuration.
|
||||
* Sets the local Backbone Router configuration #otBackboneRouterConfig.
|
||||
*
|
||||
* A Server Data Request message `SRV_DATA.ntf` is initiated automatically if BBR Dataset changes for Primary
|
||||
* Backbone Router.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aConfig A pointer to the Backbone Router configuration to take effect.
|
||||
@@ -127,7 +141,11 @@ void otBackboneRouterGetConfig(otInstance *aInstance, otBackboneRouterConfig *aC
|
||||
otError otBackboneRouterSetConfig(otInstance *aInstance, const otBackboneRouterConfig *aConfig);
|
||||
|
||||
/**
|
||||
* This function explicitly registers local Backbone Router configuration.
|
||||
* Explicitly registers local Backbone Router configuration.
|
||||
*
|
||||
* A Server Data Request message `SRV_DATA.ntf` is triggered for the attached device.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -194,10 +212,11 @@ void otBackboneRouterConfigNextDuaRegistrationResponse(otInstance *
|
||||
uint8_t aStatus);
|
||||
|
||||
/**
|
||||
* This method configures response status for next Multicast Listener Registration.
|
||||
* Configures the response status for the next Multicast Listener Registration.
|
||||
*
|
||||
* Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
|
||||
* Only used for test and certification.
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE`,
|
||||
* `OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE`, and
|
||||
* `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` are enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aStatus The status to respond.
|
||||
@@ -240,10 +259,11 @@ void otBackboneRouterSetMulticastListenerCallback(otInstance *
|
||||
void * aContext);
|
||||
|
||||
/**
|
||||
* This method clears the Multicast Listeners.
|
||||
* Clears the Multicast Listeners.
|
||||
*
|
||||
* Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
|
||||
* Only used for test and certification.
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE`,
|
||||
* `OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE`, and
|
||||
* `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` are enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -254,10 +274,13 @@ void otBackboneRouterSetMulticastListenerCallback(otInstance *
|
||||
void otBackboneRouterMulticastListenerClear(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This method adds a Multicast Listener.
|
||||
* Adds a Multicast Listener with a timeout value, in seconds.
|
||||
*
|
||||
* Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
|
||||
* Only used for test and certification.
|
||||
* Pass `0` to use the default MLR timeout.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE`,
|
||||
* `OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE`, and
|
||||
* `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` are enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aAddress The Multicast Listener address.
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef OPENTHREAD_BORDER_ROUTER_H_
|
||||
#define OPENTHREAD_BORDER_ROUTER_H_
|
||||
|
||||
#include <openthread/border_routing.h>
|
||||
#include <openthread/ip6.h>
|
||||
#include <openthread/netdata.h>
|
||||
|
||||
@@ -52,112 +53,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method initializes the Border Routing Manager on given infrastructure interface.
|
||||
*
|
||||
* @note This method MUST be called before any other otBorderRouting* APIs.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aInfraIfIndex The infrastructure interface index.
|
||||
* @param[in] aInfraIfIsRunning A boolean that indicates whether the infrastructure
|
||||
* interface is running.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started the Border Routing Manager on given infrastructure.
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager has already been initialized.
|
||||
* @retval OT_ERROR_INVALID_ARGS The index of the infrastructure interface is not valid.
|
||||
* @retval OT_ERROR_FAILED Internal failure. Usually due to failure in generating random prefixes.
|
||||
*
|
||||
* @sa otPlatInfraIfStateChanged.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingInit(otInstance *aInstance, uint32_t aInfraIfIndex, bool aInfraIfIsRunning);
|
||||
|
||||
/**
|
||||
* Enables or disables the Border Routing Manager.
|
||||
*
|
||||
* @note The Border Routing Manager is disabled by default.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled A boolean to enable/disable the routing manager.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully enabled/disabled the Border Routing Manager.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingSetEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function gets the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in
|
||||
* Router Advertisement messages sent over the infrastructure link.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The OMR prefix advertisement preference.
|
||||
*
|
||||
*/
|
||||
otRoutePreference otBorderRoutingGetRouteInfoOptionPreference(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the preference to use when advertising Route Info Options (e.g., for discovered OMR prefixes) in
|
||||
* Router Advertisement messages sent over the infrastructure link.
|
||||
*
|
||||
* By default BR will use 'medium' preference level but this function allows the default value to be changed. As an
|
||||
* example, it can be set to 'low' preference in the case where device is a temporary BR (a mobile BR or a
|
||||
* battery-powered BR) to indicate that other BRs (if any) should be preferred over this BR on the infrastructure link.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPreference The route preference to use.
|
||||
*
|
||||
*/
|
||||
void otBorderRoutingSetRouteInfoOptionPreference(otInstance *aInstance, otRoutePreference aPreference);
|
||||
|
||||
/**
|
||||
* Gets the Off-Mesh-Routable (OMR) Prefix, for example `fdfc:1ff5:1512:5622::/64`.
|
||||
*
|
||||
* An OMR Prefix is a randomly generated 64-bit prefix that's published in the
|
||||
* Thread network if there isn't already an OMR prefix. This prefix can be reached
|
||||
* from the local Wi-Fi or Ethernet network.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to where the prefix will be output to.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the OMR prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* Gets the On-Link Prefix for the adjacent infrastructure link, for example `fd41:2650:a6f5:0::/64`.
|
||||
*
|
||||
* An On-Link Prefix is a randomly generated 64-bit prefix that's advertised on the infrastructure
|
||||
* link if there isn't already a usable on-link prefix being advertised on the link.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to where the prefix will be output to.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the on-link prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetOnLinkPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* Gets the local NAT64 Prefix of the Border Router.
|
||||
*
|
||||
* NAT64 Prefix might not be advertised in the Thread network.
|
||||
*
|
||||
* `OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE` must be enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to where the prefix will be output to.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the NAT64 prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* This method provides a full or stable copy of the local Thread Network Data.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (c) 2021-22, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
* This file defines the OpenThread Border Routing Manager API.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_BORDER_ROUTING_H_
|
||||
#define OPENTHREAD_BORDER_ROUTING_H_
|
||||
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/ip6.h>
|
||||
#include <openthread/netdata.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup api-border-routing
|
||||
*
|
||||
* @brief
|
||||
* This module includes definitions related to Border Routing Manager.
|
||||
*
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* All the functions in this module require `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` to be enabled.
|
||||
*
|
||||
* Border Routing Manager handles bi-directional routing between Thread network and adjacent infrastructure link (AIL).
|
||||
*
|
||||
* It emits ICMRv6 ND Router Advertisement (RA) messages on AIL to advertise on-link and route prefixes. It also
|
||||
* processes received RA messages from infrastructure and mirrors the discovered prefixes on the Thread Network Data to
|
||||
* ensure devices on Thread mesh can reach AIL through the Border Router.
|
||||
*
|
||||
* Routing Manager manages the Off-Mesh Routable (OMR) prefix on the Thread Network data which configures Thread
|
||||
* devices with a suitable Off-Mesh Routable IPv6 address. It announces the reachability of this prefix on AIL by
|
||||
* including it in the emitted RA messages as an IPv6 Route Information Option (RIO).
|
||||
*
|
||||
* Routing Manager also monitors and adds on-link prefix on the infrastructure network. If a router on AIL is already
|
||||
* providing RA messages containing an IPv6 Prefix Information Option (PIO) that enables IPv6 devices on the link to
|
||||
* self-configure their own routable unicast IPv6 address, this address can be used by Thread devices to reach AIL. If
|
||||
* Border Router finds no such RA message on AIL, it generates a ULA on-link prefix which it then advertises on AIL in
|
||||
* the emitted RA messages.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This structure represents an iterator to iterate through the Border Router's discovered prefix table.
|
||||
*
|
||||
* The fields in this type are opaque (intended for use by OpenThread core only) and therefore should not be
|
||||
* accessed or used by caller.
|
||||
*
|
||||
* Before using an iterator, it MUST be initialized using `otBorderRoutingPrefixTableInitIterator()`.
|
||||
*
|
||||
*/
|
||||
typedef struct otBorderRoutingPrefixTableIterator
|
||||
{
|
||||
const void *mPtr1;
|
||||
const void *mPtr2;
|
||||
uint32_t mData32;
|
||||
} otBorderRoutingPrefixTableIterator;
|
||||
|
||||
/**
|
||||
* This structure represents an entry from the discovered prefix table.
|
||||
*
|
||||
* The entries in the discovered table track the Prefix/Route Info Options in the received Router Advertisement messages
|
||||
* from other routers on infrastructure link.
|
||||
*
|
||||
*/
|
||||
typedef struct otBorderRoutingPrefixTableEntry
|
||||
{
|
||||
otIp6Address mRouterAddress; ///< IPv6 address of the router.
|
||||
otIp6Prefix mPrefix; ///< The discovered IPv6 prefix.
|
||||
bool mIsOnLink; ///< Indicates whether the prefix is on-link or route prefix.
|
||||
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update of this prefix.
|
||||
uint32_t mValidLifetime; ///< Valid lifetime of the prefix (in seconds).
|
||||
otRoutePreference mRoutePreference; ///< Route preference when `mIsOnlink` is false.
|
||||
uint32_t mPreferredLifetime; ///< Preferred lifetime of the on-link prefix when `mIsOnLink` is true.
|
||||
} otBorderRoutingPrefixTableEntry;
|
||||
|
||||
/**
|
||||
* This method initializes the Border Routing Manager on given infrastructure interface.
|
||||
*
|
||||
* @note This method MUST be called before any other otBorderRouting* APIs.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aInfraIfIndex The infrastructure interface index.
|
||||
* @param[in] aInfraIfIsRunning A boolean that indicates whether the infrastructure
|
||||
* interface is running.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started the Border Routing Manager on given infrastructure.
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager has already been initialized.
|
||||
* @retval OT_ERROR_INVALID_ARGS The index of the infrastructure interface is not valid.
|
||||
* @retval OT_ERROR_FAILED Internal failure. Usually due to failure in generating random prefixes.
|
||||
*
|
||||
* @sa otPlatInfraIfStateChanged.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingInit(otInstance *aInstance, uint32_t aInfraIfIndex, bool aInfraIfIsRunning);
|
||||
|
||||
/**
|
||||
* Enables or disables the Border Routing Manager.
|
||||
*
|
||||
* @note The Border Routing Manager is disabled by default.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled A boolean to enable/disable the routing manager.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully enabled/disabled the Border Routing Manager.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingSetEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function gets the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in
|
||||
* Router Advertisement messages sent over the infrastructure link.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The OMR prefix advertisement preference.
|
||||
*
|
||||
*/
|
||||
otRoutePreference otBorderRoutingGetRouteInfoOptionPreference(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the preference to use when advertising Route Info Options in Router Advertisement messages sent
|
||||
* over the infrastructure link, for example for discovered OMR prefixes.
|
||||
*
|
||||
* By default BR will use `medium` preference level, but this function allows the default value to be changed. As an
|
||||
* example, it can be set to `low` preference in the case where device is a temporary BR (a mobile BR or a
|
||||
* battery-powered BR) to indicate that other BRs (if any) should be preferred over this BR on the infrastructure link.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPreference The route preference to use.
|
||||
*
|
||||
*/
|
||||
void otBorderRoutingSetRouteInfoOptionPreference(otInstance *aInstance, otRoutePreference aPreference);
|
||||
|
||||
/**
|
||||
* Gets the local Off-Mesh-Routable (OMR) Prefix, for example `fdfc:1ff5:1512:5622::/64`.
|
||||
*
|
||||
* An OMR Prefix is a randomly generated 64-bit prefix that's published in the
|
||||
* Thread network if there isn't already an OMR prefix. This prefix can be reached
|
||||
* from the local Wi-Fi or Ethernet network.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to where the prefix will be output to.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the OMR prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* Gets the currently favored Off-Mesh-Routable (OMR) Prefix.
|
||||
*
|
||||
* The favored OMR prefix can be discovered from Network Data or can be this device's local OMR prefix.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to output the favored OMR prefix.
|
||||
* @param[out] aPreference A pointer to output the preference associated the favored prefix.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the favored OMR prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetFavoredOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix, otRoutePreference *aPreference);
|
||||
|
||||
/**
|
||||
* Gets the On-Link Prefix for the adjacent infrastructure link, for example `fd41:2650:a6f5:0::/64`.
|
||||
*
|
||||
* An On-Link Prefix is a 64-bit prefix that's advertised on the infrastructure link if there isn't already a usable
|
||||
* on-link prefix being advertised on the link.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to where the prefix will be output to.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the on-link prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetOnLinkPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* Gets the local NAT64 Prefix of the Border Router.
|
||||
*
|
||||
* NAT64 Prefix might not be advertised in the Thread network.
|
||||
*
|
||||
* `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` must be enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to where the prefix will be output to.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the NAT64 prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* Gets the currently favored NAT64 prefix.
|
||||
*
|
||||
* The favored NAT64 prefix can be discovered from infrastructure link or can be this device's local NAT64 prefix.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPrefix A pointer to output the favored NAT64 prefix.
|
||||
* @param[out] aPreference A pointer to output the preference associated the favored prefix.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the favored NAT64 prefix.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetFavoredNat64Prefix(otInstance * aInstance,
|
||||
otIp6Prefix * aPrefix,
|
||||
otRoutePreference *aPreference);
|
||||
|
||||
/**
|
||||
* This function initializes an `otBorderRoutingPrefixTableIterator`.
|
||||
*
|
||||
* An iterator MUST be initialized before it is used.
|
||||
*
|
||||
* An iterator can be initialized again to restart from the beginning of the table.
|
||||
*
|
||||
* When iterating over entries in the table, to ensure the update times `mMsecSinceLastUpdate` of entries are
|
||||
* consistent, they are given relative to the time the iterator was initialized.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance.
|
||||
* @param[out] aIterator A pointer to the iterator to initialize.
|
||||
*
|
||||
*/
|
||||
void otBorderRoutingPrefixTableInitIterator(otInstance *aInstance, otBorderRoutingPrefixTableIterator *aIterator);
|
||||
|
||||
/**
|
||||
* This function iterates over the entries in the Border Router's discovered prefix table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance.
|
||||
* @param[in,out] aIterator A pointer to the iterator.
|
||||
* @param[out] aEntry A pointer to the entry to populate.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Iterated to the next entry, @p aEntry and @p aIterator are updated.
|
||||
* @retval OT_ERROR_NOT_FOUND No more entries in the table.
|
||||
*
|
||||
*/
|
||||
otError otBorderRoutingGetNextPrefixTableEntry(otInstance * aInstance,
|
||||
otBorderRoutingPrefixTableIterator *aIterator,
|
||||
otBorderRoutingPrefixTableEntry * aEntry);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_BORDER_ROUTING_H_
|
||||
@@ -55,12 +55,12 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function requests a Thread network channel change.
|
||||
* Requests a Thread network channel change.
|
||||
*
|
||||
* The network switches to the given channel after a specified delay (see otChannelManagerSetDelay()). The channel
|
||||
* The network switches to the given channel after a specified delay (see #otChannelManagerSetDelay()). The channel
|
||||
* change is performed by updating the Pending Operational Dataset.
|
||||
*
|
||||
* A subsequent call to this function will cancel an ongoing previously requested channel change.
|
||||
* A subsequent call will cancel an ongoing previously requested channel change.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChannel The new channel for the Thread network.
|
||||
@@ -87,9 +87,9 @@ uint8_t otChannelManagerGetRequestedChannel(otInstance *aInstance);
|
||||
uint16_t otChannelManagerGetDelay(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the delay (in seconds) used for a channel change.
|
||||
* Sets the delay (in seconds) used for a channel change.
|
||||
*
|
||||
* The delay should preferably be longer than maximum data poll interval used by all sleepy-end-devices within the
|
||||
* The delay should preferably be longer than the maximum data poll interval used by all sleepy-end-devices within the
|
||||
* Thread network.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
@@ -105,7 +105,7 @@ otError otChannelManagerSetDelay(otInstance *aInstance, uint16_t aDelay);
|
||||
* This function requests that `ChannelManager` checks and selects a new channel and starts a channel change.
|
||||
*
|
||||
* Unlike the `otChannelManagerRequestChannelChange()` where the channel must be given as a parameter, this function
|
||||
* asks the `ChannelManager` to select a channel by itself (based of collected channel quality info).
|
||||
* asks the `ChannelManager` to select a channel by itself (based on collected channel quality info).
|
||||
*
|
||||
* Once called, the Channel Manager will perform the following 3 steps:
|
||||
*
|
||||
@@ -132,7 +132,7 @@ otError otChannelManagerSetDelay(otInstance *aInstance, uint16_t aDelay);
|
||||
otError otChannelManagerRequestChannelSelect(otInstance *aInstance, bool aSkipQualityCheck);
|
||||
|
||||
/**
|
||||
* This function enables/disables the auto-channel-selection functionality.
|
||||
* Enables or disables the auto-channel-selection functionality.
|
||||
*
|
||||
* When enabled, `ChannelManager` will periodically invoke a `RequestChannelSelect(false)`. The period interval
|
||||
* can be set by `SetAutoChannelSelectionInterval()`.
|
||||
@@ -154,7 +154,7 @@ void otChannelManagerSetAutoChannelSelectionEnabled(otInstance *aInstance, bool
|
||||
bool otChannelManagerGetAutoChannelSelectionEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the period interval (in seconds) used by auto-channel-selection functionality.
|
||||
* Sets the period interval (in seconds) used by auto-channel-selection functionality.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aInterval The interval in seconds.
|
||||
@@ -176,7 +176,7 @@ otError otChannelManagerSetAutoChannelSelectionInterval(otInstance *aInstance, u
|
||||
uint32_t otChannelManagerGetAutoChannelSelectionInterval(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function gets the supported channel mask.
|
||||
* Gets the supported channel mask.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -186,7 +186,7 @@ uint32_t otChannelManagerGetAutoChannelSelectionInterval(otInstance *aInstance);
|
||||
uint32_t otChannelManagerGetSupportedChannels(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the supported channel mask.
|
||||
* Sets the supported channel mask.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChannelMask A channel mask.
|
||||
@@ -195,7 +195,7 @@ uint32_t otChannelManagerGetSupportedChannels(otInstance *aInstance);
|
||||
void otChannelManagerSetSupportedChannels(otInstance *aInstance, uint32_t aChannelMask);
|
||||
|
||||
/**
|
||||
* This function gets the favored channel mask.
|
||||
* Gets the favored channel mask.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -205,7 +205,7 @@ void otChannelManagerSetSupportedChannels(otInstance *aInstance, uint32_t aChann
|
||||
uint32_t otChannelManagerGetFavoredChannels(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the favored channel mask.
|
||||
* Sets the favored channel mask.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChannelMask A channel mask.
|
||||
@@ -214,7 +214,7 @@ uint32_t otChannelManagerGetFavoredChannels(otInstance *aInstance);
|
||||
void otChannelManagerSetFavoredChannels(otInstance *aInstance, uint32_t aChannelMask);
|
||||
|
||||
/**
|
||||
* This function gets the CCA failure rate threshold
|
||||
* Gets the CCA failure rate threshold.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -224,7 +224,7 @@ void otChannelManagerSetFavoredChannels(otInstance *aInstance, uint32_t aChannel
|
||||
uint16_t otChannelManagerGetCcaFailureRateThreshold(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the CCA failure rate threshold
|
||||
* Sets the CCA failure rate threshold.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold A CCA failure rate threshold. Value 0 maps to 0% and 0xffff maps to 100%.
|
||||
|
||||
@@ -64,13 +64,13 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function enables/disables the Channel Monitoring operation.
|
||||
* Enables or disables the Channel Monitoring operation.
|
||||
*
|
||||
* Once operation starts, any previously collected data is cleared. However, after operation is disabled, the previous
|
||||
* collected data is still valid and can be read.
|
||||
*
|
||||
* @note OpenThread core internally enables/disables the Channel Monitoring operation when the IPv6 interface is
|
||||
* brought up/down (i.e., call to `otIp6SetEnabled()`).
|
||||
* @note OpenThread core internally enables or disables the Channel Monitoring operation when the IPv6 interface is
|
||||
* brought up or down, for example in a call to `otIp6SetEnabled()`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE to enable/start Channel Monitoring operation, FALSE to disable/stop it.
|
||||
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the child supervision interval (in seconds).
|
||||
* Gets the child supervision interval (in seconds).
|
||||
*
|
||||
* Child supervision feature provides a mechanism for parent to ensure that a message is sent to each sleepy child
|
||||
* within the supervision interval. If there is no transmission to the child within the supervision interval,
|
||||
@@ -69,7 +69,7 @@ extern "C" {
|
||||
uint16_t otChildSupervisionGetInterval(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the child supervision interval (in seconds).
|
||||
* Sets the child supervision interval (in seconds).
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aInterval The supervision interval (in seconds). Zero to disable supervision on parent.
|
||||
@@ -78,7 +78,7 @@ uint16_t otChildSupervisionGetInterval(otInstance *aInstance);
|
||||
void otChildSupervisionSetInterval(otInstance *aInstance, uint16_t aInterval);
|
||||
|
||||
/**
|
||||
* Get the supervision check timeout interval (in seconds).
|
||||
* Gets the supervision check timeout interval (in seconds).
|
||||
*
|
||||
* If the device is a sleepy child and it does not hear from its parent within the specified check timeout, it initiates
|
||||
* the re-attach process (MLE Child Update Request/Response exchange with its parent).
|
||||
@@ -91,7 +91,7 @@ void otChildSupervisionSetInterval(otInstance *aInstance, uint16_t aInterval);
|
||||
uint16_t otChildSupervisionGetCheckTimeout(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the supervision check timeout interval (in seconds).
|
||||
* Sets the supervision check timeout interval (in seconds).
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTimeout The check timeout (in seconds). Zero to disable supervision check on the child.
|
||||
|
||||
@@ -52,9 +52,9 @@ extern "C" {
|
||||
typedef struct otCliCommand
|
||||
{
|
||||
const char *mName; ///< A pointer to the command string.
|
||||
void (*mCommand)(void * aContext,
|
||||
uint8_t aArgsLength,
|
||||
char * aArgs[]); ///< A function pointer to process the command.
|
||||
otError (*mCommand)(void * aContext,
|
||||
uint8_t aArgsLength,
|
||||
char * aArgs[]); ///< A function pointer to process the command.
|
||||
} otCliCommand;
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,6 +49,8 @@ extern "C" {
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* For FTD and MTD builds, the Operational Dataset API includes functions to manage Active and Pending datasets
|
||||
* and dataset TLVs.
|
||||
*/
|
||||
|
||||
#define OT_NETWORK_KEY_SIZE 16 ///< Size of the Thread Network Key (bytes)
|
||||
@@ -339,7 +341,7 @@ typedef void (*otDatasetMgmtSetCallback)(otError aResult, void *aContext);
|
||||
bool otDatasetIsCommissioned(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function gets the Active Operational Dataset.
|
||||
* Gets the Active Operational Dataset.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aDataset A pointer to where the Active Operational Dataset will be placed.
|
||||
@@ -363,7 +365,7 @@ otError otDatasetGetActive(otInstance *aInstance, otOperationalDataset *aDataset
|
||||
otError otDatasetGetActiveTlvs(otInstance *aInstance, otOperationalDatasetTlvs *aDataset);
|
||||
|
||||
/**
|
||||
* This function sets the Active Operational Dataset.
|
||||
* Sets the Active Operational Dataset.
|
||||
*
|
||||
* If the dataset does not include an Active Timestamp, the dataset is only partially complete.
|
||||
*
|
||||
@@ -439,7 +441,7 @@ otError otDatasetGetPending(otInstance *aInstance, otOperationalDataset *aDatase
|
||||
otError otDatasetGetPendingTlvs(otInstance *aInstance, otOperationalDatasetTlvs *aDataset);
|
||||
|
||||
/**
|
||||
* This function sets the Pending Operational Dataset.
|
||||
* Sets the Pending Operational Dataset.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDataset A pointer to the Pending Operational Dataset.
|
||||
@@ -465,7 +467,7 @@ otError otDatasetSetPending(otInstance *aInstance, const otOperationalDataset *a
|
||||
otError otDatasetSetPendingTlvs(otInstance *aInstance, const otOperationalDatasetTlvs *aDataset);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_ACTIVE_GET.
|
||||
* Sends MGMT_ACTIVE_GET.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDatasetComponents A pointer to a Dataset Components structure specifying which components to request.
|
||||
@@ -484,7 +486,7 @@ otError otDatasetSendMgmtActiveGet(otInstance * aInstan
|
||||
const otIp6Address * aAddress);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_ACTIVE_SET.
|
||||
* Sends MGMT_ACTIVE_SET.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDataset A pointer to operational dataset.
|
||||
@@ -506,7 +508,7 @@ otError otDatasetSendMgmtActiveSet(otInstance * aInstance,
|
||||
void * aContext);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_PENDING_GET.
|
||||
* Sends MGMT_PENDING_GET.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDatasetComponents A pointer to a Dataset Components structure specifying which components to request.
|
||||
@@ -525,7 +527,7 @@ otError otDatasetSendMgmtPendingGet(otInstance * aInsta
|
||||
const otIp6Address * aAddress);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_PENDING_SET.
|
||||
* Sends MGMT_PENDING_SET.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDataset A pointer to operational dataset.
|
||||
@@ -566,9 +568,9 @@ otError otDatasetGeneratePskc(const char * aPassPhrase,
|
||||
otPskc * aPskc);
|
||||
|
||||
/**
|
||||
* This function sets an `otNetworkName` instance from a given null terminated C string.
|
||||
* Sets an `otNetworkName` instance from a given null terminated C string.
|
||||
*
|
||||
* This function also validates that the given @p aNameString follows UTF-8 encoding and its length is not longer than
|
||||
* @p aNameString must follow UTF-8 encoding and the Network Name length must not be longer than
|
||||
* `OT_NETWORK_NAME_MAX_SIZE`.
|
||||
*
|
||||
* @param[out] aNetworkName A pointer to the `otNetworkName` to set.
|
||||
|
||||
@@ -50,7 +50,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method creates a new Operational Dataset to use when forming a new network.
|
||||
* For FTD only, creates a new Operational Dataset to use when forming a new network.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aDataset The Operational Dataset.
|
||||
@@ -62,7 +62,7 @@ extern "C" {
|
||||
otError otDatasetCreateNewNetwork(otInstance *aInstance, otOperationalDataset *aDataset);
|
||||
|
||||
/**
|
||||
* Get minimal delay timer.
|
||||
* For FTD only, gets a minimal delay timer.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -72,7 +72,7 @@ otError otDatasetCreateNewNetwork(otInstance *aInstance, otOperationalDataset *a
|
||||
uint32_t otDatasetGetDelayTimerMinimal(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set minimal delay timer.
|
||||
* For FTD only, sets a minimal delay timer.
|
||||
*
|
||||
* @note This API is reserved for testing and demo purposes only. Changing settings with
|
||||
* this API will render a production application non-compliant with the Thread Specification.
|
||||
|
||||
@@ -45,20 +45,18 @@ extern "C" {
|
||||
/**
|
||||
* @addtogroup api-operational-dataset
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions for Dataset Updater.
|
||||
*
|
||||
* The functions in this module are available when Dataset Updater feature is enabled (i.e.
|
||||
* `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is set to 1). Further this feature is available only on an FTD build.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* For FTD builds only, Dataset Updater includes functions to manage dataset updates.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This callback function pointer is called when a Dataset update request finishes, reporting success or failure status
|
||||
* of the Dataset update request.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aError The error status.
|
||||
* OT_ERROR_NONE indicates successful Dataset update.
|
||||
* OT_ERROR_INVALID_STATE indicates failure due invalid state (MLE being disabled).
|
||||
@@ -73,6 +71,8 @@ typedef void (*otDatasetUpdaterCallback)(otError aError, void *aContext);
|
||||
/**
|
||||
* This function requests an update to Operational Dataset.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.
|
||||
*
|
||||
* @p aDataset should contain the fields to be updated and their new value. It must not contain Active or Pending
|
||||
* Timestamp fields. The Delay field is optional, if not provided a default value (1000 ms) would be used.
|
||||
*
|
||||
@@ -96,6 +96,8 @@ otError otDatasetUpdaterRequestUpdate(otInstance * aInstance,
|
||||
/**
|
||||
* This function cancels an ongoing (if any) Operational Dataset update request.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
*/
|
||||
@@ -104,6 +106,8 @@ void otDatasetUpdaterCancelUpdate(otInstance *aInstance);
|
||||
/**
|
||||
* This function indicates whether there is an ongoing Operation Dataset update request.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE There is an ongoing update.
|
||||
|
||||
@@ -85,8 +85,13 @@ otError otDiagProcessCmd(otInstance *aInstance,
|
||||
* @param[out] aOutput The diagnostics execution result.
|
||||
* @param[in] aOutputMaxLen The output buffer size.
|
||||
*
|
||||
* @retval OT_ERROR_NONE The command is successfully process.
|
||||
* @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.
|
||||
* @retval OT_ERROR_NO_BUFS The command string is too long.
|
||||
*
|
||||
*/
|
||||
void otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen);
|
||||
otError otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the factory diagnostics mode is enabled.
|
||||
|
||||
@@ -323,7 +323,8 @@ typedef struct otDnsServiceInfo
|
||||
otIp6Address mHostAddress; ///< The host IPv6 address. Set to all zero if not available.
|
||||
uint32_t mHostAddressTtl; ///< The host address TTL.
|
||||
uint8_t * mTxtData; ///< Buffer to output TXT data (can be NULL if not needed).
|
||||
uint16_t mTxtDataSize; ///< On input, size of `mTxtData` buffer. On output `mTxtData` length.
|
||||
uint16_t mTxtDataSize; ///< On input, size of `mTxtData` buffer. On output number bytes written.
|
||||
bool mTxtDataTruncated; ///< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated.
|
||||
uint32_t mTxtDataTtl; ///< The TXT data TTL.
|
||||
} otDnsServiceInfo;
|
||||
|
||||
@@ -408,6 +409,7 @@ otError otDnsBrowseResponseGetServiceInstance(const otDnsBrowseResponse *aRespon
|
||||
* - If no matching SRV record is found in @p aResponse, `OT_ERROR_NOT_FOUND` is returned.
|
||||
* - If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated and `OT_ERROR_NONE` is returned.
|
||||
* - If no matching TXT record is found in @p aResponse, `mTxtDataSize` in @p aServiceInfo is set to zero.
|
||||
* - If TXT data length is greater than `mTxtDataSize`, it is read partially and `mTxtDataTruncated` is set to true.
|
||||
* - If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.
|
||||
* - If there are multiple AAAA records for the host name in @p aResponse, `mHostAddress` is set to the first one. The
|
||||
* other addresses can be retrieved using `otDnsBrowseResponseGetHostAddress()`.
|
||||
@@ -537,6 +539,7 @@ otError otDnsServiceResponseGetServiceName(const otDnsServiceResponse *aResponse
|
||||
* - If no matching SRV record is found in @p aResponse, `OT_ERROR_NOT_FOUND` is returned.
|
||||
* - If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated and `OT_ERROR_NONE` is returned.
|
||||
* - If no matching TXT record is found in @p aResponse, `mTxtDataSize` in @p aServiceInfo is set to zero.
|
||||
* - If TXT data length is greater than `mTxtDataSize`, it is read partially and `mTxtDataTruncated` is set to true.
|
||||
* - If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.
|
||||
* - If there are multiple AAAA records for the host name in @p aResponse, `mHostAddress` is set to the first one. The
|
||||
* other addresses can be retrieved using `otDnsServiceResponseGetHostAddress()`.
|
||||
|
||||
@@ -66,6 +66,8 @@ typedef enum otIcmp6Type
|
||||
OT_ICMP6_TYPE_ECHO_REPLY = 129, ///< Echo Reply
|
||||
OT_ICMP6_TYPE_ROUTER_SOLICIT = 133, ///< Router Solicitation
|
||||
OT_ICMP6_TYPE_ROUTER_ADVERT = 134, ///< Router Advertisement
|
||||
OT_ICMP6_TYPE_NEIGHBOR_SOLICIT = 135, ///< Neighbor Solicitation
|
||||
OT_ICMP6_TYPE_NEIGHBOR_ADVERT = 136, ///< Neighbor Advertisement
|
||||
} otIcmp6Type;
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (223)
|
||||
#define OPENTHREAD_API_VERSION (257)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
@@ -250,7 +250,7 @@ void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback a
|
||||
void otInstanceReset(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This method deletes all the settings stored on non-volatile memory, and then triggers platform reset.
|
||||
* Deletes all the settings stored on non-volatile memory, and then triggers a platform reset.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
|
||||
+26
-15
@@ -257,9 +257,9 @@ enum
|
||||
};
|
||||
|
||||
/**
|
||||
* This function brings up/down the IPv6 interface.
|
||||
* Brings the IPv6 interface up or down.
|
||||
*
|
||||
* Call this function to enable/disable IPv6 communication.
|
||||
* Call this to enable or disable IPv6 communication.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE to enable IPv6, FALSE otherwise.
|
||||
@@ -272,7 +272,7 @@ enum
|
||||
otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the IPv6 interface is up.
|
||||
* Indicates whether or not the IPv6 interface is up.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -283,10 +283,10 @@ otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled);
|
||||
bool otIp6IsEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Add a Network Interface Address to the Thread interface.
|
||||
* Adds a Network Interface Address to the Thread interface.
|
||||
*
|
||||
* The passed-in instance @p aAddress is copied by the Thread interface. The Thread interface only
|
||||
* supports a fixed number of externally added unicast addresses. See OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS.
|
||||
* supports a fixed number of externally added unicast addresses. See `OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aAddress A pointer to a Network Interface Address.
|
||||
@@ -298,7 +298,7 @@ bool otIp6IsEnabled(otInstance *aInstance);
|
||||
otError otIp6AddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAddress);
|
||||
|
||||
/**
|
||||
* Remove a Network Interface Address from the Thread interface.
|
||||
* Removes a Network Interface Address from the Thread interface.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aAddress A pointer to an IP Address.
|
||||
@@ -310,7 +310,7 @@ otError otIp6AddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAdd
|
||||
otError otIp6RemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAddress);
|
||||
|
||||
/**
|
||||
* Get the list of IPv6 addresses assigned to the Thread interface.
|
||||
* Gets the list of IPv6 addresses assigned to the Thread interface.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -319,10 +319,10 @@ otError otIp6RemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAd
|
||||
const otNetifAddress *otIp6GetUnicastAddresses(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Subscribe the Thread interface to a Network Interface Multicast Address.
|
||||
* Subscribes the Thread interface to a Network Interface Multicast Address.
|
||||
*
|
||||
* The passed in instance @p aAddress will be copied by the Thread interface. The Thread interface only
|
||||
* supports a fixed number of externally added multicast addresses. See OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS.
|
||||
* supports a fixed number of externally added multicast addresses. See `OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aAddress A pointer to an IP Address.
|
||||
@@ -338,7 +338,7 @@ const otNetifAddress *otIp6GetUnicastAddresses(otInstance *aInstance);
|
||||
otError otIp6SubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress);
|
||||
|
||||
/**
|
||||
* Unsubscribe the Thread interface to a Network Interface Multicast Address.
|
||||
* Unsubscribes the Thread interface to a Network Interface Multicast Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aAddress A pointer to an IP Address.
|
||||
@@ -351,7 +351,7 @@ otError otIp6SubscribeMulticastAddress(otInstance *aInstance, const otIp6Address
|
||||
otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress);
|
||||
|
||||
/**
|
||||
* Get the list of IPv6 multicast addresses subscribed to the Thread interface.
|
||||
* Gets the list of IPv6 multicast addresses subscribed to the Thread interface.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -361,7 +361,7 @@ otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Addre
|
||||
const otNetifMulticastAddress *otIp6GetMulticastAddresses(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Check if multicast promiscuous mode is enabled on the Thread interface.
|
||||
* Checks if multicast promiscuous mode is enabled on the Thread interface.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -371,7 +371,7 @@ const otNetifMulticastAddress *otIp6GetMulticastAddresses(otInstance *aInstance)
|
||||
bool otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable multicast promiscuous mode on the Thread interface.
|
||||
* Enables or disables multicast promiscuous mode on the Thread interface.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE to enable Multicast Promiscuous mode, FALSE otherwise.
|
||||
@@ -638,8 +638,9 @@ void otIp6AddressToString(const otIp6Address *aAddress, char *aBuffer, uint16_t
|
||||
/**
|
||||
* This function converts a given IPv6 socket address to a human-readable string.
|
||||
*
|
||||
* The IPv6 socket address string is formatted as "[<address>]:<port>" where `<address> is shown as 16 hex values
|
||||
* separated by ':' and `<port>` is the port number in decimal format (i.e., "[%x:%x:...:%x]:%u")
|
||||
* The IPv6 socket address string is formatted as [`address`]:`port` where `address` is shown
|
||||
* as 16 hex values separated by `:` and `port` is the port number in decimal format,
|
||||
* for example "[%x:%x:...:%x]:%u".
|
||||
*
|
||||
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated
|
||||
* but the outputted string is always null-terminated.
|
||||
@@ -679,6 +680,16 @@ void otIp6PrefixToString(const otIp6Prefix *aPrefix, char *aBuffer, uint16_t aSi
|
||||
*/
|
||||
uint8_t otIp6PrefixMatch(const otIp6Address *aFirst, const otIp6Address *aSecond);
|
||||
|
||||
/**
|
||||
* This method gets a prefix with @p aLength from @p aAddress.
|
||||
*
|
||||
* @param[in] aAddress A pointer to an IPv6 address.
|
||||
* @param[in] aLength The length of prefix in bits.
|
||||
* @param[out] aPrefix A pointer to output the IPv6 prefix.
|
||||
*
|
||||
*/
|
||||
void otIp6GetPrefix(const otIp6Address *aAddress, uint8_t aLength, otIp6Prefix *aPrefix);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not a given IPv6 address is the Unspecified Address.
|
||||
*
|
||||
|
||||
@@ -565,7 +565,7 @@ uint32_t otLinkGetSupportedChannelMask(otInstance *aInstance);
|
||||
otError otLinkSetSupportedChannelMask(otInstance *aInstance, uint32_t aChannelMask);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Extended Address.
|
||||
* Gets the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -575,9 +575,9 @@ otError otLinkSetSupportedChannelMask(otInstance *aInstance, uint32_t aChannelMa
|
||||
const otExtAddress *otLinkGetExtendedAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the IEEE 802.15.4 Extended Address.
|
||||
* Sets the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* This function succeeds only when Thread protocols are disabled.
|
||||
* @note Only succeeds when Thread protocols are disabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address.
|
||||
@@ -965,7 +965,7 @@ void otLinkResetTxRetrySuccessHistogram(otInstance *aInstance);
|
||||
const otMacCounters *otLinkGetCounters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Reset the MAC layer counters.
|
||||
* Resets the MAC layer counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -1034,7 +1034,7 @@ otError otLinkSetPromiscuous(otInstance *aInstance, bool aPromiscuous);
|
||||
uint8_t otLinkCslGetChannel(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the CSL channel.
|
||||
* Sets the CSL channel.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChannel The CSL sample channel. Channel value should be `0` (Set CSL Channel unspecified) or
|
||||
@@ -1057,7 +1057,7 @@ otError otLinkCslSetChannel(otInstance *aInstance, uint8_t aChannel);
|
||||
uint16_t otLinkCslGetPeriod(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the CSL period.
|
||||
* Sets the CSL period in units of 10 symbols. Disable CSL by setting this parameter to `0`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPeriod The CSL period in units of 10 symbols.
|
||||
@@ -1079,7 +1079,7 @@ otError otLinkCslSetPeriod(otInstance *aInstance, uint16_t aPeriod);
|
||||
uint32_t otLinkCslGetTimeout(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the CSL timeout.
|
||||
* Sets the CSL timeout in seconds.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTimeout The CSL timeout in seconds.
|
||||
|
||||
@@ -170,7 +170,7 @@ otError otLinkMetricsQuery(otInstance * aInstance,
|
||||
void * aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function sends an MLE Link Metrics Management Request to configure/clear a Forward Tracking Series.
|
||||
* Sends an MLE Link Metrics Management Request to configure or clear a Forward Tracking Series.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDestination A pointer to the destination address.
|
||||
@@ -228,7 +228,7 @@ otError otLinkMetricsConfigEnhAckProbing(otInstance *
|
||||
void * aEnhAckCallbackContext);
|
||||
|
||||
/**
|
||||
* This function sends an MLE Link Probe message.
|
||||
* Sends an MLE Link Probe message.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDestination A pointer to the destination address.
|
||||
|
||||
@@ -287,8 +287,8 @@ typedef struct otMessageQueueInfo
|
||||
*/
|
||||
typedef struct otBufferInfo
|
||||
{
|
||||
uint16_t mTotalBuffers; ///< The total number of buffers in the messages pool.
|
||||
uint16_t mFreeBuffers; ///< The number of free buffers.
|
||||
uint16_t mTotalBuffers; ///< The total number of buffers in the messages pool (0xffff if unknown).
|
||||
uint16_t mFreeBuffers; ///< The number of free buffers (0xffff if unknown).
|
||||
otMessageQueueInfo m6loSendQueue; ///< Info about 6LoWPAN send queue.
|
||||
otMessageQueueInfo m6loReassemblyQueue; ///< Info about 6LoWPAN reassembly queue.
|
||||
otMessageQueueInfo mIp6Queue; ///< Info about IPv6 send queue.
|
||||
|
||||
@@ -0,0 +1,489 @@
|
||||
/*
|
||||
* Copyright (c) 2022, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
* This file defines the OpenThread API for NAT64 on a border router.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_NAT64_H_
|
||||
#define OPENTHREAD_NAT64_H_
|
||||
|
||||
#include <openthread/ip6.h>
|
||||
#include <openthread/message.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup api-nat64
|
||||
*
|
||||
* @brief This module includes functions and structs for the NAT64 function on the border router. These functions are
|
||||
* only available when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
#define OT_IP4_ADDRESS_SIZE 4 ///< Size of an IPv4 address (bytes)
|
||||
|
||||
/**
|
||||
* @struct otIp4Address
|
||||
*
|
||||
* This structure represents an IPv4 address.
|
||||
*
|
||||
*/
|
||||
OT_TOOL_PACKED_BEGIN
|
||||
struct otIp4Address
|
||||
{
|
||||
union OT_TOOL_PACKED_FIELD
|
||||
{
|
||||
uint8_t m8[OT_IP4_ADDRESS_SIZE]; ///< 8-bit fields
|
||||
uint32_t m32; ///< 32-bit representation
|
||||
} mFields;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
/**
|
||||
* This structure represents an IPv4 address.
|
||||
*
|
||||
*/
|
||||
typedef struct otIp4Address otIp4Address;
|
||||
|
||||
/**
|
||||
* @struct otIp4Cidr
|
||||
*
|
||||
* This structure represents an IPv4 CIDR block.
|
||||
*
|
||||
*/
|
||||
typedef struct otIp4Cidr
|
||||
{
|
||||
otIp4Address mAddress;
|
||||
uint8_t mLength;
|
||||
} otIp4Cidr;
|
||||
|
||||
/**
|
||||
* Represents the counters for NAT64.
|
||||
*
|
||||
*/
|
||||
typedef struct otNat64Counters
|
||||
{
|
||||
uint64_t m4To6Packets; ///< Number of packets translated from IPv4 to IPv6.
|
||||
uint64_t m4To6Bytes; ///< Sum of size of packets translated from IPv4 to IPv6.
|
||||
uint64_t m6To4Packets; ///< Number of packets translated from IPv6 to IPv4.
|
||||
uint64_t m6To4Bytes; ///< Sum of size of packets translated from IPv6 to IPv4.
|
||||
} otNat64Counters;
|
||||
|
||||
/**
|
||||
* Represents the counters for the protocols supported by NAT64.
|
||||
*
|
||||
*/
|
||||
typedef struct otNat64ProtocolCounters
|
||||
{
|
||||
otNat64Counters mTotal; ///< Counters for sum of all protocols.
|
||||
otNat64Counters mIcmp; ///< Counters for ICMP and ICMPv6.
|
||||
otNat64Counters mUdp; ///< Counters for UDP.
|
||||
otNat64Counters mTcp; ///< Counters for TCP.
|
||||
} otNat64ProtocolCounters;
|
||||
|
||||
/**
|
||||
* Packet drop reasons.
|
||||
*
|
||||
*/
|
||||
typedef enum otNat64DropReason
|
||||
{
|
||||
OT_NAT64_DROP_REASON_UNKNOWN = 0, ///< Packet drop for unknown reasons.
|
||||
OT_NAT64_DROP_REASON_ILLEGAL_PACKET, ///< Packet drop due to failed to parse the datagram.
|
||||
OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO, ///< Packet drop due to unsupported IP protocol.
|
||||
OT_NAT64_DROP_REASON_NO_MAPPING, ///< Packet drop due to no mappings found or mapping pool exhausted.
|
||||
//---
|
||||
OT_NAT64_DROP_REASON_COUNT,
|
||||
} otNat64DropReason;
|
||||
|
||||
/**
|
||||
* Represents the counters of dropped packets due to errors when handling NAT64 packets.
|
||||
*
|
||||
*/
|
||||
typedef struct otNat64ErrorCounters
|
||||
{
|
||||
uint64_t mCount4To6[OT_NAT64_DROP_REASON_COUNT]; ///< Errors translating IPv4 packets.
|
||||
uint64_t mCount6To4[OT_NAT64_DROP_REASON_COUNT]; ///< Errors translating IPv6 packets.
|
||||
} otNat64ErrorCounters;
|
||||
|
||||
/**
|
||||
* Gets NAT64 translator counters.
|
||||
*
|
||||
* The counter is counted since the instance initialized.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aCounters A pointer to an `otNat64Counters` where the counters of NAT64 translator will be placed.
|
||||
*
|
||||
*/
|
||||
void otNat64GetCounters(otInstance *aInstance, otNat64ProtocolCounters *aCounters);
|
||||
|
||||
/**
|
||||
* Gets the NAT64 translator error counters.
|
||||
*
|
||||
* The counters are initialized to zero when the OpenThread instance is initialized.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aCounters A pointer to an `otNat64Counters` where the counters of NAT64 translator will be placed.
|
||||
*
|
||||
*/
|
||||
void otNat64GetErrorCounters(otInstance *aInstance, otNat64ErrorCounters *aCounters);
|
||||
|
||||
/**
|
||||
* Represents an address mapping record for NAT64.
|
||||
*
|
||||
* @note The counters will be reset for each mapping session even for the same address pair. Applications can use `mId`
|
||||
* to identify different sessions to calculate the packets correctly.
|
||||
*
|
||||
*/
|
||||
typedef struct otNat64AddressMapping
|
||||
{
|
||||
uint64_t mId; ///< The unique id for a mapping session.
|
||||
|
||||
otIp4Address mIp4; ///< The IPv4 address of the mapping.
|
||||
otIp6Address mIp6; ///< The IPv6 address of the mapping.
|
||||
uint32_t mRemainingTimeMs; ///< Remaining time before expiry in milliseconds.
|
||||
|
||||
otNat64ProtocolCounters mCounters;
|
||||
} otNat64AddressMapping;
|
||||
|
||||
/**
|
||||
* Used to iterate through NAT64 address mappings.
|
||||
*
|
||||
* The fields in this type are opaque (intended for use by OpenThread core only) and therefore should not be
|
||||
* accessed or used by caller.
|
||||
*
|
||||
* Before using an iterator, it MUST be initialized using `otNat64AddressMappingIteratorInit()`.
|
||||
*
|
||||
*/
|
||||
typedef struct otNat64AddressMappingIterator
|
||||
{
|
||||
void *mPtr;
|
||||
} otNat64AddressMappingIterator;
|
||||
|
||||
/**
|
||||
* Initializes an `otNat64AddressMappingIterator`.
|
||||
*
|
||||
* An iterator MUST be initialized before it is used.
|
||||
*
|
||||
* An iterator can be initialized again to restart from the beginning of the mapping info.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance.
|
||||
* @param[out] aIterator A pointer to the iterator to initialize.
|
||||
*
|
||||
*/
|
||||
void otNat64InitAddressMappingIterator(otInstance *aInstance, otNat64AddressMappingIterator *aIterator);
|
||||
|
||||
/**
|
||||
* Gets the next AddressMapping info (using an iterator).
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in,out] aIterator A pointer to the iterator. On success the iterator will be updated to point to next
|
||||
* NAT64 address mapping record. To get the first entry the iterator should be set to
|
||||
* OT_NAT64_ADDRESS_MAPPING_ITERATOR_INIT.
|
||||
* @param[out] aMapping A pointer to an `otNat64AddressMapping` where information of next NAT64 address
|
||||
* mapping record is placed (on success).
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully found the next NAT64 address mapping info (@p aMapping was successfully
|
||||
* updated).
|
||||
* @retval OT_ERROR_NOT_FOUND No subsequent NAT64 address mapping info was found.
|
||||
*
|
||||
*/
|
||||
otError otNat64GetNextAddressMapping(otInstance * aInstance,
|
||||
otNat64AddressMappingIterator *aIterator,
|
||||
otNat64AddressMapping * aMapping);
|
||||
|
||||
/**
|
||||
* States of NAT64.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OT_NAT64_STATE_DISABLED = 0, ///< NAT64 is disabled.
|
||||
OT_NAT64_STATE_NOT_RUNNING, ///< NAT64 is enabled, but one or more dependencies of NAT64 are not running.
|
||||
OT_NAT64_STATE_IDLE, ///< NAT64 is enabled, but this BR is not an active NAT64 BR.
|
||||
OT_NAT64_STATE_ACTIVE, ///< The BR is publishing a NAT64 prefix and/or translating packets.
|
||||
} otNat64State;
|
||||
|
||||
/**
|
||||
* Gets the state of NAT64 translator.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval OT_NAT64_STATE_DISABLED NAT64 translator is disabled.
|
||||
* @retval OT_NAT64_STATE_NOT_RUNNING NAT64 translator is enabled, but the translator is not configured with a valid
|
||||
* NAT64 prefix and a CIDR.
|
||||
* @retval OT_NAT64_STATE_ACTIVE NAT64 translator is enabled, and is translating packets.
|
||||
*
|
||||
*/
|
||||
otNat64State otNat64GetTranslatorState(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Gets the state of NAT64 prefix manager.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval OT_NAT64_STATE_DISABLED NAT64 prefix manager is disabled.
|
||||
* @retval OT_NAT64_STATE_NOT_RUNNING NAT64 prefix manager is enabled, but is not running (because the routing manager
|
||||
* is not running).
|
||||
* @retval OT_NAT64_STATE_IDLE NAT64 prefix manager is enabled, but is not publishing a NAT64 prefix. Usually
|
||||
* when there is another border router publishing a NAT64 prefix with higher
|
||||
* priority.
|
||||
* @retval OT_NAT64_STATE_ACTIVE NAT64 prefix manager is enabled, and is publishing NAT64 prefix to the Thread
|
||||
* network.
|
||||
*
|
||||
*/
|
||||
otNat64State otNat64GetPrefixManagerState(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable or disable NAT64 functions.
|
||||
*
|
||||
* Note: This includes the NAT64 Translator (when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled) and the NAT64
|
||||
* Prefix Manager (when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled).
|
||||
*
|
||||
* When `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled, setting disabled to true resets the
|
||||
* mapping table in the translator.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is
|
||||
* enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled A boolean to enable/disable the NAT64 functions
|
||||
*
|
||||
* @sa otNat64GetTranslatorState
|
||||
* @sa otNat64GetPrefixManagerState
|
||||
*
|
||||
*/
|
||||
void otNat64SetEnabled(otInstance *aInstance, bool aEnable);
|
||||
|
||||
/**
|
||||
* Allocate a new message buffer for sending an IPv4 message to the NAT64 translator.
|
||||
*
|
||||
* Message buffers allocated by this function will have 20 bytes (difference between the size of IPv6 headers
|
||||
* and IPv4 header sizes) reserved.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
|
||||
*
|
||||
* @note If @p aSettings is `NULL`, the link layer security is enabled and the message priority is set to
|
||||
* OT_MESSAGE_PRIORITY_NORMAL by default.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aSettings A pointer to the message settings or NULL to set default settings.
|
||||
*
|
||||
* @returns A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.
|
||||
*
|
||||
* @sa otNat64Send
|
||||
*
|
||||
*/
|
||||
otMessage *otIp4NewMessage(otInstance *aInstance, const otMessageSettings *aSettings);
|
||||
|
||||
/**
|
||||
* Sets the CIDR used when setting the source address of the outgoing translated IPv4 packets.
|
||||
*
|
||||
* This function is available only when OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE is enabled.
|
||||
*
|
||||
* @note A valid CIDR must have a non-zero prefix length. The actual addresses pool is limited by the size of the
|
||||
* mapping pool and the number of addresses available in the CIDR block.
|
||||
*
|
||||
* @note This function can be called at any time, but the NAT64 translator will be reset and all existing sessions will
|
||||
* be expired when updating the configured CIDR.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aCidr A pointer to an otIp4Cidr for the IPv4 CIDR block for NAT64.
|
||||
*
|
||||
* @retval OT_ERROR_INVALID_ARGS The given CIDR is not a valid IPv4 CIDR for NAT64.
|
||||
* @retval OT_ERROR_NONE Successfully set the CIDR for NAT64.
|
||||
*
|
||||
* @sa otBorderRouterSend
|
||||
* @sa otBorderRouterSetReceiveCallback
|
||||
*
|
||||
*/
|
||||
otError otNat64SetIp4Cidr(otInstance *aInstance, const otIp4Cidr *aCidr);
|
||||
|
||||
/**
|
||||
* Translates an IPv4 datagram to an IPv6 datagram and sends via the Thread interface.
|
||||
*
|
||||
* The caller transfers ownership of @p aMessage when making this call. OpenThread will free @p aMessage when
|
||||
* processing is complete, including when a value other than `OT_ERROR_NONE` is returned.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMessage A pointer to the message buffer containing the IPv4 datagram.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully processed the message.
|
||||
* @retval OT_ERROR_DROP Message was well-formed but not fully processed due to packet processing
|
||||
* rules.
|
||||
* @retval OT_ERROR_NO_BUFS Could not allocate necessary message buffers when processing the datagram.
|
||||
* @retval OT_ERROR_NO_ROUTE No route to host.
|
||||
* @retval OT_ERROR_INVALID_SOURCE_ADDRESS Source address is invalid, e.g. an anycast address or a multicast address.
|
||||
* @retval OT_ERROR_PARSE Encountered a malformed header when processing the message.
|
||||
*
|
||||
*/
|
||||
otError otNat64Send(otInstance *aInstance, otMessage *aMessage);
|
||||
|
||||
/**
|
||||
* This function pointer is called when an IPv4 datagram (translated by NAT64 translator) is received.
|
||||
*
|
||||
* @param[in] aMessage A pointer to the message buffer containing the received IPv6 datagram. This function transfers
|
||||
* the ownership of the @p aMessage to the receiver of the callback. The message should be
|
||||
* freed by the receiver of the callback after it is processed.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otNat64ReceiveIp4Callback)(otMessage *aMessage, void *aContext);
|
||||
|
||||
/**
|
||||
* Registers a callback to provide received IPv4 datagrams.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aCallback A pointer to a function that is called when an IPv4 datagram is received or
|
||||
* NULL to disable the callback.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
void otNat64SetReceiveIp4Callback(otInstance *aInstance, otNat64ReceiveIp4Callback aCallback, void *aContext);
|
||||
|
||||
/**
|
||||
* Gets the IPv4 CIDR configured in the NAT64 translator.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aCidr A pointer to an otIp4Cidr. Where the CIDR will be filled.
|
||||
*
|
||||
*/
|
||||
otError otNat64GetCidr(otInstance *aInstance, otIp4Cidr *aCidr);
|
||||
|
||||
/**
|
||||
* Test if two IPv4 addresses are the same.
|
||||
*
|
||||
* @param[in] aFirst A pointer to the first IPv4 address to compare.
|
||||
* @param[in] aSecond A pointer to the second IPv4 address to compare.
|
||||
*
|
||||
* @retval TRUE The two IPv4 addresses are the same.
|
||||
* @retval FALSE The two IPv4 addresses are not the same.
|
||||
*
|
||||
*/
|
||||
bool otIp4IsAddressEqual(const otIp4Address *aFirst, const otIp4Address *aSecond);
|
||||
|
||||
/**
|
||||
* Set @p aIp4Address by performing NAT64 address translation from @p aIp6Address as specified
|
||||
* in RFC 6052.
|
||||
*
|
||||
* The NAT64 @p aPrefixLength MUST be one of the following values: 32, 40, 48, 56, 64, or 96, otherwise the behavior
|
||||
* of this method is undefined.
|
||||
*
|
||||
* @param[in] aPrefixLength The prefix length to use for IPv4/IPv6 translation.
|
||||
* @param[in] aIp6Address A pointer to an IPv6 address.
|
||||
* @param[out] aIp4Address A pointer to output the IPv4 address.
|
||||
*
|
||||
*/
|
||||
void otIp4ExtractFromIp6Address(uint8_t aPrefixLength, const otIp6Address *aIp6Address, otIp4Address *aIp4Address);
|
||||
|
||||
#define OT_IP4_ADDRESS_STRING_SIZE 17 ///< Length of 000.000.000.000 plus a suffix NUL
|
||||
|
||||
/**
|
||||
* Converts the address to a string.
|
||||
*
|
||||
* The string format uses quad-dotted notation of four bytes in the address (e.g., "127.0.0.1").
|
||||
*
|
||||
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be
|
||||
* truncated but the outputted string is always null-terminated.
|
||||
*
|
||||
* @param[in] aAddress A pointer to an IPv4 address (MUST NOT be NULL).
|
||||
* @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be `nullptr`).
|
||||
* @param[in] aSize The size of @p aBuffer (in bytes).
|
||||
*
|
||||
*/
|
||||
void otIp4AddressToString(const otIp4Address *aAddress, char *aBuffer, uint16_t aSize);
|
||||
|
||||
#define OT_IP4_CIDR_STRING_SIZE 20 ///< Length of 000.000.000.000/00 plus a suffix NUL
|
||||
|
||||
/**
|
||||
* Converts the IPv4 CIDR to a string.
|
||||
*
|
||||
* The string format uses quad-dotted notation of four bytes in the address with the length of prefix (e.g.,
|
||||
* "127.0.0.1/32").
|
||||
*
|
||||
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be
|
||||
* truncated but the outputted string is always null-terminated.
|
||||
*
|
||||
* @param[in] aCidr A pointer to an IPv4 CIDR (MUST NOT be NULL).
|
||||
* @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be `nullptr`).
|
||||
* @param[in] aSize The size of @p aBuffer (in bytes).
|
||||
*
|
||||
*/
|
||||
void otIp4CidrToString(const otIp4Cidr *aCidr, char *aBuffer, uint16_t aSize);
|
||||
|
||||
/**
|
||||
* Converts a human-readable IPv4 address string into a binary representation.
|
||||
*
|
||||
* @param[in] aString A pointer to a NULL-terminated string.
|
||||
* @param[out] aAddress A pointer to an IPv4 address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully parsed the string.
|
||||
* @retval OT_ERROR_INVALID_ARGS Failed to parse the string.
|
||||
*
|
||||
*/
|
||||
otError otIp4AddressFromString(const char *aString, otIp4Address *aAddress);
|
||||
|
||||
/**
|
||||
* Sets the IPv6 address by performing NAT64 address translation from the preferred NAT64 prefix and the given IPv4
|
||||
* address as specified in RFC 6052.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIp4Address A pointer to the IPv4 address to translate to IPv6.
|
||||
* @param[out] aIp6Address A pointer to the synthesized IPv6 address.
|
||||
*
|
||||
* @returns OT_ERROR_NONE Successfully synthesized the IPv6 address from NAT64 prefix and IPv4 address.
|
||||
* @returns OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data.
|
||||
*
|
||||
*/
|
||||
otError otNat64SynthesizeIp6Address(otInstance *aInstance, const otIp4Address *aIp4Address, otIp6Address *aIp6Address);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_NAT64_H_
|
||||
@@ -129,6 +129,32 @@ void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otErro
|
||||
*/
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the gpio value.
|
||||
*
|
||||
* @param[in] aGpio The gpio number.
|
||||
* @param[in] aValue true to set the gpio to high level, or false otherwise.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the gpio.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on the platform.
|
||||
*
|
||||
*/
|
||||
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue);
|
||||
|
||||
/**
|
||||
* This function gets the gpio value.
|
||||
*
|
||||
* @param[in] aGpio The gpio number.
|
||||
* @param[out] aValue A pointer where to put gpio value.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully got the gpio value.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported or @p aValue is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on the platform.
|
||||
*
|
||||
*/
|
||||
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
@@ -46,6 +46,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup plat-infra-if
|
||||
*
|
||||
* @brief
|
||||
* This module includes the platform abstraction for the adjacent infrastructure network interface.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method tells whether an infra interface has the given IPv6 address assigned.
|
||||
*
|
||||
@@ -123,6 +133,40 @@ extern void otPlatInfraIfRecvIcmp6Nd(otInstance * aInstance,
|
||||
*/
|
||||
extern otError otPlatInfraIfStateChanged(otInstance *aInstance, uint32_t aInfraIfIndex, bool aIsRunning);
|
||||
|
||||
/**
|
||||
* Send a request to discover the NAT64 prefix on the infrastructure interface with @p aInfraIfIndex.
|
||||
*
|
||||
* OpenThread will call this method periodically to monitor the presence or change of NAT64 prefix.
|
||||
*
|
||||
* @param[in] aInfraIfIndex The index of the infrastructure interface to discover the NAT64 prefix.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully request NAT64 prefix discovery.
|
||||
* @retval OT_ERROR_FAILED Failed to request NAT64 prefix discovery.
|
||||
*
|
||||
*/
|
||||
otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex);
|
||||
|
||||
/**
|
||||
* The infra interface driver calls this method to notify OpenThread that
|
||||
* the discovery of NAT64 prefix is done.
|
||||
*
|
||||
* This method is expected to be invoked after calling otPlatInfraIfDiscoverNat64Prefix.
|
||||
* If no NAT64 prefix is discovered, @p aIp6Prefix shall point to an empty prefix with zero length.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aInfraIfIndex The index of the infrastructure interface on which the NAT64 prefix is discovered.
|
||||
* @param[in] aIp6Prefix A pointer to NAT64 prefix.
|
||||
*
|
||||
*/
|
||||
extern void otPlatInfraIfDiscoverNat64PrefixDone(otInstance * aInstance,
|
||||
uint32_t aInfraIfIndex,
|
||||
const otIp6Prefix *aIp6Prefix);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -536,7 +536,7 @@ otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aT
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Get the external FEM's Rx LNA gain in dBm.
|
||||
* Gets the external FEM's Rx LNA gain in dBm.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[out] aGain The external FEM's Rx LNA gain in dBm.
|
||||
@@ -549,7 +549,7 @@ otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aTh
|
||||
otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain);
|
||||
|
||||
/**
|
||||
* Set the external FEM's Rx LNA gain in dBm.
|
||||
* Sets the external FEM's Rx LNA gain in dBm.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aGain The external FEM's Rx LNA gain in dBm.
|
||||
@@ -969,7 +969,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance);
|
||||
uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the radio preferred channel mask that the device prefers to form on.
|
||||
* Gets the radio preferred channel mask that the device prefers to form on.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
|
||||
@@ -72,6 +72,7 @@ enum
|
||||
OT_SETTINGS_KEY_SRP_CLIENT_INFO = 0x000c, ///< The SRP client info (selected SRP server address).
|
||||
OT_SETTINGS_KEY_SRP_SERVER_INFO = 0x000d, ///< The SRP server info (UDP port).
|
||||
OT_SETTINGS_KEY_BR_ULA_PREFIX = 0x000f, ///< BR ULA prefix.
|
||||
OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES = 0x0010, ///< BR local on-link prefixes.
|
||||
|
||||
// Deprecated and reserved key values:
|
||||
//
|
||||
|
||||
@@ -110,6 +110,24 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK
|
||||
*
|
||||
* This macro specifies that a function or method takes `printf` style arguments and should be type-checked against
|
||||
* a format string.
|
||||
*
|
||||
* This macro must be added after the function/method declaration. For example:
|
||||
*
|
||||
* `void MyPrintf(void *aObject, const char *aFormat, ...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(2, 3);`
|
||||
*
|
||||
* The two argument index values indicate format string and first argument to check against it. They start at index 1
|
||||
* for the first parameter in a function and at index 2 for the first parameter in a method.
|
||||
*
|
||||
* @param[in] aFmtIndex The argument index of the format string.
|
||||
* @param[in] aStartIndex The argument index of the first argument to check against the format string.
|
||||
*
|
||||
*/
|
||||
|
||||
// =========== TOOLCHAIN SELECTION : START ===========
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) || defined(__TI_ARM__)
|
||||
@@ -122,6 +140,9 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_END __attribute__((packed))
|
||||
#define OT_TOOL_WEAK __attribute__((weak))
|
||||
|
||||
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex) \
|
||||
__attribute__((format(printf, aFmtIndex, aStartIndex)))
|
||||
|
||||
#elif defined(__ICCARM__) || defined(__ICC8051__)
|
||||
|
||||
// http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
|
||||
@@ -133,6 +154,8 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_END
|
||||
#define OT_TOOL_WEAK __weak
|
||||
|
||||
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex)
|
||||
|
||||
#elif defined(__SDCC)
|
||||
|
||||
// Structures are packed by default in sdcc, as it primarily targets 8-bit MCUs.
|
||||
@@ -142,6 +165,8 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_END
|
||||
#define OT_TOOL_WEAK
|
||||
|
||||
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex)
|
||||
|
||||
#else
|
||||
|
||||
#error "Error: No valid Toolchain specified"
|
||||
@@ -153,6 +178,8 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_END
|
||||
#define OT_TOOL_WEAK
|
||||
|
||||
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex)
|
||||
|
||||
#endif
|
||||
|
||||
// =========== TOOLCHAIN SELECTION : END ===========
|
||||
|
||||
@@ -88,28 +88,34 @@ typedef struct otSrpClientHostInfo
|
||||
* and stay constant after an instance of this structure is passed to OpenThread from `otSrpClientAddService()` or
|
||||
* `otSrpClientRemoveService()`.
|
||||
*
|
||||
* The `mState`, `mData`, `mNext` fields are used/managed by OT core only. Their value is ignored when an instance of
|
||||
* `otSrpClientService` is passed in `otSrpClientAddService()` or `otSrpClientRemoveService()` or other functions. The
|
||||
* caller does not need to set these fields.
|
||||
*
|
||||
* The `mLease` and `mKeyLease` fields specify the desired lease and key lease intervals for this service. Zero value
|
||||
* indicates that the interval is unspecified and then the default lease or key lease intervals from
|
||||
* `otSrpClientGetLeaseInterval()` and `otSrpClientGetKeyLeaseInterval()` are used for this service. If the key lease
|
||||
* interval (whether set explicitly or determined from the default) is shorter than the lease interval for a service,
|
||||
* SRP client will re-use the lease interval value for key lease interval as well. For example, if in service `mLease`
|
||||
* is explicitly set to 2 days and `mKeyLease` is set to zero and default key lease is set to 1 day, then when
|
||||
* registering this service, the requested key lease for this service is also set to 2 days.
|
||||
*
|
||||
*/
|
||||
typedef struct otSrpClientService
|
||||
{
|
||||
const char * mName; ///< The service name labels (e.g., "_chip._udp", not the full domain name).
|
||||
const char * mInstanceName; ///< The service instance name label (not the full name).
|
||||
const char *const * mSubTypeLabels; ///< Array of service sub-type labels (must end with `NULL` or can be `NULL`).
|
||||
const otDnsTxtEntry *mTxtEntries; ///< Array of TXT entries (number of entries is given by `mNumTxtEntries`).
|
||||
uint16_t mPort; ///< The service port number.
|
||||
uint16_t mPriority; ///< The service priority.
|
||||
uint16_t mWeight; ///< The service weight.
|
||||
uint8_t mNumTxtEntries; ///< Number of entries in the `mTxtEntries` array.
|
||||
|
||||
/**
|
||||
* @note The following fields are used/managed by OT core only. Their values do not matter and are ignored when an
|
||||
* instance of `otSrpClientService` is passed in `otSrpClientAddService()` or `otSrpClientRemoveService()`. The
|
||||
* user should not modify these fields.
|
||||
*
|
||||
*/
|
||||
|
||||
otSrpClientItemState mState; ///< Service state (managed by OT core).
|
||||
uint32_t mData; ///< Internal data (used by OT core).
|
||||
struct otSrpClientService *mNext; ///< Pointer to next entry in a linked-list (managed by OT core).
|
||||
const char * mName; ///< The service labels (e.g., "_mt._udp", not the full domain name).
|
||||
const char * mInstanceName; ///< The service instance name label (not the full name).
|
||||
const char *const * mSubTypeLabels; ///< Array of sub-type labels (must end with `NULL` or can be `NULL`).
|
||||
const otDnsTxtEntry * mTxtEntries; ///< Array of TXT entries (`mNumTxtEntries` gives num of entries).
|
||||
uint16_t mPort; ///< The service port number.
|
||||
uint16_t mPriority; ///< The service priority.
|
||||
uint16_t mWeight; ///< The service weight.
|
||||
uint8_t mNumTxtEntries; ///< Number of entries in the `mTxtEntries` array.
|
||||
otSrpClientItemState mState; ///< Service state (managed by OT core).
|
||||
uint32_t mData; ///< Internal data (used by OT core).
|
||||
struct otSrpClientService *mNext; ///< Pointer to next entry in a linked-list (managed by OT core).
|
||||
uint32_t mLease; ///< Desired lease interval in sec - zero to use default.
|
||||
uint32_t mKeyLease; ///< Desired key lease interval in sec - zero to use default.
|
||||
} otSrpClientService;
|
||||
|
||||
/**
|
||||
@@ -270,12 +276,26 @@ void otSrpClientSetCallback(otInstance *aInstance, otSrpClientCallback aCallback
|
||||
* Config option `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE` specifies the default auto-start mode (whether
|
||||
* it is enabled or disabled at the start of OT stack).
|
||||
*
|
||||
* When auto-start is enabled, the SRP client will monitor the Thread Network Data for SRP Server Service entries
|
||||
* and automatically start and stop the client when an SRP server is detected.
|
||||
* When auto-start is enabled, the SRP client will monitor the Thread Network Data to discover SRP servers and select
|
||||
* the preferred server and automatically start and stop the client when an SRP server is detected.
|
||||
*
|
||||
* If multiple SRP servers are found, a random one will be selected. If the selected SRP server is no longer
|
||||
* detected (not longer present in the Thread Network Data), the SRP client will be stopped and then it may switch
|
||||
* to another SRP server (if available).
|
||||
* There are three categories of Network Data entries indicating presence of SRP sever. They are preferred in the
|
||||
* following order:
|
||||
*
|
||||
* 1) Preferred unicast entries where server address is included in the service data. If there are multiple options,
|
||||
* the one with numerically lowest IPv6 address is preferred.
|
||||
*
|
||||
* 2) Anycast entries each having a seq number. A larger sequence number in the sense specified by Serial Number
|
||||
* Arithmetic logic in RFC-1982 is considered more recent and therefore preferred. The largest seq number using
|
||||
* serial number arithmetic is preferred if it is well-defined (i.e., the seq number is larger than all other
|
||||
* seq numbers). If it is not well-defined, then the numerically largest seq number is preferred.
|
||||
*
|
||||
* 3) Unicast entries where the server address info is included in server data. If there are multiple options, the
|
||||
* one with numerically lowest IPv6 address is preferred.
|
||||
*
|
||||
* When there is a change in the Network Data entries, client will check that the currently selected server is still
|
||||
* present in the Network Data and is still the preferred one. Otherwise the client will switch to the new preferred
|
||||
* server or stop if there is none.
|
||||
*
|
||||
* When the SRP client is explicitly started through a successful call to `otSrpClientStart()`, the given SRP server
|
||||
* address in `otSrpClientStart()` will continue to be used regardless of the state of auto-start mode and whether the
|
||||
@@ -345,7 +365,9 @@ uint32_t otSrpClientGetTtl(otInstance *aInstance);
|
||||
void otSrpClientSetTtl(otInstance *aInstance, uint32_t aTtl);
|
||||
|
||||
/**
|
||||
* This function gets the lease interval used in SRP update requests.
|
||||
* This function gets the default lease interval used in SRP update requests.
|
||||
*
|
||||
* The default interval is used only for `otSrpClientService` instances with `mLease` set to zero.
|
||||
*
|
||||
* Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease
|
||||
* interval.
|
||||
@@ -358,7 +380,9 @@ void otSrpClientSetTtl(otInstance *aInstance, uint32_t aTtl);
|
||||
uint32_t otSrpClientGetLeaseInterval(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the lease interval used in SRP update requests.
|
||||
* This function sets the default lease interval used in SRP update requests.
|
||||
*
|
||||
* The default interval is used only for `otSrpClientService` instances with `mLease` set to zero.
|
||||
*
|
||||
* Changing the lease interval does not impact the accepted lease interval of already registered services/host-info.
|
||||
* It only affects any future SRP update messages (i.e., adding new services and/or refreshes of the existing services).
|
||||
@@ -371,7 +395,9 @@ uint32_t otSrpClientGetLeaseInterval(otInstance *aInstance);
|
||||
void otSrpClientSetLeaseInterval(otInstance *aInstance, uint32_t aInterval);
|
||||
|
||||
/**
|
||||
* This function gets the key lease interval used in SRP update requests.
|
||||
* This function gets the default key lease interval used in SRP update requests.
|
||||
*
|
||||
* The default interval is used only for `otSrpClientService` instances with `mKeyLease` set to zero.
|
||||
*
|
||||
* Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease
|
||||
* interval.
|
||||
@@ -384,7 +410,9 @@ void otSrpClientSetLeaseInterval(otInstance *aInstance, uint32_t aInterval);
|
||||
uint32_t otSrpClientGetKeyLeaseInterval(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the key lease interval used in SRP update requests.
|
||||
* This function sets the default key lease interval used in SRP update requests.
|
||||
*
|
||||
* The default interval is used only for `otSrpClientService` instances with `mKeyLease` set to zero.
|
||||
*
|
||||
* Changing the lease interval does not impact the accepted lease interval of already registered services/host-info.
|
||||
* It only affects any future SRP update messages (i.e., adding new services and/or refreshes of existing services).
|
||||
|
||||
@@ -132,14 +132,14 @@ enum
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the state of an SRP server
|
||||
* This enumeration represents the state of the SRP server.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OT_SRP_SERVER_STATE_DISABLED = 0, ///< The SRP server is disabled.
|
||||
OT_SRP_SERVER_STATE_RUNNING = 1, ///< The SRP server is running.
|
||||
OT_SRP_SERVER_STATE_STOPPED = 2, ///< The SRP server is stopped.
|
||||
OT_SRP_SERVER_STATE_RUNNING = 1, ///< The SRP server is enabled and running.
|
||||
OT_SRP_SERVER_STATE_STOPPED = 2, ///< The SRP server is enabled but stopped.
|
||||
} otSrpServerState;
|
||||
|
||||
/**
|
||||
@@ -302,12 +302,49 @@ otError otSrpServerSetAnycastModeSequenceNumber(otInstance *aInstance, uint8_t a
|
||||
/**
|
||||
* This function enables/disables the SRP server.
|
||||
*
|
||||
* On a Border Router, it is recommended to use `otSrpServerSetAutoEnableMode()` instead.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled A boolean to enable/disable the SRP server.
|
||||
*
|
||||
*/
|
||||
void otSrpServerSetEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function enables/disables the auto-enable mode on SRP server.
|
||||
*
|
||||
* This function requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` feature.
|
||||
*
|
||||
* When this mode is enabled, the Border Routing Manager controls if/when to enable or disable the SRP server.
|
||||
* SRP sever is auto-enabled if/when Border Routing is started and it is done with the initial prefix and route
|
||||
* configurations (when the OMR and on-link prefixes are determined, advertised in emitted Router Advertisement message
|
||||
* on infrastructure side and published in the Thread Network Data). The SRP server is auto-disabled if/when BR is
|
||||
* stopped (e.g., if the infrastructure network interface is brought down or if BR gets detached).
|
||||
*
|
||||
* This mode can be disabled by a `otSrpServerSetAutoEnableMode()` call with @p aEnabled set to `false` or if the SRP
|
||||
* server is explicitly enabled or disabled by a call to `otSrpServerSetEnabled()` function. Disabling auto-enable mode
|
||||
* using `otSrpServerSetAutoEnableMode(false)` will not change the current state of SRP sever (e.g., if it is enabled
|
||||
* it stays enabled).
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnbaled A boolean to enable/disable the auto-enable mode.
|
||||
*
|
||||
*/
|
||||
void otSrpServerSetAutoEnableMode(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function indicates whether the auto-enable mode is enabled or disabled.
|
||||
*
|
||||
* This function requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` feature.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE The auto-enable mode is enabled.
|
||||
* @retval FALSE The auto-enable mode is disabled.
|
||||
*
|
||||
*/
|
||||
bool otSrpServerIsAutoEnableMode(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function returns SRP server TTL configuration.
|
||||
*
|
||||
|
||||
@@ -294,7 +294,7 @@ typedef struct otTcpEndpointInitializeArgs
|
||||
* select a smaller buffer size.
|
||||
*
|
||||
*/
|
||||
#define OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS 2599
|
||||
#define OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS 2598
|
||||
|
||||
/**
|
||||
* @def OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS
|
||||
@@ -306,7 +306,7 @@ typedef struct otTcpEndpointInitializeArgs
|
||||
* so), then it may be advisable to select a large buffer size manually.
|
||||
*
|
||||
*/
|
||||
#define OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS 4158
|
||||
#define OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS 4157
|
||||
|
||||
/**
|
||||
* Initializes a TCP endpoint.
|
||||
|
||||
@@ -88,10 +88,10 @@ extern "C" {
|
||||
*/
|
||||
typedef struct otTcpCircularSendBuffer
|
||||
{
|
||||
const uint8_t *mDataBuffer; ///< Pointer to data in the circular send buffer
|
||||
size_t mCapacity; ///< Length of the circular send buffer
|
||||
size_t mStartIndex; ///< Index of the first valid byte in the send buffer
|
||||
size_t mCapacityUsed; ///< Number of bytes stored in the send buffer
|
||||
uint8_t *mDataBuffer; ///< Pointer to data in the circular send buffer
|
||||
size_t mCapacity; ///< Length of the circular send buffer
|
||||
size_t mStartIndex; ///< Index of the first valid byte in the send buffer
|
||||
size_t mCapacityUsed; ///< Number of bytes stored in the send buffer
|
||||
|
||||
otLinkedBuffer mSendLinks[2];
|
||||
uint8_t mFirstSendLinkIndex;
|
||||
@@ -107,6 +107,15 @@ typedef struct otTcpCircularSendBuffer
|
||||
*/
|
||||
void otTcpCircularSendBufferInitialize(otTcpCircularSendBuffer *aSendBuffer, void *aDataBuffer, size_t aCapacity);
|
||||
|
||||
/**
|
||||
* This enumeration defines flags passed to @p otTcpCircularSendBufferWrite.
|
||||
*
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OT_TCP_CIRCULAR_SEND_BUFFER_WRITE_MORE_TO_COME = 1 << 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends out data on a TCP endpoint, using the provided TCP circular send
|
||||
* buffer to manage buffering.
|
||||
@@ -136,15 +145,17 @@ void otTcpCircularSendBufferInitialize(otTcpCircularSendBuffer *aSendBuffer, voi
|
||||
* @param[in] aLength The length of the data pointed to by @p aData to copy into the TCP circular send buffer.
|
||||
* @param[out] aWritten Populated with the amount of data copied into the send buffer, which might be less than
|
||||
* @p aLength if the send buffer reaches capacity.
|
||||
* @param[in] aFlags Flags specifying options for this operation (see enumeration above).
|
||||
*
|
||||
* @returns OT_ERROR_NONE Successfully copied data into the send buffer and sent it on the TCP endpoint.
|
||||
* @returns OT_ERROR_FAILED Failed to send out data on the TCP endpoint.
|
||||
*/
|
||||
otError otTcpCircularSendBufferWrite(otTcpEndpoint * aEndpoint,
|
||||
otTcpCircularSendBuffer *aSendBuffer,
|
||||
void * aData,
|
||||
const void * aData,
|
||||
size_t aLength,
|
||||
size_t * aWritten);
|
||||
size_t * aWritten,
|
||||
uint32_t aFlags);
|
||||
|
||||
/**
|
||||
* Performs circular-send-buffer-specific handling in the otTcpForwardProgress
|
||||
@@ -175,7 +186,7 @@ void otTcpCircularSendBufferHandleForwardProgress(otTcpCircularSendBuffer *aSend
|
||||
*
|
||||
* @return The amount of free space in the send buffer.
|
||||
*/
|
||||
size_t otTcpCircularSendBufferFreeSpace(otTcpCircularSendBuffer *aSendBuffer);
|
||||
size_t otTcpCircularSendBufferGetFreeSpace(const otTcpCircularSendBuffer *aSendBuffer);
|
||||
|
||||
/**
|
||||
* Forcibly discards all data in the circular send buffer.
|
||||
|
||||
+64
-29
@@ -138,6 +138,14 @@ typedef struct
|
||||
uint8_t mAge; ///< Time last heard
|
||||
bool mAllocated : 1; ///< Router ID allocated or not
|
||||
bool mLinkEstablished : 1; ///< Link established with Router ID or not
|
||||
uint8_t mVersion; ///< Thread version
|
||||
|
||||
/**
|
||||
* Parent CSL parameters are only relevant when OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE is enabled.
|
||||
*
|
||||
*/
|
||||
uint8_t mCslClockAccuracy; ///< CSL clock accuracy, in ± ppm
|
||||
uint8_t mCslUncertainty; ///< CSL uncertainty, in ±10 us
|
||||
} otRouterInfo;
|
||||
|
||||
/**
|
||||
@@ -167,6 +175,19 @@ typedef struct otMleCounters
|
||||
uint16_t mPartitionIdChanges; ///< Number of changes to partition ID.
|
||||
uint16_t mBetterPartitionAttachAttempts; ///< Number of attempts to attach to a better partition.
|
||||
|
||||
/**
|
||||
* Role time tracking.
|
||||
*
|
||||
* When uptime feature is enabled (OPENTHREAD_CONFIG_UPTIME_ENABLE = 1) time spent in each MLE role is tracked.
|
||||
*
|
||||
*/
|
||||
uint64_t mDisabledTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role.
|
||||
uint64_t mDetachedTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role.
|
||||
uint64_t mChildTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role.
|
||||
uint64_t mRouterTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role.
|
||||
uint64_t mLeaderTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role.
|
||||
uint64_t mTrackedTime; ///< Number of milliseconds tracked by previous counters.
|
||||
|
||||
/**
|
||||
* Number of times device changed its parent.
|
||||
*
|
||||
@@ -297,7 +318,7 @@ otError otThreadSetJoinerAdvertisement(otInstance * aInstance,
|
||||
#define OT_JOINER_ADVDATA_MAX_LENGTH 64 ///< Maximum AdvData Length of Joiner Advertisement
|
||||
|
||||
/**
|
||||
* Get the Thread Child Timeout used when operating in the Child role.
|
||||
* Gets the Thread Child Timeout (in seconds) used when operating in the Child role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -309,7 +330,7 @@ otError otThreadSetJoinerAdvertisement(otInstance * aInstance,
|
||||
uint32_t otThreadGetChildTimeout(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Child Timeout used when operating in the Child role.
|
||||
* Sets the Thread Child Timeout (in seconds) used when operating in the Child role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTimeout The timeout value in seconds.
|
||||
@@ -320,7 +341,7 @@ uint32_t otThreadGetChildTimeout(otInstance *aInstance);
|
||||
void otThreadSetChildTimeout(otInstance *aInstance, uint32_t aTimeout);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Extended PAN ID.
|
||||
* Gets the IEEE 802.15.4 Extended PAN ID.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -332,9 +353,9 @@ void otThreadSetChildTimeout(otInstance *aInstance, uint32_t aTimeout);
|
||||
const otExtendedPanId *otThreadGetExtendedPanId(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the IEEE 802.15.4 Extended PAN ID.
|
||||
* Sets the IEEE 802.15.4 Extended PAN ID.
|
||||
*
|
||||
* This function can only be called while Thread protocols are disabled. A successful
|
||||
* @note Can only be called while Thread protocols are disabled. A successful
|
||||
* call to this function invalidates the Active and Pending Operational Datasets in
|
||||
* non-volatile memory.
|
||||
*
|
||||
@@ -451,7 +472,7 @@ otError otThreadSetNetworkKey(otInstance *aInstance, const otNetworkKey *aKey);
|
||||
otError otThreadSetNetworkKeyRef(otInstance *aInstance, otNetworkKeyRef aKeyRef);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the Thread Routing Locator (RLOC) address.
|
||||
* Gets the Thread Routing Locator (RLOC) address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -461,7 +482,7 @@ otError otThreadSetNetworkKeyRef(otInstance *aInstance, otNetworkKeyRef aKeyRef)
|
||||
const otIp6Address *otThreadGetRloc(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the Mesh Local EID address.
|
||||
* Gets the Mesh Local EID address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -497,7 +518,7 @@ const otMeshLocalPrefix *otThreadGetMeshLocalPrefix(otInstance *aInstance);
|
||||
otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefix *aMeshLocalPrefix);
|
||||
|
||||
/**
|
||||
* This function returns the Thread link-local IPv6 address.
|
||||
* Gets the Thread link-local IPv6 address.
|
||||
*
|
||||
* The Thread link local address is derived using IEEE802.15.4 Extended Address as Interface Identifier.
|
||||
*
|
||||
@@ -509,9 +530,9 @@ otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefi
|
||||
const otIp6Address *otThreadGetLinkLocalIp6Address(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function returns the Thread Link-Local All Thread Nodes multicast address.
|
||||
* Gets the Thread Link-Local All Thread Nodes multicast address.
|
||||
*
|
||||
* The address is a link-local Unicast Prefix-Based Multcast Address [RFC 3306], with:
|
||||
* The address is a link-local Unicast Prefix-Based Multicast Address [RFC 3306], with:
|
||||
* - flgs set to 3 (P = 1 and T = 1)
|
||||
* - scop set to 2
|
||||
* - plen set to 64
|
||||
@@ -526,9 +547,9 @@ const otIp6Address *otThreadGetLinkLocalIp6Address(otInstance *aInstance);
|
||||
const otIp6Address *otThreadGetLinkLocalAllThreadNodesMulticastAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function returns the Thread Realm-Local All Thread Nodes multicast address.
|
||||
* Gets the Thread Realm-Local All Thread Nodes multicast address.
|
||||
*
|
||||
* The address is a realm-local Unicast Prefix-Based Multcast Address [RFC 3306], with:
|
||||
* The address is a realm-local Unicast Prefix-Based Multicast Address [RFC 3306], with:
|
||||
* - flgs set to 3 (P = 1 and T = 1)
|
||||
* - scop set to 3
|
||||
* - plen set to 64
|
||||
@@ -585,9 +606,9 @@ const char *otThreadGetNetworkName(otInstance *aInstance);
|
||||
otError otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName);
|
||||
|
||||
/**
|
||||
* Get the Thread Domain Name.
|
||||
* Gets the Thread Domain Name.
|
||||
*
|
||||
* This function is only available since Thread 1.2.
|
||||
* @note Available since Thread 1.2.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -599,10 +620,9 @@ otError otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName);
|
||||
const char *otThreadGetDomainName(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Domain Name.
|
||||
* Sets the Thread Domain Name. Only succeeds when Thread protocols are disabled.
|
||||
*
|
||||
* This function is only available since Thread 1.2.
|
||||
* This function succeeds only when Thread protocols are disabled.
|
||||
* @note Available since Thread 1.2.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDomainName A pointer to the Thread Domain Name.
|
||||
@@ -616,9 +636,11 @@ const char *otThreadGetDomainName(otInstance *aInstance);
|
||||
otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName);
|
||||
|
||||
/**
|
||||
* Set/Clear the Interface Identifier manually specified for the Thread Domain Unicast Address.
|
||||
* Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address.
|
||||
*
|
||||
* This function is only available since Thread 1.2 when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
|
||||
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
|
||||
*
|
||||
* @note Only available since Thread 1.2.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear.
|
||||
@@ -631,9 +653,11 @@ otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName);
|
||||
otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid);
|
||||
|
||||
/**
|
||||
* Get the Interface Identifier manually specified for the Thread Domain Unicast Address.
|
||||
* Gets the Interface Identifier manually specified for the Thread Domain Unicast Address.
|
||||
*
|
||||
* This function is only available since Thread 1.2 when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
|
||||
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
|
||||
*
|
||||
* @note Only available since Thread 1.2.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -645,7 +669,7 @@ otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp
|
||||
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the thrKeySequenceCounter.
|
||||
* Gets the thrKeySequenceCounter.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -657,7 +681,7 @@ const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstanc
|
||||
uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the thrKeySequenceCounter.
|
||||
* Sets the thrKeySequenceCounter.
|
||||
*
|
||||
* @note This API is reserved for testing and demo purposes only. Changing settings with
|
||||
* this API will render a production application non-compliant with the Thread Specification.
|
||||
@@ -671,7 +695,7 @@ uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance);
|
||||
void otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t aKeySequenceCounter);
|
||||
|
||||
/**
|
||||
* Get the thrKeySwitchGuardTime
|
||||
* Gets the thrKeySwitchGuardTime (in hours).
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -683,7 +707,7 @@ void otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t aKeySequenceC
|
||||
uint32_t otThreadGetKeySwitchGuardTime(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the thrKeySwitchGuardTime
|
||||
* Sets the thrKeySwitchGuardTime (in hours).
|
||||
*
|
||||
* @note This API is reserved for testing and demo purposes only. Changing settings with
|
||||
* this API will render a production application non-compliant with the Thread Specification.
|
||||
@@ -845,7 +869,18 @@ otError otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
|
||||
otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi);
|
||||
|
||||
/**
|
||||
* Get the IPv6 counters.
|
||||
* Starts the process for child to search for a better parent while staying attached to its current parent.
|
||||
*
|
||||
* Must be used when device is attached as a child.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started the process to search for a better parent.
|
||||
* @retval OT_ERROR_INVALID_STATE Device role is not child.
|
||||
*
|
||||
*/
|
||||
otError otThreadSearchForBetterParent(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Gets the IPv6 counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -855,7 +890,7 @@ otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi);
|
||||
const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Reset the IPv6 counters.
|
||||
* Resets the IPv6 counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -863,7 +898,7 @@ const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance);
|
||||
void otThreadResetIp6Counters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the Thread MLE counters.
|
||||
* Gets the Thread MLE counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -873,7 +908,7 @@ void otThreadResetIp6Counters(otInstance *aInstance);
|
||||
const otMleCounters *otThreadGetMleCounters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Reset the Thread MLE counters.
|
||||
* Resets the Thread MLE counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
|
||||
@@ -122,7 +122,7 @@ typedef struct otCacheEntryIterator
|
||||
} otCacheEntryIterator;
|
||||
|
||||
/**
|
||||
* Get the maximum number of children currently allowed.
|
||||
* Gets the maximum number of children currently allowed.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -134,7 +134,7 @@ typedef struct otCacheEntryIterator
|
||||
uint16_t otThreadGetMaxAllowedChildren(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the maximum number of children currently allowed.
|
||||
* Sets the maximum number of children currently allowed.
|
||||
*
|
||||
* This parameter can only be set when Thread protocol operation has been stopped.
|
||||
*
|
||||
@@ -196,7 +196,7 @@ otError otThreadSetRouterEligible(otInstance *aInstance, bool aEligible);
|
||||
otError otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* Get the Thread Leader Weight used when operating in the Leader role.
|
||||
* Gets the Thread Leader Weight used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -208,7 +208,7 @@ otError otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
uint8_t otThreadGetLocalLeaderWeight(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Leader Weight used when operating in the Leader role.
|
||||
* Sets the Thread Leader Weight used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aWeight The Thread Leader Weight value.
|
||||
@@ -238,7 +238,7 @@ uint32_t otThreadGetPreferredLeaderPartitionId(otInstance *aInstance);
|
||||
void otThreadSetPreferredLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId);
|
||||
|
||||
/**
|
||||
* Get the Joiner UDP Port.
|
||||
* Gets the Joiner UDP Port.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -250,7 +250,7 @@ void otThreadSetPreferredLeaderPartitionId(otInstance *aInstance, uint32_t aPart
|
||||
uint16_t otThreadGetJoinerUdpPort(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Joiner UDP Port.
|
||||
* Sets the Joiner UDP Port.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aJoinerUdpPort The Joiner UDP Port number.
|
||||
@@ -451,7 +451,7 @@ uint8_t otThreadGetRouterSelectionJitter(otInstance *aInstance);
|
||||
void otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter);
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for an attached Child by its Child ID or RLOC16.
|
||||
* Gets diagnostic information for an attached Child by its Child ID or RLOC16.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChildId The Child ID or RLOC16 for the attached child.
|
||||
@@ -645,7 +645,7 @@ int8_t otThreadGetParentPriority(otInstance *aInstance);
|
||||
otError otThreadSetParentPriority(otInstance *aInstance, int8_t aParentPriority);
|
||||
|
||||
/**
|
||||
* This function gets the maximum number of IP addresses that each MTD child may register with this device as parent.
|
||||
* Gets the maximum number of IP addresses that each MTD child may register with this device as parent.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
@@ -657,11 +657,15 @@ otError otThreadSetParentPriority(otInstance *aInstance, int8_t aParentPriority)
|
||||
uint8_t otThreadGetMaxChildIpAddresses(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets/restores the maximum number of IP addresses that each MTD child may register with this
|
||||
* Sets or restores the maximum number of IP addresses that each MTD child may register with this
|
||||
* device as parent.
|
||||
*
|
||||
* @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used by Thread Test Harness
|
||||
* to limit the address registrations of the reference parent in order to test the MTD DUT reaction.
|
||||
* Pass `0` to clear the setting and restore the default.
|
||||
*
|
||||
* Available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
|
||||
*
|
||||
* @note Only used by Thread Test Harness to limit the address registrations of the reference
|
||||
* parent in order to test the MTD DUT reaction.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMaxIpAddresses The maximum number of IP addresses that each MTD child may register with this
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ install_packages_brew()
|
||||
|
||||
# add ARM toolchain
|
||||
brew tap ArmMbed/homebrew-formulae
|
||||
brew install arm-none-eabi-gcc
|
||||
brew install armmbed/formulae/arm-none-eabi-gcc
|
||||
|
||||
# check for gcc for simulation
|
||||
if ! command -v gcc; then
|
||||
|
||||
@@ -55,8 +55,7 @@ check_datetime()
|
||||
EOF
|
||||
|
||||
OPENTHREAD_PROJECT_CFLAGS="-I$PWD -DOPENTHREAD_CONFIG_FILE=\\\"openthread-config-datetime.h\\\" \
|
||||
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\\\"openthread-core-posix-config.h\\\" \
|
||||
-std=c99" \
|
||||
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\\\"openthread-core-posix-config.h\\\"" \
|
||||
make showcommands ot-cli
|
||||
grep "$datetime" -ao "out/target/product/generic/system/bin/ot-cli"
|
||||
make clean-ot-cli
|
||||
|
||||
+69
-2
@@ -29,10 +29,77 @@
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
readonly OT_TMP_DIR=/tmp/ot-arm-build-cmake
|
||||
readonly OT_SHA_NEW=${GITHUB_SHA:-$(git rev-parse HEAD)}
|
||||
|
||||
build_nrf52840()
|
||||
{
|
||||
local options=(
|
||||
"-DOT_ANYCAST_LOCATOR=ON"
|
||||
"-DOT_BACKBONE_ROUTER=ON"
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_CHANNEL_MANAGER=ON"
|
||||
"-DOT_CHANNEL_MONITOR=ON"
|
||||
"-DOT_CHILD_SUPERVISION=ON"
|
||||
"-DOT_COAP=ON"
|
||||
"-DOT_COAPS=ON"
|
||||
"-DOT_COMMISSIONER=ON"
|
||||
"-DOT_CSL_RECEIVER=ON"
|
||||
"-DOT_DATASET_UPDATER=ON"
|
||||
"-DOT_DHCP6_CLIENT=ON"
|
||||
"-DOT_DHCP6_SERVER=ON"
|
||||
"-DOT_DIAGNOSTIC=ON"
|
||||
"-DOT_DNSSD_SERVER=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_DUA=ON"
|
||||
"-DOT_ECDSA=ON"
|
||||
"-DOT_FULL_LOGS=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
"-DOT_LINK_METRICS_INITIATOR=ON"
|
||||
"-DOT_LINK_METRICS_SUBJECT=ON"
|
||||
"-DOT_LINK_RAW=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MESSAGE_USE_HEAP=ON"
|
||||
"-DOT_MLR=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
"-DOT_NETDATA_PUBLISHER=ON"
|
||||
"-DOT_PING_SENDER=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
"-DOT_SLAAC=ON"
|
||||
"-DOT_SNTP_CLIENT=ON"
|
||||
"-DOT_SRP_CLIENT=ON"
|
||||
"-DOT_SRP_SERVER=ON"
|
||||
"-DOT_THREAD_VERSION=1.3"
|
||||
"-DOT_TIME_SYNC=ON"
|
||||
"-DOT_UDP_FORWARD=ON"
|
||||
"-DOT_UPTIME=ON"
|
||||
)
|
||||
|
||||
rm -rf "${OT_TMP_DIR}"
|
||||
|
||||
script/git-tool clone https://github.com/openthread/ot-nrf528xx.git "${OT_TMP_DIR}"
|
||||
rm -rf "${OT_TMP_DIR}/openthread/*"
|
||||
git archive "${OT_SHA_NEW}" | tar x -C "${OT_TMP_DIR}/openthread"
|
||||
|
||||
cd "${OT_TMP_DIR}"
|
||||
script/build nrf52840 UART_trans "${options[@]}"
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
"$(dirname "$0")"/check-arm-build-autotools
|
||||
"$(dirname "$0")"/check-arm-build-cmake
|
||||
export CPPFLAGS="${CPPFLAGS:-} -DNDEBUG"
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
build_nrf52840
|
||||
return 0
|
||||
fi
|
||||
|
||||
while [[ $# != 0 ]]; do
|
||||
"build_$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user