mirror of
https://github.com/espressif/openthread.git
synced 2026-06-16 18:35:00 +00:00
Compare commits
204 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04af4827d1 | |||
| 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 |
+19
-19
@@ -30,15 +30,11 @@ 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
|
||||
@@ -66,14 +62,15 @@ jobs:
|
||||
max-depth: 3
|
||||
|
||||
cmake-version:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
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
|
||||
@@ -123,7 +120,7 @@ jobs:
|
||||
script/check-scan-build
|
||||
|
||||
mbedtls3-build:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -135,7 +132,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ARMmbed/mbedtls
|
||||
ref: v3.1.0
|
||||
ref: v3.5.0
|
||||
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:
|
||||
@@ -175,20 +172,23 @@ 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 }}
|
||||
@@ -216,7 +216,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 }}
|
||||
@@ -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 }}
|
||||
@@ -303,7 +303,7 @@ jobs:
|
||||
CXX: clang++
|
||||
- CC: gcc
|
||||
CXX: g++
|
||||
runs-on: macos-10.15
|
||||
runs-on: macos-12
|
||||
env:
|
||||
CC: ${{ matrix.CC }}
|
||||
CXX: ${{ matrix.CXX }}
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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,15 +30,11 @@ 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:
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
- 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,6 +160,7 @@ jobs:
|
||||
PYTHONUNBUFFERED: 1
|
||||
VERBOSE: 1
|
||||
BORDER_ROUTING: 1
|
||||
NAT64: ${{ matrix.nat64 }}
|
||||
MAX_JOBS: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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,14 +44,6 @@ 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
|
||||
|
||||
+21
-15
@@ -30,18 +30,14 @@ 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
|
||||
@@ -77,12 +73,11 @@ jobs:
|
||||
- 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
|
||||
@@ -111,6 +106,17 @@ jobs:
|
||||
with:
|
||||
name: cov-expects-linux-2
|
||||
path: tmp/coverage.info
|
||||
|
||||
tcplp-buffering:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
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
|
||||
@@ -226,7 +232,7 @@ jobs:
|
||||
|
||||
pty-macos:
|
||||
name: pty-macos OT_DAEMON=${{ matrix.OT_DAEMON }}
|
||||
runs-on: macos-10.15
|
||||
runs-on: macos-12
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
||||
@@ -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
|
||||
@@ -233,7 +229,7 @@ jobs:
|
||||
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
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -30,15 +30,11 @@ 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
|
||||
@@ -48,7 +44,7 @@ jobs:
|
||||
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:
|
||||
@@ -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
|
||||
@@ -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']
|
||||
@@ -120,11 +119,32 @@ jobs:
|
||||
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@v2
|
||||
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
|
||||
with:
|
||||
|
||||
@@ -30,15 +30,11 @@ 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:
|
||||
|
||||
+10
-1
@@ -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 \
|
||||
@@ -580,6 +588,7 @@ LOCAL_CPPFLAGS := \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_LDLIBS := \
|
||||
-lanl \
|
||||
-lrt \
|
||||
-lutil
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*
|
||||
* @}
|
||||
*
|
||||
|
||||
+116
-347
@@ -34,58 +34,127 @@ 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_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 +171,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) ""
|
||||
+2
-1
@@ -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. |
|
||||
|
||||
@@ -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,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
|
||||
@@ -166,6 +168,75 @@ static otRadioKeyType sKeyType;
|
||||
|
||||
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 +369,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 +408,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 +427,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 +886,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 +907,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 +930,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 +1381,21 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 (246)
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
|
||||
@@ -679,6 +679,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.
|
||||
|
||||
@@ -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,422 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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 otNat64SynthersizeIp6Address(otInstance *aInstance, const otIp4Address *aIp4Address, otIp6Address *aIp6Address);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_NAT64_H_
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -270,12 +270,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
|
||||
|
||||
@@ -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.
|
||||
|
||||
+40
-18
@@ -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;
|
||||
|
||||
/**
|
||||
@@ -297,7 +305,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 +317,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 +328,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 +340,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.
|
||||
*
|
||||
@@ -585,9 +593,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 +607,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 +623,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 +640,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.
|
||||
*
|
||||
@@ -845,7 +856,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 +877,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 +885,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 +895,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.
|
||||
*
|
||||
@@ -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
|
||||
|
||||
+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 "$@"
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020, 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 -euxo pipefail
|
||||
|
||||
readonly OT_BUILDDIR="$(pwd)/build"
|
||||
|
||||
readonly OT_COMMON_OPTIONS=(
|
||||
"-DOT_COMPILE_WARNING_AS_ERROR=ON"
|
||||
)
|
||||
|
||||
readonly OT_BASIC_CHECK_OPTIONS=(
|
||||
"-DOT_COMMISSIONER=ON"
|
||||
"-DOT_DHCP6_CLIENT=ON"
|
||||
"-DOT_DHCP6_SERVER=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
)
|
||||
|
||||
reset_source()
|
||||
{
|
||||
rm -rf "$OT_BUILDDIR"
|
||||
}
|
||||
|
||||
build_cc2538()
|
||||
{
|
||||
local options=(
|
||||
# cc2538 does not have enough resources to support Thread 1.3
|
||||
"-DOT_THREAD_VERSION=1.1"
|
||||
)
|
||||
|
||||
reset_source
|
||||
"$(dirname "$0")"/cmake-build cc2538 "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}" "${options[@]}"
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
export CPPFLAGS="${CPPFLAGS:-} -DNDEBUG"
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
build_cc2538
|
||||
return 0
|
||||
fi
|
||||
|
||||
while [[ $# != 0 ]]; do
|
||||
"build_$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -63,6 +63,9 @@ main()
|
||||
reset_source
|
||||
build -DOT_POSIX_CONFIG_RCP_BUS=SPI "$@"
|
||||
fi
|
||||
|
||||
reset_source
|
||||
build -DOT_POSIX_CONFIG_RCP_BUS=VENDOR "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -37,7 +37,6 @@ readonly OT_BUILD_OPTIONS=(
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_BORDER_ROUTING=ON"
|
||||
"-DOT_BORDER_ROUTING_NAT64=ON"
|
||||
"-DOT_COAP=ON"
|
||||
"-DOT_COAP_BLOCK=ON"
|
||||
"-DOT_COAP_OBSERVE=ON"
|
||||
@@ -63,6 +62,8 @@ readonly OT_BUILD_OPTIONS=(
|
||||
"-DOT_LOG_LEVEL_DYNAMIC=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
"-DOT_NAT64_BORDER_ROUTING=ON"
|
||||
"-DOT_NAT64_TRANSLATOR=ON"
|
||||
"-DOT_NEIGHBOR_DISCOVERY_AGENT=ON"
|
||||
"-DOT_PING_SENDER=ON"
|
||||
"-DOT_PLATFORM=external"
|
||||
|
||||
@@ -95,6 +95,8 @@ build_all_features()
|
||||
|
||||
local options_1_3=(
|
||||
"-DOPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_DUA_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_MLR_ENABLE=1"
|
||||
@@ -129,6 +131,11 @@ build_all_features()
|
||||
export CPPFLAGS="${options[*]}"
|
||||
reset_source
|
||||
make -f examples/Makefile-simulation THREAD_VERSION=1.1 OTNS=1
|
||||
|
||||
# Build Thread 1.3 with external heap and msg pool using heap
|
||||
export CPPFLAGS="${options[*]} ${options_1_3[*]} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1"
|
||||
reset_source
|
||||
make -f examples/Makefile-simulation THREAD_VERSION=1.3
|
||||
}
|
||||
|
||||
build_nest_common()
|
||||
|
||||
@@ -57,6 +57,8 @@ build_all_features()
|
||||
local options=(
|
||||
"-DOT_BACKBONE_ROUTER=ON"
|
||||
"-DOT_BORDER_ROUTING=ON"
|
||||
"-DOT_NAT64_BORDER_ROUTING=ON"
|
||||
"-DOT_NAT64_TRANSLATOR=ON"
|
||||
"-DOT_CSL_RECEIVER=ON"
|
||||
"-DOT_MLR=ON"
|
||||
"-DOT_OTNS=ON"
|
||||
|
||||
+1
-4
@@ -66,7 +66,7 @@ OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-}
|
||||
OT_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)"
|
||||
|
||||
readonly OT_SRCDIR
|
||||
readonly OT_PLATFORMS=(cc2538 simulation posix)
|
||||
readonly OT_PLATFORMS=(simulation posix)
|
||||
readonly OT_POSIX_SIM_COMMON_OPTIONS=(
|
||||
"-DOT_ANYCAST_LOCATOR=ON"
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
@@ -162,9 +162,6 @@ main()
|
||||
local_options=("-DOT_LINK_RAW=ON")
|
||||
options+=("${OT_POSIX_SIM_COMMON_OPTIONS[@]}" "${local_options[@]}")
|
||||
;;
|
||||
cc2538)
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=MinSizeRel")
|
||||
;;
|
||||
*)
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake")
|
||||
;;
|
||||
|
||||
+2
-1
@@ -83,7 +83,6 @@ readonly OT_CLANG_TIDY_BUILD_OPTS=(
|
||||
'-DOT_BORDER_AGENT=ON'
|
||||
'-DOT_BORDER_ROUTER=ON'
|
||||
'-DOT_BORDER_ROUTING=ON'
|
||||
'-DOT_BORDER_ROUTING_NAT64=ON'
|
||||
'-DOT_CHANNEL_MANAGER=ON'
|
||||
'-DOT_CHANNEL_MONITOR=ON'
|
||||
'-DOT_CHILD_SUPERVISION=ON'
|
||||
@@ -113,6 +112,8 @@ readonly OT_CLANG_TIDY_BUILD_OPTS=(
|
||||
'-DOT_LINK_METRICS_SUBJECT=ON'
|
||||
'-DOT_MAC_FILTER=ON'
|
||||
'-DOT_MTD_NETDIAG=ON'
|
||||
'-DOT_NAT64_BORDER_ROUTING=ON'
|
||||
'-DOT_NAT64_TRANSLATOR=ON'
|
||||
'-DOT_NETDATA_PUBLISHER=ON'
|
||||
'-DOT_PING_SENDER=ON'
|
||||
'-DOT_REFERENCE_DEVICE=ON'
|
||||
|
||||
+6
-5
@@ -46,7 +46,7 @@ readonly THREAD_VERSION="${THREAD_VERSION:-1.3}"
|
||||
readonly INTER_OP="${INTER_OP:-0}"
|
||||
readonly VERBOSE="${VERBOSE:-0}"
|
||||
readonly BORDER_ROUTING="${BORDER_ROUTING:-1}"
|
||||
readonly BORDER_ROUTING_NAT64="${BORDER_ROUTING_NAT64:-1}"
|
||||
readonly NAT64="${NAT64:-0}"
|
||||
readonly INTER_OP_BBR="${INTER_OP_BBR:-1}"
|
||||
|
||||
readonly OT_COREDUMP_DIR="${PWD}/ot-core-dump"
|
||||
@@ -296,10 +296,10 @@ do_build_otbr_docker()
|
||||
otbr_options+=("-DOTBR_TREL=OFF")
|
||||
fi
|
||||
|
||||
if [[ ${BORDER_ROUTING_NAT64} == 1 ]]; then
|
||||
otbr_options+=("-DOT_BORDER_ROUTING_NAT64=ON")
|
||||
if [[ ${NAT64} == 1 ]]; then
|
||||
otbr_options+=("-DOT_NAT64_BORDER_ROUTING=ON")
|
||||
else
|
||||
otbr_options+=("-DOT_BORDER_ROUTING_NAT64=OFF")
|
||||
otbr_options+=("-DOT_NAT64_BORDER_ROUTING=OFF")
|
||||
fi
|
||||
|
||||
local otbr_docker_image=${OTBR_DOCKER_IMAGE:-otbr-ot12-backbone-ci}
|
||||
@@ -324,7 +324,8 @@ do_build_otbr_docker()
|
||||
--build-arg BACKBONE_ROUTER=1 \
|
||||
--build-arg REFERENCE_DEVICE=1 \
|
||||
--build-arg OT_BACKBONE_CI=1 \
|
||||
--build-arg NAT64=0 \
|
||||
--build-arg NAT64="${NAT64}" \
|
||||
--build-arg DNS64="${NAT64}" \
|
||||
--build-arg REST_API=0 \
|
||||
--build-arg WEB_GUI=0 \
|
||||
--build-arg MDNS="${OTBR_MDNS:-mDNSResponder}" \
|
||||
|
||||
+81
-4
@@ -70,6 +70,7 @@ Done
|
||||
- [mlr](#mlr-reg-ipaddr--timeout)
|
||||
- [mode](#mode)
|
||||
- [multiradio](#multiradio)
|
||||
- [nat64](#nat64-cidr)
|
||||
- [neighbor](#neighbor-list)
|
||||
- [netdata](README_NETDATA.md)
|
||||
- [netstat](#netstat)
|
||||
@@ -82,7 +83,7 @@ Done
|
||||
- [parent](#parent)
|
||||
- [parentpriority](#parentpriority)
|
||||
- [partitionid](#partitionid)
|
||||
- [ping](#ping--i-source-ipaddr-size-count-interval-hoplimit-timeout)
|
||||
- [ping](#ping-async--i-source-ipaddr-size-count-interval-hoplimit-timeout)
|
||||
- [pollperiod](#pollperiod-pollperiod)
|
||||
- [preferrouterid](#preferrouterid-routerid)
|
||||
- [prefix](#prefix)
|
||||
@@ -386,7 +387,7 @@ Done
|
||||
|
||||
Get the local NAT64 prefix of the Border Router.
|
||||
|
||||
`OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE` is required.
|
||||
`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required.
|
||||
|
||||
```bash
|
||||
> br nat64prefix
|
||||
@@ -1835,6 +1836,61 @@ This command is only available when device supports more than one radio link.
|
||||
Done
|
||||
```
|
||||
|
||||
### nat64 cidr
|
||||
|
||||
Gets the IPv4 configured CIDR in the NAT64 translator.
|
||||
|
||||
This command is only available when device enables NAT64 translator.
|
||||
|
||||
```bash
|
||||
> nat64 cidr
|
||||
192.168.64.0/24
|
||||
Done
|
||||
```
|
||||
|
||||
### nat64 mappings
|
||||
|
||||
Get the NAT64 translator mappings.
|
||||
|
||||
This command is only available when device enables NAT64 translator.
|
||||
|
||||
```bash
|
||||
> nat64 mappings
|
||||
| | Address | | 4 to 6 | 6 to 4 |
|
||||
+----------+---------------------------+--------+--------------+--------------+
|
||||
| ID | IPv6 | IPv4 | Expiry | Pkts | Bytes | Pkts | Bytes |
|
||||
+----------+------------+--------------+--------+------+-------+------+-------+
|
||||
| 00021cb9 | fdc7::df79 | 192.168.64.2 | 7196s | 6 | 456 | 11 | 1928 |
|
||||
| | TCP | 0 | 0 | 0 | 0 |
|
||||
| | UDP | 1 | 136 | 16 | 1608 |
|
||||
| | ICMP | 5 | 320 | 5 | 320 |
|
||||
```
|
||||
|
||||
### nat64 counters
|
||||
|
||||
Get the NAT64 translator packet and error counters.
|
||||
|
||||
This command is only available when device enables NAT64 translator.
|
||||
|
||||
```bash
|
||||
> nat64 counters
|
||||
| | 4 to 6 | 6 to 4 |
|
||||
+---------------+-------------------------+-------------------------+
|
||||
| Protocol | Pkts | Bytes | Pkts | Bytes |
|
||||
+---------------+----------+--------------+----------+--------------+
|
||||
| Total | 11 | 704 | 11 | 704 |
|
||||
| TCP | 0 | 0 | 0 | 0 |
|
||||
| UDP | 0 | 0 | 0 | 0 |
|
||||
| ICMP | 11 | 704 | 11 | 704 |
|
||||
| Errors | Pkts | Pkts |
|
||||
+---------------+-------------------------+-------------------------+
|
||||
| Total | 8 | 4 |
|
||||
| Illegal Pkt | 0 | 0 |
|
||||
| Unsup Proto | 0 | 0 |
|
||||
| No Mapping | 2 | 0 |
|
||||
Done
|
||||
```
|
||||
|
||||
### neighbor list
|
||||
|
||||
List RLOC16 of neighbors.
|
||||
@@ -1995,7 +2051,7 @@ Done
|
||||
|
||||
Get the diagnostic information for a Thread Router as parent.
|
||||
|
||||
Note: When operating as a Thread Router, this command will return the cached information from when the device was previously attached as a Thread Child. Returning cached information is necessary to support the Thread Test Harness - Test Scenario 8.2.x requests the former parent (i.e. Joiner Router's) MAC address even if the device has already promoted to a router.
|
||||
Note: When operating as a Thread Router when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled, this command will return the cached information from when the device was previously attached as a Thread Child. Returning cached information is necessary to support the Thread Test Harness - Test Scenario 8.2.x requests the former parent (i.e. Joiner Router's) MAC address even if the device has already promoted to a router.
|
||||
|
||||
```bash
|
||||
> parent
|
||||
@@ -2004,9 +2060,17 @@ Rloc: 5c00
|
||||
Link Quality In: 3
|
||||
Link Quality Out: 3
|
||||
Age: 20
|
||||
Version: 4
|
||||
Done
|
||||
```
|
||||
|
||||
Note: When `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE` is enabled, this command will return two extra lines with information relevant for CSL Receiver operation.
|
||||
|
||||
```bash
|
||||
CSL clock accuracy: 20
|
||||
CSL uncertainty: 5
|
||||
```
|
||||
|
||||
### parentpriority
|
||||
|
||||
Get the assigned parent priority value, -2 means not assigned.
|
||||
@@ -2059,10 +2123,11 @@ Set the preferred Thread Leader Partition ID.
|
||||
Done
|
||||
```
|
||||
|
||||
### ping \[-I source\] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
|
||||
### ping \[async\] \[-I source\] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
|
||||
|
||||
Send an ICMPv6 Echo Request.
|
||||
|
||||
- async: Use the non-blocking mode. New commands are allowed before the ping process terminates.
|
||||
- source: The source IPv6 address of the echo request.
|
||||
- size: The number of data bytes to be sent.
|
||||
- count: The number of ICMPv6 Echo Requests to be sent.
|
||||
@@ -2082,6 +2147,18 @@ Done
|
||||
Done
|
||||
```
|
||||
|
||||
The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
|
||||
|
||||
> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
|
||||
|
||||
```bash
|
||||
> ping 172.17.0.1
|
||||
Pinging synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
|
||||
> 16 bytes from fdde:ad00:beef:2:0:0:ac11:1: icmp_seq=5 hlim=64 time=0ms
|
||||
1 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
|
||||
Done
|
||||
```
|
||||
|
||||
### ping stop
|
||||
|
||||
Stop sending ICMPv6 Echo Requests.
|
||||
|
||||
+11
-1
@@ -109,7 +109,7 @@ Establishes a connection with the specified peer.
|
||||
|
||||
If the connection establishment is successful, the resulting TCP connection is associated with the example TCP endpoint.
|
||||
|
||||
- ip: the peer's IPv6 address.
|
||||
- ip: the peer's IP address.
|
||||
- port: the peer's TCP port.
|
||||
|
||||
```bash
|
||||
@@ -118,6 +118,16 @@ Done
|
||||
TCP: Connection established
|
||||
```
|
||||
|
||||
The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
|
||||
|
||||
> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
|
||||
|
||||
```bash
|
||||
> tcp connect 172.17.0.1 1234
|
||||
Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
|
||||
Done
|
||||
```
|
||||
|
||||
### deinit
|
||||
|
||||
Deinitializes the example TCP listener and the example TCP endpoint.
|
||||
|
||||
+22
-2
@@ -96,7 +96,7 @@ Done
|
||||
|
||||
Specifies the peer with which the socket is to be associated.
|
||||
|
||||
- ip: the peer's IPv6 address.
|
||||
- ip: the peer's IP address.
|
||||
- port: the peer's UDP port.
|
||||
|
||||
```bash
|
||||
@@ -104,6 +104,16 @@ Specifies the peer with which the socket is to be associated.
|
||||
Done
|
||||
```
|
||||
|
||||
The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
|
||||
|
||||
> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
|
||||
|
||||
```bash
|
||||
> udp connect 172.17.0.1 1234
|
||||
Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
|
||||
Done
|
||||
```
|
||||
|
||||
### linksecurity
|
||||
|
||||
Indicates whether the link security is enabled or disabled.
|
||||
@@ -145,7 +155,7 @@ Done
|
||||
|
||||
Send a UDP message.
|
||||
|
||||
- ip: the IPv6 destination address.
|
||||
- ip: the destination address.
|
||||
- port: the UDP destination port.
|
||||
- message: the message to send.
|
||||
|
||||
@@ -154,6 +164,16 @@ Send a UDP message.
|
||||
Done
|
||||
```
|
||||
|
||||
The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
|
||||
|
||||
> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
|
||||
|
||||
```bash
|
||||
> udp send 172.17.0.1 1234
|
||||
Sending to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
|
||||
Done
|
||||
```
|
||||
|
||||
### send \<ip\> \<port\> \<type\> \<value\>
|
||||
|
||||
Send a few bytes over UDP.
|
||||
|
||||
+1409
-35
File diff suppressed because it is too large
Load Diff
@@ -235,6 +235,27 @@ public:
|
||||
*/
|
||||
static const char *PreferenceToString(signed int aPreference);
|
||||
|
||||
/**
|
||||
* This method parses the argument as an IP address.
|
||||
*
|
||||
* If the argument string is an IPv4 address, this method will try to synthersize an IPv6 address using preferred
|
||||
* NAT64 prefix in the network data.
|
||||
*
|
||||
* @param[in] aInstance A pointer to openthread instance.
|
||||
* @param[in] aArg The argument string to parse.
|
||||
* @param[out] aAddress A reference to an `otIp6Address` to output the parsed IPv6 address.
|
||||
* @param[out] aSynthesized Whether @p aAddress is synthesized from an IPv4 address.
|
||||
*
|
||||
* @retval OT_ERROR_NONE The argument was parsed successfully.
|
||||
* @retval OT_ERROR_INVALID_ARGS The argument is empty or does not contain valid IP address.
|
||||
* @retval OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data.
|
||||
*
|
||||
*/
|
||||
static otError ParseToIp6Address(otInstance * aInstance,
|
||||
const Arg & aArg,
|
||||
otIp6Address &aAddress,
|
||||
bool & aSynthesized);
|
||||
|
||||
protected:
|
||||
static Interpreter *sInterpreter;
|
||||
|
||||
@@ -547,6 +568,10 @@ private:
|
||||
#if OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE
|
||||
bool mLocateInProgress : 1;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE
|
||||
bool mLinkMetricsQueryInProgress : 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Specializations of `FormatStringFor<ValueType>()`
|
||||
|
||||
@@ -118,6 +118,21 @@ otError Dataset::Print(otOperationalDataset &aDataset)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset init (active,new,pending,tlvs)
|
||||
* @code
|
||||
* dataset init new
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset init {@ca{active}|@ca{new}|@ca{pending}|@ca{tlvs}} [@ca{hex-encoded-tlvs}]
|
||||
* Use `new` to initialize a new dataset, then enter the command `dataset commit active`.
|
||||
* Use `tlvs` for hex-encoded TLVs.
|
||||
* @par
|
||||
* OT CLI checks for `active`, `pending`, or `tlvs` and returns the corresponding values. Otherwise,
|
||||
* OT CLI creates a new, random network and returns a new dataset.
|
||||
* @csa{dataset commit active}
|
||||
* @csa{dataset active}
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("init")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_INVALID_ARGS;
|
||||
@@ -151,6 +166,34 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset active
|
||||
* @code
|
||||
* dataset active
|
||||
* Active Timestamp: 1
|
||||
* Channel: 13
|
||||
* Channel Mask: 0x07fff800
|
||||
* Ext PAN ID: d63e8e3e495ebbc3
|
||||
* Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
|
||||
* Network Key: dfd34f0f05cad978ec4e32b0413038ff
|
||||
* Network Name: OpenThread-8f28
|
||||
* PAN ID: 0x8f28
|
||||
* PSKc: c23a76e98f1a6483639b1ac1271e2e27
|
||||
* Security Policy: 0, onrcb
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset active -x
|
||||
* 0e08000000000001000000030000103506000...3023d82c841eff0e68db86f35740c030000ff
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset active [-x]
|
||||
* The optional `-x` argument prints the Active Operational %Dataset values as hex-encoded TLVs.
|
||||
* @par api_copy
|
||||
* #otDatasetGetActive
|
||||
* @par
|
||||
* OT CLI uses #otOperationalDataset members to return dataset values to the console.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("active")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_INVALID_ARGS;
|
||||
@@ -197,6 +240,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset activetimestamp (get, set)
|
||||
* @code
|
||||
* dataset activetimestamp
|
||||
* 123456789
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset activetimestamp 123456789
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset activetimestamp [@ca{timestamp}]
|
||||
* Pass the optional `timestamp` argument to set the active timestamp.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mActiveTimestamp.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("activetimestamp")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -220,6 +279,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset channel (get,set)
|
||||
* @code
|
||||
* dataset channel
|
||||
* 12
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset channel 12
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset channel [@ca{channel-num}]
|
||||
* Use the optional `channel-num` argument to set the channel.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mChannel.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("channel")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -241,6 +316,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset channelmask (get,set)
|
||||
* @code
|
||||
* dataset channelmask
|
||||
* 0x07fff800
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset channelmask 0x07fff800
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset channelmask [@ca{channel-mask}]
|
||||
* Use the optional `channel-mask` argument to set the channel mask.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mChannelMask
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("channelmask")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -262,6 +353,15 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset clear
|
||||
* @code
|
||||
* dataset clear
|
||||
* Done
|
||||
* @endcode
|
||||
* @par
|
||||
* Reset the Operational %Dataset buffer.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("clear")>(Arg aArgs[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aArgs);
|
||||
@@ -274,10 +374,32 @@ template <> otError Dataset::Process<Cmd("commit")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_INVALID_ARGS;
|
||||
|
||||
/**
|
||||
* @cli dataset commit active
|
||||
* @code
|
||||
* dataset commit active
|
||||
* Done
|
||||
* @endcode
|
||||
* @par
|
||||
* Commit the Operational %Dataset buffer to Active Operational %Dataset.
|
||||
* @csa{dataset commit pending}
|
||||
* @sa #otDatasetSetPending
|
||||
*/
|
||||
if (aArgs[0] == "active")
|
||||
{
|
||||
error = otDatasetSetActive(GetInstancePtr(), &sDataset);
|
||||
}
|
||||
/**
|
||||
* @cli dataset commit pending
|
||||
* @code
|
||||
* dataset commit pending
|
||||
* Done
|
||||
* @endcode
|
||||
* @par
|
||||
* Commit the Operational %Dataset buffer to Pending Operational %Dataset.
|
||||
* @csa{dataset commit active}
|
||||
* @sa #otDatasetSetActive
|
||||
*/
|
||||
else if (aArgs[0] == "pending")
|
||||
{
|
||||
error = otDatasetSetPending(GetInstancePtr(), &sDataset);
|
||||
@@ -286,6 +408,23 @@ template <> otError Dataset::Process<Cmd("commit")>(Arg aArgs[])
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset delay (get,set)
|
||||
* @code
|
||||
* dataset delay
|
||||
* 1000
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset delay 1000
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset delay [@ca{delay}]
|
||||
* Use the optional `delay` argument to set the delay timer value.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mDelay.
|
||||
* @sa otDatasetSetDelayTimerMinimal
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("delay")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -307,6 +446,25 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset extpanid (get,set)
|
||||
* @code
|
||||
* dataset extpanid
|
||||
* 000db80123456789
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset extpanid 000db80123456789
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset extpanid [@ca{extpanid}]
|
||||
* Use the optional `extpanid` argument to set the Extended Personal Area Network ID.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mExtendedPanId.
|
||||
* @note The commissioning credential in the dataset buffer becomes stale after changing
|
||||
* this value. Use `dataset pskc` to reset.
|
||||
* @csa{dataset pskc (get,set)}
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("extpanid")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -328,6 +486,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset meshlocalprefix (get,set)
|
||||
* @code
|
||||
* dataset meshlocalprefix
|
||||
* fd00:db8:0:0::/64
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset meshlocalprefix fd00:db8:0:0::/64
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset meshlocalprefix [@ca{meshlocalprefix}]
|
||||
* Use the optional `meshlocalprefix` argument to set the Mesh-Local Prefix.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mMeshLocalPrefix.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("meshlocalprefix")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -354,6 +528,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset networkkey (get,set)
|
||||
* @code
|
||||
* dataset networkkey
|
||||
* 00112233445566778899aabbccddeeff
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset networkkey 00112233445566778899aabbccddeeff
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset networkkey [@ca{key}]
|
||||
* Use the optional `key` argument to set the Network Key.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mNetworkKey.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("networkkey")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -375,6 +565,25 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset networkname (get,set)
|
||||
* @code
|
||||
* dataset networkname
|
||||
* OpenThread
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset networkname OpenThread
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset networkname [@ca{name}]
|
||||
* Use the optional `name` argument to set the Network Name.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mNetworkName.
|
||||
* @note The Commissioning Credential in the dataset buffer becomes stale after changing this value.
|
||||
* Use `dataset pskc` to reset.
|
||||
* @csa{dataset pskc (get,set)}
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("networkname")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -396,6 +605,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset panid (get,set)
|
||||
* @code
|
||||
* dataset panid
|
||||
* 0x1234
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset panid 0x1234
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset panid [@ca{panid}]
|
||||
* Use the optional `panid` argument to set the PAN ID.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mPanId.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("panid")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -417,6 +642,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset pendingtimestamp (get,set)
|
||||
* @code
|
||||
* dataset pendingtimestamp
|
||||
* 123456789
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset pendingtimestamp 123456789
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset pendingtimestamp [@ca{timestamp}]
|
||||
* Use the optional `timestamp` argument to set the pending timestamp seconds.
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mPendingTimestamp.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("pendingtimestamp")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -540,11 +781,43 @@ template <> otError Dataset::Process<Cmd("mgmtsetcommand")>(Arg aArgs[])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset mgmtsetcommand active
|
||||
* @code
|
||||
* dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrcb
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset mgmtsetcommand active [@ca{dataset-components}] [-x @ca{tlv-list}]
|
||||
* To learn more about these parameters and argument mappings, refer to @dataset.
|
||||
* @par
|
||||
* @note This command is primarily used for testing only.
|
||||
* @par api_copy
|
||||
* #otDatasetSendMgmtActiveSet
|
||||
* @csa{dataset mgmtgetcommand active}
|
||||
* @csa{dataset mgmtgetcommand pending}
|
||||
* @csa{dataset mgmtsetcommand pending}
|
||||
*/
|
||||
if (aArgs[0] == "active")
|
||||
{
|
||||
error = otDatasetSendMgmtActiveSet(GetInstancePtr(), &dataset, tlvs, tlvsLength, /* aCallback */ nullptr,
|
||||
/* aContext */ nullptr);
|
||||
}
|
||||
/**
|
||||
* @cli dataset mgmtsetcommand pending
|
||||
* @code
|
||||
* dataset mgmtsetcommand pending activetimestamp 123 securitypolicy 1 onrcb
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset mgmtsetcommand pending [@ca{dataset-components}] [-x @ca{tlv-list}]
|
||||
* To learn more about these parameters and argument mappings, refer to @dataset.
|
||||
* @par
|
||||
* @note This command is primarily used for testing only.
|
||||
* @par api_copy
|
||||
* #otDatasetSendMgmtPendingSet
|
||||
* @csa{dataset mgmtgetcommand active}
|
||||
* @csa{dataset mgmtgetcommand pending}
|
||||
* @csa{dataset mgmtsetcommand active}
|
||||
*/
|
||||
else if (aArgs[0] == "pending")
|
||||
{
|
||||
error = otDatasetSendMgmtPendingSet(GetInstancePtr(), &dataset, tlvs, tlvsLength, /* aCallback */ nullptr,
|
||||
@@ -633,11 +906,56 @@ template <> otError Dataset::Process<Cmd("mgmtgetcommand")>(Arg aArgs[])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset mgmtgetcommand active
|
||||
* @code
|
||||
* dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset mgmtgetcommand active networkname
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset mgmtgetcommand active [address @ca{leader-address}] [@ca{dataset-components}] [-x @ca{tlv-list}]
|
||||
* * Use `address` to specify the IPv6 destination; otherwise, the Leader ALOC is used as default.
|
||||
* * For `dataset-components`, you can pass any combination of #otOperationalDatasetComponents, for
|
||||
* example `activetimestamp`, `pendingtimestamp`, or `networkkey`.
|
||||
* * The optional `-x` argument specifies raw TLVs to be requested.
|
||||
* @par
|
||||
* OT CLI sends a MGMT_ACTIVE_GET with the relevant arguments.
|
||||
* To learn more about these parameters and argument mappings, refer to @dataset.
|
||||
* @note This command is primarily used for testing only.
|
||||
* @par api_copy
|
||||
* #otDatasetSendMgmtActiveGet
|
||||
* @csa{dataset mgmtgetcommand pending}
|
||||
* @csa{dataset mgmtsetcommand active}
|
||||
* @csa{dataset mgmtsetcommand pending}
|
||||
*/
|
||||
if (aArgs[0] == "active")
|
||||
{
|
||||
error = otDatasetSendMgmtActiveGet(GetInstancePtr(), &datasetComponents, tlvs, tlvsLength,
|
||||
destAddrSpecified ? &address : nullptr);
|
||||
}
|
||||
/**
|
||||
* @cli dataset mgmtgetcommand pending
|
||||
* @code
|
||||
* dataset mgmtgetcommand pending address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset mgmtgetcommand pending networkname
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset mgmtgetcommand pending [address @ca{leader-address}] [@ca{dataset-components}] [-x @ca{tlv-list}]
|
||||
* To learn more about these parameters and argument mappings, refer to @dataset.
|
||||
* @par
|
||||
* @note This command is primarily used for testing only.
|
||||
* @par api_copy
|
||||
* #otDatasetSendMgmtPendingGet
|
||||
* @csa{dataset mgmtgetcommand active}
|
||||
* @csa{dataset mgmtsetcommand active}
|
||||
* @csa{dataset mgmtsetcommand pending}
|
||||
*/
|
||||
else if (aArgs[0] == "pending")
|
||||
{
|
||||
error = otDatasetSendMgmtPendingGet(GetInstancePtr(), &datasetComponents, tlvs, tlvsLength,
|
||||
@@ -652,6 +970,30 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset pskc (get,set)
|
||||
* @code
|
||||
* dataset pskc
|
||||
* 67c0c203aa0b042bfb5381c47aef4d9e
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset pskc -p 123456
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset pskc [@ca{-p} @ca{passphrase}] | [@ca{key}]
|
||||
* For FTD only, use `-p` with the `passphrase` argument. `-p` generates a pskc from
|
||||
* the UTF-8 encoded `passphrase` that you provide, together with
|
||||
* the network name and extended PAN ID. If set, `-p` uses the dataset buffer;
|
||||
* otherwise, it uses the current stack.
|
||||
* Alternatively, you can set pskc as `key` (hex format).
|
||||
* @par
|
||||
* Gets or sets #otOperationalDataset::mPskc.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("pskc")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -806,6 +1148,26 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset securitypolicy (get,set)
|
||||
* @code
|
||||
* dataset securitypolicy
|
||||
* 672 onrc
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset securitypolicy 672 onrc
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset securitypolicy [@ca{rotationtime} [@ca{onrcCepR}]]
|
||||
* * Use `rotationtime` for `thrKeyRotation`, in units of hours.
|
||||
* * Security Policy commands use the `onrcCepR` argument mappings to get and set
|
||||
* #otSecurityPolicy members, for example `o` represents
|
||||
* #otSecurityPolicy::mObtainNetworkKeyEnabled.
|
||||
* @moreinfo{@dataset}.
|
||||
* @par
|
||||
* Gets or sets the %Dataset security policy.
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("securitypolicy")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -829,6 +1191,22 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset set (active,pending)
|
||||
* @code
|
||||
* dataset set active 0e08000000000001000000030000103506000...3023d82c841eff0e68db86f35740c030000ff
|
||||
* Done
|
||||
* @endcode
|
||||
* @code
|
||||
* dataset set pending 0e08000000000001000000030000103506000...3023d82c841eff0e68db86f35740c030000ff
|
||||
* Done
|
||||
* @endcode
|
||||
* @cparam dataset set {active|pending} @ca{tlvs}
|
||||
* @par
|
||||
* The CLI `dataset set` command sets the Active Operational %Dataset using hex-encoded TLVs.
|
||||
* @par api_copy
|
||||
* #otDatasetSetActive
|
||||
*/
|
||||
template <> otError Dataset::Process<Cmd("set")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -955,6 +1333,35 @@ otError Dataset::Process(Arg aArgs[])
|
||||
ExitNow(error = Print(sDataset));
|
||||
}
|
||||
|
||||
/**
|
||||
* @cli dataset help
|
||||
* @code
|
||||
* dataset help
|
||||
* help
|
||||
* active
|
||||
* activetimestamp
|
||||
* channel
|
||||
* channelmask
|
||||
* clear
|
||||
* commit
|
||||
* delay
|
||||
* extpanid
|
||||
* init
|
||||
* meshlocalprefix
|
||||
* mgmtgetcommand
|
||||
* mgmtsetcommand
|
||||
* networkkey
|
||||
* networkname
|
||||
* panid
|
||||
* pending
|
||||
* pendingtimestamp
|
||||
* pskc
|
||||
* securitypolicy
|
||||
* Done
|
||||
* @endcode
|
||||
* @par
|
||||
* Gets a list of `dataset` CLI commands. @moreinfo{@dataset}.
|
||||
*/
|
||||
if (aArgs[0] == "help")
|
||||
{
|
||||
OutputCommandTable(kCommands);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user